本文整理汇总了Python中wokkel.client.XMPPClient.rooms方法的典型用法代码示例。如果您正苦于以下问题:Python XMPPClient.rooms方法的具体用法?Python XMPPClient.rooms怎么用?Python XMPPClient.rooms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wokkel.client.XMPPClient
的用法示例。
在下文中一共展示了XMPPClient.rooms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeService
# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import rooms [as 别名]
def makeService(self, options):
with open(options.config, "r") as config_file:
config = json.load(config_file)
root = resource.Resource()
root.putChild('jsMath', static.File(config["global"]["jsmath"]))
bot = service.MultiService()
xmppclient = XMPPClient(JID(config["global"]["jid"]),
config["global"]["password"])
xmppclient.logTraffic = options['verbose']
xmppclient.setServiceParent(bot)
xmppclient.dbpool = DatabaseRunner(config["global"]["database"])
xmppclient.rooms = dict()
xmlrpc_port = config["global"].get("xml-rpc-port", None)
if xmlrpc_port is not None:
xmlrpcinterface = XMLRPCInterface(xmppclient)
rpc = internet.TCPServer(xmlrpc_port, server.Site(xmlrpcinterface))
rpc.setName('XML-RPC')
rpc.setServiceParent(bot)
for muc_config in config["mucs"]:
room_jid = JID(muc_config["jid"])
mucbot = KITBot(room_jid, muc_config.get("password", None),
config["global"]["logpath"])
mucbot.setHandlerParent(xmppclient)
if "xml-rpc-id" in muc_config:
xmppclient.rooms[muc_config["xml-rpc-id"]] = mucbot
# Log resource
portal = Portal(
LogViewRealm(os.path.join(config["global"]['logpath'],
room_jid.user + '.log')),
[strcred.makeChecker(muc_config["log-auth"])]
)
credential_factory = DigestCredentialFactory('md5', 'Hello Kitty!')
auth_resource = HTTPAuthSessionWrapper(portal, [credential_factory])
root.putChild(room_jid.user, auth_resource)
httpd_log_view = internet.TCPServer(config["global"]["http-port"],
server.Site(root))
httpd_log_view.setServiceParent(bot)
# REPL over SSH
def makeREPLProtocol():
namespace = dict(bot=xmppclient)
return insults.ServerProtocol(manhole.ColoredManhole, namespace)
repl_realm = manhole_ssh.TerminalRealm()
repl_realm.chainedProtocolFactory = makeREPLProtocol
repl_checker = checkers.SSHPublicKeyDatabase()
repl_portal = Portal(repl_realm, [repl_checker])
repl_factory = manhole_ssh.ConchFactory(repl_portal)
repl = internet.TCPServer(config["global"]["ssh-port"], repl_factory)
repl.setServiceParent(bot)
return bot