Class jabberwerx.cisco.QuickContactController
Extends
jabberwerx.Controller.
Quick contact Controller class is responsible for quick contact subscriptions/unsubscriptions.
It is also registered to listen to temp presence pubsub notification events.Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new QuickContactController with the given client. |
Field Attributes | Field Name and Description |
---|---|
- Fields borrowed from class jabberwerx.Controller:
- client, name
Method Attributes | Method Name and Description |
---|---|
cleanupEntity(entity)
Cleanup QuickContact entity on behalf of the client entity set jabberwerx.EntitySet. |
|
destroy()
Unbinds events and calls base class method.
|
|
Handle custom serialization.
|
|
removeEntity(entity)
Deletes the given entity.
|
|
subscribe(jid)
This function sends direct presence with caps containing
temp presence feautre to the given jid.
|
|
subscribeAll(jids, reset)
Temp subscribe to multiple contacts.
|
|
unsubscribe(jid)
This function removes temp presence feature for the given jid.
|
|
unsubscribeAll(jids)
Unsubscribe temp subscriptions for multiple contacts.
|
|
Handle custom serialization.
|
- Methods borrowed from class jabberwerx.Controller:
- updateEntity
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- getClassName, init, invocation, shouldBeSerializedInline, toString, wasUnserialized
Class Detail
jabberwerx.cisco.QuickContactController(client)
Creates a new QuickContactController with the given client.
- Parameters:
- {jabberwerx.Client} client
- The owning client
- Throws:
- {TypeError}
- If {client} is not valid
Field Detail
{Number
The bulk subscription work queue timer interval.
The time in seconds between processing of batched subscribe and
unsubscribe operations in the pending work queues.
For example the default value of
0.5 means {@see #subscriptionSlice) subscribes/unsubscribes are
executed twice a second.
Value should be in [0,1]. A value of <= 0 is treated as 0
and implies all pending subscription operations will be executed
(asynchronously) as soon as possible.}
subscriptionInterval
{Integer
The number of subscription operations performed during one
pending work queue timer execution.
This property defines the number of subscribes or
unsubscribes to be attempted during one timer
execution {@see #subscriptionInterval}.
The value should be a positive integer. Values <= 0 are treated
as if they were == 1.}
subscriptionSlice
Method Detail
cleanupEntity(entity)
Cleanup QuickContact entity on behalf of the client entity set jabberwerx.EntitySet.
- Parameters:
- {jabberwerx.Entity} entity
- The entity to destroy
destroy()
Unbinds events and calls base class method.
graphUnserialized()
Handle custom serialization. Override base class to start pending
work queue timer if a queue is not empty.
removeEntity(entity)
Deletes the given entity.
This method is invoked from jabberwerx.Entity#remove method.
- Parameters:
- {jabberwerx.cisco.QuickContact} entity
- The entity to delete
- Throws:
- {TypeError}
- If {entity} is not a Contact
{Boolean}
subscribe(jid)
This function sends direct presence with caps containing
temp presence feautre to the given jid.
Returns false if already subscribed to the jid and true otherwise.
- Parameters:
- {JID} jid
- for which to subscribe to temp presence changes
- Throws:
- {TypeError}
- If {entity} is RosterContact with status "both" or "to"
- Returns:
- {Boolean} true if successfully added, false if unsuccessful
subscribeAll(jids, reset)
Temp subscribe to multiple contacts. Send a temp subscription to each
jid in the given list. JIDS already subscribed to are ignored. Any
errors encountered while subscribing (ie an invalid jid) are logged
but otherwise ignored.
None of the jids in the given list is guarenteed to be subscribed
when this method returns. Subscription operations occur on a
work queue {@see #subscriptionInterval} {@see #subscriptionSlice},
whose execution will occur sometime after this method returns.
An optional reset parameter will unsubscribe from all temp subscriptions
in the entity cache before adding new subscriptions. Existing temp
subs that are in the given list are not removed or resubscribed.
- Parameters:
- {[jabberwerx.JID|String]} jids
- List of jids or JID strings to subscribe. May be an empty array.
- {Boolean} reset Optional
- Unsubscribe from all temp subs currently in the entity cache before subscribing to jids. Default is false, no unsubscriptions are performed.
- Throws:
- TypeError if jids is not an array.
{Boolean}
unsubscribe(jid)
This function removes temp presence feature for the given jid.
and sends direct presence stanza to the jid.
Returns false if not currently subscribed to the temp presence
from jid and true otherwise.
- Parameters:
- {JID} jid
- for which to subscribe to temp presence changes
- Returns:
- {Boolean} true if successfully removed, false if unsuccessful
unsubscribeAll(jids)
Unsubscribe temp subscriptions for multiple contacts. Unsubscribe
from any temp subscriptions to the jids in the given list. If no
temp subscription exists for the jid it is ignored. Any
errors encountered while unsubscribing (ie an invalid jid) are
logged but otherwise ignored.
None of the jids in the given list is guarenteed to be unsubscribed
when this method returns. Bulk Subscription operations occur on a
work queue {@see #subscriptionInterval} {@see #subscriptionSlice},
whose execution will occur sometime after this method returns.
- Parameters:
- {[jabberwerx.JID|String]} jids
- List of bare JIDs or JID Strings to unsubscribe. May be an empty array.
- Throws:
- TypeError if jids is not an array.
willBeSerialized()
Handle custom serialization. Override base class to clear pending
work queue timer as needed. _pending queues are persisted automatically.