diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2010-11-15 02:00:56 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2010-11-15 02:00:56 +0100 |
| commit | 59f44cc48166589846401d609c0cac3f454b8e5f (patch) | |
| tree | cd6b7ed71d9ee7a887c0cf0f405900c2edf6fdf2 /plugin.py | |
| parent | f0552f8d39407c4fdcb14f8cc0c30c31f94a510e (diff) | |
| download | alias-59f44cc48166589846401d609c0cac3f454b8e5f.tar.gz | |
Basic alias plugin
Diffstat (limited to 'plugin.py')
| -rw-r--r-- | plugin.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugin.py b/plugin.py new file mode 100644 index 0000000..a88d244 --- /dev/null +++ b/plugin.py @@ -0,0 +1,32 @@ +from sleekxmpp.xmlstream.stanzabase import ElementBase, registerStanzaPlugin +from sleekxmpp.plugins import base +from sleekxmpp.xmlstream.handler.callback import Callback +from sleekxmpp.xmlstream.matcher.xpath import MatchXPath +from sleekxmpp.stanza.iq import Iq +import logging + +class AliasQuery(ElementBase) : + namespace = 'alias:query' + name = 'query' + plugin_attrib = 'query' + interfaces = set(('node', 'type', 'items','object')) + sub_interfaces = set(('items')) + + +class AliasPlugin(base.base_plugin) : + + def plugin_init(self) : + self.description = 'Plugin to handle alias queries' + registerStanzaPlugin(Iq, AliasQuery) + + self.xmpp.registerHandler( + Callback('Alias queries', + MatchXPath('{%s}iq/{%s}query' % (self.xmpp.default_ns, + AliasQuery.namespace)), + self.handle_alias_query)) + + def handle_alias_query(self, iq) : + iq.reply().send() + + + |
