Class jabberwerx.MUCOccupantCache
Extends
jabberwerx.EntitySet.
The entity cache for MUC room occupants.
This class provides the following events:
Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new MUCOccupantCache with the given room. |
Field Attributes | Field Name and Description |
---|---|
The owning MUCRoom. |
Method Attributes | Method Name and Description |
---|---|
occupant(nick)
Retrieves the occupant with the given nickname. |
|
register(entity)
Registers the given occupant to this cache. |
|
rename(entity, njid)
Renames an occupant to the new JID. |
|
unregister(entity)
Unregisters the given occupant from this cache. |
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- destroy, getClassName, graphUnserialized, init, invocation, shouldBeSerializedInline, toString, wasUnserialized, willBeSerialized
Creates a new MUCOccupantCache with the given room.
- Parameters:
- {jabberwerx.MUCRoom} room
- The owning room
- Throws:
- {TypeError}
- if {room} is not a valid MUCRoom
The owning MUCRoom.
Retrieves the occupant with the given nickname.
- Parameters:
- {String} nick
- The nickname of the occupant to retrieve
- Throws:
- {TypeError}
- If {nick} is not a non-empty string.
- Returns:
- {jabberwerx.MUCOccupant} The occupant for {nick}, or undefined if not found.
Registers the given occupant to this cache. This method overrides the base to ensure {entity} is a MUCOccupant, then to trigger the "entityCreated" event once added.
- Parameters:
- {jabberwerx.MUCOccupant} entity
- The occupant to register
- Throws:
- {TypeError}
- If {entity} is not a valid MUCOccupant
Renames an occupant to the new JID. This method reindexes the given entity to the new JID, then triggers the "entityRenamed" event.
NOTE: This method should not be called directly. Instead, the owning room will call this method when a nickname change is detected.
- Parameters:
- {jabberwerx.MUCOccupant} entity
- The occupant to rename
- {jabberwerx.JID|String} njid
- The new JID for the occupant
Unregisters the given occupant from this cache. This method overrides the base to ensure {entity} is a MUCOccupant, then to trigger the "entityDestroyed" event once removed.
- Parameters:
- {jabberwerx.MUCOccupant} entity
- The occupant to unregister
- Throws:
- {TypeError}
- If {entity} is not a valid MUCOccupant