Packageorg.igniterealtime.xiff.data
Classpublic class IQ
InheritanceIQ Inheritance XMPPStanza Inheritance XMLStanza Inheritance ExtensionContainer Inheritance Object
Implements IIQ

A class for abstraction and encapsulation of IQ (info-query) data.

See also

http://tools.ietf.org/html/rfc3920#section-9.2.3


Public Properties
 PropertyDefined By
  callback : Function
The function that will be called when an IQ result is received with the same ID as one you send.
IQ
  errorCallback : Function
The function that will be called when an IQ error is received with the same ID as one you send.
IQ
 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
 Inheritedfrom : EscapedJID
The JID of the sender.
XMPPStanza
 Inheritedid : String
The unique identifier of this stanza.
XMPPStanza
  idGenerator : IIDGenerator
[static] The ID generator for this stanza type.
IQ
 Inheritedto : EscapedJID
The JID of the recipient.
XMPPStanza
 Inheritedtype : String
The stanza type.
XMPPStanza
 Inheritedxml : 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
 InheriteddelayedDelivery : Date
[read-only] Time of the message/presence in case of a delay.
XMPPStanza
Public Methods
 MethodDefined By
  
IQ(recipient:EscapedJID = null, iqType:String = null, iqID:String = null, iqCallback:Function = null, iqErrorCallback:Function = null)
A class for abstraction and encapsulation of IQ (info-query) data.
IQ
 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.
IQ
 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
 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 (message, presence, and iq).
XMPPStanza
 InheritedDEFAULT_NS : Namespace
[static] Default XML namespace.
XMLStanza
 InheritedELEMENT_IQ : String = iq
[static]
XMPPStanza
 InheritedELEMENT_MESSAGE : String = message
[static]
XMPPStanza
 InheritedELEMENT_PRESENCE : String = presence
[static]
XMPPStanza
 InheritedELEMENT_TEMP : String = temp
[static] Internal name in XIFF for incoming data.
XMPPStanza
 InheritedERROR_AUTH : String = auth
[static] Retry after providing credentials
XMPPStanza
 InheritedERROR_CANCEL : String = cancel
[static] Do not retry (the error is unrecoverable)
XMPPStanza
 InheritedERROR_CONTINUE : String = continue
[static] Proceed (the condition was only a warning)
XMPPStanza
 InheritedERROR_MODIFY : String = modify
[static] Retry after changing the data sent
XMPPStanza
 InheritedERROR_WAIT : String = wait
[static] Retry after waiting (the error is temporary)
XMPPStanza
 InheritedFLASH_NS : Namespace
[static]
XMLStanza
 InheritedNAMESPACE_BOSH : String = urn:xmpp:xbosh
[static]
XMPPStanza
 InheritedNAMESPACE_FLASH : String = http://www.jabber.com/streams/flash
[static]
XMPPStanza
 InheritedNAMESPACE_STREAM : String = http://etherx.jabber.org/streams
[static]
XMPPStanza
 InheritedSTREAM_NS : Namespace
[static]
XMLStanza
  TYPE_ERROR : String = error
[static] The stanza reports an error that has occurred regarding processing or delivery of a previously-sent get or set request.
IQ
  TYPE_GET : String = get
[static] The stanza requests information, inquires about what data is needed in order to complete further operations, etc.
IQ
  TYPE_RESULT : String = result
[static] The stanza is a response to a successful get or set request.
IQ
  TYPE_SET : String = set
[static] The stanza provides data that is needed for an operation to be completed, sets new values, replaces existing values, etc.
IQ
 InheritedXML_LANG : String = en
[static]
XMPPStanza
Property Detail
callbackproperty
callback:Function

The function that will be called when an IQ result is received with the same ID as one you send.

Callback functions take one parameter which will be the IQ instance received from the server.

This isn't a required property, but is useful if you need to respond to server responses to an IQ.


Implementation
    public function get callback():Function
    public function set callback(value:Function):void
errorCallbackproperty 
errorCallback:Function

The function that will be called when an IQ error is received with the same ID as one you send.

Callback functions take one parameter which will be the IQ instance received from the server.

This isn't a required property, but is useful if you need to respond to server responses to an IQ.


Implementation
    public function get errorCallback():Function
    public function set errorCallback(value:Function):void
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

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();
Constructor Detail
IQ()Constructor
public function IQ(recipient:EscapedJID = null, iqType:String = null, iqID:String = null, iqCallback:Function = null, iqErrorCallback:Function = null)

A class for abstraction and encapsulation of IQ (info-query) data.

Info/Query, or IQ, is a request-response mechanism, similar in some ways to [HTTP]. The semantics of IQ enable an entity to make a request of, and receive a response from, another entity. The data content of the request and response is defined by the namespace declaration of a direct child element of the IQ element, and the interaction is tracked by the requesting entity through use of the 'id' attribute. Thus, IQ interactions follow a common pattern of structured data exchange such as get/result or set/result (although an error may be returned in reply to a request if appropriate):

		    Requesting                 Responding
		      Entity                     Entity
		    ----------                 ----------
		        |                           |
		        | <iq type='get' id='1'>    |
		        | ------------------------> |
		        |                           |
		        | <iq type='result' id='1'> |
		        | <------------------------ |
		        |                           |
		        | <iq type='set' id='2'>    |
		        | ------------------------> |
		        |                           |
		        | <iq type='error' id='2'>  |
		        | <------------------------ |
		        |                           |
	     

Parameters
recipient:EscapedJID (default = null) — The JID of the IQ recipient
 
iqType:String (default = null) — The type of the IQ - there are static variables declared for each type
 
iqID:String (default = null) — The unique ID of the IQ, one of TYPE_constants
 
iqCallback:Function (default = null) — The function to be called when the server responds to the IQ
 
iqErrorCallback:Function (default = null) — The function to be called when there is an error
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
TYPE_ERRORConstant
public static const TYPE_ERROR:String = error

The stanza reports an error that has occurred regarding processing or delivery of a previously-sent get or set request.

See also

TYPE_GETConstant 
public static const TYPE_GET:String = get

The stanza requests information, inquires about what data is needed in order to complete further operations, etc.

TYPE_RESULTConstant 
public static const TYPE_RESULT:String = result

The stanza is a response to a successful get or set request.

TYPE_SETConstant 
public static const TYPE_SET:String = set

The stanza provides data that is needed for an operation to be completed, sets new values, replaces existing values, etc.