本文整理汇总了Python中sleekxmpp.ClientXMPP.use_ipv6方法的典型用法代码示例。如果您正苦于以下问题:Python ClientXMPP.use_ipv6方法的具体用法?Python ClientXMPP.use_ipv6怎么用?Python ClientXMPP.use_ipv6使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sleekxmpp.ClientXMPP
的用法示例。
在下文中一共展示了ClientXMPP.use_ipv6方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sleekxmpp import ClientXMPP [as 别名]
# 或者: from sleekxmpp.ClientXMPP import use_ipv6 [as 别名]
def __init__(self, jid, password, room, nick):
print('creating bot with {} {} {} {} '.format(jid, password, room, nick))
self.nick = nick
self.room = room
self.jid = JID(jid)
self._presence_callbacks = []
self._message_callbacks = []
bot = ClientXMPP(jid, password)
# disable ipv6 for now since we're getting errors using it
bot.use_ipv6 = False
bot.add_event_handler('session_start', self.on_start)
bot.add_event_handler('message', self.on_message)
bot.add_event_handler('groupchat_presence', self.on_presence)
bot.add_event_handler('groupchat_subject', self.on_room_joined)
bot.register_plugin('xep_0045')
self._muc = bot.plugin['xep_0045']
bot.register_plugin('xep_0199')
bot.plugin['xep_0199'].enable_keepalive(30, 30)
self.unknown_command_callback = None
def on_unknown_callback(message):
if self.unknown_command_callback is not None:
return self.unknown_command_callback(message)
self.message_processor = MessageProcessor(on_unknown_callback)
log.info('sb connect')
if bot.connect():
log.info('sb process')
bot.process()
else:
raise 'could not connect'
self.add_presence_handler(self.rejoin_if_kicked)
self._bot = bot