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:
Name | Type | Description |
---|---|---|
name | String | The nickname from the server (may be "") |
subscription | String | The subscription state (one of "none", "to", "from", or "both") |
ask | String | The pending subscription state (one of "subscribe", "unsubscribe", or "") |
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 Attributes | Method Name and Description |
---|---|
Retrieves the display name of this contact. |
|
Get the contact node object
|
|
remove()
Deletes this Contact. |
|
setDisplayName(name)
Changes or removes the display name for this Contact. |
|
setGroups(The)
Changes or removes the groups for this Contact. |
|
setItemNode(node)
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
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
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
- Returns:
- {Node} A DOM node which represents an <item> element
Deletes this Contact. This method overrides the base class to instead operate via jabberwerx.RosterController#deleteContact.
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
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
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