• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xmlstream.register_stanza_plugin函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: plugin_init

    def plugin_init(self):
        """
        Start the XEP-0030 plugin.
        """
        self.xep = '0030'
        self.description = 'Service Discovery'
        self.stanza = sleekxmpp.plugins.xep_0030.stanza

        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._disco_ops = ['get_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']
        self.default_handlers = {}
        self._handlers = {}
        for op in self._disco_ops:
            self._add_disco_op(op, getattr(self.static, op))
开发者ID:Lujeni,项目名称:old-projects,代码行数:32,代码来源:disco.py


示例17: plugin_init

    def plugin_init(self):
        self.gpg = GPG(gnupghome=self.gpg_home,
                       gpgbinary=self.gpg_binary,
                       use_agent=self.use_agent,
                       keyring=self.keyring)

        self.xmpp.add_filter('out', self._sign_presence)

        self._keyids = {}

        self.api.register(self._set_keyid, 'set_keyid', default=True)
        self.api.register(self._get_keyid, 'get_keyid', default=True)
        self.api.register(self._del_keyid, 'del_keyid', default=True)
        self.api.register(self._get_keyids, 'get_keyids', default=True)

        register_stanza_plugin(Presence, Signed)
        register_stanza_plugin(Message, Encrypted)

        self.xmpp.add_event_handler('unverified_signed_presence',
                self._handle_unverified_signed_presence,
                threaded=True)

        self.xmpp.register_handler(
                Callback('Signed Presence',
                    StanzaPath('presence/signed'),
                    self._handle_signed_presence))

        self.xmpp.register_handler(
                Callback('Encrypted Message',
                    StanzaPath('message/encrypted'),
                    self._handle_encrypted_message))
开发者ID:AmiZya,项目名称:emesene,代码行数:31,代码来源:gpg.py


示例18: plugin_init

    def plugin_init(self):
        self._cids = {}

        self.xmpp['xep_0030'].add_feature('urn:xmpp:bob')

        register_stanza_plugin(Iq, BitsOfBinary)

        self.xmpp.register_handler(
            Callback('Bits of Binary - Iq',
                StanzaPath('iq/bob'),
                self._handle_bob_iq))

        self.xmpp.register_handler(
            Callback('Bits of Binary - Message',
                StanzaPath('message/bob'),
                self._handle_bob))

        self.xmpp.register_handler(
            Callback('Bits of Binary - Presence',
                StanzaPath('presence/bob'),
                self._handle_bob))

        self.api.register(self._get_bob, 'get_bob', default=True)
        self.api.register(self._set_bob, 'set_bob', default=True)
        self.api.register(self._del_bob, 'del_bob', default=True)
开发者ID:firemountain,项目名称:emesene,代码行数:25,代码来源:bob.py


示例19: plugin_init

    def plugin_init(self):
        self.xep = '0086'
        self.description = 'Error Condition Mappings'
        self.stanza = stanza

        register_stanza_plugin(Error, LegacyError,
                               overrides=self.config.get('override', True))
开发者ID:GuruMeditation,项目名称:SleekXMPP,代码行数:7,代码来源:legacy_error.py


示例20: plugin_init

    def plugin_init(self):
        """Start the XEP-0050 plugin."""
        self.xep = '0050'
        self.description = 'Ad-Hoc Commands'
        self.stanza = stanza

        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, stanza.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)
开发者ID:vijayp,项目名称:SleekXMPP,代码行数:29,代码来源:adhoc.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xmlstream.ET类代码示例发布时间:2022-05-27
下一篇:
Python misc_ops.setdefaultencoding函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap