From 67972c5e8496864e2297f5820e4034734996479b Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Mon, 12 Mar 2012 19:06:54 -0700 Subject: Move XEP-0080 to the new system. --- sleekxmpp/plugins/xep_0080/__init__.py | 7 ++++++- sleekxmpp/plugins/xep_0080/geoloc.py | 30 +++++++++--------------------- 2 files changed, 15 insertions(+), 22 deletions(-) (limited to 'sleekxmpp/plugins') diff --git a/sleekxmpp/plugins/xep_0080/__init__.py b/sleekxmpp/plugins/xep_0080/__init__.py index 1e3fe4c8..cad23d22 100644 --- a/sleekxmpp/plugins/xep_0080/__init__.py +++ b/sleekxmpp/plugins/xep_0080/__init__.py @@ -6,5 +6,10 @@ See the file LICENSE for copying permission. """ +from sleekxmpp.plugins.base import register_plugin + from sleekxmpp.plugins.xep_0080.stanza import Geoloc -from sleekxmpp.plugins.xep_0080.geoloc import xep_0080 +from sleekxmpp.plugins.xep_0080.geoloc import XEP_0080 + + +register_plugin(XEP_0080) diff --git a/sleekxmpp/plugins/xep_0080/geoloc.py b/sleekxmpp/plugins/xep_0080/geoloc.py index 99e07951..20dde4dd 100644 --- a/sleekxmpp/plugins/xep_0080/geoloc.py +++ b/sleekxmpp/plugins/xep_0080/geoloc.py @@ -9,7 +9,7 @@ import logging import sleekxmpp -from sleekxmpp.plugins.base import base_plugin +from sleekxmpp.plugins.base import BasePlugin from sleekxmpp.xmlstream import register_stanza_plugin from sleekxmpp.plugins.xep_0080 import stanza, Geoloc @@ -17,30 +17,20 @@ from sleekxmpp.plugins.xep_0080 import stanza, Geoloc log = logging.getLogger(__name__) -class xep_0080(base_plugin): +class XEP_0080(BasePlugin): """ XEP-0080: User Location """ - def plugin_init(self): - """ - Start the XEP-0090 plugin. - """ - self.xep = '0080' - self.description = 'User Location' - self.stanza = stanza + name = 'xep_0080' + description = 'XEP-0080: User Location' + dependencies = set(['xep_0163']) + stanza = stanza - def post_init(self): - """Handle inter-plugin dependencies.""" - base_plugin.post_init(self) - - pubsub_stanza = self.xmpp['xep_0060'].stanza - register_stanza_plugin(pubsub_stanza.EventItem, Geoloc) - - self.xmpp['xep_0030'].add_feature(Geoloc.namespace) - self.xmpp['xep_0163'].add_interest(Geoloc.namespace) - self.xmpp['xep_0060'].map_node_event(Geoloc.namespace, 'user_location') + def plugin_init(self): + """Start the XEP-0080 plugin.""" + self.xmpp['xep_0163'].register_pep('user_location', Geoloc) def publish_location(self, **kwargs): """ @@ -104,7 +94,6 @@ class xep_0080(base_plugin): geoloc.values = kwargs return self.xmpp['xep_0163'].publish(geoloc, - node=Geoloc.namespace, options=options, ifrom=ifrom, block=block, @@ -127,7 +116,6 @@ class xep_0080(base_plugin): """ geoloc = Geoloc() return self.xmpp['xep_0163'].publish(geoloc, - node=Geoloc.namespace, ifrom=ifrom, block=block, callback=callback, -- cgit v1.2.3