org.jivesoftware.xiff.im

class Roster

Object | +--org.jivesoftware.xiff.im.Roster

class Roster extends Object
Manages a user's server-side instant messaging roster (or "buddy list"). By default, this class uses an internal data provider to keep track of roster data locally and provides a "read-only" form of the Data Provider API for external use. Non-read operations are performed using alternative, roster-specific methods. You can also use your own, external data provider if you choose, by using the setExternalDataProvider() method. This is most useful for applications where the data provider might need to be a class other than an array with the Data Provider API decorations, like in the case of a Macromedia Central LCDataProvider. Overall, however, its probably a rare occurence.
  • Author:
    Sean Voisen
  • Since:
    2.0.0

Field Summary

public addEventListener: Function
public removeEventListener: Function

Property Summary

public connection: XMPPConnection (read, write)
The instance of the XMPPConnection class to use for the roster to use for sending and receiving data.
public length: Number (read-only)
(Read-only) The number of items in the roster.

Constructor

public Roster ( aConnection: XMPPConnection, externalDataProvider: Object)

Method Summary

public addContact ( id: String, displayName: String, group: String, requestSubscription: Boolean ): Void
Adds a contact to the roster. Remember: All roster data is managed on the server-side, so this contact is added to the server-side roster first, and upon successful addition, reflected in the local client-side copy of the roster.
public denySubscription ( to: String ): Void
Revokes an existing presence subscription or denies a subscription request. If a user has sent you a subscription request you can use this method to deny that request. Otherwise, if a user already has a granted presence subscription, you can use this method to revoke that subscription.
public fetchRoster ( ): Void
Fetches the roster data from the server. Once the data has been fetched, the Roster's data provider is populated appropriately. If the Roster-XMPPConnection class dependency has been set up before logging in, then this method will be called automatically because the Roster listens for "login" events from the XMPPConnection.
public getContactInformation ( jid: String ): Object
Gets all of the locally-cached information for a certain contact by in the roster.
public getItemAt ( index: Number ): Object
Gets a roster item at a specific index. Part of the "read-only" implementation of the DataProvider API. Roster items are generic objects with the following attributes: jid, displayName, group, subscribeType, status, show, and priority.
public getItemID ( index: Number ): Number
Gets the ID of a roster item at a particular index. Part of the "read-only" implementation of the DataProvider API.
public grantSubscription ( to: String, requestAfterGrant: Boolean ): Void
Grants a user or service authorization for subscribing to your presence. Once authorization is granted, the user can see whether you are offline, online, away, etc. Subscriptions can be revoked at any time using the denySubscription() method.
public removeContact ( id: String ): Void
Removes a contact from the roster and revokes all presence subscriptions for that contact. This method will only attempt action if the contact you are trying to remove is currently on the roster in the first place.
public requestSubscription ( id: String ): Void
Requests subscription authorization with a user or service. In the XMPP-world, you cannot receive notifications on changes to a contact's presence until that contact has authorized you to subscribe to his/her/its presence.
public setExternalDataProvider ( externalDP: Object ): Void
Allows use of an external data provider instead of the one used internally by the class by default. This is useful in the case of a Macromedia Central application where the data provider might need to be an instance of an LCDataProvider. The data provider should either implement the Data Provider API interface, or the interface for Central's LCDataProvider.
public setPresence ( show: String, status: String, priority: Number ): Void
Sets your current presence status. Calling this method notifies others who are subscribed to your presence of a presence change. You should use this to change your status to away, extended-away, etc. There are static variables that you can use defined in the presence class for the show parameter:
  • Presence.SHOW_AWAY
  • Presence.SHOW_CHAT
  • Presence.SHOW_DND
  • Presence.SHOW_NORMAL
  • Presence.SHOW_XA
public sortItems ( compareFunc, optionFlags ): Void
Sorts items in the roster using a specific comparison function as passed to the method. Part of the "read-only" implementation of the DataProvider API. For more information, consult the DataProvider documentation.
public sortItemsBy ( fieldName, order ): Void
Sorts items in the roster by a specific field name.
public updateContact ( id: String, newName: String, newGroup: String ): Void
Updates the information for an existing contact. You can use this method to change the display name or associated group for a contact in your roster.

Field Documentation

addEventListener

public var addEventListener: Function

    removeEventListener

    public var removeEventListener: Function

      Property Documentation


      Constructor Documentation

      Roster

      public function Roster (
      aConnection: XMPPConnection,
      externalDataProvider: Object)

        Method Documentation


        The documentation was generated from the following file:
        • Roster.as, Last Modified: 4/20/2005 10:41:24 AM