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
020/**
021 * A listener that is fired anytime a participant's status in a room is changed, such as the 
022 * user being kicked, banned, or granted admin permissions.
023 * 
024 * @author Gaston Dombiak
025 */
026public interface ParticipantStatusListener {
027
028    /**
029     * Called when a new room occupant has joined the room. Note: Take in consideration that when
030     * you join a room you will receive the list of current occupants in the room. This message will
031     * be sent for each occupant.
032     *
033     * @param participant the participant that has just joined the room
034     * (e.g. room@conference.jabber.org/nick).
035     */
036    public abstract void joined(String participant);
037
038    /**
039     * Called when a room occupant has left the room on its own. This means that the occupant was
040     * neither kicked nor banned from the room.
041     *
042     * @param participant the participant that has left the room on its own.
043     * (e.g. room@conference.jabber.org/nick).
044     */
045    public abstract void left(String participant);
046
047    /**
048     * Called when a room participant has been kicked from the room. This means that the kicked 
049     * participant is no longer participating in the room.
050     * 
051     * @param participant the participant that was kicked from the room 
052     * (e.g. room@conference.jabber.org/nick).
053     * @param actor the moderator that kicked the occupant from the room (e.g. user@host.org).
054     * @param reason the reason provided by the actor to kick the occupant from the room.
055     */
056    public abstract void kicked(String participant, String actor, String reason);
057
058    /**
059     * Called when a moderator grants voice to a visitor. This means that the visitor 
060     * can now participate in the moderated room sending messages to all occupants.
061     * 
062     * @param participant the participant that was granted voice in the room 
063     * (e.g. room@conference.jabber.org/nick).
064     */
065    public abstract void voiceGranted(String participant);
066
067    /**
068     * Called when a moderator revokes voice from a participant. This means that the participant 
069     * in the room was able to speak and now is a visitor that can't send messages to the room 
070     * occupants.
071     * 
072     * @param participant the participant that was revoked voice from the room 
073     * (e.g. room@conference.jabber.org/nick).
074     */
075    public abstract void voiceRevoked(String participant);
076
077    /**
078     * Called when an administrator or owner banned a participant from the room. This means that 
079     * banned participant will no longer be able to join the room unless the ban has been removed.
080     * 
081     * @param participant the participant that was banned from the room 
082     * (e.g. room@conference.jabber.org/nick).
083     * @param actor the administrator that banned the occupant (e.g. user@host.org).
084     * @param reason the reason provided by the administrator to ban the occupant.
085     */
086    public abstract void banned(String participant, String actor, String reason);
087
088    /**
089     * Called when an administrator grants a user membership to the room. This means that the user 
090     * will be able to join the members-only room.
091     * 
092     * @param participant the participant that was granted membership in the room 
093     * (e.g. room@conference.jabber.org/nick).
094     */
095    public abstract void membershipGranted(String participant);
096
097    /**
098     * Called when an administrator revokes a user membership to the room. This means that the 
099     * user will not be able to join the members-only room.
100     * 
101     * @param participant the participant that was revoked membership from the room 
102     * (e.g. room@conference.jabber.org/nick).
103     */
104    public abstract void membershipRevoked(String participant);
105
106    /**
107     * Called when an administrator grants moderator privileges to a user. This means that the user 
108     * will be able to kick users, grant and revoke voice, invite other users, modify room's 
109     * subject plus all the partcipants privileges.
110     * 
111     * @param participant the participant that was granted moderator privileges in the room 
112     * (e.g. room@conference.jabber.org/nick).
113     */
114    public abstract void moderatorGranted(String participant);
115
116    /**
117     * Called when an administrator revokes moderator privileges from a user. This means that the 
118     * user will no longer be able to kick users, grant and revoke voice, invite other users, 
119     * modify room's subject plus all the partcipants privileges.
120     * 
121     * @param participant the participant that was revoked moderator privileges in the room 
122     * (e.g. room@conference.jabber.org/nick).
123     */
124    public abstract void moderatorRevoked(String participant);
125
126    /**
127     * Called when an owner grants a user ownership on the room. This means that the user 
128     * will be able to change defining room features as well as perform all administrative 
129     * functions.
130     * 
131     * @param participant the participant that was granted ownership on the room 
132     * (e.g. room@conference.jabber.org/nick).
133     */
134    public abstract void ownershipGranted(String participant);
135
136    /**
137     * Called when an owner revokes a user ownership on the room. This means that the user 
138     * will no longer be able to change defining room features as well as perform all 
139     * administrative functions.
140     * 
141     * @param participant the participant that was revoked ownership on the room 
142     * (e.g. room@conference.jabber.org/nick).
143     */
144    public abstract void ownershipRevoked(String participant);
145
146    /**
147     * Called when an owner grants administrator privileges to a user. This means that the user 
148     * will be able to perform administrative functions such as banning users and edit moderator 
149     * list.
150     * 
151     * @param participant the participant that was granted administrator privileges 
152     * (e.g. room@conference.jabber.org/nick).
153     */
154    public abstract void adminGranted(String participant);
155
156    /**
157     * Called when an owner revokes administrator privileges from a user. This means that the user 
158     * will no longer be able to perform administrative functions such as banning users and edit 
159     * moderator list.
160     * 
161     * @param participant the participant that was revoked administrator privileges 
162     * (e.g. room@conference.jabber.org/nick).
163     */
164    public abstract void adminRevoked(String participant);
165
166    /**
167     * Called when a participant changed his/her nickname in the room. The new participant's 
168     * nickname will be informed with the next available presence.
169     * 
170     * @param participant the participant that was revoked administrator privileges
171     * (e.g. room@conference.jabber.org/nick).
172     * @param newNickname the new nickname that the participant decided to use.
173     */
174    public abstract void nicknameChanged(String participant, String newNickname);
175
176}