summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0009/stanza
diff options
context:
space:
mode:
authorDann Martens <me@dannmartens.com>2011-01-13 08:40:53 +0100
committerDann Martens <me@dannmartens.com>2011-01-13 08:40:53 +0100
commit3a12cdbd131e5bb98f192c077faa6bdda8fd95c7 (patch)
tree390479304a1d62b83a4c7317379972fc343384cc /sleekxmpp/plugins/xep_0009/stanza
parentb3353183f308b5ec43a6d69e637a3b87b7d7fcb2 (diff)
downloadslixmpp-3a12cdbd131e5bb98f192c077faa6bdda8fd95c7.tar.gz
slixmpp-3a12cdbd131e5bb98f192c077faa6bdda8fd95c7.tar.bz2
slixmpp-3a12cdbd131e5bb98f192c077faa6bdda8fd95c7.tar.xz
slixmpp-3a12cdbd131e5bb98f192c077faa6bdda8fd95c7.zip
Introduced new XEP-0009 into develop.
Diffstat (limited to 'sleekxmpp/plugins/xep_0009/stanza')
-rw-r--r--sleekxmpp/plugins/xep_0009/stanza/RPC.py68
-rw-r--r--sleekxmpp/plugins/xep_0009/stanza/__init__.py9
2 files changed, 77 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0009/stanza/RPC.py b/sleekxmpp/plugins/xep_0009/stanza/RPC.py
new file mode 100644
index 00000000..24f2efd8
--- /dev/null
+++ b/sleekxmpp/plugins/xep_0009/stanza/RPC.py
@@ -0,0 +1,68 @@
+"""
+ SleekXMPP: The Sleek XMPP Library
+ Copyright (C) 2011 Nathanael C. Fritz, Dann Martens (TOMOTON).
+ This file is part of SleekXMPP.
+
+ See the file LICENSE for copying permission.
+"""
+
+from sleekxmpp.xmlstream.stanzabase import ElementBase
+from xml.etree import cElementTree as ET
+
+
+class RPCQuery(ElementBase):
+ name = 'query'
+ namespace = 'jabber:iq:rpc'
+ plugin_attrib = 'rpc_query'
+ interfaces = set(())
+ subinterfaces = set(())
+ plugin_attrib_map = {}
+ plugin_tag_map = {}
+
+
+
+class MethodCall(ElementBase):
+ name = 'methodCall'
+ namespace = 'jabber:iq:rpc'
+ plugin_attrib = 'method_call'
+ interfaces = set(('method_name', 'params'))
+ subinterfaces = set(())
+ plugin_attrib_map = {}
+ plugin_tag_map = {}
+
+
+ def get_method_name(self):
+ return self._get_sub_text('methodName')
+
+ def set_method_name(self, value):
+ return self._set_sub_text('methodName', value)
+
+ def get_params(self):
+ return self.xml.find('{%s}params' % self.namespace)
+
+ def set_params(self, params):
+ self.append(params)
+
+
+
+class MethodResponse(ElementBase):
+ name = 'methodResponse'
+ namespace = 'jabber:iq:rpc'
+ plugin_attrib = 'method_response'
+ interfaces = set(('params', 'fault'))
+ subinterfaces = set(())
+ plugin_attrib_map = {}
+ plugin_tag_map = {}
+
+
+ def get_params(self):
+ return self.xml.find('{%s}params' % self.namespace)
+
+ def set_params(self, params):
+ self.append(params)
+
+ def get_fault(self):
+ return self.xml.find('{%s}fault' % self.namespace)
+
+ def set_fault(self, fault):
+ self.append(fault)
diff --git a/sleekxmpp/plugins/xep_0009/stanza/__init__.py b/sleekxmpp/plugins/xep_0009/stanza/__init__.py
new file mode 100644
index 00000000..0b902238
--- /dev/null
+++ b/sleekxmpp/plugins/xep_0009/stanza/__init__.py
@@ -0,0 +1,9 @@
+"""
+ SleekXMPP: The Sleek XMPP Library
+ Copyright (C) 2011 Nathanael C. Fritz, Dann Martens (TOMOTON).
+ This file is part of SleekXMPP.
+
+ See the file LICENSE for copying permission.
+"""
+
+from RPC import RPCQuery, MethodCall, MethodResponse