summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0128.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-08-19 16:09:47 -0700
committerNathan Fritz <nathan@andyet.net>2010-08-19 16:09:47 -0700
commitd150b35464742de7af9b3105bc7eeb55171b96ee (patch)
treef1dce9115efbe4c85d37bc27d6ae35f1e937a043 /sleekxmpp/plugins/xep_0128.py
parent21b7109c06695955632692814fed11b3717e0fc7 (diff)
parente4240dd593207a5912de996c42451b3946f113b2 (diff)
downloadslixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.gz
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.bz2
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.tar.xz
slixmpp-d150b35464742de7af9b3105bc7eeb55171b96ee.zip
fixed todo merge
Diffstat (limited to 'sleekxmpp/plugins/xep_0128.py')
-rw-r--r--sleekxmpp/plugins/xep_0128.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0128.py b/sleekxmpp/plugins/xep_0128.py
new file mode 100644
index 00000000..824977b6
--- /dev/null
+++ b/sleekxmpp/plugins/xep_0128.py
@@ -0,0 +1,51 @@
+"""
+ SleekXMPP: The Sleek XMPP Library
+ Copyright (C) 2010 Nathanael C. Fritz, Lance J.T. Stout
+ This file is part of SleekXMPP.
+
+ See the file LICENSE for copying permission.
+"""
+
+import logging
+from . import base
+from .. xmlstream.handler.callback import Callback
+from .. xmlstream.matcher.xpath import MatchXPath
+from .. xmlstream.stanzabase import registerStanzaPlugin, ElementBase, ET, JID
+from .. stanza.iq import Iq
+from . xep_0030 import DiscoInfo, DiscoItems
+from . xep_0004 import Form
+
+
+class xep_0128(base.base_plugin):
+ """
+ XEP-0128 Service Discovery Extensions
+ """
+
+ def plugin_init(self):
+ self.xep = '0128'
+ self.description = 'Service Discovery Extensions'
+
+ registerStanzaPlugin(DiscoInfo, Form)
+ registerStanzaPlugin(DiscoItems, Form)
+
+ def extend_info(self, node, data=None):
+ if data is None:
+ data = {}
+ node = self.xmpp['xep_0030'].nodes.get(node, None)
+ if node is None:
+ self.xmpp['xep_0030'].add_node(node)
+
+ info = node.info
+ info['form']['type'] = 'result'
+ info['form'].setFields(data, default=None)
+
+ def extend_items(self, node, data=None):
+ if data is None:
+ data = {}
+ node = self.xmpp['xep_0030'].nodes.get(node, None)
+ if node is None:
+ self.xmpp['xep_0030'].add_node(node)
+
+ items = node.items
+ items['form']['type'] = 'result'
+ items['form'].setFields(data, default=None)