Packageorg.igniterealtime.xiff.data
Classpublic class Message
InheritanceMessage Inheritance XMPPStanza Inheritance XMLStanza Inheritance ExtensionContainer
ImplementsIMessage

See also

http://tools.ietf.org/html/rfc3921#section-2.1.1


Public Properties
 PropertyDefined by
  body : String
The message body in plain-text format.
Message
 InheritederrorCode : int
The error code, assuming this stanza contains error information.
XMPPStanza
 InheritederrorCondition : String
The error condition, assuming this stanza contains error information.
XMPPStanza
 InheritederrorMessage : String
The error message, assuming this stanza contains error information.
XMPPStanza
 InheritederrorType : String
The error type, assuming this stanza contains error information.
XMPPStanza
 Inherited_exts : Object
ExtensionContainer
 Inheritedfrom : EscapedJID
The JID of the sender.
XMPPStanza
  htmlBody : String
The message body in XHTML format.
Message
 Inheritedid : String
The unique identifier of this stanza.
XMPPStanza
  idGenerator : IIDGenerator
[static] The ID generator for this stanza type.
Message
  state : String
The chat state if any.
Message
  subject : String
The message subject.
Message
  thread : String
The message thread ID.
Message
  time : Date
[read-only] Time of the message in case of a delay.
Message
 Inheritedto : EscapedJID
The JID of the recipient.
XMPPStanza
 Inheritedtype : String
The stanza type.
XMPPStanza
 InheritedXMLData : XML
[static]
XMLStanza
 InheritedXMLFactory : XMLDocument
[static]
XMLStanza
Public Methods
 MethodDefined by
  
Message(recipient:EscapedJID = null, msgID:String = null, msgBody:String = null, msgHTMLBody:String = null, msgType:String = null, msgSubject:String = null, chatState:String = null)
A class for abstraction and encapsulation of message data.
Message
 Inherited
ExtensionContainer
 Inherited
addTextNode(parent:XMLNode, elementName:String, value:String):XMLNode
Adds a simple text node to the parent node specified.
XMLStanza
  
deserialize(xmlNode:XMLNode):Boolean
Deserializes an XML object and populates the Message instance with its data.
Message
 Inherited
ensureNode(node:XMLNode, elementName:String):XMLNode
Ensures that a node with a specific element name exists in the stanza.
XMLStanza
 Inherited
exists(value:*):Boolean
[static] A helper method to determine if a value is both not null and not undefined.
XMLStanza
  
generateID(prefix:String = null):String
[static] Generates a unique ID for the stanza.
Message
 Inherited
ExtensionContainer
 Inherited
getAllExtensionsByNS(ns:String):Array
ExtensionContainer
 Inherited
getExtension(name:String):Extension
ExtensionContainer
 Inherited
getNode():XMLNode
XMLStanza
  
[static]
Message
 Inherited
removeAllExtensions(ns:String):void
ExtensionContainer
 Inherited
ExtensionContainer
 Inherited
replaceTextNode(parent:XMLNode, original:XMLNode, elementName:String, value:String):XMLNode
Replaces one node in the stanza with another simple text node.
XMLStanza
  
serialize(parentNode:XMLNode):Boolean
Serializes the Message into XML form for sending to a server.
Message
 Inherited
setNode(node:XMLNode):Boolean
Sets the XML node that should be used for this stanza's internal XML representation.
XMLStanza
Public Constants
 ConstantDefined by
 InheritedCLIENT_NAMESPACE : String = "jabber:client"
[static]
XMPPStanza
 InheritedCLIENT_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 (, , and ).
XMPPStanza
 InheritedNAMESPACE_FLASH : String = "http://www.jabber.com/streams/flash"
[static]
XMPPStanza
 InheritedNAMESPACE_STREAM : String = "http://etherx.jabber.org/streams"
[static]
XMPPStanza
  NS_RECEIPT : String = "urn:xmpp:receipts"
