diff src/plugins/plugin_xep_0060.py @ 286:3b382fa0ac28

plugin xep-0163: added mood publishing
author Goffi <goffi@goffi.org>
date Fri, 04 Feb 2011 01:06:57 +0100
parents 68cd30d982a5
children 7c79d4a8c9e6
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0060.py	Fri Feb 04 00:17:56 2011 +0100
+++ b/src/plugins/plugin_xep_0060.py	Fri Feb 04 01:06:57 2011 +0100
@@ -59,6 +59,20 @@
         @param profile: profile which manage this handler"""
         self.managedNodes.append((node_name, callback))
 
+    def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
+        profile = self.host.memory.getProfileName(profile_key)
+        if not profile:
+            err_mess = _('Trying to publish items with an unknown profile key [%s]') % profile_key
+            error(err_mess)
+            raise Exception(err_mess)
+        try:
+            client = self.clients[profile]
+        except KeyError:
+            err_mess = _('INTERNAL ERROR: no handler for required profile')
+            error(err_mess)
+            raise Exception(err_mess)
+        client.publish(service, nodeIdentifier, items, client.parent.jid) 
+
 
 class SatPubSubClient(pubsub.PubSubClient):
     implements(disco.IDisco)