summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0009
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-11 22:27:40 -0700
committerLance Stout <lancestout@gmail.com>2012-03-12 19:32:19 -0700
commitd104a5fe75dfee29768542a395cdd6958b331ed8 (patch)
treed4f114f07ca962c40e65b4103b18303fa030d5ac /sleekxmpp/plugins/xep_0009
parentcdd69c68426c50bff9d11ee3380821e86196b1e2 (diff)
downloadslixmpp-d104a5fe75dfee29768542a395cdd6958b331ed8.tar.gz
slixmpp-d104a5fe75dfee29768542a395cdd6958b331ed8.tar.bz2
slixmpp-d104a5fe75dfee29768542a395cdd6958b331ed8.tar.xz
slixmpp-d104a5fe75dfee29768542a395cdd6958b331ed8.zip
Move XEP-0009 to new system.
Diffstat (limited to 'sleekxmpp/plugins/xep_0009')
-rw-r--r--sleekxmpp/plugins/xep_0009/__init__.py11
-rw-r--r--sleekxmpp/plugins/xep_0009/rpc.py30
2 files changed, 24 insertions, 17 deletions
diff --git a/sleekxmpp/plugins/xep_0009/__init__.py b/sleekxmpp/plugins/xep_0009/__init__.py
index 2cd14170..0ce3cf2c 100644
--- a/sleekxmpp/plugins/xep_0009/__init__.py
+++ b/sleekxmpp/plugins/xep_0009/__init__.py
@@ -6,6 +6,15 @@
See the file LICENSE for copying permission.
"""
+from sleekxmpp.plugins.base import register_plugin
+
from sleekxmpp.plugins.xep_0009 import stanza
-from sleekxmpp.plugins.xep_0009.rpc import xep_0009
+from sleekxmpp.plugins.xep_0009.rpc import XEP_0009
from sleekxmpp.plugins.xep_0009.stanza import RPCQuery, MethodCall, MethodResponse
+
+
+register_plugin(XEP_0009)
+
+
+# Retain some backwards compatibility
+xep_0009 = XEP_0009
diff --git a/sleekxmpp/plugins/xep_0009/rpc.py b/sleekxmpp/plugins/xep_0009/rpc.py
index 986a42e7..4e1c538b 100644
--- a/sleekxmpp/plugins/xep_0009/rpc.py
+++ b/sleekxmpp/plugins/xep_0009/rpc.py
@@ -6,27 +6,28 @@
See the file LICENSE for copying permission.
"""
-from sleekxmpp.plugins import base
-from sleekxmpp.plugins.xep_0009.stanza.RPC import RPCQuery, MethodCall, MethodResponse
-from sleekxmpp.stanza.iq import Iq
-from sleekxmpp.xmlstream.handler.callback import Callback
-from sleekxmpp.xmlstream.matcher.xpath import MatchXPath
-from sleekxmpp.xmlstream.stanzabase import register_stanza_plugin, ET
import logging
+from sleekxmpp import Iq
+from sleekxmpp.xmlstream import ET, register_stanza_plugin
+from sleekxmpp.xmlstream.handler import Callback
+from sleekxmpp.xmlstream.matcher import MatchXPath
+from sleekxmpp.plugins import BasePlugin
+from sleekxmpp.plugins.xep_0009 import stanza
+from sleekxmpp.plugins.xep_0009.stanza.RPC import RPCQuery, MethodCall, MethodResponse
log = logging.getLogger(__name__)
+class XEP_0009(BasePlugin):
-class xep_0009(base.base_plugin):
+ name = 'xep_0009'
+ description = 'XEP-0009: Jabber-RPC'
+ dependencies = set(['xep_0030'])
+ stanza = stanza
def plugin_init(self):
- self.xep = '0009'
- self.description = 'Jabber-RPC'
- #self.stanza = sleekxmpp.plugins.xep_0009.stanza
-
register_stanza_plugin(Iq, RPCQuery)
register_stanza_plugin(RPCQuery, MethodCall)
register_stanza_plugin(RPCQuery, MethodResponse)
@@ -50,10 +51,8 @@ class xep_0009(base.base_plugin):
self.xmpp.add_event_handler('error', self._handle_error)
#self.activeCalls = []
- def post_init(self):
- base.base_plugin.post_init(self)
- self.xmpp.plugin['xep_0030'].add_feature('jabber:iq:rpc')
- self.xmpp.plugin['xep_0030'].add_identity('automation','rpc')
+ self.xmpp['xep_0030'].add_feature('jabber:iq:rpc')
+ self.xmpp['xep_0030'].add_identity('automation','rpc')
def make_iq_method_call(self, pto, pmethod, params):
iq = self.xmpp.makeIqSet()
@@ -217,4 +216,3 @@ class xep_0009(base.base_plugin):
def _extract_method(self, stanza):
xml = ET.fromstring("%s" % stanza)
return xml.find("./methodCall/methodName").text
-