[static] The name space used in the message delivery node.
Message
  NS_STATE : String = "http://jabber.org/protocol/chatstates"
[static] The name space used in the Chat state node.
Message
  RECEIPT_RECEIVED : String = "received"
[static] Included by a receiving entity that wishes to inform the sending entity that the message has been received.
Message
  RECEIPT_REQUEST : String = "request"
[static] Included by a sending entity that wishes to know if the message has been received.
Message
  STATE_ACTIVE : String = "active"
[static] User is actively participating in the chat session.
Message
  STATE_COMPOSING : String = "composing"
[static] User is composing a message.
Message
  STATE_GONE : String = "gone"
[static] User has effectively ended their participation in the chat session.
Message
  STATE_INACTIVE : String = "inactive"
[static] User has not been actively participating in the chat session.
Message
  STATE_PAUSED : String = "paused"
[static] User had been composing but now has stopped.
Message
  TYPE_CHAT : String = "chat"
[static] The message is sent in the context of a one-to-one chat session.
Message
  TYPE_ERROR : String = "error"
[static] The message is generated by an entity that experiences an error in processing a message received from another entity (for details regarding stanza error syntax, refer to [xmpp-core]).
Message
  TYPE_GROUPCHAT : String = "groupchat"
[static] The message is sent in the context of a multi-user chat environment (similar to that of [IRC]).
Message
  TYPE_HEADLINE : String = "headline"
[static] The message provides an alert, a notification, or other information to which no reply is expected (e.g., news headlines, sports updates, near-real-time market data, and syndicated content).
Message
  TYPE_NORMAL : String = "normal"
[static] The message is a standalone message that is sent outside the context of a one-to-one conversation or groupchat, and to which it is expected that the recipient will reply.
Message
 InheritedXML_LANG : String = "en"
[static]
XMPPStanza
Property detail
bodyproperty
body:String  [read-write]

The message body in plain-text format. If a client cannot render HTML-formatted text, this text is typically used instead.

Implementation
    public function get body():String
    public function set body(value:String):void
htmlBodyproperty 
htmlBody:String  [read-write]

The message body in XHTML format. Internally, this uses the XHTML data extension.

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

See also

idGeneratorproperty 
idGenerator:IIDGenerator  [read-write]

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 function set idGenerator(value:IIDGenerator):void

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();

stateproperty 
state:String  [read-write]

The chat state if any. Possible values, in addition to null, are:

Implementation
    public function get state():String
    public function set state(value:String):void
subjectproperty 
subject:String  [read-write]

The message subject. Typically chat and groupchat-type messages do not use subjects. Rather, this is reserved for normal and headline-type messages.

Implementation
    public function get subject():String
    public function set subject(value:String):void
threadproperty 
thread:String  [read-write]

The message thread ID. Threading is used to group messages of the same discussion together. The library does not perform message grouping, rather it is up to any client authors to properly perform this task.

Implementation
    public function get thread():String
    public function set thread(value:String):void
timeproperty 
time:Date  [read-only]

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

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

Implementation
    public function get time():Date

See also

Constructor detail
Message()constructor
public function Message(recipient:EscapedJID = null, msgID:String = null, msgBody:String = null, msgHTMLBody:String = null, msgType:String = null, msgSubject:String = null, chatState:String = null)

A class for abstraction and encapsulation of message data.

Parameters
recipient:EscapedJID (default = null) — The JID of the message recipient
 
msgID:String (default = null) — The JID of the message sender - the server should report an error if this is falsified
 
msgBody:String (default = null) — The message ID
 
msgHTMLBody:String (default = null) — The message body in plain-text format
 
msgType:String (default = null) — The message body in XHTML format
 
msgSubject:String (default = null) — The message type
 
chatState:String (default = null) — (Optional) The message subject
Method detail
deserialize()method
public override function deserialize(xmlNode:XMLNode):Boolean

Deserializes an XML object and populates the Message instance with its data.

