Class Index | Minimal

Classes


Class jabberwerx.Stanza (MINIMAL)


Extends jabberwerx.JWModel.

A representation of an XMPP stanza.

Class Summary
Constructor Attributes Constructor Name and Description
 

Creates a new Stanza with the given root element or root name.

Field Summary
Field Attributes Field Name and Description
<static>  
jabberwerx.Stanza.ERR_BAD_REQUEST

ErrorInfo for a bad request error.

<static>  
jabberwerx.Stanza.ERR_CONFLICT

ErrorInfo for a conflict error.

<static>  
jabberwerx.Stanza.ERR_FEATURE_NOT_IMPLEMENTED

ErrorInfo for a feature not implemented error.

<static>  
jabberwerx.Stanza.ERR_FORBIDDEN

ErrorInfo for a forbidden error.

<static>  
jabberwerx.Stanza.ERR_INTERNAL_SERVER_ERROR

ErrorInfo for an internal server error.

<static>  
jabberwerx.Stanza.ERR_ITEM_NOT_FOUND

ErrorInfo for a non-existent item.

<static>  
jabberwerx.Stanza.ERR_JID_MALFORMED

ErrorInfo for a malformed JID error.

<static>  
jabberwerx.Stanza.ERR_NOT_ACCEPTABLE

ErrorInfo for a not acceptable error.

<static>  
jabberwerx.Stanza.ERR_NOT_ALLOWED

ErrorInfo for a not allowed error.

<static>  
jabberwerx.Stanza.ERR_NOT_AUTHORIZED

ErrorInfo for a not authorized error.

<static>  
jabberwerx.Stanza.ERR_REMOTE_SERVER_TIMEOUT

ErrorInfo for a remote server timeout error.

<static>  
jabberwerx.Stanza.ERR_SERVICE_UNAVAILABLE

ErrorInfo for a service unavailable error.

 
The timestamp of this Stanza.
Method Summary
Method Attributes Method Name and Description
 
Creates a duplicate of this stanza.
<static>  
jabberwerx.Stanza.createWithNode(node)
Factory method for creating a stanza from an XML node.
 

Creates an error stanza based on this Stanza.

<static>  
jabberwerx.Stanza.generateID()
Generate a secure stanza ID Result will be a string suitable for any stanza id attribute.
 

Retrieves the document that owns this Stanza's XML element.

 

Returns an ErrorInfo object containing the error information of this stanza if there is any.

 

Retrieves the "from" address for this Stanza.

 

Retrieves the "from" address for this Stanza as a JID.

 

Retrieves the ID for this Stanza.

 

Retrieves the XML element representing this Stanza.

 

Retrieves the "to" address for this Stanza.

 

Retrieves the "to" address for this Stanza as a JID.

 

Retrieves the type for this Stanza.

 

Determines if this Stanza is reporting an error.

 

Retrieves the stanza-type for this Stanza.

 
setFrom(addr)

Changes or removes the "from" address for this Stanza.

 
setID(id)

Changes or removes the ID for this Stanza.

 
setTo(addr)

Changes or removes the "to" address for this Stanza.

 
setType(type)

Changes or removes the type for this Stanza.

 
swap(include_from)
Creates a stanza with the addresses reversed.
 
Called after this Stanza is deserialized from persistence.
 
Called before this Stanza is serialized for persistence.
 
xml()

Generates the XML string representation of this Stanza.

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.Stanza(root)

Creates a new Stanza with the given root element or root name.

Parameters:
{Element|String} root
The element name of the stanza
Throws:
{TypeError}
If {root} is not a valid Element or String
Field Detail
<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_BAD_REQUEST

ErrorInfo for a bad request error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_CONFLICT

ErrorInfo for a conflict error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_FEATURE_NOT_IMPLEMENTED

ErrorInfo for a feature not implemented error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_FORBIDDEN

ErrorInfo for a forbidden error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_INTERNAL_SERVER_ERROR

ErrorInfo for an internal server error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_ITEM_NOT_FOUND

ErrorInfo for a non-existent item.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_JID_MALFORMED

ErrorInfo for a malformed JID error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_NOT_ACCEPTABLE

ErrorInfo for a not acceptable error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_NOT_ALLOWED

ErrorInfo for a not allowed error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_NOT_AUTHORIZED

ErrorInfo for a not authorized error.


<static> {jabberwerx.Stream.ErrorInfo} jabberwerx.Stanza.ERR_REMOTE_SERVER_TIMEOUT

ErrorInfo for a remote server timeout error.


<static> {jabberwerx.Stanza.ErrorInfo} jabberwerx.Stanza.ERR_SERVICE_UNAVAILABLE

