summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0066
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0066')
-rw-r--r--sleekxmpp/plugins/xep_0066/__init__.py11
-rw-r--r--sleekxmpp/plugins/xep_0066/oob.py21
2 files changed, 20 insertions, 12 deletions
diff --git a/sleekxmpp/plugins/xep_0066/__init__.py b/sleekxmpp/plugins/xep_0066/__init__.py
index ebfbd0c2..68a50180 100644
--- a/sleekxmpp/plugins/xep_0066/__init__.py
+++ b/sleekxmpp/plugins/xep_0066/__init__.py
@@ -6,6 +6,15 @@
See the file LICENSE for copying permission.
"""
+from sleekxmpp.plugins.base import register_plugin
+
from sleekxmpp.plugins.xep_0066 import stanza
from sleekxmpp.plugins.xep_0066.stanza import OOB, OOBTransfer
-from sleekxmpp.plugins.xep_0066.oob import xep_0066
+from sleekxmpp.plugins.xep_0066.oob import XEP_0066
+
+
+register_plugin(XEP_0066)
+
+
+# Retain some backwards compatibility
+xep_0066 = XEP_0066
diff --git a/sleekxmpp/plugins/xep_0066/oob.py b/sleekxmpp/plugins/xep_0066/oob.py
index d1f4b3ff..dc215e83 100644
--- a/sleekxmpp/plugins/xep_0066/oob.py
+++ b/sleekxmpp/plugins/xep_0066/oob.py
@@ -13,19 +13,19 @@ from sleekxmpp.exceptions import XMPPError
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import StanzaPath
-from sleekxmpp.plugins.base import base_plugin
+from sleekxmpp.plugins import BasePlugin
from sleekxmpp.plugins.xep_0066 import stanza
log = logging.getLogger(__name__)
-class xep_0066(base_plugin):
+class XEP_0066(BasePlugin):
"""
- XEP-0066: Out-of-Band Data
+ XEP-0066: Out of Band Data
- Out-of-Band Data is a basic method for transferring files between
+ Out of Band Data is a basic method for transferring files between
XMPP agents. The URL of the resource in question is sent to the receiving
entity, which then downloads the resource before responding to the OOB
request. OOB is also used as a generic means to transmit URLs in other
@@ -42,11 +42,13 @@ class xep_0066(base_plugin):
or other addressable resource.
"""
+ name = 'xep_0066'
+ description = 'XEP-0066: Out of Band Data'
+ dependencies = set(['xep_0030'])
+ stanza = stanza
+
def plugin_init(self):
"""Start the XEP-0066 plugin."""
- self.xep = '0066'
- self.description = 'Out-of-Band Transfer'
- self.stanza = stanza
self.url_handlers = {'global': self._default_handler,
'jid': {}}
@@ -60,9 +62,6 @@ class xep_0066(base_plugin):
StanzaPath('iq@type=set/oob_transfer'),
self._handle_transfer))
- def post_init(self):
- """Handle cross-plugin dependencies."""
- base_plugin.post_init(self)
self.xmpp['xep_0030'].add_feature(stanza.OOBTransfer.namespace)
self.xmpp['xep_0030'].add_feature(stanza.OOB.namespace)
@@ -121,7 +120,7 @@ class xep_0066(base_plugin):
iq -- The Iq stanza containing the OOB transfer request.
"""
if iq['to'] in self.url_handlers['jid']:
- return self.url_handlers['jid'][jid](iq)
+ return self.url_handlers['jid'][iq['to']](iq)
else:
if self.url_handlers['global']:
self.url_handlers['global'](iq)