Package rocks.xmpp.extensions.muc
Class Occupant
- java.lang.Object
-
- rocks.xmpp.extensions.muc.Occupant
-
- All Implemented Interfaces:
Comparable<Occupant>
,Addressable
public final class Occupant extends Object implements Addressable, Comparable<Occupant>
The main actor in a multi-user chat environment is the occupant, who can be said to be located "in" a multi-user chat room and to participate in the discussions held in that room.- See Also:
- 7. Occupant Use Cases
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Occupant o)
Compares this occupant with another occupant.Affiliation
getAffiliation()
Gets the affiliation of the occupant.Jid
getJid()
Gets the JID of the occupant.String
getNick()
Gets the nickname.Presence
getPresence()
Gets the current presence of this occupant.Role
getRole()
Gets the role of the occupant.boolean
isSelf()
If the occupant is yourself.String
toString()
-
-
-
Method Detail
-
getAffiliation
public Affiliation getAffiliation()
Gets the affiliation of the occupant.- Returns:
- The affiliation.
-
getRole
public Role getRole()
Gets the role of the occupant.- Returns:
- The role.
-
getJid
public Jid getJid()
Gets the JID of the occupant. Note that it can be null, if the room is (semi-)anonymous.- Specified by:
getJid
in interfaceAddressable
- Returns:
- The JID or null for (semi-)anonymous rooms.
-
getNick
public String getNick()
Gets the nickname.- Returns:
- The nickname.
-
getPresence
public Presence getPresence()
Gets the current presence of this occupant.- Returns:
- The presence.
-
isSelf
public boolean isSelf()
If the occupant is yourself.- Returns:
- True, if this occupant is you.
-
compareTo
public int compareTo(Occupant o)
Compares this occupant with another occupant. Occupants are compared first by their affiliation, then by their role, then by their nickname.Affiliations and roles are ranked by their privileges, so that occupants with the most privileges are ranked higher.
That means, in a sorted list of occupants, the owners are listed first, followed by the admins, followed by the mere members. Within each affiliation group, the moderators are listed first, followed by the participants and visitors. Each group is then sorted by its occupants' nicknames.
- Specified by:
compareTo
in interfaceComparable<Occupant>
- Parameters:
o
- The other occupant.- Returns:
- The comparison result.
-
-