001/**
002 *
003 * Copyright 2003-2007 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.jivesoftware.smackx.muc;
019
020import org.jxmpp.jid.EntityFullJid;
021import org.jxmpp.jid.Jid;
022import org.jxmpp.jid.parts.Resourcepart;
023
024/**
025 * A listener that is fired anytime a participant's status in a room is changed, such as the
026 * user being kicked, banned, or granted admin permissions.
027 *
028 * @author Gaston Dombiak
029 */
030public interface ParticipantStatusListener {
031
032    /**
033     * Called when a new room occupant has joined the room. Note: Take in consideration that when
034     * you join a room you will receive the list of current occupants in the room. This message will
035     * be sent for each occupant.
036     *
037     * @param participant the participant that has just joined the room
038     * (e.g. room@conference.jabber.org/nick).
039     */
040    void joined(EntityFullJid participant);
041
042    /**
043     * Called when a room occupant has left the room on its own. This means that the occupant was
044     * neither kicked nor banned from the room.
045     *
046     * @param participant the participant that has left the room on its own.
047     * (e.g. room@conference.jabber.org/nick).
048     */
049    void left(EntityFullJid participant);
050
051    /**
052     * Called when a room participant has been kicked from the room. This means that the kicked
053     * participant is no longer participating in the room.
054     *
055     * @param participant the participant that was kicked from the room
056     * (e.g. room@conference.jabber.org/nick).
057     * @param actor the moderator that kicked the occupant from the room (e.g. user@host.org).
058     * @param reason the reason provided by the actor to kick the occupant from the room.
059     */
060    void kicked(EntityFullJid participant, Jid actor, String reason);
061
062    /**
063     * Called when a moderator grants voice to a visitor. This means that the visitor
064     * can now participate in the moderated room sending messages to all occupants.
065     *
066     * @param participant the participant that was granted voice in the room
067     * (e.g. room@conference.jabber.org/nick).
068     */
069    void voiceGranted(EntityFullJid participant);
070
071    /**
072     * Called when a moderator revokes voice from a participant. This means that the participant
073     * in the room was able to speak and now is a visitor that can't send messages to the room
074     * occupants.
075     *
076     * @param participant the participant that was revoked voice from the room
077     * (e.g. room@conference.jabber.org/nick).
078     */
079    void voiceRevoked(EntityFullJid participant);
080
081    /**
082     * Called when an administrator or owner banned a participant from the room. This means that
083     * banned participant will no longer be able to join the room unless the ban has been removed.
084     *
085     * @param participant the participant that was banned from the room
086     * (e.g. room@conference.jabber.org/nick).
087     * @param actor the administrator that banned the occupant (e.g. user@host.org).
088     * @param reason the reason provided by the administrator to ban the occupant.
089     */
090    void banned(EntityFullJid participant, Jid actor, String reason);
091
092    /**
093     * Called when an administrator grants a user membership to the room. This means that the user
094     * will be able to join the members-only room.
095     *
096     * @param participant the participant that was granted membership in the room
097     * (e.g. room@conference.jabber.org/nick).
098     */
099     void membershipGranted(EntityFullJid participant);
100
101    /**
102     * Called when an administrator revokes a user membership to the room. This means that the
103     * user will not be able to join the members-only room.
104     *
105     * @param participant the participant that was revoked membership from the room
106     * (e.g. room@conference.jabber.org/nick).
107     */
108     void membershipRevoked(EntityFullJid participant);
109
110    /**
111     * Called when an administrator grants moderator privileges to a user. This means that the user
112     * will be able to kick users, grant and revoke voice, invite other users, modify room's
113     * subject plus all the partcipants privileges.
114     *
115     * @param participant the participant that was granted moderator privileges in the room
116     * (e.g. room@conference.jabber.org/nick).
117     */
118     void moderatorGranted(EntityFullJid participant);
119
120    /**
121     * Called when an administrator revokes moderator privileges from a user. This means that the
122     * user will no longer be able to kick users, grant and revoke voice, invite other users,
123     * modify room's subject plus all the partcipants privileges.
124     *
125     * @param participant the participant that was revoked moderator privileges in the room
126     * (e.g. room@conference.jabber.org/nick).
127     */
128     void moderatorRevoked(EntityFullJid participant);
129
130    /**
131     * Called when an owner grants a user ownership on the room. This means that the user
132     * will be able to change defining room features as well as perform all administrative
133     * functions.
134     *
135     * @param participant the participant that was granted ownership on the room
136     * (e.g. room@conference.jabber.org/nick).
137     */
138     void ownershipGranted(EntityFullJid participant);
139
140    /**
141     * Called when an owner revokes a user ownership on the room. This means that the user
142     * will no longer be able to change defining room features as well as perform all
143     * administrative functions.
144     *
145     * @param participant the participant that was revoked ownership on the room
146     * (e.g. room@conference.jabber.org/nick).
147     */
148     void ownershipRevoked(EntityFullJid participant);
149
150    /**
151     * Called when an owner grants administrator privileges to a user. This means that the user
152     * will be able to perform administrative functions such as banning users and edit moderator
153     * list.
154     *
155     * @param participant the participant that was granted administrator privileges
156     * (e.g. room@conference.jabber.org/nick).
157     */
158     void adminGranted(EntityFullJid participant);
159
160    /**
161     * Called when an owner revokes administrator privileges from a user. This means that the user
162     * will no longer be able to perform administrative functions such as banning users and edit
163     * moderator list.
164     *
165     * @param participant the participant that was revoked administrator privileges
166     * (e.g. room@conference.jabber.org/nick).
167     */
168     void adminRevoked(EntityFullJid participant);
169
170    /**
171     * Called when a participant changed his/her nickname in the room. The new participant's
172     * nickname will be informed with the next available presence.
173     *
174     * @param participant the participant that was revoked administrator privileges
175     * (e.g. room@conference.jabber.org/nick).
176     * @param newNickname the new nickname that the participant decided to use.
177     */
178     void nicknameChanged(EntityFullJid participant, Resourcepart newNickname);
179
180}