1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Added notifications of occupant joining and leaving the room. SMACK-38

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2437 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-12-26 21:55:41 +00:00 committed by gaston
parent 81d647af56
commit d2187b7374
4 changed files with 135 additions and 0 deletions

View file

@ -31,6 +31,12 @@ package org.jivesoftware.smackx.muc;
*/
public class DefaultParticipantStatusListener implements ParticipantStatusListener {
public void joined(String participant) {
}
public void left(String participant) {
}
public void kicked(String participant) {
}

View file

@ -2014,6 +2014,12 @@ public class MultiUserChat {
isUserStatusModification,
from);
}
else {
// A new occupant has joined the room
if (!isUserStatusModification) {
fireParticipantStatusListeners("joined", from);
}
}
}
else if (presence.getType() == Presence.Type.UNAVAILABLE) {
synchronized (occupantsMap) {
@ -2027,6 +2033,11 @@ public class MultiUserChat {
presence.getFrom().equals(myRoomJID),
mucUser,
from);
} else {
// An occupant has left the room
if (!isUserStatusModification) {
fireParticipantStatusListeners("left", from);
}
}
}
}

View file

@ -28,6 +28,23 @@ package org.jivesoftware.smackx.muc;
*/
public interface ParticipantStatusListener {
/**
* Called when a new room occupant has joined the room.
*
* @param participant the participant that has just joined the room
* (e.g. room@conference.jabber.org/nick).
*/
public abstract void joined(String participant);
/**
* Called when a room occupant has left the room on its own. This means that the occupant was
* neither kicked nor banned from the room.
*
* @param participant the participant that has left the room on its own.
* (e.g. room@conference.jabber.org/nick).
*/
public abstract void left(String participant);
/**
* Called when a room participant has been kicked from the room. This means that the kicked
* participant is no longer participating in the room.