Package nbxmpp :: Module protocol :: Class Message

[hide private]
[frames] | no frames]

# Class Message

source code

XMPP Message stanza - "push" mechanism

Instance Methods | [hide private]

__init__(self, to=None, body=None, xhtml=None, typ=None, subject=None, attrs=`{``}`, frm=None, payload=`[``]`, timestamp=None, xmlns=`'``jabber:client``'`, node=None) You can specify recipient, text of message, type of message any additional attributes, sender of the message, any additional payload (f.e. jabber:x:delay element) and namespace in one go. | source code

getBody(self) Return text of the message | source code

getXHTML(self, xmllang=None) Return serialized xhtml-im element text of the message | source code

getSubject(self) Return subject of the message | source code

getThread(self) Return thread of the message | source code

setBody(self, val) Set the text of the message | source code

setXHTML(self, val, xmllang=None) Sets the xhtml text of the message (XEP-0071). The parameter is the "inner html" to the body. | source code

setSubject(self, val) Set the subject of the message | source code

setThread(self, val) Set the thread of the message | source code

buildReply(self, text=None) Builds and returns another message object with specified text. The to, from, thread and type properties of new message are pre-set as reply to this message | source code

getStatusCode(self) Return the status code of the message (for groupchat config change) | source code

Inherited from `Protocol`: `__setitem__`, `getError`, `getErrorCode`, `getErrorMsg`, `getFrom`, `getID`, `getProperties`, `getStatusConditions`, `getTimestamp`, `getTimestamp2`, `getTo`, `getType`, `setError`, `setFrom`, `setID`, `setTimestamp`, `setTo`, `setType`

Inherited from `simplexml.Node`: `__contains__`, `__delitem__`, `__getattr__`, `__getitem__`, `__str__`, `addChild`, `addData`, `clearData`, `delAttr`, `delChild`, `getAttr`, `getAttrs`, `getChildren`, `getData`, `getName`, `getNamespace`, `getParent`, `getPayload`, `getTag`, `getTagAttr`, `getTagData`, `getTags`, `has_attr`, `iterTags`, `lookup_nsp`, `setAttr`, `setData`, `setName`, `setNamespace`, `setParent`, `setPayload`, `setTag`, `setTagAttr`, `setTagData`

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

Class Variables | [hide private]

Inherited from `simplexml.Node`: `FORCE_NODE_RECREATION`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, to=None, body=None, xhtml=None, typ=None, subject=None, attrs=`{``}`, frm=None, payload=`[``]`, timestamp=None, xmlns=`'``jabber:client``'`, node=None)
(Constructor)

source code

You can specify recipient, text of message, type of message any additional attributes, sender of the message, any additional payload (f.e. jabber:x:delay element) and namespace in one go.

Alternatively you can pass in the other XML object as the 'node' parameted to replicate it as message

Overrides: object.__init__

### getBody(self)

source code

Return text of the message

### getXHTML(self, xmllang=None)

source code

Return serialized xhtml-im element text of the message

TODO: Returning a DOM could make rendering faster.

### getSubject(self)

source code

Return subject of the message

### getThread(self)

source code

Return thread of the message

### setBody(self, val)

source code

Set the text of the message

### setXHTML(self, val, xmllang=None)

source code

Sets the xhtml text of the message (XEP-0071). The parameter is the "inner html" to the body.

### setSubject(self, val)

source code

Set the subject of the message

### setThread(self, val)

source code

Set the thread of the message

### buildReply(self, text=None)

source code

Builds and returns another message object with specified text. The to, from, thread and type properties of new message are pre-set as reply to this message

### getStatusCode(self)

source code

Return the status code of the message (for groupchat config change)