From c66a4d4097a249efc029b761d6150378a54bf702 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 24 Feb 2015 18:58:40 +0100 Subject: Update the documentation and examples - update most of the examples with slixmpp - change the help channels pointed out in the doc - add a page listing differences from slixmpp and how to use asyncio nicely with slixmpp - fix some in-code rst documentation --- slixmpp/stanza/message.py | 50 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'slixmpp/stanza/message.py') diff --git a/slixmpp/stanza/message.py b/slixmpp/stanza/message.py index 7f9e90f5..cbb170fa 100644 --- a/slixmpp/stanza/message.py +++ b/slixmpp/stanza/message.py @@ -23,6 +23,9 @@ class Message(RootStanza): an error response. Example stanzas: + + .. code-block:: xml + Hi! @@ -32,26 +35,13 @@ class Message(RootStanza): Stanza Interface: - body -- The main contents of the message. - subject -- An optional description of the message's contents. - mucroom -- (Read-only) The name of the MUC room that sent the message. - mucnick -- (Read-only) The MUC nickname of message's sender. + - **body**: The main contents of the message. + - **subject**: An optional description of the message's contents. + - **mucroom**: (Read-only) The name of the MUC room that sent the message. + - **mucnick**: (Read-only) The MUC nickname of message's sender. Attributes: - types -- May be one of: normal, chat, headline, groupchat, or error. - - Methods: - setup -- Overrides StanzaBase.setup. - chat -- Set the message type to 'chat'. - normal -- Set the message type to 'normal'. - reply -- Overrides StanzaBase.reply - get_type -- Overrides StanzaBase interface - get_mucroom -- Return the name of the MUC room of the message. - set_mucroom -- Dummy method to prevent assignment. - del_mucroom -- Dummy method to prevent deletion. - get_mucnick -- Return the MUC nickname of the message's sender. - set_mucnick -- Dummy method to prevent assignment. - del_mucnick -- Dummy method to prevent deletion. + - **types**: May be one of: normal, chat, headline, groupchat, or error. """ name = 'message' @@ -81,18 +71,25 @@ class Message(RootStanza): Overrides default stanza interface behavior. Returns 'normal' if no type attribute is present. + + :rtype: str """ return self._get_attr('type', 'normal') def get_parent_thread(self): - """Return the message thread's parent thread.""" + """Return the message thread's parent thread. + + :rtype: str + """ thread = self.xml.find('{%s}thread' % self.namespace) if thread is not None: return thread.attrib.get('parent', '') return '' def set_parent_thread(self, value): - """Add or change the message thread's parent thread.""" + """Add or change the message thread's parent thread. + + :param str value: identifier of the thread""" thread = self.xml.find('{%s}thread' % self.namespace) if value: if thread is None: @@ -128,10 +125,11 @@ class Message(RootStanza): Sets proper 'to' attribute if the message is from a MUC, and adds a message body if one is given. - Arguments: - body -- Optional text content for the message. - clear -- Indicates if existing content should be removed - before replying. Defaults to True. + :param str body: Optional text content for the message. + :param bool clear: Indicates if existing content should be removed + before replying. Defaults to True. + + :rtype: :class:`~.Message` """ new_message = StanzaBase.reply(self, clear) @@ -152,6 +150,8 @@ class Message(RootStanza): Return the name of the MUC room where the message originated. Read-only stanza interface. + + :rtype: str """ if self['type'] == 'groupchat': return self['from'].bare @@ -163,6 +163,8 @@ class Message(RootStanza): Return the nickname of the MUC user that sent the message. Read-only stanza interface. + + :rtype: str """ if self['type'] == 'groupchat': return self['from'].resource -- cgit v1.2.3