public final class ChatRoom extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
addInvitationDeclineListener(InvitationDeclineListener invitationDeclineListener)
Adds a invitation decline listener, which allows to listen for invitation declines.
|
void |
addMessageListener(MessageListener messageListener)
Adds a message listener, which allows to listen for incoming messages in this room.
|
void |
addOccupantListener(OccupantListener occupantListener)
Adds an occupant listener, which allows to listen for presence changes of occupants, e.g.
|
void |
addSubjectChangeListener(SubjectChangeListener subjectChangeListener)
Adds a subject change listener, which allows to listen for subject changes.
|
void |
changeAffiliation(Affiliation affiliation,
rocks.xmpp.core.Jid user,
String reason)
Changes the affiliation for an user.
|
void |
changeAffiliationsOrRoles(List<Item> items)
Changes multiple affiliations or roles.
|
void |
changeAvailabilityStatus(rocks.xmpp.core.stanza.model.AbstractPresence.Show show,
String status)
Changes the availability status.
|
void |
changeNickname(String newNickname)
Changes the nickname.
|
void |
changeRole(Role role,
String nickname,
String reason)
Changes the role for an occupant.
|
void |
changeSubject(String subject)
Changes the room subject.
|
void |
createRoom()
Creates an instant room.
|
void |
destroy(String reason)
Destroys the room.
|
List<String> |
discoverOccupants()
Gets the occupants in this room, i.e. their nicknames.
|
void |
enter(String nick)
Enters the room.
|
void |
enter(String nick,
History history)
Enters the room and requests history messages.
|
void |
enter(String nick,
String password)
Enters the room with a password.
|
void |
enter(String nick,
String password,
History history)
Enters the room with a password and requests history messages.
|
void |
exit()
Exits the room.
|
void |
exit(String message)
Exits the room with a custom message.
|
rocks.xmpp.core.Jid |
getAddress()
Gets the room address.
|
List<? extends Item> |
getBanList()
Gets the ban list.
|
rocks.xmpp.extensions.data.model.DataForm |
getConfigurationForm()
Gets the configuration form for the room.
|
List<? extends Item> |
getMembers()
Gets the members of the room.
|
List<? extends Item> |
getModerators()
Gets the moderators.
|
String |
getName()
Gets the name for this room.
|
Occupant |
getOccupant(String nickname)
Gets an occupant by nickname.
|
Collection<Occupant> |
getOccupants()
Gets the occupants, while being in the room.
|
rocks.xmpp.extensions.data.model.DataForm |
getRegistrationForm()
Gets the data form necessary to register with the room.
|
String |
getReservedNickname()
Gets your reserved room nickname.
|
RoomInfo |
getRoomInfo()
Gets the room information for this chat room.
|
List<? extends Item> |
getVoiceList()
Gets the voice list.
|
void |
invite(rocks.xmpp.core.Jid invitee,
String reason)
Invites another user to the room.
|
void |
invite(rocks.xmpp.core.Jid invitee,
String reason,
boolean direct) |
void |
removeInvitationDeclineListener(InvitationDeclineListener invitationDeclineListener)
Removes a previously added invitation decline listener.
|
void |
removeMessageListener(MessageListener messageListener)
Removes a previously added message listener.
|
void |
removeOccupantListener(OccupantListener occupantListener)
Removes a previously added occupant listener.
|
void |
removeSubjectChangeListener(SubjectChangeListener subjectChangeListener)
Removes a previously added subject change listener.
|
void |
requestVoice()
Requests voice in a moderated room.
|
void |
sendMessage(rocks.xmpp.core.stanza.model.client.Message message)
Sends a message to the room.
|
void |
sendMessage(String message)
Sends a message to the room.
|
void |
submitConfigurationForm(rocks.xmpp.extensions.data.model.DataForm dataForm)
Submits the configuration form for this room.
|
void |
submitRegistrationForm(rocks.xmpp.extensions.data.model.DataForm dataForm)
Submits the registration form.
|
String |
toString() |
public void addInvitationDeclineListener(InvitationDeclineListener invitationDeclineListener)
invitationDeclineListener - The listener.removeInvitationDeclineListener(InvitationDeclineListener)public void removeInvitationDeclineListener(InvitationDeclineListener invitationDeclineListener)
invitationDeclineListener - The listener.addInvitationDeclineListener(InvitationDeclineListener)public void addSubjectChangeListener(SubjectChangeListener subjectChangeListener)
subjectChangeListener - The listener.removeSubjectChangeListener(SubjectChangeListener)public void removeSubjectChangeListener(SubjectChangeListener subjectChangeListener)
subjectChangeListener - The listener.addSubjectChangeListener(SubjectChangeListener)public void addMessageListener(MessageListener messageListener)
messageListener - The listener.removeMessageListener(rocks.xmpp.core.stanza.MessageListener)public void removeMessageListener(MessageListener messageListener)
messageListener - The listener.addMessageListener(rocks.xmpp.core.stanza.MessageListener)public void addOccupantListener(OccupantListener occupantListener)
occupantListener - The listener.removeOccupantListener(OccupantListener)public void removeOccupantListener(OccupantListener occupantListener)
occupantListener - The listener.addOccupantListener(OccupantListener)public void enter(String nick) throws rocks.xmpp.core.XmppException
nick - The nickname.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void enter(String nick, String password) throws rocks.xmpp.core.XmppException
nick - The nickname.password - The password.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void enter(String nick, History history) throws rocks.xmpp.core.XmppException
nick - The nickname.history - The history.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void enter(String nick, String password, History history) throws rocks.xmpp.core.XmppException
nick - The nickname.password - The password.history - The history.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void changeSubject(String subject) throws rocks.xmpp.core.XmppException
subject - The subject.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void sendMessage(String message)
message - The message text.public void sendMessage(rocks.xmpp.core.stanza.model.client.Message message)
message - The message.public void changeNickname(String newNickname) throws rocks.xmpp.core.XmppException
newNickname - The new nickname.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void changeAvailabilityStatus(rocks.xmpp.core.stanza.model.AbstractPresence.Show show, String status)
show - The 'show' value.status - The status.public void invite(rocks.xmpp.core.Jid invitee,
String reason)
invitee - The invitee.reason - The reason.public void invite(rocks.xmpp.core.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 rocks.xmpp.extensions.data.model.DataForm getRegistrationForm()
throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionRoomRegistrationFormpublic void submitRegistrationForm(rocks.xmpp.extensions.data.model.DataForm dataForm)
throws rocks.xmpp.core.XmppException
dataForm - The data form.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionRoomRegistrationFormpublic String getReservedNickname() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void requestVoice()
public void exit()
public void exit(String message)
message - The exit message.public List<? extends Item> getVoiceList() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic void changeAffiliationsOrRoles(List<Item> items) throws rocks.xmpp.core.XmppException
items - The items.rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic List<? extends Item> getBanList() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic void changeAffiliation(Affiliation affiliation, rocks.xmpp.core.Jid user, String reason) throws rocks.xmpp.core.XmppException
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.rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic void changeRole(Role role, String nickname, String reason) throws rocks.xmpp.core.XmppException
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.rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic List<? extends Item> getMembers() throws rocks.xmpp.core.XmppException
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.
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic List<? extends Item> getModerators() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic void createRoom()
throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.rocks.xmpp.core.XmppExceptionpublic RoomInfo getRoomInfo() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic List<String> discoverOccupants() throws rocks.xmpp.core.XmppException
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptiongetOccupants()public Collection<Occupant> getOccupants()
public Occupant getOccupant(String nickname)
nickname - The occupant's nickname.public rocks.xmpp.extensions.data.model.DataForm getConfigurationForm()
throws rocks.xmpp.core.XmppException
RoomConfigurationForm for easier processing.
Use this method if you want to create a reserved room or configure an existing room.
rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionRoomConfigurationForm,
10.1.3 Creating a Reserved Room,
submitConfigurationForm(rocks.xmpp.extensions.data.model.DataForm)public void submitConfigurationForm(rocks.xmpp.extensions.data.model.DataForm dataForm)
throws rocks.xmpp.core.XmppException
dataForm - The data form.rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptiongetConfigurationForm()public String getName()
public void destroy(String reason) throws rocks.xmpp.core.XmppException
reason - The reason for the room destruction.rocks.xmpp.core.stanza.model.StanzaException - If the chat service returned a stanza error.NoResponseException - If the chat service did not respond.rocks.xmpp.core.XmppExceptionpublic rocks.xmpp.core.Jid getAddress()
Copyright © 2014 XMPP.rocks. All rights reserved.