The Roster stanza object builds item elements manually, and did not handle the
case where the name attribute is set to None, which would crash SleekXMPP.
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)