Packageorg.igniterealtime.xiff.data
Classpublic dynamic class XMPPStanza
InheritanceXMPPStanza Inheritance XMLStanza Inheritance ExtensionContainer Inheritance Object
Implements IXMPPStanza
Subclasses IQ, Message, Presence

The base class for all XMPP stanza data classes.

Three types can exist:

See also

http://xmpp.org/rfcs/rfc3920.html#stanzas
http://tools.ietf.org/html/rfc3920#section-9


Public Properties
 PropertyDefined By
  errorCode : int
The error code, assuming this stanza contains error information.
XMPPStanza
  errorCondition : String
The error condition, assuming this stanza contains error information.
XMPPStanza
  errorMessage : String
The error message, assuming this stanza contains error information.
XMPPStanza
  errorType : String
The error type, assuming this stanza contains error information.
XMPPStanza
  from : EscapedJID
The JID of the sender.
XMPPStanza
  id : String
The unique identifier of this stanza.
XMPPStanza
  idGenerator : IIDGenerator
[static] The ID generator for this stanza type.
XMPPStanza
  to : EscapedJID
The JID of the recipient.
XMPPStanza
  type : String
The stanza type.
XMPPStanza
  xml : XML
[override] In addition to saving the XML, check for possible Extensions that are registered for listening this XML data.
XMPPStanza
Protected Properties
 PropertyDefined By
  delayedDelivery : Date
[read-only] Time of the message/presence in case of a delay.
XMPPStanza
Public Methods
 MethodDefined By
  
XMPPStanza(recipient:EscapedJID, sender:EscapedJID, theType:String, theID:String, nodeName:String)
The following four first attributes are common to message, presence, and IQ stanzas.
XMPPStanza
 Inherited
Add extension to the list of the given namespace and insert to the XML element as a child.
ExtensionContainer
  
generateID(prefix:String = null):String
[static] Generates a unique ID for the stanza.
XMPPStanza
 Inherited
ExtensionContainer
 Inherited
getAllExtensionsByNS(nameSpace:String):Array
ExtensionContainer
 Inherited
getAttribute(name:String):String
Convinience method for getting element value from the XML.
XMLStanza
 Inherited
getChildAttribute(elem:String, name:String):String
Convinience method for getting child element attribute value from the XML.
XMLStanza
 Inherited
getChildField(elem:String, name:String):String
Convinience method for getting child element value from the XML.
XMLStanza
 Inherited
getExtension(elementName:String):IExtension
Get the extension having the given element name.
ExtensionContainer
 Inherited
getField(name:String):String
Convinience method for getting element value from the XML.
XMLStanza
 Inherited
removeAllExtensions(nameSpace:String):void
ExtensionContainer
 Inherited
removeExtension(extension:IExtension):Boolean
ExtensionContainer
 Inherited
removeFields(name:String):void
Helper method for removing all child elements that have the given name.
XMLStanza
 Inherited
setAttribute(name:String, value:String):void
Convinience method for setting a value to a element in the XML.
XMLStanza
 Inherited
setChildAttribute(elem:String, name:String, value:String):void
Convinience method for setting an attribute for a child element of the XML.
XMLStanza
 Inherited
setChildField(elem:String, name:String, value:String):void
Convinience method for setting a value for a child element of the XML.
XMLStanza
 Inherited
setField(name:String, value:String):void
Convinience method for setting a value to a element in the XML.
XMLStanza
 Inherited
toString():String
Converts the base stanza XML to a string.
XMLStanza
Public Constants
 ConstantDefined By
  CLIENT_NAMESPACE : String = jabber:client
[static]
XMPPStanza
  CLIENT_VERSION : String = 1.0
[static] The version of XMPP specified in RFC 3920 is "1.0"; in particular, this encapsulates the stream-related protocols (Use of TLS (Section 5), Use of SASL (Section 6), and Stream Errors (Section 4.7)), as well as the semantics of the three defined XML stanza types (message, presence, and iq).
XMPPStanza
 InheritedDEFAULT_NS : Namespace
[static] Default XML namespace.
XMLStanza
  ELEMENT_IQ : String = iq
[static]
XMPPStanza
  ELEMENT_MESSAGE : String = message
[static]
XMPPStanza
  ELEMENT_PRESENCE : String = presence
[static]
XMPPStanza
  ELEMENT_TEMP : String = temp
[static] Internal name in XIFF for incoming data.
XMPPStanza
  ERROR_AUTH : String = auth
[static] Retry after providing credentials
XMPPStanza
  ERROR_CANCEL : String = cancel
[static] Do not retry (the error is unrecoverable)
XMPPStanza
  ERROR_CONTINUE : String = continue
