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


Python XMPPClient.logTraffic方法代码示例

本文整理汇总了Python中wokkel.client.XMPPClient.logTraffic方法的典型用法代码示例。如果您正苦于以下问题:Python XMPPClient.logTraffic方法的具体用法?Python XMPPClient.logTraffic怎么用?Python XMPPClient.logTraffic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wokkel.client.XMPPClient的用法示例。


在下文中一共展示了XMPPClient.logTraffic方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeService

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [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
开发者ID:lorenzhs,项目名称:kitbot,代码行数:60,代码来源:kitbot_plugin.py

示例2: connect

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
    def connect(self):
        application = service.Application("gbot")

        xmppclient = XMPPClient(jid.internJID(self.username), self.password)
        xmppclient.logTraffic = False
        self.protocol = GBotProtocol()
        self.protocol.bot = self
        self.protocol.setHandlerParent(xmppclient)
        xmppclient.setServiceParent(application)
        return application
开发者ID:B-Rich,项目名称:Watson,代码行数:12,代码来源:gbot.py

示例3: setupConnection

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
    def setupConnection(self):
        xmppclient = XMPPClient(self.jid, self.password, self.jabber_server)
        xmppclient.logTraffic = False

        xmppbot = XMPPCassBot(self, self.state['nickname'])
        xmppbot.conference_server = self.conference_server
        xmppbot.setHandlerParent(xmppclient)

        xmppclient.setServiceParent(self)

        self.xmppbot = xmppbot
        self.xmppclient = xmppclient
开发者ID:joaquincasares,项目名称:cassbot,代码行数:14,代码来源:xmppbot.py

示例4: createService

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
def createService():
    bot_jid = "{0}@{1}/{2}".format(cfg.connect.jabber.jid, cfg.connect.jabber.server, cfg.connect.jabber.resource)
    xmppclient = XMPPClient(jid.internJID(bot_jid), cfg.connect.jabber.password, cfg.connect.jabber.server)
    xmppclient.logTraffic = cfg.connect.jabber.log_traffic

    # Send some whitespace every once in a while to stay alive
    KeepAlive().setHandlerParent(xmppclient)

    # Hook chat instance into main app
    connection = JabberConnector()
    FritBot.bot.registerConnector(connection)
    connection.setHandlerParent(xmppclient)
    
    return xmppclient
开发者ID:Urthen,项目名称:Fritbot_Python,代码行数:16,代码来源:jabber.py

示例5: makeService

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
    def makeService(self, options):
        """
        Construct a TCPServer from a factory defined in myproject.
        """

        multi_service = MultiService()
        from wokkel.client import XMPPClient
        from twisted.words.protocols.jabber import jid
        import forwarder

        xmppclient = XMPPClient(jid.internJID(options["account"]), options["password"])
        xmppclient.logTraffic = False
        bot = forwarder.ForwarderProtocol(options["uri"])
        bot.setHandlerParent(xmppclient)
        multi_service.addService(xmppclient)

        return multi_service
开发者ID:our-city-app,项目名称:mobicage-xmpp-service-forwarder,代码行数:19,代码来源:forwarder_plugin.py

示例6: initIrcJabberRelay

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
def initIrcJabberRelay(application):
    manager = RelayManager()

    # Configure IRC
    ircfactory = IrcBotFactory(manager, cfg["ircchannel"], cfg["ircnick"], manager.sendJabber)
    # point = TCP4ClientEndpoint(reactor, 'irc.freenode.net', 6667)
    # d = point.connect(ircfactory)
    # d.addCallback(gotProtocol)
    connector = internet.TCPClient(cfg["ircserver"], cfg["ircport"], ircfactory)
    connector.setServiceParent(application)

    # Configure Jabber
    xmppclient = XMPPClient(jid.internJID(cfg["jabberjid"]), cfg["jabberpass"])
    jabberbot = JabberBot(manager, cfg["jabberserver"], cfg["jabberchannel"], cfg["jabbernick"], manager.sendIRC)
    xmppclient.logTraffic = False
    jabberbot.setHandlerParent(xmppclient)
    xmppclient.setServiceParent(application)
    manager.setJabber(jabberbot)
开发者ID:atorkhov,项目名称:ircjabberrelay,代码行数:20,代码来源:manager.py

示例7: makeService

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
def makeService(config):
    if IQ.timeout is None:
        IQ.timeout = 30

    xmppService = XMPPClient(config['jid'], config['secret'],
                             config.get('xmpp-host'),
                             config.get('xmpp-port', 5222))
    if config['verbose']:
        xmppService.logTraffic = True

    presenceHandler = PresenceHandler()
    presenceHandler.setHandlerParent(xmppService)

    pinger = Pinger(config['service'])
    pinger.setHandlerParent(xmppService)
    pinger.verbose = config['verbose']

    return xmppService
开发者ID:mediamatic,项目名称:ikdisplay,代码行数:20,代码来源:xmpp.py

示例8: make_client

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
def make_client(config):

    keepalive = KeepAlive()
    keepalive.interval = config.getint('hipchat', 'keepalive.interval')
    xmppclient = XMPPClient(
        jid.internJID(config.get('hipchat', 'jabber_id')),
        config.get('hipchat', 'password')
    )
    xmppclient.logTraffic = config.getboolean('hipchat', 'logtraffic')

    mucbot = HipBot(
        config.get('hipchat', 'server'),
        config.get('hipchat', 'channel'),
        config.get('hipchat', 'botnick'),
        config.get('hipchat', 'stfu_minutes'))
    mucbot.setHandlerParent(xmppclient)
    keepalive.setHandlerParent(xmppclient)

    return xmppclient
开发者ID:mahmoudimus,项目名称:ircer,代码行数:21,代码来源:hipbot.py

示例9: make_client

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
def make_client(bot, config, password):
    keepalive = KeepAlive()
    keepalive.interval = 30
    xmppclient = XMPPClient(jid.internJID(config.get("hipchat", "jid")), password)
    xmppclient.logTraffic = True

    team_members = [n.strip() for n in config.get("team", "members").decode("utf-8").strip().split(u",")]

    mucbot = HipchatBot(
        bot,
        config.get("hipchat", "room_server"),
        config.get("hipchat", "room_jid"),
        config.get("team", "room_name"),
        config.get("hipchat", "nickname"),
        config.get("hipchat", "stfu_minutes"),
        team_members,
    )
    mucbot.setHandlerParent(xmppclient)
    keepalive.setHandlerParent(xmppclient)

    return xmppclient
开发者ID:LipuFei,项目名称:team-hipchat-bot,代码行数:23,代码来源:hipchat_xmpp.py

示例10: JID

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
# Configuration parameters
config = ConfigParser.RawConfigParser()
config.read('bot.conf')

myJID = JID(config.get('Connection', 'my_jid'))
roomJID = JID(config.get('Connection', 'room_jid'))
roomPassword = config.get('Connection', 'room_password')

my_nick = config.get('Connection', 'my_nick')
my_secret = config.get('Connection', 'my_secret')

rt_url = config.get('RT', 'url')
rt_display_url = config.get('RT','display_url')
rt_user = config.get('RT', 'user')
rt_pwd = config.get('RT', 'pwd')
rt_default_queue = config.get('RT','default_queue')

LOG_TRAFFIC = False
#LOG_TRAFFIC = True

# Set up the Twisted application
application = service.Application("MUC Client")

client = XMPPClient(myJID, my_secret)
client.logTraffic = LOG_TRAFFIC
client.setServiceParent(application)

mucHandler = RTBot(roomJID, my_nick, rt_url, rt_user, rt_pwd, roomPassword, rt_display_url, output_format)
mucHandler.setHandlerParent(client)
开发者ID:GOVCERT-LU,项目名称:rt_bot,代码行数:31,代码来源:rt_bot.py

示例11: abort_job

# 需要导入模块: from wokkel.client import XMPPClient [as 别名]
# 或者: from wokkel.client.XMPPClient import logTraffic [as 别名]
            output = (self.PACKET.get_packet(packet_id), None)  # Return status.

        return output

    def abort_job(self, vm_jid, job_id):
        """ Terminate a job. """

        self.__send__(self.abort_job_packet(vm_jid, job_id))

    def terminate_vm(self, vm_jid):
        """ Terminate a VM. """

        self.__send__(packet)


# Misc.

if __name__ == "__main__":
    FARM_JID = raw_input("Farm JID: ")
    MY_JID = raw_input("My JID: ")
    PASSWORD = raw_input("My password: ")

    app = service.Application("TestVillein")

    test_villein = villein(MY_JID, PASSWORD, FARM_JID)
    xmpp_client = XMPPClient(test_villein.JID, PASSWORD)
    xmpp_client.logTraffic = False
    test_villein.setHandlerParent(xmpp_client)
    xmpp_client.setServiceParent(app)
开发者ID:ameetkini,项目名称:tinkubator,代码行数:31,代码来源:villein.py


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