def onPresence(conn, msg): if msg.getFrom().getDomain() == config.conference: conf, nickname = msg.getFrom().getNode(), msg.getFrom().getResource() role = msg.getTag("x", namespace = xmpp.NS_MUC_USER) if role and role.getTag("item").getAttr("jid"): person = xmpp.JID(role.getTag("item").getAttr("jid")) alive = role.getTag("item").getAttr("role") != "none" and msg.getAttr("type") != "unavailable" #print "%s: %s is %s and is he alive: %s" % (conf, person, nickname, alive) if conf == config.mainChannel: registry.onPresence(person, nickname, alive) else: confObj = getConfByName(conf) if confObj: confObj.onPresence(conn, person, nickname, alive)
def onPresence(conn, msg): if msg.getFrom().getDomain() == config.conference: conf, nickname = msg.getFrom().getNode(), msg.getFrom().getResource() role = msg.getTag("x", namespace=xmpp.NS_MUC_USER) if role and role.getTag("item").getAttr("jid"): person = xmpp.JID(role.getTag("item").getAttr("jid")) alive = role.getTag("item").getAttr( "role") != "none" and msg.getAttr("type") != "unavailable" #print "%s: %s is %s and is he alive: %s" % (conf, person, nickname, alive) if conf == config.mainChannel: registry.onPresence(person, nickname, alive) else: confObj = getConfByName(conf) if confObj: confObj.onPresence(conn, person, nickname, alive) raise xmpp.NodeProcessed
def onBattleMessage(conn, msg, confName): conf = getConfByName(confName) if conf: conf.onMessage(conn, msg)