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

Class Iq

Stanza --+
         |
        Iq

Known Subclasses:
MucIq

Wraper object for <iq /> stanzas.

Method Summary
  __init__(self, xmlnode, from_jid, to_jid, stanza_type, stanza_id, error, error_cond)
Initialize an `Iq` object.
  copy(self)
Create a deep copy of the iq stanza.
  get_query(self)
Get the payload element of the stanza.
  get_query_ns(self)
Get a namespace of the stanza payload.
  make_error_response(self, cond)
Create error response for the a "get" or "set" iq stanza.
  make_result_response(self)
Create result response for the a "get" or "set" iq stanza.
  new_query(self, ns_uri, name)
Create new payload element for the stanza.
    Inherited from Stanza
  __del__(self)
  __eq__(self, other)
  __ne__(self, other)
  add_content(self, content)
Add an XML node to the stanza's payload.
  add_new_content(self, ns_uri, name)
Add a new XML element to the stanza payload.
  free(self)
Free the node associated with this `Stanza` object.
  get_error(self)
Get stanza error information.
  get_from(self)
Get "from" attribute of the stanza.
  get_from_jid(self)
Get "from" attribute of the stanza.
  get_id(self)
Get "id" attribute of the stanza.
  get_node(self)
Return the XML node wrapped into `self`.
  get_stanza_id(self)
Get "id" attribute of the stanza.
  get_stanza_type(self)
Get "type" attribute of the stanza.
  get_to(self)
Get "to" attribute of the stanza.
  get_to_jid(self)
Get "to" attribute of the stanza.
  get_type(self)
Get "type" attribute of the stanza.
  serialize(self)
Serialize the stanza into an UTF-8 encoded XML string.
  set_content(self, content)
Set stanza content to an XML node.
  set_from(self, from_jid)
Set "from" attribute of the stanza.
  set_id(self, stanza_id)
Set "id" attribute of the stanza.
  set_new_content(self, ns_uri, name)
Set stanza payload to a new XML element.
  set_to(self, to_jid)
Set "to" attribute of the stanza.
  set_type(self, stanza_type)
Set "type" attribute of the stanza.
  xpath_eval(self, expr, namespaces)
Evaluate an XPath expression on the stanza XML node.

Class Variable Summary
str stanza_type = 'iq'

Method Details

__init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None)
(Constructor)

Initialize an `Iq` object.

:Parameters:
    - `xmlnode`: 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`: sender JID.
    - `to_jid`: recipient JID.
    - `stanza_type`: staza type: one of: "get", "set", "result" or "error".
    - `stanza_id`: stanza id -- value of stanza's "id" attribute. If not
      given, then unique for the session value is generated.
    - `error_cond`: error condition name. Ignored if `stanza_type` is not "error".
:Types:
    - `xmlnode`: `unicode` or `libxml2.xmlNode` or `Iq`
    - `from_jid`: `JID`
    - `to_jid`: `JID`
    - `stanza_type`: `unicode`
    - `stanza_id`: `unicode`
    - `error_cond`: `unicode`
Overrides:
pyxmpp.stanza.Stanza.__init__

copy(self)

Create a deep copy of the iq stanza.

:returntype: `Iq`
Overrides:
pyxmpp.stanza.Stanza.copy

get_query(self)

Get the payload element of the stanza.

:return: the payload element or None if there is no payload.
:returntype: `libxml2.xmlNode`

get_query_ns(self)

Get a namespace of the stanza payload.

:return: XML namespace URI of the payload or None if there is no
    payload.
:returntype: `str`

make_error_response(self, cond)

Create error response for the a "get" or "set" iq stanza.

:Parameters:
    - `cond`: error condition name, as defined in XMPP specification.

:return: new `Iq` object with the same "id" as self, "from" and "to"
    attributes swapped, type="error" and containing <error /> element
    plus payload of `self`.
:returntype: `Iq`

make_result_response(self)

Create result response for the a "get" or "set" iq stanza.

:return: new `Iq` object with the same "id" as self, "from" and "to"
    attributes replaced and type="result".
:returntype: `Iq`

new_query(self, ns_uri, name='query')

Create new payload element for the stanza.

:Parameters:
    - `ns_uri`: namespace URI of the element.
    - `name`: element name.
:Types:
    - `ns_uri`: `str`
    - `name`: `unicode`

:return: the new payload node.
:returntype: `libxml2.xmlNode`

Class Variable Details

stanza_type

Type:
str
Value:
'iq'                                                                   

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