Package pyxmpp2 :: Module message :: Class Message
[hide private]

Class Message


<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, subject=None, body=None, thread=None)
Initialize a Message object.
 
_decode_subelements(self)
Decode the stanza subelements.
ElementTree.Element
as_xml(self)
Return the XML stanza representation.
Message
copy(self)
Create a deep copy of the stanza.
Message
make_error_response(self, cond)
Create error response for any non-error message stanza.

Inherited from stanza.Stanza: add_payload, 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]
unicode subject
Message subject.
unicode body
Message body.
unicode thread
Thread id.

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, subject=None, body=None, thread=None)
(Constructor)

 
Initialize a Message 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: "normal", "chat", "headline", "error", "groupchat"
  • 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
  • subject (unicode) - message subject,
  • body (unicode) - message body.
  • thread (unicode) - message thread id.
  • error (pyxmpp.error.StanzaErrorElement)
Overrides: object.__init__

as_xml(self)

 

Return the XML stanza representation.

Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza.

Returns: ElementTree.Element
Overrides: stanza.Stanza.as_xml

copy(self)

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

make_error_response(self, cond)

 
Create error response for any non-error message stanza.
Parameters:
  • cond - error condition name, as defined in XMPP specification.
Returns: Message
new message stanza with the same "id" as self, "from" and "to" attributes swapped, type="error" and containing <error /> element plus payload of self.

Property Details [hide private]

subject

Message subject.
Get Method:
unreachable.subject(self) - Message subject.
Set Method:
unreachable.subject(self, subject)
Type:
unicode

body

Message body.
Get Method:
unreachable.body(self) - Message body.
Set Method:
unreachable.body(self, body)
Type:
unicode

thread

Thread id.
Get Method:
unreachable.thread(self) - Thread id.
Set Method:
unreachable.thread(self, thread)
Type:
unicode