ErrorInfo for a service unavailable error.


{Date} timestamp
The timestamp of this Stanza. If this stanza contains a "{urn:xmpp:time}delay" or "{jabber:x:delay}x" child element, this value reflects the date specified by that element. Otherwise, it is the timestamp at which this stanza was created.
Method Detail
{jabberwerx.Stanza} clone()
Creates a duplicate of this stanza. This method performs a deep copy of the DOM.
Returns:
{jabberwerx.Stanza} The cloned stanza

<static> {jabberwerx.Stanza} jabberwerx.Stanza.createWithNode(node)
Factory method for creating a stanza from an XML node.
Parameters:
{Element} node
An XML node.
Returns:
{jabberwerx.Stanza} The Stanza object wrapping the given node

{jabberwerx.Stanza} errorReply(err)

Creates an error stanza based on this Stanza. This method calls #swap, sets the type to "error", and appends an <error/> element with the data from {err}.

Parameters:
{jabberwerx.Stanza.ErrorInfo} err
The error information
Throws:
{TypeError}
If {err} is not a ErrorInfo
Returns:
{jabberwerx.Stanza} The error stanza

<static> {String} jabberwerx.Stanza.generateID()
Generate a secure stanza ID Result will be a string suitable for any stanza id attribute. Default implementation will return a b64 encoded sha1 hashed sufficiently randomized value.
Returns:
{String} The 'secure' stanza Identifier.

{Document} getDoc()

Retrieves the document that owns this Stanza's XML element.

Returns:
{Document} The owning document for the Stanza's element

{jabberwerx.Stanza.ErrorInfo} getErrorInfo()

Returns an ErrorInfo object containing the error information of this stanza if there is any. Otherwise it returns null.

Returns:
{jabberwerx.Stanza.ErrorInfo} The ErrorInfo object

{String} getFrom()

Retrieves the "from" address for this Stanza.

Returns:
{String} The address this Stanza is from

{jabberwerx.JID} getFromJID()

Retrieves the "from" address for this Stanza as a JID. This method will attempt to convert the "from" address string into a JID, or return null if unable to.

Returns:
{jabberwerx.JID} The JID this Stanza is from

{String} getID()

Retrieves the ID for this Stanza.

Returns:
{String} The ID

{Element} getNode()

Retrieves the XML element representing this Stanza.

Returns:
{Element} The Stanza's element

{String} getTo()

Retrieves the "to" address for this Stanza.

Returns:
{String} The address this Stanza is to

{jabberwerx.JID} getToJID()

Retrieves the "to" address for this Stanza as a JID. This method will attempt to convert the "to" address string into a JID, or return null if unable to.

Returns:
{jabberwerx.JID} The JID this Stanza is to

{String} getType()

Retrieves the type for this Stanza. This is equivalent to retrieving the "type" attribute from #getNode.

Returns:
{String} The type

{Boolean} isError()

Determines if this Stanza is reporting an error.

Returns:
{Boolean} true if this is a Stanza of type error

{String} pType()

Retrieves the stanza-type for this Stanza. This is equivalent to retrieving the node name from #getNode.

Returns:
{String} The type of stanza (e.g. "message")

setFrom(addr)

Changes or removes the "from" address for this Stanza.

Parameters:
{String|jabberwerx.JID} addr Optional
The new from address

setID(id)

Changes or removes the ID for this Stanza.

If {id} is "", undefined, or null, any current value is removed.

Parameters:
{String} id Optional
The new ID

setTo(addr)

Changes or removes the "to" address for this Stanza.

Parameters:
{String|jabberwerx.JID} addr Optional
The new to address

setType(type)

Changes or removes the type for this Stanza.

If {type} is "", undefined, or null, any current value is removed.

Parameters:
{String} type Optional
The new type

{jabberwerx.Stanza} swap(include_from)
Creates a stanza with the addresses reversed. This method clones this Stanza, sets the "to" address to be the original "from" address, then (optionally) sets the "from" address to be the original "to" address.
Parameters:
{Boolean} include_from Optional
true if the new stanza should include a "from" address (default is false)
Returns:
{jabberwerx.Stanza} The cloned stanza, with addresses swapped.

wasUnserialized()
Called after this Stanza is deserialized from persistence. This method rebuilds the DOM structure from the saved XML string and converts the timestamp from a number into a Date object.

willBeSerialized()
Called before this Stanza is serialized for persistence. This method saves a string representation of the XMPP stanza and converts the timestamp from a Date object into a number.

{String} xml()

Generates the XML string representation of this Stanza.

Returns:
{String} The XML

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