pyxmpp.jabber.disco.DiscoInfo

Package pyxmpp :: Package jabber :: Module disco :: Class DiscoInfo |
[show private | hide private]
[frames | no frames]

## Type DiscoInfo

                    object --+
                             |
          CachedPropertyObject --+
                                 |
                    object --+   |
                             |   |
    StanzaPayloadWrapperObject --+
                                 |
                                DiscoInfo

A disco#info response object.

Method Summary
| ``__init__`(self, xmlnode_or_node, parent, doc)` Initialize an `DiscoInfo` object.
| `__del__(self)`
| ``add_feature`(self, var)` Add a feature to `self`.
`DiscoIdentity` | ``add_identity`(self, item_name, item_category, item_type)` Add an identity to the `DiscoInfo` object.
`list` of `unicode` | ``get_features`(self)` Get the features contained in `self`.
`list` of `DiscoIdentity` | ``get_identities`(self)` List the identity objects contained in `self`.
`unicode` | ``get_node`(self)` Get the node address of the `DiscoInfo` object.
`bool` | ``has_feature`(self, var)` Check if `self` contains the named feature.
`bool` | ``identity_is`(self, item_category, item_type)` Check if the item described by `self` belongs to the given category and type.
| ``invalidate_features`(self)` Clear cached feature list.
| ``invalidate_identities`(self)` Clear cached identity list.
| ``remove_feature`(self, var)` Remove a feature from `self`.
| ``set_features`(self, features)` Set features in the disco#info object.
| ``set_identities`(self, identities)` Set identities in the disco#info object.
| ``set_node`(self, node)` Set the node of the disco#info element.
Inherited from CachedPropertyObject
| ``__getattr__`(self, name)`
| ``__setattr__`(self, name, value)`
Inherited from StanzaPayloadWrapperObject
`libxml2.xmlNode` or `libxml2.xmlDoc` | ``as_xml`(self, parent, doc)` Get the XML representation of `self`.
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__hash__`(x)` x.__hash__() <==> hash(x)
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__str__`(x)` x.__str__() <==> str(x)

Instance Variable Summary
`tuple` of `unicode` | `features`: features in the disco#info object.
`tuple` of `DiscoIdentity` | `identities`: identities in the disco#info object.
`unicode` | `node`: node name of the disco#info element (cached).
`libxml2.xmlNode` | `xmlnode`: XML element listing the items.

Method Details

### __init__(self, xmlnode_or_node=None, parent=None, doc=None) (Constructor) Initialize an `DiscoInfo` object. Wrap an existing disco#info XML element or create a new one. Parameters: `xmlnode_or_node` - XML node to be wrapped into `self` or an item node name. (type=`libxml2.xmlNode` or `unicode`) `parent` - parent node for the `DiscoInfo` element. (type=`libxml2.xmlNode`) `doc` - document for the `DiscoInfo` element. (type=`libxml2.xmlDoc`) Overrides: `__builtin__.object.__init__`

### add_feature(self, var) Add a feature to `self`. Parameters: `var` - the feature name. (type=`unicode`)

### add_identity(self, item_name, item_category=None, item_type=None) Add an identity to the `DiscoInfo` object. Parameters: `item_name` - name of the item. (type=`unicode`) `item_category` - category of the item. (type=`unicode`) `item_type` - type of the item. (type=`unicode`) Returns: the identity created. (type=`DiscoIdentity`)

### get_features(self) Get the features contained in `self`. Returns: the list of features. (type=`list` of `unicode`)

### get_identities(self) List the identity objects contained in `self`. Returns: the list of identities. (type=`list` of `DiscoIdentity`)

### get_node(self) Get the node address of the `DiscoInfo` object. Returns: the node name. (type=`unicode`)

### has_feature(self, var) Check if `self` contains the named feature. Parameters: `var` - the feature name. (type=`unicode`) Returns: `True` if the feature is found in `self`. (type=`bool`)

### identity_is(self, item_category, item_type=None) Check if the item described by `self` belongs to the given category and type. Parameters: `item_category` - the category name. (type=unicode) `item_type` - the type name. If `None` then only the category is checked. (type=unicode) Returns: `True` if `self` contains at least one <identity/> object with given type and category. (type=`bool`)

### invalidate_features(self) Clear cached feature list.

### invalidate_identities(self) Clear cached identity list.

### remove_feature(self, var) Remove a feature from `self`. Parameters: `var` - the feature name. (type=`unicode`)

### set_features(self, features) Set features in the disco#info object. All existing features are removed from `self`. Parameters: `features` - list of features. (type=sequence of `unicode`)

### set_identities(self, identities) Set identities in the disco#info object. Remove all existing identities from `self`. Parameters: `identities` - list of identities or identity properties (jid,node,category,type,name). (type=sequence of `DiscoIdentity` or sequence of sequences)

### set_node(self, node) Set the node of the disco#info element. Parameters: `node` - the new node or `None`. (type=`unicode`)

Instance Variable Details

### features features in the disco#info object. Type: `tuple` of `unicode`

### identities identities in the disco#info object. Type: `tuple` of `DiscoIdentity`

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

### xmlnode XML element listing the items. Type: `libxml2.xmlNode`