ParticipantStatusListener.java

  1. /**
  2.  *
  3.  * Copyright 2003-2007 Jive Software.
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.jivesoftware.smackx.muc;

  18. import org.jxmpp.jid.EntityFullJid;
  19. import org.jxmpp.jid.Jid;
  20. import org.jxmpp.jid.parts.Resourcepart;

  21. /**
  22.  * A listener that is fired anytime a participant's status in a room is changed, such as the
  23.  * user being kicked, banned, or granted admin permissions.
  24.  *
  25.  * @author Gaston Dombiak
  26.  */
  27. public interface ParticipantStatusListener {

  28.     /**
  29.      * Called when a new room occupant has joined the room. Note: Take in consideration that when
  30.      * you join a room you will receive the list of current occupants in the room. This message will
  31.      * be sent for each occupant.
  32.      *
  33.      * @param participant the participant that has just joined the room
  34.      * (e.g. room@conference.jabber.org/nick).
  35.      */
  36.     default void joined(EntityFullJid participant) {
  37.     }

  38.     /**
  39.      * Called when a room occupant has left the room on its own. This means that the occupant was
  40.      * neither kicked nor banned from the room.
  41.      *
  42.      * @param participant the participant that has left the room on its own.
  43.      * (e.g. room@conference.jabber.org/nick).
  44.      */
  45.     default void left(EntityFullJid participant) {
  46.     }

  47.     /**
  48.      * Called when a participant is parted for whatever reason. This callback is always invoked if a participant
  49.      * parted the room, either voluntarily or involuntarily. Prior this callback, a callback with a more specific
  50.      * reason for the removal, like {@link #left(EntityFullJid)} may be invoked.
  51.      *
  52.      * @param participant the participant that was removed from the room.
  53.      * @since 4.4
  54.      */
  55.     default void parted(EntityFullJid participant) {
  56.     }

  57.     /**
  58.      * Called when a room participant has been kicked from the room. This means that the kicked
  59.      * participant is no longer participating in the room.
  60.      *
  61.      * @param participant the participant that was kicked from the room
  62.      * (e.g. room@conference.jabber.org/nick).
  63.      * @param actor the moderator that kicked the occupant from the room (e.g. user@host.org).
  64.      * @param reason the reason provided by the actor to kick the occupant from the room.
  65.      */
  66.     default void kicked(EntityFullJid participant, Jid actor, String reason) {
  67.     }

  68.     /**
  69.      * Called when a moderator grants voice to a visitor. This means that the visitor
  70.      * can now participate in the moderated room sending messages to all occupants.
  71.      *
  72.      * @param participant the participant that was granted voice in the room
  73.      * (e.g. room@conference.jabber.org/nick).
  74.      */
  75.     default void voiceGranted(EntityFullJid participant) {
  76.     }

  77.     /**
  78.      * Called when a moderator revokes voice from a participant. This means that the participant
  79.      * in the room was able to speak and now is a visitor that can't send messages to the room
  80.      * occupants.
  81.      *
  82.      * @param participant the participant that was revoked voice from the room
  83.      * (e.g. room@conference.jabber.org/nick).
  84.      */
  85.     default void voiceRevoked(EntityFullJid participant) {
  86.     }

  87.     /**
  88.      * Called when an administrator or owner banned a participant from the room. This means that
  89.      * banned participant will no longer be able to join the room unless the ban has been removed.
  90.      *
  91.      * @param participant the participant that was banned from the room
  92.      * (e.g. room@conference.jabber.org/nick).
  93.      * @param actor the administrator that banned the occupant (e.g. user@host.org).
  94.      * @param reason the reason provided by the administrator to ban the occupant.
  95.      */
  96.     default void banned(EntityFullJid participant, Jid actor, String reason) {
  97.     }

  98.     /**
  99.      * Called when an administrator grants a user membership to the room. This means that the user
  100.      * will be able to join the members-only room.
  101.      *
  102.      * @param participant the participant that was granted membership in the room
  103.      * (e.g. room@conference.jabber.org/nick).
  104.      */
  105.     default void membershipGranted(EntityFullJid participant) {
  106.     }

  107.     /**
  108.      * Called when an administrator revokes a user membership to the room. This means that the
  109.      * user will not be able to join the members-only room.
  110.      *
  111.      * @param participant the participant that was revoked membership from the room
  112.      * (e.g. room@conference.jabber.org/nick).
  113.      */
  114.     default void membershipRevoked(EntityFullJid participant) {
  115.     }

  116.     /**
  117.      * Called when an administrator grants moderator privileges to a user. This means that the user
  118.      * will be able to kick users, grant and revoke voice, invite other users, modify room's
  119.      * subject plus all the participant privileges.
  120.      *
  121.      * @param participant the participant that was granted moderator privileges in the room
  122.      * (e.g. room@conference.jabber.org/nick).
  123.      */
  124.     default void moderatorGranted(EntityFullJid participant) {
  125.     }

  126.     /**
  127.      * Called when an administrator revokes moderator privileges from a user. This means that the
  128.      * user will no longer be able to kick users, grant and revoke voice, invite other users,
  129.      * modify room's subject plus all the participant privileges.
  130.      *
  131.      * @param participant the participant that was revoked moderator privileges in the room
  132.      * (e.g. room@conference.jabber.org/nick).
  133.      */
  134.     default void moderatorRevoked(EntityFullJid participant) {
  135.     }

  136.     /**
  137.      * Called when an owner grants a user ownership on the room. This means that the user
  138.      * will be able to change defining room features as well as perform all administrative
  139.      * functions.
  140.      *
  141.      * @param participant the participant that was granted ownership on the room
  142.      * (e.g. room@conference.jabber.org/nick).
  143.      */
  144.     default void ownershipGranted(EntityFullJid participant) {
  145.     }

  146.     /**
  147.      * Called when an owner revokes a user ownership on the room. This means that the user
  148.      * will no longer be able to change defining room features as well as perform all
  149.      * administrative functions.
  150.      *
  151.      * @param participant the participant that was revoked ownership on the room
  152.      * (e.g. room@conference.jabber.org/nick).
  153.      */
  154.     default void ownershipRevoked(EntityFullJid participant) {
  155.     }

  156.     /**
  157.      * Called when an owner grants administrator privileges to a user. This means that the user
  158.      * will be able to perform administrative functions such as banning users and edit moderator
  159.      * list.
  160.      *
  161.      * @param participant the participant that was granted administrator privileges
  162.      * (e.g. room@conference.jabber.org/nick).
  163.      */
  164.     default void adminGranted(EntityFullJid participant) {
  165.     }

  166.     /**
  167.      * Called when an owner revokes administrator privileges from a user. This means that the user
  168.      * will no longer be able to perform administrative functions such as banning users and edit
  169.      * moderator list.
  170.      *
  171.      * @param participant the participant that was revoked administrator privileges
  172.      * (e.g. room@conference.jabber.org/nick).
  173.      */
  174.     default void adminRevoked(EntityFullJid participant) {
  175.     }

  176.     /**
  177.      * Called when a participant changed his/her nickname in the room. The new participant's
  178.      * nickname will be informed with the next available presence.
  179.      *
  180.      * @param participant the participant that was revoked administrator privileges
  181.      * (e.g. room@conference.jabber.org/nick).
  182.      * @param newNickname the new nickname that the participant decided to use.
  183.      */
  184.     default void nicknameChanged(EntityFullJid participant, Resourcepart newNickname) {
  185.     }

  186. }