pyxmpp.message.Message

Package pyxmpp :: Module message :: Class Message |
[hide private]

# Class Message

source code

    stanza.Stanza --+
                    |
                   Message

Wraper object for <message /> stanzas.

Instance Methods | [hide private]
__init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, subject=None, body=None, thread=None, error=None, error_cond=None, stream=None) Initialize a Message object. | source code
`unicode` |
get_subject(self) Get the message subject. | source code
`unicode` |
get_thread(self) Get the thread-id subject. | source code
Message |
copy(self) Create a deep copy of the message stanza. | source code
`unicode` |
get_body(self) Get the body of the message. | source code
`unicode` |
make_error_response(self, cond) Create error response for any non-error message 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 = ``'``message``'``

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, subject=None, body=None, thread=None, error=None, error_cond=None, stream=None) (Constructor) | source code
Initialize a Message object. Parameters: `xmlnode` (: `unicode` or `libxml2.xmlNode` or Stanza) - : XML node to_jid be wrapped into the Message object or other Message 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. `subject` (: `unicode`) - : message subject, `body` (: `unicode`) - : message body. `thread` (: `unicode`) - : message thread id. `error_cond` (: `unicode`) - : error condition name. Ignored if stanza_type is not "error". Overrides: stanza.Stanza.__init__

### get_subject(self) | source code
Get the message subject. Returns: `unicode` the message subject or `None` if there is no subject.

### get_thread(self) | source code
Get the thread-id subject. Returns: `unicode` the thread-id or `None` if there is no thread-id.

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

### get_body(self) | source code
Get the body of the message. Returns: `unicode` the body of the message or `None` if there is no body.

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