Class Index | Minimal

Classes


Class jabberwerx.Message (MINIMAL)


Extends jabberwerx.Stanza.

Represents a <message/> stanza.

Class Summary
Constructor Attributes Constructor Name and Description
 

Creates a new Message object.

Fields borrowed from class jabberwerx.Stanza:
timestamp
Method Summary
Method Attributes Method Name and Description
 

Retrieves the plaintext body for this Message.

 

Retrieves the XHTML-IM body element for this Message.

 

Retrieves the subject for this Message.

 

Retrieves the thread for this Message.

 
setBody(body)

Changes or removes the body for this Message.

 
setHTML(html)

Changes or removes both the HTML and plaintext bodies for this Message.

 
setSubject(subject)

Changes or removes the subject for this Message.

 
setThread(thread)

Changes or removes the thread for this Message.

<static>  
jabberwerx.Message.translate(content, displayName)
Takes a String or an Element and substitutes in the user name, nickname or handle of the sender, where the string begins with '/me '.
Methods borrowed from class jabberwerx.Stanza:
clone, errorReply, getDoc, getErrorInfo, getFrom, getFromJID, getID, getNode, getTo, getToJID, getType, isError, pType, setFrom, setID, setTo, setType, swap, wasUnserialized, willBeSerialized, xml
Methods borrowed from class jabberwerx.JWModel:
applyEvent, event, shouldBeSavedWithGraph
Methods borrowed from class jabberwerx.JWBase:
destroy, getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString
Class Detail
jabberwerx.Message(packet)

Creates a new Message object.

Parameters:
{Element} packet Optional
The <message/> element, or null for an empty Message
Throws:
{TypeError}
If {packet} is not a <message/> element
Method Detail
{String} getBody()

Retrieves the plaintext body for this Message.

Returns:
{String} The body

{DOM} getHTML()

Retrieves the XHTML-IM body element for this Message. The first body contained within an html element (xep-71 namespaces) or null if the element does not exist. Returned element will be cleaned using xep-71 Recommended Profile. See jabberwerx.xhtmlim#.sanitize. NOTE the entire body element is returned, not just its contents.

Returns:
{DOM} The XHTML body element or null

{String} getSubject()

Retrieves the subject for this Message.

Returns:
{String} The subject

{String} getThread()

Retrieves the thread for this Message.

Returns:
{String} The thread

setBody(body)

Changes or removes the body for this Message.

Changes to the plaintext body will automatically clear the XHTML-IM body (XEP-71 8#2). In practice setBody and #setHTML are mutually exclusively, using both within the same message is not recommended.

Parameters:
{String} body Optional
The new message body

setHTML(html)

Changes or removes both the HTML and plaintext bodies for this Message.

XHTML-IM and plaintext must have the same text value (xep-71 8#2). See #setBody. HTML is cleaned using xep-71 Recommended Profile (See jabberwerx.xhtmlim#.sanitize). html may be a string that will parse into a root tag, a single root HTML tag or an array of HTML tags (must not be body elements). setHTML adds a body wrapper as needed. If html is null the XHTML-IM html element is removed and the plaintext body is cleared.

Parameters:
{DOM|Array|String} html Optional
The new message
Throws:
{TypeError}
If html is defined and not a parsable string, DOM or a non empty Array of DOM

setSubject(subject)

Changes or removes the subject for this Message.

Parameters:
{String} subject Optional
The new message subject

setThread(thread)

Changes or removes the thread for this Message.

Parameters:
{String} thread Optional
The new message thread

<static> {jQueryCollection|null} jabberwerx.Message.translate(content, displayName)
Takes a String or an Element and substitutes in the user name, nickname or handle of the sender, where the string begins with '/me '.
Example: translate('/me laughs', 'foo') returns ['* foo laughs']
Parameters:
{String|Element} content
The message content.
{String} displayName
The displayName of the sender
Throws:
{jabberwerx.Message.InvalidContentFormat}
if content is not a string or a Element.
Returns:
{jQueryCollection|null} The translated Message if content contained a XEP-0245 '/me ' command, otherwise null

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 02 2014 13:23:42 GMT-0600 (MDT)