[static] Proceed (the condition was only a warning)
XMPPStanza
  ERROR_MODIFY : String = modify
[static] Retry after changing the data sent
XMPPStanza
  ERROR_WAIT : String = wait
[static] Retry after waiting (the error is temporary)
XMPPStanza
 InheritedFLASH_NS : Namespace
[static]
XMLStanza
  NAMESPACE_BOSH : String = urn:xmpp:xbosh
[static]
XMPPStanza
  NAMESPACE_FLASH : String = http://www.jabber.com/streams/flash
[static]
XMPPStanza
  NAMESPACE_STREAM : String = http://etherx.jabber.org/streams
[static]
XMPPStanza
 InheritedSTREAM_NS : Namespace
[static]
XMLStanza
  XML_LANG : String = en
[static]
XMPPStanza
Property Detail
delayedDeliveryproperty
delayedDelivery:Date  [read-only]

Time of the message/presence in case of a delay. Used only for messages which were sent while user was offline.

Can be set only via XML as the value should come from the server.

There are two ways that might be possible coming from the server, XEP-0203 or XEP-0091, of which the latter is legacy.

XEP-0203: CCYY-MM-DDThh:mm:ss[.sss]TZD

XEP-0091: CCYYMMDDThh:mm:ss


Implementation
    protected function get delayedDelivery():Date

See also

errorCodeproperty 
errorCode:int

The error code, assuming this stanza contains error information. Error codes are deprecated in standard XMPP, but they are commonly used by older Jabber servers like Jabberd 1.4.

Use NaN to remove.

See the link for XEP-0086: Error Condition Mappings


Implementation
    public function get errorCode():int
    public function set errorCode(value:int):void

See also

errorConditionproperty 
errorCondition:String

The error condition, assuming this stanza contains error information.

Use null to remove.

Error condition should be in lowercase and not contain any whitespace.

Error element must be qualified by urn:ietf:params:xml:ns:xmpp-stanzas namespace.


Implementation
    public function get errorCondition():String
    public function set errorCondition(value:String):void

See also

errorMessageproperty 
errorMessage:String

The error message, assuming this stanza contains error information.

Use null to remove.

This is the text element that is a child of error element.


Implementation
    public function get errorMessage():String
    public function set errorMessage(value:String):void

See also

errorTypeproperty 
errorType:String

The error type, assuming this stanza contains error information.

Use null to remove.

The value of the error element's 'type' attribute MUST be one of the following:


Implementation
    public function get errorType():String
    public function set errorType(value:String):void

See also

fromproperty 
from:EscapedJID

The JID of the sender. Most, if not all, server implementations follow the specifications that prevent this from being falsified. Thus, under normal circumstances, you don't need to supply this information because the server will fill it in automatically.

Use null to remove.


Implementation
    public function get from():EscapedJID
    public function set from(value:EscapedJID):void
idproperty 
id:String

The unique identifier of this stanza. ID generation is accomplished using the static generateID method of the particular stanza type.

RFC: The optional 'id' attribute MAY be used by a sending entity for internal tracking of stanzas that it sends and receives (especially for tracking the request-response interaction inherent in the semantics of IQ stanzas). It is OPTIONAL for the value of the 'id' attribute to be unique globally, within a domain, or within a stream. The semantics of IQ stanzas impose additional restrictions; see IQ Semantics (Section 9.2.3).

Use null to remove.


Implementation
    public function get id():String
    public function set id(value:String):void

See also

idGeneratorproperty 
idGenerator:IIDGenerator

The ID generator for this stanza type.

