comparison 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
comparison
equal deleted inserted replaced
285:6422fcdd831c 286:3b382fa0ac28
57 @param namespace: NS of the handler (will appear in disco info) 57 @param namespace: NS of the handler (will appear in disco info)
58 @param callback: method to call when the handler is found 58 @param callback: method to call when the handler is found
59 @param profile: profile which manage this handler""" 59 @param profile: profile which manage this handler"""
60 self.managedNodes.append((node_name, callback)) 60 self.managedNodes.append((node_name, callback))
61 61
62 def publish(self, service, nodeIdentifier, items=None, profile_key='@DEFAULT@'):
63 profile = self.host.memory.getProfileName(profile_key)
64 if not profile:
65 err_mess = _('Trying to publish items with an unknown profile key [%s]') % profile_key
66 error(err_mess)
67 raise Exception(err_mess)
68 try:
69 client = self.clients[profile]
70 except KeyError:
71 err_mess = _('INTERNAL ERROR: no handler for required profile')
72 error(err_mess)
73 raise Exception(err_mess)
74 client.publish(service, nodeIdentifier, items, client.parent.jid)
75
62 76
63 class SatPubSubClient(pubsub.PubSubClient): 77 class SatPubSubClient(pubsub.PubSubClient):
64 implements(disco.IDisco) 78 implements(disco.IDisco)
65 79
66 def __init__(self, host, parent_plugin): 80 def __init__(self, host, parent_plugin):