Class Index | Minimal

Classes


Class jabberwerx.RosterContact


Extends jabberwerx.Contact.

RosterContact object which is part of a user's roster. This object SHOULD NOT be created directly. Instead, it should be created via jabberwerx.RosterController#addContact.

This entity has the following in its #properties map:

NameTypeDescription
nameStringThe nickname from the server (may be "")
subscriptionStringThe subscription state (one of "none", "to", "from", or "both")
askStringThe pending subscription state (one of "subscribe", "unsubscribe", or "")

Class Summary
Constructor Attributes Constructor Name and Description
 
jabberwerx.RosterContact(item, roster, base)

Creates a new Contact with the given item node, creating RosterController and optional base entity.

Fields borrowed from class jabberwerx.Entity:
features, identities, jid, node, properties
Method Summary
Method Attributes Method Name and Description
 

Retrieves the display name of this contact.

 
Get the contact node object
 

Deletes this Contact.

 

Changes or removes the display name for this Contact.

 
setGroups(The)

Changes or removes the groups for this Contact.

 

Sets the contact node object.

Methods borrowed from class jabberwerx.Entity:
apply, destroy, getAllPresence, getGroups, getPrimaryPresence, getResourcePresence, hasFeature, hasIdentity, isActive, matches, toString, update, updatePresence
Methods borrowed from class jabberwerx.JWModel:
applyEvent, event, shouldBeSavedWithGraph
Methods borrowed from class jabberwerx.JWBase:
getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, wasUnserialized, willBeSerialized
Class Detail
jabberwerx.RosterContact(item, roster, base)

Creates a new Contact with the given item node, creating RosterController and optional base entity.

A popular use case is to promote a temporary entity into a RosterContact. To simplify promotion, a base entity may be passed to the constructor. After the new RosterContact is created and populated from the given item, the base's entity properties are merged into the new instance using the following rules:

  • _groups, identities, features and properties lists are merged using jQuery's extend method.
  • The Contact's _presenceList is overwritten by the base. All presence events should already be handled by the base entity (same jid).
  • The Contact's _displayName is not overwritten by base's if it had been set by the given item.
Parameters:
{Element} item
A DOM node which represents an <item> element
{jabberwerx.RosterController} roster
The creating RosterController
{jabberwerx.Entity} base
optional base entity whose members are merged into newly created RosterContact
Throws:
{TypeError}
If {item} is not a valid DOM element, if {roster} is not a valid RosterController or if base is provided but not an jabberwerx.Entity
Method Detail
{String} getDisplayName()

Retrieves the display name of this contact. This method overrides the base to use the properties name, or the default implementation if no server-side name is present.

Returns:
{String} The display name

{Node} getItemNode()
Get the contact node object
Returns:
{Node} A DOM node which represents an <item> element

remove()

Deletes this Contact. This method overrides the base class to instead operate via jabberwerx.RosterController#deleteContact.


setDisplayName(name)

Changes or removes the display name for this Contact. This method overrides the base class to instead change the display name via jabberwerx.RosterController#updateContact.

Parameters:
{String} name
The display name to be set

setGroups(The)

Changes or removes the groups for this Contact. This method overrides the base class to instead operate via jabberwerx.RosteControllerr#updateContact.

Parameters:
{String} The
name of groups

setItemNode(node)

Sets the contact node object. Calling this method triggers an "entityUpdated" event.

This method SHOULD NOT be called directly.

Parameters:
{Node} node
A DOM node which represents an <item> element
Throws:
{TypeError}
if {node} is not valid

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 02 2014 13:23:42 GMT-0600 (MDT)