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


Python xmlstream.register_stanza_plugin函数代码示例

本文整理汇总了Python中sleekxmpp.xmlstream.register_stanza_plugin函数的典型用法代码示例。如果您正苦于以下问题:Python register_stanza_plugin函数的具体用法?Python register_stanza_plugin怎么用?Python register_stanza_plugin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: plugin_init

    def plugin_init(self):
        self.xmpp.register_feature('preapproval',
                self._handle_preapproval,
                restart=False,
                order=9001)

        register_stanza_plugin(StreamFeatures, stanza.PreApproval)
开发者ID:2M1R,项目名称:SleekXMPP,代码行数:7,代码来源:preapproval.py

示例2: plugin_init

    def plugin_init(self):
        """
        Start the XEP-0199 plugin.
        """
        self.description = 'XMPP Ping'
        self.xep = '0199'
        self.stanza = stanza

        self.keepalive = self.config.get('keepalive', False)
        self.frequency = float(self.config.get('frequency', 300))
        self.timeout = self.config.get('timeout', 30)

        register_stanza_plugin(Iq, Ping)

        self.xmpp.register_handler(
                Callback('Ping',
                         StanzaPath('[email protected]=get/ping'),
                         self._handle_ping))

        if self.keepalive:
            self.xmpp.add_event_handler('session_start',
                                        self._handle_keepalive,
                                        threaded=True)
            self.xmpp.add_event_handler('session_end',
                                        self._handle_session_end)
开发者ID:detower,项目名称:SleekXMPP,代码行数:25,代码来源:ping.py

示例3: plugin_init

    def plugin_init(self):
        self.description = "XEP-0138: Stream Compression"
        self.xmpp.register_feature(
            "compression", self._handle_compression, restart=False, order=self.config.get("order", 0)
        )

        register_stanza_plugin(StreamFeatures, CompressionStanza)
开发者ID:bhariesshkumar,项目名称:django-xmpp-server-list,代码行数:7,代码来源:compression.py

示例4: plugin_init

    def plugin_init(self):
        self.xep = '0050'
        self.description = 'Ad-Hoc Commands'

        self.threaded = self.config.get('threaded', True)

        self.addCommand = self.add_command
        self.getNewSession = self.new_session

        self.xmpp.register_handler(
                Callback("Ad-Hoc Execute",
                         StanzaPath('[email protected]=set/command'),
                         self._handle_command))

        register_stanza_plugin(Iq, Command)

        self.xmpp.add_event_handler('command_execute',
                                    self._handle_command_start,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_next',
                                    self._handle_command_next,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_cancel',
                                    self._handle_command_cancel,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_complete',
                                    self._handle_command_complete,
                                    threaded=self.threaded)

        self.commands = {}
        self.sessions = {}
开发者ID:legastero,项目名称:AdHoc,代码行数:31,代码来源:xep_0050.py

示例5: plugin_init

    def plugin_init(self):
        """
        Start the XEP-0030 plugin.
        """
        self.xmpp.register_handler(
                Callback('Disco Info',
                         StanzaPath('iq/disco_info'),
                         self._handle_disco_info))

        self.xmpp.register_handler(
                Callback('Disco Items',
                         StanzaPath('iq/disco_items'),
                         self._handle_disco_items))

        register_stanza_plugin(Iq, DiscoInfo)
        register_stanza_plugin(Iq, DiscoItems)

        self.static = StaticDisco(self.xmpp, self)

        self.use_cache = self.config.get('use_cache', True)
        self.wrap_results = self.config.get('wrap_results', False)

        self._disco_ops = [
                'get_info', 'set_info', 'set_identities', 'set_features',
                'get_items', 'set_items', 'del_items', 'add_identity',
                'del_identity', 'add_feature', 'del_feature', 'add_item',
                'del_item', 'del_identities', 'del_features', 'cache_info',
                'get_cached_info', 'supports', 'has_identity']

        for op in self._disco_ops:
            self.api.register(getattr(self.static, op), op, default=True)
开发者ID:Stiveknx,项目名称:emesene,代码行数:31,代码来源:disco.py

示例6: plugin_init

    def plugin_init(self):
        """Start the XEP-0050 plugin."""
        self.threaded = self.config.get('threaded', True)
        self.commands = {}
        self.sessions = self.config.get('session_db', {})

        self.xmpp.register_handler(
                Callback("Ad-Hoc Execute",
                         StanzaPath('[email protected]=set/command'),
                         self._handle_command))

        register_stanza_plugin(Iq, Command)
        register_stanza_plugin(Command, Form)

        self.xmpp.add_event_handler('command_execute',
                                    self._handle_command_start,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_next',
                                    self._handle_command_next,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_cancel',
                                    self._handle_command_cancel,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_complete',
                                    self._handle_command_complete,
                                    threaded=self.threaded)

        self.xmpp['xep_0030'].add_feature(Command.namespace)
        self.xmpp['xep_0030'].set_items(node=Command.namespace, items=tuple())
开发者ID:Stiveknx,项目名称:emesene,代码行数:29,代码来源:adhoc.py

示例7: plugin_init

    def plugin_init(self):
        self.xmpp.register_feature('rosterver',
                self._handle_rosterver,
                restart=False,
                order=9000)

        register_stanza_plugin(StreamFeatures, stanza.RosterVer)
