Package pyxmpp :: Package jabber :: Module disco :: Class DiscoItems

[hide private]

# Class DiscoItems

source code

                            object --+
                                     |
    objects.StanzaPayloadWrapperObject --+
                                         |
                                        DiscoItems

A disco#items response or publish-request object.

Instance Methods | [hide private]

__init__(self, xmlnode_or_node=None) Initialize an DiscoItems object. | source code

__del__(self) | source code

`unicode`

get_node(self) Get the node address of the DiscoItems object. | source code

set_node(self, node) Set the node of the disco#item element. | source code

`list` of DiscoItem

get_items(self) Get the items contained in `self`. | source code

set_items(self, item_list) Set items in the disco#items object. | source code

invalidate_items(self) Clear cached item list. | source code

DiscoItem.

add_item(self, jid, node=None, name=None, action=None) Add a new item to the DiscoItems object. | source code

`bool`

has_item(self, jid, node=None) Check if `self` contains an item. | source code

Inherited from `objects.StanzaPayloadWrapperObject`: `as_xml` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Instance Variables | [hide private]

: `unicode` | node : node name of the disco#items element.
: `tuple` of DiscoItem | items : items in the disco#items element.
: `libxml2.xmlNode` | xmlnode : XML node of the object.

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, xmlnode_or_node=None)
(Constructor)

source code

Initialize an DiscoItems object.

Wrap an existing disco#items XML element or create a new one.

Parameters:
  - `xmlnode_or_node` (: `libxml2.xmlNode` or `unicode`) - : XML node to be wrapped into `self` or an item node name.
Overrides: object.__init__

### get_node(self)

source code

Get the node address of the DiscoItems object.

Returns: `unicode`
  the node name.

### set_node(self, node)

source code

Set the node of the disco#item element.

Parameters:
  - `node` (: `unicode`) - : the new node or `None`.

### get_items(self)

source code

Get the items contained in `self`.

Returns: `list` of DiscoItem
  the items contained.

### set_items(self, item_list)

source code

Set items in the disco#items object.

All previous items are removed.

Parameters:
  - `item_list` (: sequence of DiscoItem or sequence of sequences) - : list of items or item properties (jid,node,name,action).

### add_item(self, jid, node=None, name=None, action=None)

source code

Add a new item to the DiscoItems object.

Parameters:
  - `jid` (: pyxmpp.JID) - : item JID.
  - `node` (: `unicode`) - : item node name.
  - `name` (: `unicode`) - : item name.
  - `action` (: `unicode`) - : action for a "disco push".
Returns: DiscoItem.
  the item created.

### has_item(self, jid, node=None)

source code

Check if `self` contains an item.

Parameters:
  - `jid` (: JID) - : JID of the item.
  - `node` (: `libxml2.xmlNode`) - : node name of the item.
Returns: `bool`
  `True` if the item is found in `self`.

Instance Variable Details | [hide private]

### node

: node name of the disco#items element.

Get Method:
  get_node(self) - Get the node address of the DiscoItems object.
Set Method:
  set_node(self, node) - Set the node of the disco#item element.
Type:
  : `unicode`

### items

: items in the disco#items element.

Get Method:
  get_items(self) - Get the items contained in `self`.
Set Method:
  set_items(self, item_list) - Set items in the disco#items object.