Parameters
xmlNode:XMLNode — The XML to deserialize

Returns
Boolean — An indication as to whether deserialization was sucessful
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
MessageStaticConstructor()method 
public static function MessageStaticConstructor():Boolean

Returns
Boolean
serialize()method 
public override function serialize(parentNode:XMLNode):Boolean

Serializes the Message into XML form for sending to a server.

Parameters
parentNode:XMLNode

Returns
Boolean — An indication as to whether serialization was successful
Constant detail
NS_RECEIPTconstant
public static const NS_RECEIPT:String = "urn:xmpp:receipts"

The name space used in the message delivery node.

See also

NS_STATEconstant 
public static const NS_STATE:String = "http://jabber.org/protocol/chatstates"

The name space used in the Chat state node.

See also

RECEIPT_RECEIVEDconstant 
public static const RECEIPT_RECEIVED:String = "received"

Included by a receiving entity that wishes to inform the sending entity that the message has been received. The element SHOULD be the only child of the stanza and MUST mirror the 'id' of the sent message.

RECEIPT_REQUESTconstant 
public static const RECEIPT_REQUEST:String = "request"

Included by a sending entity that wishes to know if the message has been received.

STATE_ACTIVEconstant 
public static const STATE_ACTIVE:String = "active"

User is actively participating in the chat session.

STATE_COMPOSINGconstant 
public static const STATE_COMPOSING:String = "composing"

User is composing a message.

STATE_GONEconstant 
public static const STATE_GONE:String = "gone"

User has effectively ended their participation in the chat session. Suggested delay after last activity some 10 minutes.

STATE_INACTIVEconstant 
public static const STATE_INACTIVE:String = "inactive"

User has not been actively participating in the chat session. Suggested delay after last activity some 2 minutes.

STATE_PAUSEDconstant 
public static const STATE_PAUSED:String = "paused"

User had been composing but now has stopped. Suggested delay after last activity some 30 seconds.

TYPE_CHATconstant 
public static const TYPE_CHAT:String = "chat"

The message is sent in the context of a one-to-one chat session. Typically a receiving client will present message of type "chat" in an interface that enables one-to-one chat between the two parties, including an appropriate conversation history. Detailed recommendations regarding one-to-one chat sessions are provided under Section 5.1. of RFC 3921 (draft version).

See also

TYPE_ERRORconstant 
public static const TYPE_ERROR:String = "error"

The message is generated by an entity that experiences an error in processing a message received from another entity (for details regarding stanza error syntax, refer to [xmpp-core]). A client that receives a message of type "error" SHOULD present an appropriate interface informing the sender of the nature of the error.

TYPE_GROUPCHATconstant 
public static const TYPE_GROUPCHAT:String = "groupchat"

The message is sent in the context of a multi-user chat environment (similar to that of [IRC]). Typically a receiving client will present a message of type "groupchat" in an interface that enables many-to-many chat between the parties, including a roster of parties in the chatroom and an appropriate conversation history. For detailed information about XMPP-based groupchat, refer to [XEP-0045].

See also

TYPE_HEADLINEconstant 
public static const TYPE_HEADLINE:String = "headline"

The message provides an alert, a notification, or other information to which no reply is expected (e.g., news headlines, sports updates, near-real-time market data, and syndicated content). Because no reply to the message is expected, typically a receiving client will present a message of type "headline" in an interface that appropriately differentiates the message from standalone messages, chat messages, or groupchat messages (e.g., by not providing the recipient with the ability to reply). The receiving server SHOULD deliver the message to all of the recipient’s available resources.

TYPE_NORMALconstant 
public static const TYPE_NORMAL:String = "normal"

The message is a standalone message that is sent outside the context of a one-to-one conversation or groupchat, and to which it is expected that the recipient will reply. Typically a receiving client will present a message of type "normal" in an interface that enables the recipient to reply, but without a conversation history. The default value of the ’type’ attribute is "normal".