当前位置: 首页>>代码示例>>Python>>正文


Python Message.origjid方法代码示例

本文整理汇总了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)
开发者ID:NURDspace,项目名称:jsonbot,代码行数:29,代码来源:bot.py

示例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()
开发者ID:melmothx,项目名称:jsonbot,代码行数:35,代码来源:bot.py

示例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()
开发者ID:code2u,项目名称:jsb,代码行数:38,代码来源:bot.py


注:本文中的message.Message.origjid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。