public final class ChatRoom extends Chat implements Comparable<ChatRoom>
Use this class to enter a chat room, to send and receive messages, invite others and to manage members (e.g. kick or ban a user, grant admin status, etc.).
| Modifier and Type | Method and Description |
|---|---|
void |
addInvitationDeclineListener(Consumer<InvitationDeclineEvent> invitationDeclineListener)
Adds a invitation decline listener, which allows to listen for invitation declines.
|
void |
addOccupantListener(Consumer<OccupantEvent> occupantListener)
Adds an occupant listener, which allows to listen for presence changes of occupants, e.g.
|
void |
addSubjectChangeListener(Consumer<SubjectChangeEvent> subjectChangeListener)
Adds a subject change listener, which allows to listen for subject changes.
|
AsyncResult<IQ> |
banUser(rocks.xmpp.addr.Jid user,
String reason)
Bans a user.
|
AsyncResult<IQ> |
changeAffiliation(Affiliation affiliation,
rocks.xmpp.addr.Jid user,
String reason)
Changes the affiliation for an user.
|
AsyncResult<IQ> |
changeAffiliationsOrRoles(List<Item> items)
Changes multiple affiliations or roles.
|
void |
changeAvailabilityStatus(Presence.Show show,
String status)
Changes the availability status.
|
AsyncResult<Presence> |
changeNickname(String newNickname)
Changes the nickname.
|
AsyncResult<IQ> |
changeRole(Role role,
String nickname,
String reason)
Changes the role for an occupant.
|
AsyncResult<Message> |
changeSubject(String subject)
Changes the room subject.
|
int |
compareTo(ChatRoom o)
Compares this chat service first by their name and then by their service address.
|
AsyncResult<IQ> |
configure(RoomConfiguration roomConfiguration)
Configures this room.
|
AsyncResult<IQ> |
createRoom()
Deprecated.
This method is flawed. Simply enter the room.
|
AsyncResult<IQ> |
destroy()
Destroys the room.
|
AsyncResult<IQ> |
destroy(String reason)
Destroys the room.
|
AsyncResult<Set<String>> |
discoverAllowableTraffic()
Discovers the allowable traffic, i.e. the allowed extensions.
|
AsyncResult<List<String>> |
discoverOccupants()
Gets the occupants in this room, i.e. their nicknames.
|
AsyncResult<String> |
discoverReservedNickname()
Gets your reserved room nickname.
|
AsyncResult<Presence> |
enter(String nick)
Enters the room.
|
AsyncResult<Presence> |
enter(String nick,
DiscussionHistory history)
Enters the room and requests history messages.
|
AsyncResult<Presence> |
enter(String nick,
String password)
Enters the room with a password.
|
AsyncResult<Presence> |
enter(String nick,
String password,
DiscussionHistory history)
Enters the room with a password and requests history messages.
|
AsyncResult<Void> |
exit()
Exits the room.
|
AsyncResult<Void> |
exit(String message)
Exits the room with a custom message.
|
rocks.xmpp.addr.Jid |
getAddress()
Gets the room address.
|
AsyncResult<List<Item>> |
getAdmins()
Gets the admins of the room.
|
AsyncResult<List<Item>> |
getBanList()
Gets the ban list.
|
AsyncResult<DataForm> |
getConfigurationForm()
Gets the configuration form for the room.
|
AsyncResult<List<Item>> |
getMembers()
Gets the members of the room.
|
AsyncResult<List<Item>> |
getModerators()
Gets the moderators.
|
String |
getName()
Gets the name for this room.
|
String |
getNick()
Gets the nickname in this room.
|
Occupant |
getOccupant(String nickname)
Gets an occupant by nickname.
|
Collection<Occupant> |
getOccupants()
Gets the occupants, while being in the room.
|
AsyncResult<List<Item>> |
getOutcasts()
Gets the outcasts of the room.
|
AsyncResult<List<Item>> |
getOwners()
Gets the owners of the room.
|
AsyncResult<DataForm> |
getRegistrationForm()
Gets the data form necessary to register with the room.
|
AsyncResult<RoomInformation> |
getRoomInformation()
Gets the room information for this chat room.
|
AsyncResult<List<Item>> |
getVoiceList()
Gets the voice list.
|
AsyncResult<IQ> |
grantAdminStatus(rocks.xmpp.addr.Jid user,
String reason)
Grants admin status to a user.
|
AsyncResult<IQ> |
grantMembership(rocks.xmpp.addr.Jid user,
String nick,
String reason)
Grants membership to a user.
|
AsyncResult<IQ> |
grantModeratorStatus(String nickname,
String reason)
Grants moderator status to a participant or visitor.
|
AsyncResult<IQ> |
grantOwnerStatus(rocks.xmpp.addr.Jid user,
String reason)
Grants owner status to a user.
|
AsyncResult<IQ> |
grantVoice(String nickname,
String reason)
Grants voice to a visitor.
|
boolean |
hasEntered()
Indicates, if you have entered the room.
|
void |
invite(rocks.xmpp.addr.Jid invitee,
String reason)
Invites another user to the room.
|
void |
invite(rocks.xmpp.addr.Jid invitee,
String reason,
boolean direct)
Invites another user to the room.
|
AsyncResult<IQ> |
kickOccupant(String nickname,
String reason)
Kicks an occupant from the room.
|
AsyncResult<IQ> |
register(Registration registration)
Registers with the room.
|
void |
removeInvitationDeclineListener(Consumer<InvitationDeclineEvent> invitationDeclineListener)
Removes a previously added invitation decline listener.
|
void |
removeOccupantListener(Consumer<OccupantEvent> occupantListener)
Removes a previously added occupant listener.
|
void |
removeSubjectChangeListener(Consumer<SubjectChangeEvent> subjectChangeListener)
Removes a previously added subject change listener.
|
void |
requestVoice()
Requests voice in a moderated room.
|
AsyncResult<IQ> |
revokeAdminStatus(rocks.xmpp.addr.Jid user,
String reason)
Revokes a user's admin status.
|
AsyncResult<IQ> |
revokeMembership(rocks.xmpp.addr.Jid user,
String reason)
Revokes a user's membership.
|
AsyncResult<IQ> |
revokeModeratorStatus(String nickname,
String reason)
Revokes moderator status from a participant or visitor.
|
AsyncResult<IQ> |
revokeOwnerStatus(rocks.xmpp.addr.Jid user,
String reason)
Revokes a user's owner status.
|
AsyncResult<IQ> |
revokeVoice(String nickname,
String reason)
Revokes voice from a participant.
|
SendTask<Message> |
sendMessage(Message message)
Sends a message to the room.
|
SendTask<Message> |
sendMessage(String message)
Sends a message to the room.
|
String |
toString() |
addInboundMessageListener, removeInboundMessageListenerpublic void addInvitationDeclineListener(Consumer<InvitationDeclineEvent> invitationDeclineListener)
invitationDeclineListener - The listener.removeInvitationDeclineListener(Consumer)public void removeInvitationDeclineListener(Consumer<InvitationDeclineEvent> invitationDeclineListener)
invitationDeclineListener - The listener.addInvitationDeclineListener(Consumer)public void addSubjectChangeListener(Consumer<SubjectChangeEvent> subjectChangeListener)
subjectChangeListener - The listener.removeSubjectChangeListener(Consumer)public void removeSubjectChangeListener(Consumer<SubjectChangeEvent> subjectChangeListener)
subjectChangeListener - The listener.addSubjectChangeListener(Consumer)public void addOccupantListener(Consumer<OccupantEvent> occupantListener)
occupantListener - The listener.removeOccupantListener(Consumer)public void removeOccupantListener(Consumer<OccupantEvent> occupantListener)
occupantListener - The listener.addOccupantListener(Consumer)public AsyncResult<Presence> enter(String nick)
nick - The nickname.public AsyncResult<Presence> enter(String nick, String password)
nick - The nickname.password - The password.public AsyncResult<Presence> enter(String nick, DiscussionHistory history)
nick - The nickname.history - The history.public final AsyncResult<Presence> enter(String nick, String password, DiscussionHistory history)
nick - The nickname.password - The password.history - The history.public AsyncResult<Message> changeSubject(String subject)
subject - The subject.public SendTask<Message> sendMessage(String message)
sendMessage in class Chatmessage - The message text.public SendTask<Message> sendMessage(Message message)
sendMessage in class Chatmessage - The message.public final AsyncResult<Presence> changeNickname(String newNickname)
newNickname - The new nickname.public void changeAvailabilityStatus(Presence.Show show, String status)
show - The 'show' value.status - The status.public void invite(rocks.xmpp.addr.Jid invitee,
String reason)
invitee - The invitee.reason - The reason.public void invite(rocks.xmpp.addr.Jid invitee,
String reason,
boolean direct)
invitee - The invitee.reason - The reason.direct - True, if the message is sent directly to the invitee; false if it is mediated by the room.public AsyncResult<DataForm> getRegistrationForm()
RoomRegistrationpublic AsyncResult<IQ> register(Registration registration)
registration - The registration.RoomRegistrationpublic AsyncResult<String> discoverReservedNickname()
public void requestVoice()
public AsyncResult<Void> exit()
public final AsyncResult<Void> exit(String message)
message - The exit message.public final boolean hasEntered()
enter(String),
exit()public AsyncResult<List<Item>> getVoiceList()
public AsyncResult<IQ> changeAffiliationsOrRoles(List<Item> items)
items - The items.public AsyncResult<List<Item>> getBanList()
public final AsyncResult<IQ> changeAffiliation(Affiliation affiliation, rocks.xmpp.addr.Jid user, String reason)
Use this method for one of the following use cases:
Affiliation.OUTCAST)Affiliation.MEMBER)Affiliation.NONE)Affiliation.ADMIN)Affiliation.MEMBER)Affiliation.OWNER)Affiliation.ADMIN)affiliation - The new affiliation for the user.user - The user.reason - The reason.public final AsyncResult<IQ> banUser(rocks.xmpp.addr.Jid user, String reason)
user - The user.reason - The reason (optional). May be null.public final AsyncResult<IQ> grantMembership(rocks.xmpp.addr.Jid user, String nick, String reason)
user - The user.nick - The nick (optional). That nick becomes the user's default nick in the room if that functionality is supported by the implementation. May be null.reason - The reason (optional). May be null.revokeMembership(Jid, String)public final AsyncResult<IQ> revokeMembership(rocks.xmpp.addr.Jid user, String reason)
user - The user.reason - The reason (optional). May be null.grantMembership(Jid, String, String)public final AsyncResult<IQ> grantOwnerStatus(rocks.xmpp.addr.Jid user, String reason)
user - The user.reason - The reason (optional). May be null.revokeOwnerStatus(Jid, String)public final AsyncResult<IQ> revokeOwnerStatus(rocks.xmpp.addr.Jid user, String reason)
grantAdminStatus(Jid, String)}.user - The user.reason - The reason (optional). May be null.grantOwnerStatus(Jid, String)public final AsyncResult<IQ> grantAdminStatus(rocks.xmpp.addr.Jid user, String reason)
revokeOwnerStatus(Jid, String).user - The user.reason - The reason (optional). May be null.revokeAdminStatus(Jid, String)public final AsyncResult<IQ> revokeAdminStatus(rocks.xmpp.addr.Jid user, String reason)
user - The user.reason - The reason (optional). May be null.grantAdminStatus(Jid, String)public final AsyncResult<IQ> changeRole(Role role, String nickname, String reason)
Use this method for one of the following use cases:
Role.NONE)Role.PARTICIPANT)Role.VISITOR)Role.MODERATOR)Role.PARTICIPANT)role - The new role for the user.nickname - The occupant's nickname.reason - The reason.public final AsyncResult<IQ> kickOccupant(String nickname, String reason)
nickname - The nickname.reason - The reason (optional). May be null.public final AsyncResult<IQ> grantVoice(String nickname, String reason)
revokeModeratorStatus(String, String)}}.nickname - The nickname.reason - The reason (optional). May be null.revokeVoice(String, String)public final AsyncResult<IQ> revokeVoice(String nickname, String reason)
nickname - The nickname.reason - The reason (optional). May be null.grantVoice(String, String)public final AsyncResult<IQ> grantModeratorStatus(String nickname, String reason)
nickname - The nickname.reason - The reason (optional). May be null.public final AsyncResult<IQ> revokeModeratorStatus(String nickname, String reason)
grantVoice(String, String).nickname - The nickname.reason - The reason (optional). May be null.public AsyncResult<List<Item>> getOwners()
public AsyncResult<List<Item>> getOutcasts()
public AsyncResult<List<Item>> getAdmins()
public AsyncResult<List<Item>> getMembers()
In the context of a members-only room, the member list is essentially a "whitelist" of people who are allowed to enter the room.
In the context of an open room, the member list is simply a list of users (bare JID and reserved nick) who are registered with the room.
public AsyncResult<List<Item>> getModerators()
@Deprecated public AsyncResult<IQ> createRoom()
public AsyncResult<RoomInformation> getRoomInformation()
public AsyncResult<List<String>> discoverOccupants()
getOccupants()public Collection<Occupant> getOccupants()
public Occupant getOccupant(String nickname)
nickname - The occupant's nickname.public AsyncResult<DataForm> getConfigurationForm()
RoomConfiguration for easier processing.
Use this method if you want to create a reserved room or configure an existing room.
RoomConfiguration,
10.1.3 Creating a Reserved Room,
configure(RoomConfiguration)public AsyncResult<IQ> configure(RoomConfiguration roomConfiguration)
roomConfiguration - The async result with the room configuration form.getConfigurationForm()public final String getName()
public final String getNick()
null, if not entered.public AsyncResult<IQ> destroy(String reason)
reason - The reason for the room destruction.public final AsyncResult<IQ> destroy()
public rocks.xmpp.addr.Jid getAddress()
public AsyncResult<Set<String>> discoverAllowableTraffic()
public int compareTo(ChatRoom o)
compareTo in interface Comparable<ChatRoom>o - The other chat service.Copyright © 2014–2017 XMPP.rocks. All rights reserved.