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.

:Ivariables:
    - `node`: node name of the disco#info element (cached).
    - `identities`: identities in the disco#info object.
    - `features`: features in the disco#info object.
    - `xmlnode`: XML element listing the items.
:Types:
    - `node`: `unicode`
    - `identities`: `tuple` of `DiscoIdentity`
    - `features`: `tuple` of `unicode`
    - `xmlnode`: `libxml2.xmlNode`

Method Summary
  __init__(self, xmlnode_or_node, parent, doc)
Initialize an `DiscoInfo` object.
  __del__(self)
  add_feature(self, var)
Add a feature to `self`.
  add_identity(self, item_name, item_category, item_type)
Add an identity to the `DiscoInfo` object.
  get_features(self)
Get the features contained in `self`.
  get_identities(self)
List the identity objects contained in `self`.
  get_node(self)
Get the node address of the `DiscoInfo` object.
  has_feature(self, var)
Check if `self` contains the named feature.
  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
  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)

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.
    - `parent`: parent node for the `DiscoInfo` element.
    - `doc`: document for the `DiscoInfo` element.
:Types:
    - `xmlnode_or_node`: `libxml2.xmlNode` or `unicode`
    - `parent`: `libxml2.xmlNode`
    - `doc`: `libxml2.xmlDoc`
Overrides:
__builtin__.object.__init__

add_feature(self, var)

Add a feature to `self`.

:Parameters:
    - `var`: the feature name.
:Types:
    - `var`: `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.
    - `item_category`: category of the item.
    - `item_type`: type of the item.
:Types:
    - `item_name`: `unicode`
    - `item_category`: `unicode`
    - `item_type`: `unicode`

:returns: the identity created.
:returntype: `DiscoIdentity`

get_features(self)

Get the features contained in `self`.

:return: the list of features.
:returntype: `list` of `unicode`

get_identities(self)

List the identity objects contained in `self`.

:return: the list of identities.
:returntype: `list` of `DiscoIdentity`

get_node(self)

Get the node address of the `DiscoInfo` object.

:return: the node name.
:returntype: `unicode`

has_feature(self, var)

Check if `self` contains the named feature.

:Parameters:
    - `var`: the feature name.
:Types:
    - `var`: `unicode`

:return: `True` if the feature is found in `self`.
:returntype: `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.
    - `item_type`: the type name. If `None` then only the category is
      checked.
:Types:
    - `item_category`: unicode
    - `item_type`: unicode

:return: `True` if `self` contains at least one <identity/> object with
    given type and category.
:returntype: `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.
:Types:
    - `var`: `unicode`

set_features(self, features)

Set features in the disco#info object.

All existing features are removed from `self`.

:Parameters:
    - `features`: list of features.
:Types:
    - `features`: 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).
:Types:
    - `identities`: 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`.
:Types:
    - `node`: `unicode`

Generated by Epydoc 2.1 on Wed May 31 22:36:58 2006 http://epydoc.sf.net