XEP 0059

1.6 Documentation

«  XEP 0054   ::   Contents   ::   XEP 0060  »

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.6.0/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
del_first_index()[source]

Removes the index attribute for <first> but keeps the element

get_before()[source]

Returns the value of <before>, if it is empty it will return True

get_first_index()[source]

Returns the value of the index attribute for <first>

interfaces = {'after', 'before', 'count', 'first', 'first_index', 'index', 'last', 'max'}
name = 'set'
namespace = 'http://jabber.org/protocol/rsm'
plugin_attrib = 'rsm'
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'}

«  XEP 0054   ::   Contents   ::   XEP 0060  »