ID generators must implement the IIDGenerator interface. The XIFF library comes with a few default ID generators that have already been implemented (see org.igniterealtime.xiff.data.id..

Setting the ID generator by stanza type is useful if you'd like to use different ID generation schemes for each type. For instance, messages could use the incremental ID generation scheme provided by the IncrementalGenerator class, while IQs could use the shared object ID generation scheme provided by the SOIncrementalGenerator class.


Implementation
    public static function get idGenerator():IIDGenerator
    public static function set idGenerator(value:IIDGenerator):void

See also


Example
The following sets the ID generator for the Message stanza type to an IncrementalGenerator found in org.igniterealtime.xiff.data.id.IncrementalGenerator:
Message.idGenerator = new IncrementalGenerator();
toproperty 
to:EscapedJID

The JID of the recipient.

Use null to remove.


Implementation
    public function get to():EscapedJID
    public function set to(value:EscapedJID):void
typeproperty 
type:String

The stanza type. There are MANY types available, depending on what kind of stanza this is.

The XIFF Library defines the types for IQ, Presence, and Message in each respective class as static string variables. Below is a listing of each:

IQ Presence Message

Use null to remove.

RFC: The 'type' attribute specifies detailed information about the purpose or context of the message, presence, or IQ stanza. The particular allowable values for the 'type' attribute vary depending on whether the stanza is a message, presence, or IQ; the values for message and presence stanzas are specific to instant messaging and presence applications and therefore are defined in [XMPP-IM], whereas the values for IQ stanzas specify the role of an IQ stanza in a structured request-response "conversation" and thus are defined under IQ Semantics (Section 9.2.3) below. The only 'type' value common to all three stanzas is "error"; see Stanza Errors (Section 9.3).


Implementation
    public function get type():String
    public function set type(value:String):void

See also

xmlproperty 
xml:XML[override]

In addition to saving the XML, check for possible Extensions that are registered for listening this XML data.


Implementation
    public function get xml():XML
    public function set xml(value:XML):void
Constructor Detail
XMPPStanza()Constructor
public function XMPPStanza(recipient:EscapedJID, sender:EscapedJID, theType:String, theID:String, nodeName:String)

The following four first attributes are common to message, presence, and IQ stanzas. The fifth, xml:lang, is not included here.

RFC 3920: 9. XML Stanzas

After TLS negotiation (Section 5) if desired, SASL negotiation (Section 6), and Resource Binding (Section 7) if necessary, XML stanzas can be sent over the streams. Three kinds of XML stanza are defined for the 'jabber:client' and 'jabber:server' namespaces: >message/<, >presence/<, and >iq/<. In addition, there are five common attributes for these kinds of stanza. These common attributes, as well as the basic semantics of the three stanza kinds, are defined herein; more detailed information regarding the syntax of XML stanzas in relation to instant messaging and presence applications is provided in [XMPP-IM].

		           |  initiating to receiving  |  receiving to initiating
		  ---------+---------------------------+-----------------------
		  to       |  hostname of receiver     |  silently ignored
		  from     |  silently ignored         |  hostname of receiver
		  id       |  silently ignored         |  session key
		  xml:lang |  default language         |  default language
		  version  |  signals XMPP 1.0 support |  signals XMPP 1.0 support
		 

Parameters
recipient:EscapedJID — to
 
sender:EscapedJID — from
 
theType:String — type
 
theID:String — id
 
nodeName:String — One of the four ELEMENT_constants

See also

Method Detail
generateID()method
public static function generateID(prefix:String = null):String

Generates a unique ID for the stanza. ID generation is handled using a variety of mechanisms, but the default for the library uses the IncrementalGenerator.

Parameters

prefix:String (default = null) — The prefix for the ID to be generated

Returns
String — The generated ID
Constant Detail
CLIENT_NAMESPACEConstant
public static const CLIENT_NAMESPACE:String = jabber:client

CLIENT_VERSIONConstant 
public static const CLIENT_VERSION:String = 1.0

The version of XMPP specified in RFC 3920 is "1.0"; in particular, this encapsulates the stream-related protocols (Use of TLS (Section 5), Use of SASL (Section 6), and Stream Errors (Section 4.7)), as well as the semantics of the three defined XML stanza types (message, presence, and iq).

ELEMENT_IQConstant 
public static const ELEMENT_IQ:String = iq

ELEMENT_MESSAGEConstant 
public static const ELEMENT_MESSAGE:String = message

ELEMENT_PRESENCEConstant 
public static const ELEMENT_PRESENCE:String = presence

ELEMENT_TEMPConstant 
public static const ELEMENT_TEMP:String = temp

Internal name in XIFF for incoming data. The proper element name should be available after setting the XML.

ERROR_AUTHConstant 
public static const ERROR_AUTH:String = auth

Retry after providing credentials

ERROR_CANCELConstant 
public static const ERROR_CANCEL:String = cancel

Do not retry (the error is unrecoverable)

ERROR_CONTINUEConstant 
public static const ERROR_CONTINUE:String = continue

Proceed (the condition was only a warning)

ERROR_MODIFYConstant 
public static const ERROR_MODIFY:String = modify

Retry after changing the data sent

ERROR_WAITConstant 
public static const ERROR_WAIT:String = wait

Retry after waiting (the error is temporary)

NAMESPACE_BOSHConstant 
public static const NAMESPACE_BOSH:String = urn:xmpp:xbosh

NAMESPACE_FLASHConstant 
public static const NAMESPACE_FLASH:String = http://www.jabber.com/streams/flash

NAMESPACE_STREAMConstant 
public static const NAMESPACE_STREAM:String = http://etherx.jabber.org/streams

XML_LANGConstant 
public static const XML_LANG:String = en