本文整理汇总了Python中message.Message.jid方法的典型用法代码示例。如果您正苦于以下问题:Python Message.jid方法的具体用法?Python Message.jid怎么用?Python Message.jid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类message.Message
的用法示例。
在下文中一共展示了Message.jid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_message
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import jid [as 别名]
def handle_message(self, data):
""" message handler. """
m = Message(data)
m.parse(self)
if data.type == 'groupchat' and data.subject:
logging.debug("%s - checking topic" % self.name)
self.topiccheck(m)
nm = Message(m)
callbacks.check(self, nm)
return
if data.get('x').xmlns == 'jabber:x:delay':
logging.warn("%s - ignoring delayed message" % self.name)
return
self.privwait.check(m)
if m.isresponse:
logging.debug("%s - message is a response" % self.name)
return
jid = None
m.origjid = m.jid
for node in m.subelements:
try: m.jid = node.x.item.jid
except (AttributeError, TypeError): continue
if self.me in m.fromm:
logging.debug("%s - message to self .. ignoring" % self.name)
return 0
try:
if m.type == 'error':
if m.code:
logging.error('%s - error - %s' % (self.name, str(m)))
self.errorwait.check(m)
self.errorHandler(m)
except Exception, ex:
handle_exception()
示例2: handle_message
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import jid [as 别名]
def handle_message(self, data):
""" message handler. """
m = Message(data)
m.parse(self)
if data.type == 'groupchat' and data.subject:
logging.debug("%s - checking topic" % self.cfg.name)
self.topiccheck(m)
nm = Message(m)
callbacks.check(self, nm)
return
xmlns = data.get('x').xmlns or data.get("delay").xmlns
if xmlns and (xmlns == 'jabber:x:delay' or xmlns == 'urn:xmpp:delay'):
logging.info("%s - ignoring delayed message" % self.cfg.name)
return
if m.isresponse:
logging.debug("%s - message is a response" % self.cfg.name)
return
jid = None
m.origjid = m.jid
for node in m.subelements:
try: m.jid = node.x.item.jid
except (AttributeError, TypeError): continue
if self.cfg.user in m.fromm or (m.groupchat and self.cfg.nick == m.nick):
logging.debug("%s - message to self .. ignoring" % self.cfg.name)
return 0
if self.cfg.fulljids and not m.msg:
if not m.nick: utarget = None
else:
utarget = self.userhosts.get(m.nick)
logging.warn("userhost from cache for %s ==> %s" % (m.nick, utarget))
if utarget: m.userhost = m.jid = m.auth = utarget
else: m.userhost = m.jid
if m.msg: m.userhost = stripped(m.userhost)
logging.info("using %s as userhost" % m.userhost)
try:
if m.type == 'error':
if m.code: self.errorHandler(m)
else: m.nodispatch = False
except Exception, ex:
handle_exception()
示例3: handle_message
# 需要导入模块: from message import Message [as 别名]
# 或者: from message.Message import jid [as 别名]
def handle_message(self, data):
""" message handler. """
m = Message(data)
m.parse(self)
if data.type == 'groupchat' and data.subject:
logging.debug("%s - checking topic" % self.cfg.name)
self.topiccheck(m)
nm = Message(m)
callbacks.check(self, nm)
return
if data.get('x').xmlns == 'jabber:x:delay':
logging.debug("%s - ignoring delayed message" % self.cfg.name)
return
if m.isresponse:
logging.debug("%s - message is a response" % self.cfg.name)
return
jid = None
m.origjid = m.jid
for node in m.subelements:
try: m.jid = node.x.item.jid
except (AttributeError, TypeError): continue
if self.cfg.user in m.fromm or (m.groupchat and self.cfg.nick == m.nick):
logging.debug("%s - message to self .. ignoring" % self.cfg.name)
return 0
if self.cfg.fulljids:
utarget = self.userhosts.get(m.nick)
if utarget: m.userhost = m.jid = m.auth = stripped(utarget)
else: m.userhost = m.jid
logging.warn("using %s as userhost" % m.userhost)
try:
if m.type == 'error':
if m.code:
logging.error('%s - error - %s' % (self.cfg.name, str(m)))
self.errorHandler(m)
except Exception, ex:
handle_exception()