Cisco AJAX XMPP Library :: Cisco-Specific Add-ons


Web 2.0 library for XMPP-based Instant Messaging, Availability and Roster Management


Introduction

This module provides a number of Cisco-specific extensions to the Cisco AJAX XMPP Library.




Installation

To install this module, copy the "jabberwerx.cisco.js" file into the same directory that contains "jabberwerx.js" and "jabberwerx.ui.js". Then modify your HTML pages to load "jabberwerx.cisco.js" after "jabberwerx.js" or "jabberwerx.ui.js".




Quick Contacts

Introduction

The quick contacts feature provides support for managing temporary subscriptions to other contacts. This support is provided via a controller (jabberwerx.cisco.QuickContactController) and a model (jabberwerx.cisco.QuickContact). The controller provides methods for subscribing to, and unsubscribing from quick contacts. The model provides a Contact-based reprenstation of a QuickContact, allowing most other features of the Cisco AJAX XMPP Library to operate on QuickContacts as if it were another person in the roster.

Usage

To use QuickContacts, create a QuickContactController:

    var quickCtrl = client.controller.quickContact ||
                    new jabberwerx.cisco.QuickContactController(client);

Once the client is connected, to add a quick contact, call QuickContactController's subscribe(jid) method:

    quickCtrl.subscribe("user-a@example.com");
    var contact = client.entitySet.entity("user-a@example.com");
There should now be an entity for "user-a@example.com" in the client's entitySet. Usually this will be an instance of "jabberwerx.cisco.QuickContact". Now all presence changes for that contact are evented through the standard "resourcePresenceChanged" and "primaryPresenceChanged" events.

To remove a quick contact, call the entity's remove() method:

    contact.remove();
Alternatively, a quick contact can be removed by JID via the QuickContactController's unsubscribe(jid) method:
    quickCtrl.unsubscribe("user-a@example.com");

Once the client disconnects, all quick contacts are removed from the client's entitySet.

Interaction with Roster

The quick contacts feature is meant to supplement the core roster features. As such, certain methods may behave slightly differently to accomodate roster-based contacts: