Package pyxmpp :: Package jabber :: Module disco :: Class DiscoInfo

[hide private]

# Class DiscoInfo

source code

                            object --+
                                     |
    objects.StanzaPayloadWrapperObject --+
                                         |
                                        DiscoInfo

A disco#info response object.

Instance Methods | [hide private]

__init__(self, xmlnode_or_node=None, parent=None, doc=None) Initialize an DiscoInfo object. | source code

__del__(self) | source code

`unicode`

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

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

`list` of `unicode`

get_features(self) Get the features contained in `self`. | source code

set_features(self, features) Set features in the disco#info object. | source code

`bool`

has_feature(self, var) Check if `self` contains the named feature. | source code

invalidate_features(self) Clear cached feature list. | source code

add_feature(self, var) Add a feature to `self`. | source code

remove_feature(self, var) Remove a feature from `self`. | source code

`list` of DiscoIdentity

get_identities(self) List the identity objects contained in `self`. | source code

set_identities(self, identities) Set identities in the disco#info object. | source code

`bool`

identity_is(self, item_category, item_type=None) Check if the item described by `self` belongs to the given category and type. | source code

invalidate_identities(self) Clear cached identity list. | source code

DiscoIdentity

add_identity(self, item_name, item_category=None, item_type=None) Add an identity to the DiscoInfo object. | 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#info element (cached).
: `tuple` of `unicode` | features : features in the disco#info object.
: `tuple` of DiscoIdentity | identities : identities in the disco#info object.
: `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, parent=None, doc=None)
(Constructor)

source code

Initialize an DiscoInfo object.

Wrap an existing disco#info 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.
  - `parent` (: `libxml2.xmlNode`) - : parent node for the DiscoInfo element.
  - `doc` (: `libxml2.xmlDoc`) - : document for the DiscoInfo element.
Overrides: object.__init__

### get_node(self)

source code

Get the node address of the DiscoInfo object.

Returns: `unicode`
  the node name.

### set_node(self, node)

source code

Set the node of the disco#info element.

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

### get_features(self)

source code

Get the features contained in `self`.

Returns: `list` of `unicode`
  the list of features.

### set_features(self, features)

source code

Set features in the disco#info object.

All existing features are removed from `self`.

Parameters:
  - `features` (: sequence of `unicode`) - : list of features.

### has_feature(self, var)

source code

Check if `self` contains the named feature.

Parameters:
  - `var` (: `unicode`) - : the feature name.
Returns: `bool`
  `True` if the feature is found in `self`.

### add_feature(self, var)

source code

Add a feature to `self`.

Parameters:
  - `var` (: `unicode`) - : the feature name.

### remove_feature(self, var)

source code

Remove a feature from `self`.

Parameters:
  - `var` (: `unicode`) - : the feature name.

### get_identities(self)

source code

List the identity objects contained in `self`.

Returns: `list` of DiscoIdentity
  the list of identities.

### set_identities(self, identities)

source code

Set identities in the disco#info object.

Remove all existing identities from `self`.

Parameters:
  - `identities` (: sequence of DiscoIdentity or sequence of sequences) - : list of identities or identity properties (jid,node,category,type,name).

### identity_is(self, item_category, item_type=None)

source code

Check if the item described by `self` belongs to the given category and type.

Parameters:
  - `item_category` (: unicode) - : the category name.
  - `item_type` (: unicode) - : the type name. If `None` then only the category is checked.
Returns: `bool`
  `True` if `self` contains at least one <identity/> object with given type and category.

### add_identity(self, item_name, item_category=None, item_type=None)

source code

Add an identity to the DiscoInfo object.

Parameters:
  - `item_name` (: `unicode`) - : name of the item.
  - `item_category` (: `unicode`) - : category of the item.
  - `item_type` (: `unicode`) - : type of the item.
Returns: DiscoIdentity
  the identity created.

Instance Variable Details | [hide private]

### node

: node name of the disco#info element (cached).

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

### features

: features in the disco#info object.

Get Method:
  get_features(self) - Get the features contained in `self`.
Set Method:
  set_features(self, features) - Set features in the disco#info object.
Type:
  : `tuple` of `unicode`

### identities

: identities in the disco#info object.

Get Method:
  get_identities(self) - List the identity objects contained in `self`.
Set Method:
  set_identities(self, identities) - Set identities in the disco#info object.
Type:
  : `tuple` of DiscoIdentity