Package pyxmpp2 :: Module iq :: Class Iq
[hide private]

Class Iq


<message /> stanza class.
Instance Methods [hide private]
 
__init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None)
Initialize an Iq object.
Iq
copy(self)
Create a deep copy of the stanza.
Iq
make_error_response(self, cond)
Create error response for the a "get" or "set" iq stanza.
Iq
make_result_response(self)
Create result response for the a "get" or "set" iq stanza.
 
add_payload(self, payload)
Add new the stanza payload.

Inherited from stanza.Stanza: as_xml, decode_payload, get_all_payload, get_payload, get_xml, mark_dirty, serialize, set_payload

Inherited from stanza.Stanza (private): _decode_attributes, _decode_error

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from stanza.Stanza: gen_id

Class Variables [hide private]
  element_name = 'message'

Inherited from stanza.Stanza: last_id

Instance Variables [hide private]

Inherited from stanza.Stanza (private): _error, _namespace, _payload, _return_path

Properties [hide private]

Inherited from stanza.Stanza: error, from_jid, return_path, stanza_id, stanza_type, to_jid

Inherited from object: __class__

Method Details [hide private]

__init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None)
(Constructor)

 
Initialize an Iq object.
Parameters:
  • element (ElementTree.Element) - XML element of this stanza.
  • from_jid (JID) - sender JID.
  • to_jid (JID) - recipient JID.
  • stanza_type (unicode) - staza type: one of: "get", "set", "response" 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".
  • language (unicode) - default language for the stanza content
  • error (pyxmpp.error.StanzaErrorElement)
Overrides: object.__init__

copy(self)

 
Create a deep copy of the stanza.
Returns: Iq
Overrides: stanza.Stanza.copy

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.
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)

 
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".

add_payload(self, payload)

 

Add new the stanza payload. Fails if there is already some payload element attached (<iq/> stanza can contain only one payload element)

Marks the stanza dirty.

Parameters:
Overrides: stanza.Stanza.add_payload