本文整理汇总了Python中slixmpp.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.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)
示例2: plugin_init
def plugin_init(self):
self.xmpp.register_handler(
Callback('Explicit Message Encryption',
StanzaPath('message/eme'),
self._handle_eme))
register_stanza_plugin(Message, Encryption)
示例3: 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._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)
示例4: 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)
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>
""", use_values=False)
示例5: plugin_init
def plugin_init(self):
register_stanza_plugin(Presence, LastActivity)
self.xmpp.add_filter('out', self._initial_presence_activity)
self.xmpp.add_event_handler('connected', self._reset_presence_activity)
self._initial_presence = set()
示例6: 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))
示例7: plugin_init
def plugin_init(self):
self.xmpp.register_feature('preapproval',
self._handle_preapproval,
restart=False,
order=9001)
register_stanza_plugin(StreamFeatures, stanza.PreApproval)
示例8: plugin_init
def plugin_init(self):
self._idle_stamps = {}
register_stanza_plugin(Presence, stanza.Idle)
self.api.register(self._set_idle, "set_idle", default=True)
self.api.register(self._get_idle, "get_idle", default=True)
self.xmpp.register_handler(Callback("Idle Presence", StanzaPath("presence/idle"), self._idle_presence))
self.xmpp.add_filter("out", self._stamp_idle_presence)
示例9: plugin_init
def plugin_init(self):
register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, Bookmarks)
self.xmpp['xep_0049'].register(Bookmarks)
self.xmpp['xep_0163'].register_pep('bookmarks', Bookmarks)
self.xmpp.add_event_handler('session_start', self._autojoin)
示例10: 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)
示例11: plugin_init
def plugin_init(self):
self.xmpp.register_feature('rosterver',
self._handle_rosterver,
restart=False,
order=9000)
register_stanza_plugin(StreamFeatures, stanza.RosterVer)
示例12: 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)
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))
示例13: plugin_init
def plugin_init(self):
"""Start the XEP-0224 plugin."""
register_stanza_plugin(Message, stanza.Attention)
self.xmpp.register_handler(
Callback('Attention',
StanzaPath('message/attention'),
self._handle_attention))
示例14: plugin_init
def plugin_init(self):
register_stanza_plugin(Message, stanza.NoSave)
register_stanza_plugin(Iq, stanza.NoSaveQuery)
self.xmpp.register_handler(
Callback('Google Nosave',
StanzaPath('[email protected]=set/google_nosave'),
self._handle_nosave_change))
示例15: plugin_init
def plugin_init(self):
self.xmpp.register_handler(
Callback('Message Correction',
StanzaPath('message/replace'),
self._handle_correction))
register_stanza_plugin(Message, Replace)
self.xmpp.use_message_ids = True