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