diff options
Diffstat (limited to 'module/plugins/hooks/XMPPInterface.py')
-rw-r--r-- | module/plugins/hooks/XMPPInterface.py | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index f93273df4..847fb26c3 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -92,9 +92,11 @@ class XMPPInterface(IRCInterface, JabberClient): def stream_state_changed(self, state, arg): - """This one is called when the state of stream connecting the component + """ + This one is called when the state of stream connecting the component to a server changes. This will usually be used to let the user - know what is going on.""" + know what is going on. + """ self.logDebug("*** State changed: %s %r ***" % (state, arg)) @@ -111,15 +113,19 @@ class XMPPInterface(IRCInterface, JabberClient): def get_message_handlers(self): - """Return list of (message_type, message_handler) tuples. + """ + Return list of (message_type, message_handler) tuples. The handlers returned will be called when matching message is received - in a client session.""" + in a client session. + """ return [("normal", self.message)] def message(self, stanza): - """Message handler for the component.""" + """ + Message handler for the component. + """ subject = stanza.get_subject() body = stanza.get_body() t = stanza.get_type() @@ -181,7 +187,9 @@ class XMPPInterface(IRCInterface, JabberClient): def announce(self, message): - """ send message to all owners""" + """ + Send message to all owners + """ for user in self.getConfig('owners').split(";"): self.logDebug("Send message to", user) @@ -209,42 +217,53 @@ class XMPPInterface(IRCInterface, JabberClient): class VersionHandler(object): - """Provides handler for a version query. + """ + Provides handler for a version query. This class will answer version query and announce 'jabber:iq:version' namespace - in the client's disco#info results.""" - + in the client's disco#info results. + """ implements(IIqHandlersProvider, IFeaturesProvider) def __init__(self, client): - """Just remember who created this.""" + """ + Just remember who created this. + """ self.client = client def get_features(self): - """Return namespace which should the client include in its reply to a - disco#info query.""" + """ + Return namespace which should the client include in its reply to a + disco#info query. + """ return ["jabber:iq:version"] def get_iq_get_handlers(self): - """Return list of tuples (element_name, namespace, handler) describing - handlers of <iq type='get'/> stanzas""" + """ + Return list of tuples (element_name, namespace, handler) describing + handlers of <iq type='get'/> stanzas + """ return [("query", "jabber:iq:version", self.get_version)] def get_iq_set_handlers(self): - """Return empty list, as this class provides no <iq type='set'/> stanza handler.""" + """ + Return empty list, as this class provides no <iq type='set'/> stanza handler. + """ return [] def get_version(self, iq): - """Handler for jabber:iq:version queries. + """ + Handler for jabber:iq:version queries. jabber:iq:version queries are not supported directly by PyXMPP, so the XML node is accessed directly through the libxml2 API. This should be - used very carefully!""" + used very carefully! + """ iq = iq.make_result_response() q = iq.new_query("jabber:iq:version") q.newTextChild(q.ns(), "name", "Echo component") |