diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2010-11-16 00:31:43 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2010-11-16 00:31:43 -0500 |
| commit | d4d8353b27bd499da8c1790f786a263bbf33600b (patch) | |
| tree | aa7d4547e34f6a0f3dcdba2c069151b9f9e550ad /plugin.py | |
| parent | 50ffed97de46dd5d3367703bd5e14c36ee3fb583 (diff) | |
| parent | 59f44cc48166589846401d609c0cac3f454b8e5f (diff) | |
| download | alias-d4d8353b27bd499da8c1790f786a263bbf33600b.tar.gz | |
Merge branch 'master' of alias.fr.nf:alias
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() + + + |
