XEP 0059¶
- class slixmpp.plugins.xep_0059.XEP_0059(xmpp, config=None)[source]¶
XEP-0050: Result Set Management
- iterate(stanza, interface, results='substanzas', amount=10, reverse=False, recv_interface=None, pre_cb=None, post_cb=None)[source]¶
Create a new result set iterator for a given stanza query.
- Arguments:
- stanza – A stanza object to serve as a template for
queries made each iteration. For example, a basic disco#items query.
- interface – The name of the substanza to which the
result set management stanza should be appended in the query stanza. For example, for disco#items queries the interface ‘disco_items’ should be used.
- recv_interface – The name of the substanza from which the
result set management stanza should be read in the result stanza. If unspecified, it will be set to the same value as the
interface
parameter.- pre_cb – Callback to run before sending each stanza e.g.
setting the MAM queryid and starting a stanza collector.
- post_cb – Callback to run after receiving each stanza e.g.
stopping a MAM stanza collector in order to gather results.
- results – The name of the interface containing the
query results (typically just ‘substanzas’).
- stanza = <module 'slixmpp.plugins.xep_0059.stanza' from '/home/docs/checkouts/readthedocs.org/user_builds/slixmpp/checkouts/slix-1.7.1/slixmpp/plugins/xep_0059/stanza.py'>¶
Stanza elements¶
Slixmpp: The Slick XMPP Library Copyright (C) 2010 Nathanael C. Fritz, Erik Reuterborg Larsson This file is part of Slixmpp.
See the file LICENSE for copying permission.
- class slixmpp.plugins.xep_0059.stanza.Set(xml=None, parent=None)[source]¶
XEP-0059 (Result Set Management) can be used to manage the results of queries. For example, limiting the number of items per response or starting at certain positions.
Example set stanzas:
<iq type="get"> <query xmlns="http://jabber.org/protocol/disco#items"> <set xmlns="http://jabber.org/protocol/rsm"> <max>2</max> </set> </query> </iq> <iq type="result"> <query xmlns="http://jabber.org/protocol/disco#items"> <item jid="conference.example.com" /> <item jid="pubsub.example.com" /> <set xmlns="http://jabber.org/protocol/rsm"> <first>conference.example.com</first> <last>pubsub.example.com</last> </set> </query> </iq>
Stanza Interface:
first_index -- The index attribute of <first> after -- The id defining from which item to start before -- The id defining from which item to start when browsing backwards max -- Max amount per response first -- Id for the first item in the response last -- Id for the last item in the response index -- Used to set an index to start from count -- The number of remote items available
- interfaces = {'after', 'before', 'count', 'first', 'first_index', 'index', 'last', 'max'}¶
The set of keys that the stanza provides for accessing and manipulating the underlying XML object. This set may be augmented with the
plugin_attrib
value of any registered stanza plugins.
- name = 'set'¶
The XML tag name of the element, not including any namespace prefixes. For example, an
ElementBase
object for<message />
would usename = 'message'
.
- namespace = 'http://jabber.org/protocol/rsm'¶
The XML namespace for the element. Given
<foo xmlns="bar" />
, thennamespace = "bar"
should be used. The default namespace isjabber:client
since this is being used in an XMPP library.
- plugin_attrib = 'rsm'¶
For
ElementBase
subclasses which are intended to be used as plugins, theplugin_attrib
value defines the plugin name. Plugins may be accessed by using theplugin_attrib
value as the interface. An example usingplugin_attrib = 'foo'
:register_stanza_plugin(Message, FooPlugin) msg = Message() msg['foo']['an_interface_from_the_foo_plugin']
- set_before(val)[source]¶
Sets the value of <before>, if the value is True then the element will be created without a value
- set_first_index(val)[source]¶
Sets the index attribute for <first> and creates the element if it doesn’t exist
- sub_interfaces = {'after', 'before', 'count', 'first', 'index', 'last', 'max'}¶
A subset of
interfaces
which maps interfaces to direct subelements of the underlying XML object. Using this set, the text of these subelements may be set, retrieved, or removed without needing to define custom methods.