Can now use: (where self is a SleekTest instance)
self.stanzaPlugin(stanza, plugin)
self.Message() \
self.Iq() > Just like basexmpp.Message(), etc.
self.Presence() /
self.checkMessage(msg, xmlstring)
self.checkIq(iq, xmlstring)
self.checkPresence(pres, xmlstring) <- Not implemented yet, but stub is there.
The check* methods also accept a use_values keyword argument that defaults to True.
When this value is True, an additional test is executed by creating a stanza using
getValues() and setValues(). Since some stanza objects can override these two methods,
disabling this test is sometimes required.
The previous version passed the same stanza object to each registered handler,
which can cause issues when the stanza object is modified by one handler. The next
handler receives the stanza with the modifications, not the original stanza.
Chat states may be set using:
msg['chat_state'].active()
msg['chat_state'].composing()
msg['chat_state'].gone()
msg['chat_state'].inactive()
msg['chat_state'].paused()
Checking a chat state can be done with either:
msg['chat_state'].getState()
msg['chat_state'].name
When a message with a chat state is receieved, the following events
may occur:
chatstate_active
chatstate_composing
chatstate_gone
chatstate_inactive
chatstate_paused
where the event data is the message stanza. Note that currently these
events are also triggered for messages sent by SleekXMPP, not just those
received.
Four new events have been added:
disco_info - A disco#info result has been received
disco_info_request - A disco#info request has been received
disco_items - A disco#items result has been received
disco_items_request - A disco#items request has been received
For disco_info_request and disco_items_request two default handlers are registered. These handlers will only run if they are the only handler for these two events so that multiple responses are not returned and cause errors.
In your own handlers for these two events, you can call the default handlers to preserve the static node behaviour as so:
self.plugin['xep_0030'].handle_disco_info(iq, True)
The forwarded=True will disable the check for other registered handlers.
Agents can now dynamically respond to disco requests by using these events.
(cherry picked from commit 0fc3381492a8bd75e6a9858539a972334881d8ff)
This a simple fix to prevent getting a key error as many plugins add
features to Xep_0030. A better fix would be to call pos_init after all
plugins are loaded. An even better fix would be to define dependencies
for each plugin and registering on demand.
All registered handlers for the event which use the given function will
be removed.
Using this method allows agents to reconfigure their behaviour on the fly
without needing to add extra state information to event handling functions.