pyxmpp.iq.Iq

Package pyxmpp :: Module iq :: Class Iq |
[hide private]

# Class Iq

source code

    stanza.Stanza --+
                    |
                   Iq

Known Subclasses:
  - jabber.muccore.MucIq

Wraper object for <iq /> stanzas.

Instance Methods | [hide private]
__init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, stream=None) Initialize an Iq object. | source code
Iq |
copy(self) Create a deep copy of the iq stanza. | source code
`libxml2.xmlNode` |
get_query(self) Get the payload element of the stanza. | source code
`str` |
get_query_ns(self) Get a namespace of the stanza payload. | source code
Iq |
make_error_response(self, cond) Create error response for the a "get" or "set" iq stanza. | source code
Iq |
make_result_response(self) Create result response for the a "get" or "set" iq stanza. | source code
`libxml2.xmlNode` |
new_query(self, ns_uri, name=`'``query``'`) Create new payload element for the stanza. | source code
Inherited from `stanza.Stanza`: `__del__`, `__eq__`, `__ne__`, `add_content`, `add_new_content`, `free`, `get_error`, `get_from`, `get_from_jid`, `get_id`, `get_node`, `get_stanza_id`, `get_stanza_type`, `get_to`, `get_to_jid`, `get_type`, `serialize`, `set_content`, `set_from`, `set_id`, `set_new_content`, `set_to`, `set_type`, `xpath_eval`

Class Variables | [hide private]
| stanza_type = ``'``iq``'``

Instance Variables | [hide private]
Inherited from `stanza.Stanza`: `stream`, `xmlnode` Inherited from `stanza.Stanza` (private): `_error`

Method Details | [hide private]

### __init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, stream=None) (Constructor) | source code
Initialize an Iq object. Parameters: `xmlnode` (`unicode` or `libxml2.xmlNode` or Iq) - XML node to_jid be wrapped into the Iq object or other Iq object to be copied. If not given then new presence stanza is created using following parameters. `from_jid` (JID) - sender JID. `to_jid` (JID) - recipient JID. `stanza_type` (`unicode`) - staza type: one of: "get", "set", "result" or "error". `stanza_id` (`unicode`) - stanza id -- value of stanza's "id" attribute. If not given, then unique for the session value is generated. `error_cond` (`unicode`) - error condition name. Ignored if stanza_type is not "error". Overrides: stanza.Stanza.__init__

### copy(self) | source code
Create a deep copy of the iq stanza. Returns: Iq Overrides: stanza.Stanza.copy

### get_query(self) | source code
Get the payload element of the stanza. Returns: `libxml2.xmlNode` the payload element or None if there is no payload.

### get_query_ns(self) | source code
Get a namespace of the stanza payload. Returns: `str` XML namespace URI of the payload or None if there is no payload.

### make_error_response(self, cond) | source code
Create error response for the a "get" or "set" iq stanza. Parameters: `cond` - error condition name, as defined in XMPP specification. Returns: Iq new Iq object with the same "id" as self, "from" and "to" attributes swapped, type="error" and containing <error /> element plus payload of `self`.

### make_result_response(self) | source code
Create result response for the a "get" or "set" iq stanza. Returns: Iq new Iq object with the same "id" as self, "from" and "to" attributes replaced and type="result".

### new_query(self, ns_uri, name=`'``query``'`) | source code
Create new payload element for the stanza. Parameters: `ns_uri` (`str`) - namespace URI of the element. `name` (`unicode`) - element name. Returns: `libxml2.xmlNode` the new payload node.