开发者ID:AmiZya,项目名称:emesene,代码行数:7,代码来源:rosterver.py

示例8: plugin_init

    def plugin_init(self):
        """Start the XEP-0050 plugin."""
        self.sessions = self.session_db
        if self.sessions is None:
            self.sessions = {}

        self.commands = {}

        self.xmpp.register_handler(
                Callback("Ad-Hoc Execute",
                         StanzaPath('[email protected]=set/command'),
                         self._handle_command))

        register_stanza_plugin(Iq, Command)
        register_stanza_plugin(Command, Form)

        self.xmpp.add_event_handler('command_execute',
                                    self._handle_command_start,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_next',
                                    self._handle_command_next,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_cancel',
                                    self._handle_command_cancel,
                                    threaded=self.threaded)
        self.xmpp.add_event_handler('command_complete',
                                    self._handle_command_complete,
                                    threaded=self.threaded)
开发者ID:2M1R,项目名称:SleekXMPP,代码行数:28,代码来源:adhoc.py

示例9: plugin_init

    def plugin_init(self):
        self.xmpp.register_handler(
                Callback('Direct MUC Invitations',
                         StanzaPath('message/groupchat_invite'),
                         self._handle_invite))

        register_stanza_plugin(Message, Invite)
开发者ID:2M1R,项目名称:SleekXMPP,代码行数:7,代码来源:invite.py

示例10: plugin_init

    def plugin_init(self):
        register_stanza_plugin(Iq, stanza.UserSettings)

        self.xmpp.register_handler(
                Callback('Google Settings',
                    StanzaPath('[email protected]=set/google_settings'),
                    self._handle_settings_change))
开发者ID:arduino-org,项目名称:ciao-connector-xmpp,代码行数:7,代码来源:settings.py

示例11: __init__

    def __init__(self, hostname, jid, password, room, nick, roompass, loop, jibri_start_callback, jibri_stop_callback, jibri_health_callback, recording_lock, signal_queue):
        sleekxmpp.ClientXMPP.__init__(self, jid, password)

        self.hostname = hostname
        self.room = room
        self.nick = nick
        self.roompass = roompass
        self.jid = jid
        self.jibri_start_callback = jibri_start_callback
        self.jibri_stop_callback = jibri_stop_callback
        self.jibri_health_callback = jibri_health_callback
        self.recording_lock = recording_lock
        self.queue = signal_queue
        self.loop = loop
        self.controllerJid = ''
        self.asyncio_init_flag = False

        self.add_event_handler("session_start", self.start)
        self.add_event_handler("muc::%s::got_online"%self.room,
                               self.muc_online)

        self.register_handler(
            Callback('Jibri IQ callback',
                     StanzaPath('[email protected]=set/jibri'),
                     self.on_jibri_iq))


        register_stanza_plugin(Iq, JibriElement)
        register_stanza_plugin(Iq, JibriStatusElement)
开发者ID:aaronkvanmeerten,项目名称:jibri,代码行数:29,代码来源:jibrixmppclient.py

示例12: plugin_init

    def plugin_init(self):
        self.xmpp.namespace_map['http://www.google.com/talk/protocol/auth'] = 'ga'

        register_stanza_plugin(self.xmpp['feature_mechanisms'].stanza.Auth,
                               stanza.GoogleAuth)

        self.xmpp.add_filter('out', self._auth)
开发者ID:2M1R,项目名称:SleekXMPP,代码行数:7,代码来源:auth.py

示例13: post_init

    def post_init(self):
        base_plugin.post_init(self)
        if 'xep_0004' in self.xmpp.plugin:
            register_stanza_plugin(Register, self.xmpp['xep_0004'].stanza.Form)

        if 'xep_0066' in self.xmpp.plugin:
            register_stanza_plugin(Register, self.xmpp['xep_0066'].stanza.OOB)
开发者ID:lehrblogger,项目名称:SleekXMPP,代码行数:7,代码来源:register.py

示例14: testPublishSingle

    def testPublishSingle(self):
        """Test publishing a single item."""
        payload = AtomEntry()
        payload['title'] = 'Test'

        register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)

        self.xmpp['xep_0060'].publish(
            'pubsub.example.com',
            'somenode',
            id='id42',
            payload=payload,
            block=False)
        self.send("""
          <iq type="set" id="1" to="pubsub.example.com">
            <pubsub xmlns="http://jabber.org/protocol/pubsub">
              <publish node="somenode">
                <item id="id42">
                  <entry xmlns="http://www.w3.org/2005/Atom">
                    <title>Test</title>
                  </entry>
                </item>
              </publish>
            </pubsub>
          </iq>
        """)
开发者ID:AmiZya,项目名称:emesene,代码行数:26,代码来源:test_stream_xep_0060.py

示例15: plugin_init

    def plugin_init(self):
        """Start the XEP-0128 plugin."""
        self._disco_ops = ['set_extended_info',
                           'add_extended_info',
                           'del_extended_info']

        register_stanza_plugin(DiscoInfo, Form, iterable=True)
开发者ID:Stiveknx,项目名称:emesene,代码行数:7,代码来源:extended_disco.py


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