📄 mucroom.java
字号:
* @throws ForbiddenException If the user is not allowed to modify the admin list.
* @throws ConflictException If the room was going to lose all its owners.
*/
public List<Presence> addAdmin(String bareJID, MUCRole senderRole) throws ForbiddenException,
ConflictException;
/**
* Adds a new user to the list of members.
*
* @param bareJID The bare JID of the user to add as a member.
* @param nickname The reserved nickname of the member for the room or null if none.
* @param senderRole the role of the user that is trying to modify the members list.
* @return the list of updated presences of all the client resources that the client used to
* join the room.
* @throws ForbiddenException If the user is not allowed to modify the members list.
* @throws ConflictException If the desired room nickname is already reserved for the room or if
* the room was going to lose all its owners.
*/
public List<Presence> addMember(String bareJID, String nickname, MUCRole senderRole)
throws ForbiddenException, ConflictException;
/**
* Adds a new user to the list of outcast users.
*
* @param bareJID The bare JID of the user to add as an outcast.
* @param reason The reason why the user was banned.
* @param senderRole The role of the user that initiated the ban.
* @return the list of updated presences of all the client resources that the client used to
* join the room.
* @throws NotAllowedException Thrown if trying to ban an owner or an administrator.
* @throws ForbiddenException If the user is not allowed to modify the outcast list.
* @throws ConflictException If the room was going to lose all its owners.
*/
public List<Presence> addOutcast(String bareJID, String reason, MUCRole senderRole)
throws NotAllowedException, ForbiddenException, ConflictException;
/**
* Removes the user from all the other affiliation list thus giving the user a NONE affiliation.
*
* @param bareJID The bare JID of the user to keep with a NONE affiliation.
* @param senderRole The role of the user that set the affiliation to none.
* @return the list of updated presences of all the client resources that the client used to
* join the room or null if none was updated.
* @throws ForbiddenException If the user is not allowed to modify the none list.
* @throws ConflictException If the room was going to lose all its owners.
*/
public List<Presence> addNone(String bareJID, MUCRole senderRole) throws ForbiddenException,
ConflictException;
/**
* Changes the role of the user within the room to moderator. A moderator is allowed to kick
* occupants as well as granting/revoking voice from occupants.
*
* @param fullJID The full JID of the occupant to give moderator privileges.
* @param senderRole The role of the user that is granting moderator privileges to an occupant.
* @return the updated presence of the occupant or <tt>null</tt> if the JID does not belong to
* an existing occupant.
* @throws ForbiddenException If the user is not allowed to grant moderator privileges.
*/
public Presence addModerator(JID fullJID, MUCRole senderRole) throws ForbiddenException;
/**
* Changes the role of the user within the room to participant. A participant is allowed to send
* messages to the room (i.e. has voice) and may change the room's subject.
*
* @param fullJID The full JID of the occupant to give participant privileges.
* @param reason The reason why participant privileges were gave to the user or <tt>null</tt>
* if none.
* @param senderRole The role of the user that is granting participant privileges to an occupant.
* @return the updated presence of the occupant or <tt>null</tt> if the JID does not belong to
* an existing occupant.
* @throws NotAllowedException If trying to change the moderator role to an owner or an admin.
* @throws ForbiddenException If the user is not allowed to grant participant privileges.
*/
public Presence addParticipant(JID fullJID, String reason, MUCRole senderRole)
throws NotAllowedException, ForbiddenException;
/**
* Changes the role of the user within the room to visitor. A visitor can receive messages but
* is not allowed to send messages to the room (i.e. does not has voice) and may invite others
* to the room.
*
* @param jid the full JID of the occupant to change to visitor.
* @param senderRole the role of the user that is changing the role to visitor.
* @return the updated presence of the occupant or <tt>null</tt> if the JID does not belong to
* an existing occupant.
* @throws NotAllowedException if trying to change the moderator role to an owner or an admin.
* @throws ForbiddenException if the user is not a moderator.
*/
public Presence addVisitor(JID jid, MUCRole senderRole) throws NotAllowedException,
ForbiddenException;
/**
* Returns true if the room is locked. The lock will persist for a defined period of time. If
* the room owner does not configure the room within the timeout period, the room owner is
* assumed to have accepted the default configuration.
*
* @return true if the room is locked.
*/
public boolean isLocked();
/**
* Returns true if the room is locked and it was locked by a room owner after the room was
* initially configured.
*
* @return true if the room is locked and it was locked by a room owner after the room was
* initially configured.
*/
public boolean isManuallyLocked();
/**
* An event callback fired whenever an occupant updated his presence in the chatroom.
*
* @param occupantRole occupant that changed his presence in the room.
* @param newPresence presence sent by the occupant.
*/
public void presenceUpdated(MUCRole occupantRole, Presence newPresence);
/**
* An event callback fired whenever an occupant changes his nickname within the chatroom.
*
* @param occupantRole occupant that changed his nickname in the room.
* @param newPresence presence sent by the occupant with the new nickname.
* @param oldNick old nickname within the room.
* @param newNick new nickname within the room.
*/
public void nicknameChanged(MUCRole occupantRole, Presence newPresence, String oldNick, String newNick);
/**
* Changes the room's subject if the occupant has enough permissions. The occupant must be
* a moderator or the room must be configured so that anyone can change its subject. Otherwise
* a forbidden exception will be thrown.<p>
*
* The new subject will be added to the history of the room.
*
* @param packet the sent packet to change the room's subject.
* @param role the role of the user that is trying to change the subject.
* @throws ForbiddenException If the user is not allowed to change the subject.
*/
public void changeSubject(Message packet, MUCRole role) throws ForbiddenException;
/**
* Returns the last subject that some occupant set to the room.
*
* @return the last subject that some occupant set to the room.
*/
public String getSubject();
/**
* Sets the last subject that some occupant set to the room. This message will only be used
* when loading a room from the database.
*
* @param subject the last known subject of the room.
*/
public void setSubject(String subject);
/**
* Sends a message to the all the occupants. In a moderated room, this privilege is restricted
* to occupants with a role of participant or higher. In an unmoderated room, any occupant can
* send a message to all other occupants.
*
* @param message The message to send.
* @param senderRole the role of the user that is trying to send a public message.
* @throws ForbiddenException If the user is not allowed to send a public message (i.e. does not
* have voice in the room).
*/
public void sendPublicMessage(Message message, MUCRole senderRole) throws ForbiddenException;
/**
* Sends a private packet to a selected occupant. The packet can be a Message for private
* conversation between room occupants or IQ packets when an occupant wants to send IQ packets
* to other room occupants.
*
* @param packet The packet to send.
* @param senderRole the role of the user that is trying to send a public message.
* @throws NotFoundException If the user is sending a packet to a room JID that does not exist.
*/
public void sendPrivatePacket(Packet packet, MUCRole senderRole) throws NotFoundException;
/**
* Kicks a user from the room. If the user was in the room, the returned updated presence will
* be sent to the remaining occupants.
*
* @param fullJID The full JID of the kicked user.
* @param actorJID The JID of the actor that initiated the kick.
* @param reason The reason why the user was kicked.
* @return the updated presence of the kicked user or null if the user was not in the room.
* @throws NotAllowedException Thrown if trying to ban an owner or an administrator.
*/
public Presence kickOccupant(JID fullJID, JID actorJID, String reason)
throws NotAllowedException;
public IQOwnerHandler getIQOwnerHandler();
public IQAdminHandler getIQAdminHandler();
/**
* Returns the history of the room which includes chat transcripts.
*
* @return the history of the room which includes chat transcripts.
*/
public MUCRoomHistory getRoomHistory();
/**
* Returns a collection with the current list of owners. The collection contains the bareJID of
* the users with owner affiliation.
*
* @return a collection with the current list of owners.
*/
public Collection<String> getOwners();
/**
* Returns a collection with the current list of admins. The collection contains the bareJID of
* the users with admin affiliation.
*
* @return a collection with the current list of admins.
*/
public Collection<String> getAdmins();
/**
* Returns a collection with the current list of room members. The collection contains the
* bareJID of the users with member affiliation. If the room is not members-only then the list
* will contain the users that registered with the room and therefore they may have reserved a
* nickname.
*
* @return a collection with the current list of members.
*/
public Collection<String> getMembers();
/**
* Returns a collection with the current list of outcast users. An outcast user is not allowed
* to join the room again. The collection contains the bareJID of the users with outcast
* affiliation.
*
* @return a collection with the current list of outcast users.
*/
public Collection<String> getOutcasts();
/**
* Returns a collection with the current list of room moderators. The collection contains the
* MUCRole of the occupants with moderator role.
*
* @return a collection with the current list of moderators.
*/
public Collection<MUCRole> getModerators();
/**
* Returns a collection with the current list of room participants. The collection contains the
* MUCRole of the occupants with participant role.
*
* @return a collection with the current list of moderators.
*/
public Collection<MUCRole> getParticipants();
/**
* Returns true if every presence packet will include the JID of every occupant. This
* configuration can be modified by the owner while editing the room's configuration.
*
* @return true if every presence packet will include the JID of every occupant.
*/
public boolean canAnyoneDiscoverJID();
/**
* Sets if every presence packet will include the JID of every occupant. This
* configuration can be modified by the owner while editing the room's configuration.
*
* @param canAnyoneDiscoverJID boolean that specifies if every presence packet will include the
* JID of every occupant.
*/
public void setCanAnyoneDiscoverJID(boolean canAnyoneDiscoverJID);
/**
* Returns true if participants are allowed to change the room's subject.
*
* @return true if participants are allowed to change the room's subject.
*/
public boolean canOccupantsChangeSubject();
/**
* Sets if participants are allowed to change the room's subject.
*
* @param canOccupantsChangeSubject boolean that specifies if participants are allowed to
* change the room's subject.
*/
public void setCanOccupantsChangeSubject(boolean canOccupantsChangeSubject);
/**
* Returns true if occupants can invite other users to the room. If the room does not require an
* invitation to enter (i.e. is not members-only) then any occupant can send invitations. On
* the other hand, if the room is members-only and occupants cannot send invitation then only
* the room owners and admins are allowed to send invitations.
*
* @return true if occupants can invite other users to the room.
*/
public boolean canOccupantsInvite();
/**
* Sets if occupants can invite other users to the room. If the room does not require an
* invitation to enter (i.e. is not members-only) then any occupant can send invitations. On
* the other hand, if the room is members-only and occupants cannot send invitation then only
* the room owners and admins are allowed to send invitations.
*
* @param canOccupantsInvite boolean that specified in any occupant can invite other users to
* the room.
*/
public void setCanOccupantsInvite(boolean canOccupantsInvite);
/**
* Returns the natural language name of the room. This name can only be modified by room owners.
* It's mainly used for users while discovering rooms hosted by the Multi-User Chat service.
*
* @return the natural language name of the room.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -