本文整理汇总了Python中slixmpp.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.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:mathieui,项目名称:slixmpp,代码行数:7,代码来源:auth.py
示例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)
开发者ID:mathieui,项目名称:slixmpp,代码行数:7,代码来源:eme.py
示例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)
开发者ID:goutomroy,项目名称:slixmpp,代码行数:28,代码来源:disco.py
示例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)
开发者ID:budlight,项目名称:slixmpp,代码行数:25,代码来源:test_stream_xep_0060.py
示例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()
开发者ID:mathieui,项目名称:slixmpp,代码行数:7,代码来源:xep_0256.py
示例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))
开发者ID:budlight,项目名称:slixmpp,代码行数:7,代码来源:settings.py
示例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)
开发者ID:budlight,项目名称:slixmpp,代码行数:7,代码来源:preapproval.py
示例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)
开发者ID:poezio,项目名称:slixmpp,代码行数:7,代码来源:idle.py
示例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)
开发者ID:budlight,项目名称:slixmpp,代码行数:7,代码来源:bookmarks.py
示例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)
开发者ID:mathieui,项目名称:slixmpp,代码行数:7,代码来源:invite.py
示例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)
开发者ID:budlight,项目名称:slixmpp,代码行数:7,代码来源:rosterver.py
示例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))
开发者ID:budlight,项目名称:slixmpp,代码行数:30,代码来源:gpg.py
示例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))
开发者ID:mathieui,项目名称:slixmpp,代码行数:8,代码来源:attention.py
示例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))
开发者ID:mathieui,项目名称:slixmpp,代码行数:8,代码来源:nosave.py
示例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
开发者ID:budlight,项目名称:slixmpp,代码行数:9,代码来源:correction.py
示例16: _process_command_response
def _process_command_response(self, iq, session):
"""
Generate a command reply stanza based on the
provided session data.
Arguments:
iq -- The command request stanza.
session -- A dictionary of relevant session data.
"""
sessionid = session['id']
payload = session['payload']
if payload is None:
payload = []
if not isinstance(payload, list):
payload = [payload]
interfaces = session.get('interfaces', set())
payload_classes = session.get('payload_classes', set())
interfaces.update(set([item.plugin_attrib for item in payload]))
payload_classes.update(set([item.__class__ for item in payload]))
session['interfaces'] = interfaces
session['payload_classes'] = payload_classes
self.sessions[sessionid] = session
for item in payload:
register_stanza_plugin(Command, item.__class__, iterable=True)
iq = iq.reply()
iq['command']['node'] = session['node']
iq['command']['sessionid'] = session['id']
if session['next'] is None:
iq['command']['actions'] = []
iq['command']['status'] = 'completed'
elif session['has_next']:
actions = ['next']
if session['allow_complete']:
actions.append('complete')
if session['allow_prev']:
actions.append('prev')
iq['command']['actions'] = actions
iq['command']['status'] = 'executing'
else:
iq['command']['actions'] = ['complete']
iq['command']['status'] = 'executing'
iq['command']['notes'] = session['notes']
for item in payload:
iq['command'].append(item)
iq.send()
开发者ID:goutomroy,项目名称:slixmpp,代码行数:56,代码来源:adhoc.py
示例17: testInitialPayloadCommand
def testInitialPayloadCommand(self):
"""Test a command with an initial payload."""
class TestPayload(ElementBase):
name = "foo"
namespace = "test"
interfaces = {"bar"}
plugin_attrib = name
Command = self.xmpp["xep_0050"].stanza.Command
register_stanza_plugin(Command, TestPayload, iterable=True)
def handle_command(iq, session):
initial = session["payload"]
logging.debug(initial)
new_payload = TestPayload()
if initial:
new_payload["bar"] = "Received: %s" % initial["bar"]
else:
new_payload["bar"] = "Failed"
logging.debug(initial)
session["payload"] = new_payload
session["next"] = None
session["has_next"] = False
return session
self.xmpp["xep_0050"].add_command("[email protected]", "foo", "Do Foo", handle_command)
self.recv(
"""
<iq id="11" type="set" to="[email protected]" from="[email protected]">
<command xmlns="http://jabber.org/protocol/commands"
node="foo"
action="execute">
<foo xmlns="test" bar="baz" />
</command>
</iq>
"""
)
self.send(
"""
<iq id="11" type="result" to="[email protected]">
<command xmlns="http://jabber.org/protocol/commands"
node="foo"
status="completed"
sessionid="_sessionid_">
<foo xmlns="test" bar="Received: baz" />
</command>
</iq>
"""
)
开发者ID:poezio,项目名称:slixmpp,代码行数:55,代码来源:test_stream_xep_0050.py
示例18: plugin_init
def plugin_init(self):
self.xmpp.register_handler(
Callback('Chat State',
StanzaPath('message/chat_state'),
self._handle_chat_state))
register_stanza_plugin(Message, stanza.Active)
register_stanza_plugin(Message, stanza.Composing)
register_stanza_plugin(Message, stanza.Gone)
register_stanza_plugin(Message, stanza.Inactive)
register_stanza_plugin(Message, stanza.Paused)
开发者ID:budlight,项目名称:slixmpp,代码行数:11,代码来源:chat_states.py
示例19: plugin_init
def plugin_init(self):
register_stanza_plugin(Iq, Request)
register_stanza_plugin(Iq, Slot)
register_stanza_plugin(Slot, Put)
register_stanza_plugin(Slot, Get)
register_stanza_plugin(Put, Header, iterable=True)
self.xmpp.register_handler(
Callback('HTTP Upload Request',
StanzaPath('[email protected]=get/http_upload_request'),
self._handle_request))
开发者ID:mathieui,项目名称:slixmpp,代码行数:11,代码来源:http_upload.py
示例20: plugin_init
def plugin_init(self):
self.xmpp.register_feature('auth',
self._handle_auth,
restart=False,
order=self.order)
self.xmpp.add_event_handler('legacy_protocol',
self._handle_legacy_protocol)
register_stanza_plugin(Iq, stanza.IqAuth)
register_stanza_plugin(StreamFeatures, stanza.AuthFeature)
开发者ID:budlight,项目名称:slixmpp,代码行数:11,代码来源:legacyauth.py
注:本文中的slixmpp.xmlstream.register_stanza_plugin函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论