org.jivesoftware.xiff.data
class XMPPStanza
Object
|
+--org.jivesoftware.xiff.data.XMLStanza
|
+--org.jivesoftware.xiff.data.XMPPStanza
Implemented Interfaces: IExtendable, ISerializableAll Known Subclasses: IQ, Message, Presenceclass XMPPStanza extends XMLStanza
The base class for all XMPP stanza data classes.
- Author:Sean Voisen
- Since:2.0.0
Fields inherited from class org.jivesoftware.xiff.data.XMLStanza
Property Summary
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. For more information on error codes, and corresponding error conditions, see http://www.jabber.org/jeps/jep-0086.html.
The error condition, assuming this stanza contains error information. For more information on error conditions, see http://www.jabber.org/jeps/jep-0086.html.
The error message, assuming this stanza contains error information.
The error type, assuming this stanza contains error information. For more information on error types, see http://www.jabber.org/jeps/jep-0086.html.
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.
The unique identifier of this stanza. ID generation is accomplished using the static
generateID method. The JID of the recipient.
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
- IQ.SET_TYPE
- IQ.GET_TYPE
- IQ.RESULT_TYPE
- IQ.ERROR_TYPE
- Presence.AVAILABLE_TYPE
- Presence.UNAVAILABLE_TYPE
- Presence.PROBE_TYPE
- Presence.SUBSCRIBE_TYPE
- Presence.UNSUBSCRIBE_TYPE
- Presence.SUBSCRIBED_TYPE
- Presence.UNSUBSCRIBED_TYPE
- Presence.ERROR_TYPE
- Message.NORMAL_TYPE
- Message.CHAT_TYPE
- Message.GROUPCHAT_TYPE
- Message.HEADLINE_TYPE
- Message.ERROR_TYPE
Constructor
public XMPPStanza (
recipient: String, sender: String, theType: String, theID: String, nName: String)
Method Summary
These are added by the ExtensionContainer decoration
Called when data is retrieved from the XMLSocket, use this method to extract any state into internal state.
(Static method) 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.
Prepares the XML version of the stanza for transmission to the server.
(Static method) Sets 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.jivesoftware.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 SharedObjectGenerator class.
Methods inherited from class org.jivesoftware.xiff.data.XMLStanza
Field Documentation
Property Documentation
errorCode
public errorCode: Number (read, write)
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. For more information on error codes, and corresponding error conditions, see http://www.jabber.org/jeps/jep-0086.html.
errorCondition
public errorCondition: String (read, write)
The error condition, assuming this stanza contains error information. For more information on error conditions, see http://www.jabber.org/jeps/jep-0086.html.
errorMessage
public errorMessage: String (read, write)
The error message, assuming this stanza contains error information.
errorType
public errorType: String (read, write)
The error type, assuming this stanza contains error information. For more information on error types, see http://www.jabber.org/jeps/jep-0086.html.
from
public from: String (read, write)
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.
id
public id: String (read, write)
The unique identifier of this stanza. ID generation is accomplished using the static
generateID method. - See also:
type
public type: String (read, write)
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
- IQ.SET_TYPE
- IQ.GET_TYPE
- IQ.RESULT_TYPE
- IQ.ERROR_TYPE
- Presence.AVAILABLE_TYPE
- Presence.UNAVAILABLE_TYPE
- Presence.PROBE_TYPE
- Presence.SUBSCRIBE_TYPE
- Presence.UNSUBSCRIBE_TYPE
- Presence.SUBSCRIBED_TYPE
- Presence.UNSUBSCRIBED_TYPE
- Presence.ERROR_TYPE
- Message.NORMAL_TYPE
- Message.CHAT_TYPE
- Message.GROUPCHAT_TYPE
- Message.HEADLINE_TYPE
- Message.ERROR_TYPE
Constructor Documentation
XMPPStanza
public function XMPPStanza (
recipient: String,
sender: String,
theType: String,
theID: String,
nName: String)
sender: String,
theType: String,
theID: String,
nName: String)
Method Documentation
addExtension
public function addExtension (
extension: IExtension): IExtension
These are added by the ExtensionContainer decoration
- Specified by:addExtension in interface IExtendable
deserialize
public function deserialize (
xmlNode: XMLNode): Boolean
Called when data is retrieved from the XMLSocket, use this method to extract any state into internal state.
- Specified by:deserialize in interface ISerializable
- Parameters:
xmlNode node (XMLNode) The node that should be used as the data container.
generateID
public static function generateID (
prefix: String): String
(Static method) 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 The prefix for the ID to be generated - Returns:The generated ID
- See also:
getAllExtensions
public function getAllExtensions (
): Array
- Specified by:getAllExtensions in interface IExtendable
getAllExtensionsByNS
public function getAllExtensionsByNS (
namespace: String): Array
- Specified by:getAllExtensionsByNS in interface IExtendable
removeAllExtensions
public function removeAllExtensions (
namespace: String): Void
- Specified by:removeAllExtensions in interface IExtendable
removeExtension
public function removeExtension (
extension: IExtension): Boolean
- Specified by:removeExtension in interface IExtendable
serialize
public function serialize (
parentNode: XMLNode): Boolean
Prepares the XML version of the stanza for transmission to the server.
- Specified by:serialize in interface ISerializable
- Parameters:
parentNode (Optional) The parent node that the stanza should be appended to during serialization - Returns:An indication as to whether serialization was successful
setIDGenerator
public static function setIDGenerator (
generator: IIDGenerator): Void
(Static method) Sets 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.jivesoftware.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 SharedObjectGenerator class.
- Parameters:
generator The ID generator class - Example:The following sets the ID generator for the Message stanza type to the IncrementalGenerator class found in org.jivesoftware.xiff.data.id.IncrementalGenerator:
Message.setIDGenerator( org.jivesoftware.xiff.data.id.IncrementalGenerator );
- XMPPStanza.as, Last Modified: 3/10/2005 10:16:46 PM