Home | Trees | Index | Help |
|
---|
|
StreamBase
Universal stanza handler/router class.
Provides facilities to set up custom handlers for various types of stanzas.
Method Summary | |
---|---|
Initialize a StanzaProcessor object. | |
Check "to" attribute of received stream header. | |
Modify incoming stanza before processing it. | |
Modify outgoing stanza before sending into the stream. | |
Process IQ stanza received. | |
Process message stanza. | |
Process presence stanza. | |
Process stanza received from the stream. | |
Process stanza not addressed to us. | |
Send a stanza somwhere. | |
Set <iq type="get"/> handler. | |
Set <iq type="set"/> handler. | |
Set a handler for <message/> stanzas. | |
Set a handler for <presence/> stanzas. | |
Set response handler for an IQ "get" or "set" stanza. | |
Remove <iq type="get"/> handler. | |
Remove <iq type="set"/> handler. | |
Add a handler function to a prioritized handler list. | |
Search the handler list for handlers matching given stanza type and payload namespace. | |
Same as Stream.set_response_handlers but assume self.lock is acquired. |
Instance Variable Summary | |
---|---|
initiator : True if local stream endpoint is the initiating entity. | |
lock : lock object used to synchronize access to the
StanzaProcessor object. | |
me : local JID. | |
peer : remote stream endpoint JID. | |
process_all_stanzas : when True then all stanzas received are
considered local. |
Method Details |
---|
__init__(self)
Initialize a |
check_to(self, to)Check "to" attribute of received stream header. Should be overriden in derived classes which require other logic for handling that attribute. |
fix_in_stanza(self, stanza)Modify incoming stanza before processing it. This implementation does nothig. It should be overriden in derived classes if needed. |
fix_out_stanza(self, stanza)Modify outgoing stanza before sending into the stream. This implementation does nothig. It should be overriden in derived classes if needed. |
process_iq(self, stanza)Process IQ stanza received. If a matching handler is available pass the stanza to it. Otherwise ignore it if it is "error" or "result" stanza or return "feature-not-implemented" error.
|
process_message(self, stanza)Process message stanza. Pass it to a handler of the stanza's type and payload namespace. If no handler for the actual stanza type succeeds then hadlers for type "normal" are used.
|
process_presence(self, stanza)Process presence stanza. Pass it to a handler of the stanza's type and payload namespace.
|
process_stanza(self, stanza)Process stanza received from the stream. First "fix" the stanza with
|
route_stanza(self, stanza)Process stanza not addressed to us. Return "recipient-unavailable" return if it is not "error" nor "result" stanza. This method should be overriden in derived classes if they are supposed to handle stanzas not addressed directly to local stream endpoint.
|
send(self, stanza)Send a stanza somwhere. This one does nothing. Should be overriden in derived classes.
|
set_iq_get_handler(self, element, namespace, handler)Set <iq type="get"/> handler. Only one handler may be defined per one namespaced element. If a handler for the element was already set it will be lost after calling this method.
|
set_iq_set_handler(self, element, namespace, handler)Set <iq type="set"/> handler. Only one handler may be defined per one namespaced element. If a handler for the element was already set it will be lost after calling this method.
|
set_message_handler(self, typ, handler, namespace=None, priority=100)Set a handler for <message/> stanzas. Multiple <message /> handlers with the same type/namespace/priority may be set. Order of calling handlers with the same priority is not defined. Handlers will be called in priority order until one of them returns True.
|
set_presence_handler(self, typ, handler, namespace=None, priority=100)Set a handler for <presence/> stanzas. Multiple <presence /> handlers with the same type/namespace/priority may be set. Order of calling handlers with the same priority is not defined. Handlers will be called in priority order until one of them returns True.
|
set_response_handlers(self, iq, res_handler, err_handler, timeout_handler=None, timeout=300)Set response handler for an IQ "get" or "set" stanza. This should be called before the stanza is sent.
|
unset_iq_get_handler(self, element, namespace)Remove <iq type="get"/> handler.
|
unset_iq_set_handler(self, element, namespace)Remove <iq type="set"/> handler.
|
__add_handler(self, handler_list, typ, namespace, priority, handler)Add a handler function to a prioritized handler list.
|
__try_handlers(self, handler_list, typ, stanza)Search the handler list for handlers matching given stanza type and payload namespace. Run the handlers found ordering them by priority until the first one which returnsTrue .
|
_set_response_handlers(self, iq, res_handler, err_handler, timeout_handler=None, timeout=300)Same asStream.set_response_handlers but assume self.lock is acquired. |
Instance Variable Details |
---|
initiatorTrue if local stream endpoint is the initiating entity. |
locklock object used to synchronize access to theStanzaProcessor object. |
melocal JID. |
peerremote stream endpoint JID. |
process_all_stanzaswhenTrue then all stanzas received are
considered local. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Dec 26 17:57:28 2005 | http://epydoc.sf.net |