Multi chat services and events

cusax-fix
Yana Stamcheva 19 years ago
parent 05056be7f8
commit fefef7f04d

@ -47,7 +47,6 @@ public void join()
public void join(byte[] password)
throws OperationFailedException;
/**
* Joins this chat room with the specified nickname so that the user would
* start receiving events and messages for it. If the chatroom already
@ -94,34 +93,14 @@ public void joinAs(String nickname, byte[] password)
*/
public void leave();
/**
* Adds <tt>listener</tt> to the list of listeners registered to receive
* events upon modification of chat room properties such as its subject
* for example.
*
* @param listener ChatRoomChangeListener
*/
public void addChatRoomPropertyChangeListener(
ChatRoomPropertyChangeListener listener);
/**
* Removes <tt>listener</tt> from the list of listeneres current registered
* for chat room modification events.
*
* @param listener the <tt>ChatRoomChangeListener</tt> to remove.
*/
public void removeChatRoomPropertyChangeListener(
ChatRoomPropertyChangeListener listener);
/**
* Returns the last known room subject/theme or <tt>null</tt> if the user
* hasn't joined the room or the room does not have a subject yet.
* <p>
* To be notified every time the room's subject change you should add a
* <tt>ChatRoomChangelistener</tt> to this room.
* {@link #addChatRoomPropertyChangeListener(
* ChatRoomPropertyChangeListener)}<p>
*
* {@link #addPropertyChangeListener(ChatRoomPropertyChangeListener)}
* <p>
* To change the room's subject use {@link #setSubject(String)}.
*
* @return the room subject or <tt>null</tt> if the user hasn't joined the
@ -163,41 +142,94 @@ public void setSubject(String subject)
public void setNickname(String nickname)
throws OperationFailedException;
/**
* Adds a listener that will be notified of changes in our status in the room
* such as us being kicked, banned, or granted admin permissions.
*
* @param listener a local user status listener.
*/
public void addLocalUserStatusListener(
ChatRoomLocalUserStatusListener listener);
/**
* Removes a listener that was being notified of changes in our status in
* the room such as us being kicked, banned, or granted admin permissions.
*
* @param listener a local user status listener.
*/
public void removeLocalUserStatusListener(
ChatRoomLocalUserStatusListener listener);
/**
* Adds a listener that will be notified of changes in our status in the room
* such as us being kicked, banned, or granted admin permissions.
*
* @param listener a participant status listener.
*/
public void addMemberListener(ChatRoomMemberListener listener);
/**
* Removes a listener that was being notified of changes in the status of
* other chat room participants such as users being kicked, banned, or
* granted admin permissions.
*
* @param listener a participant status listener.
*/
public void removeMemberListener(
ChatRoomMemberListener listener);
/**
* Adds a listener that will be notified of changes in our participation in
* the room such as us being kicked, join, left.
*
* @param listener a local user participation listener.
*/
public void addLocalUserPresenceListener(
ChatRoomLocalUserPresenceListener listener);
/**
* Removes a listener that was being notified of changes in our
* participation in the room such as us being kicked, join, left...
*
* @param listener a local user participation listener.
*/
public void removeLocalUserPresenceListener(
ChatRoomLocalUserPresenceListener listener);
/**
* Adds a listener that will be notified of changes in our participation in
* the room such as us being kicked, join, left...
*
* @param listener a member participation listener.
*/
public void addMemberPresenceListener(
ChatRoomMemberPresenceListener listener);
/**
* Removes a listener that was being notified of changes in the
* participation of other chat room participants such as users being kicked,
* join, left.
*
* @param listener a member participation listener.
*/
public void removeMemberPresenceListener(
ChatRoomMemberPresenceListener listener);
/**
* Adds a listener that will be notified of changes in our role in the room
* such as us being granded operator.
*
* @param listener a local user role listener.
*/
public void addLocalUserRoleListener(ChatRoomLocalUserRoleListener listener);
/**
* Removes a listener that was being notified of changes in our role in this
* chat room such as us being granded operator.
*
* @param listener a local user role listener.
*/
public void removelocalUserRoleListener(
ChatRoomLocalUserRoleListener listener);
/**
* Adds a listener that will be notified of changes of a member role in the
* room such as being granded operator.
*
* @param listener a member role listener.
*/
public void addMemberRoleListener(ChatRoomMemberRoleListener listener);
/**
* Removes a listener that was being notified of changes of a member role in
* this chat room such as us being granded operator.
*
* @param listener a member role listener.
*/
public void removeMemberRoleListener(ChatRoomMemberRoleListener listener);
/**
* Adds a listener that will be notified of changes in the property of the
* room such as the subject being change or the room state being changed.
*
* @param listener a property change listener.
*/
public void addPropertyChangeListener(
ChatRoomPropertyChangeListener listener);
/**
* Removes a listener that was being notified of changes in the property of
* the chat room such as the subject being change or the room state being
* changed.
*
* @param listener a property change listener.
*/
public void removePropertyChangeListener(
ChatRoomPropertyChangeListener listener);
/**
* Invites another user to this room.
@ -277,7 +309,6 @@ public Message createMessage(byte[] content, String contentType,
public void sendMessage(Message message)
throws OperationFailedException;
/**
* Returns a reference to the provider that created this room.
*
@ -286,6 +317,145 @@ public void sendMessage(Message message)
*/
public ProtocolProviderService getParentProvider();
//include - roominfo
/** @todo include room info */
/**
* Sets the password of this chat room. If the user does not have the right
* to change the room password, or the protocol does not support this, or
* the operation fails for some other reason, the method throws an
* <tt>OperationFailedException</tt> with the corresponding code.
*
* @param password the new password that we'd like this room to have
* @throws OperationFailedException if the user does not have the right to
* change the room password, or the protocol does not support
* this, or the operation fails for some other reason
*/
public void setPassword(String password)
throws OperationFailedException;
/**
* Returns the password of this chat room or null if the room doesn't have
* password.
* @return the password of this chat room or null if the room doesn't have
* password
*/
public String getPassword();
/**
* Adds a ban mask to the list of ban masks of this chat room. The ban mask
* defines a group of users that will be banned. This property is meant to
* be used mainly by IRC implementations. If the user does not have the
* right to change the room ban list, or the protocol does not support this,
* or the operation fails for some other reason, the method throws an
* <tt>OperationFailedException</tt> with the corresponding code.
*
* @param banMask the new ban mask that we'd like to add to the room ban
* list
* @throws OperationFailedException if the user does not have the right to
* change the room ban list, or the protocol does not support this, or the
* operation fails for some other reason
*/
public void addBanMask(String banMask)
throws OperationFailedException;
/**
* Remove a ban mask from the list of ban masks of this chat room. If the
* user does not have the right to change the room ban list, or the protocol
* does not support this, or the operation fails for some other reason, the
* method throws an <tt>OperationFailedException</tt> with the
* corresponding code.
*
* @param banMask the ban mask that we'd like to remove from this room ban
* list
* @throws OperationFailedException if the user does not have the right to
* change the room ban list, or the protocol does not support this, or the
* operation fails for some other reason
*/
public void removeBanMask(String banMask)
throws OperationFailedException;
/**
* Sets the user limit of this chat room. The user limit is the maximum
* number of users, who could enter this chat room at a time. If the user
* does not have the right to change the room user limit, or the protocol
* does not support this, or the operation fails for some other reason, the
* method throws an <tt>OperationFailedException</tt> with the
* corresponding code.
*
* @param userLimit the new user limit that we'd like this room to have
* @throws OperationFailedException if the user does not have the right to
* change the room user limit, or the protocol does not support this, or the
* operation fails for some other reason
*/
public void setUserLimit(int userLimit)
throws OperationFailedException;
/**
* Returns the limit of user for this chat room. The user limit is the
* maximum number of users, who could enter this chat room at a time.
*
* @return int the limit of user for this chat room
*/
public int getUserLimit();
/**
* Adds a configuration parameter to the configuration list of this chat
* room. If the user does not have the right to change the room
* configuration, or the protocol does not support this, or the operation
* fails for some other reason, the method throws an
* <tt>OperationFailedException</tt> with the corresponding code.
*
* @param configParam the configuration parameter to add to the
* configuration list
* @throws OperationFailedException if the user does not have the right to
* change the room configuration, or the protocol does not support this, or
* the operation fails for some other reason
*/
public void addConfigParam(ChatRoomConfigParam configParam)
throws OperationFailedException;
/**
* Removes a configuration parameter from this chat room configuration list.
* If the user does not have the right to change the room state, or the
* protocol does not support this, or the operation fails for some other
* reason, the method throws an <tt>OperationFailedException</tt> with the
* corresponding code.
*
* @throws OperationFailedException if the user does not have the right to
* change the room configuration, or the protocol does not support this, or
* the operation fails for some other reason
*/
public void removeConfigParam(ChatRoomConfigParam configParam)
throws OperationFailedException;
/**
* Returns an Iterator over a set of <tt>ChatRoomConfigParams</tt>. Each
* element in the set is one of the <tt>ChatRoomConfigParams</tt>.CHAT_ROOM_XXX
* configuration params. This method is meant to be used by other bundles,
* before trying to change <tt>ChatRoom</tt> configurations, in order to
* check which are the supported configurations by the current
* implementation.
*
* @return an Iterator over a set of <tt>ChatRoomConfigParams</tt>
*/
public Iterator getSupportedConfigParams();
/**
* Returns an Iterator over a set of <tt>ChatRoomConfigParams</tt>,
* containing the current configuration of this chat room. This method is
* meant to be used by bundles interested in what are the specific chat room
* configurations.
*
* @return an Iterator over a set of <tt>ChatRoomConfigParams</tt>,
* containing the current configuration of this chat room
*/
public Iterator getConfiguration();
/**
* Returns an Iterator over a set of ban masks for this chat room. The ban
* mask defines a group of users that will be banned. The ban list is a list
* of all such ban masks defined for this chat room.
*
* @return an Iterator over a set of ban masks for this chat room
*/
public Iterator getBanList();
}

@ -0,0 +1,369 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol;
/**
* The <tt>ChatRoomConfigParam</tt> class defines some parameters which allow to
* add additional configurations to the chat room, like for example define that
* the chat room requires a password or an invitation, or that the number of
* users that join the chat is limitted, etc. A <tt>ChatRoomConfigParam</tt>
* could be set to the chat room using the <tt>addConfigParam</tt> method in the
* <tt>ChatRoom</tt> interface.
*
* @author Stephane Remy
* @author Yana Stamcheva
*/
public class ChatRoomConfigParam
{
/**
* This constant contains the String representation of the CHAT_ROOM_VISIBLE
* configuration parameter.
* <p>
* This constant has the String value "Visible".
*/
protected static final String _CHAT_ROOM_VISIBLE = "Visible";
/**
* The visible configuration parameter. Indicates that the associated chat
* room is visible.
*/
public static final ChatRoomConfigParam CHAT_ROOM_VISIBLE
= new ChatRoomConfigParam(_CHAT_ROOM_VISIBLE);
/**
* This constant contains the String representation of the
* CHAT_ROOM_NOT_VISIBLE configuration parameter.
* <p>
* This constant has the String value "Not Visible".
*/
protected static final String _CHAT_ROOM_NOT_VISIBLE = "Not Visible";
/**
* The not visible configuration parameter. Indicates that the associated
* chat room isn't visible.
*/
public static final ChatRoomConfigParam CHAT_ROOM_NOT_VISIBLE
= new ChatRoomConfigParam(_CHAT_ROOM_NOT_VISIBLE);
/**
* This constant contains the String representation of the
* CHAT_ROOM_PASSWORD_REQUIRED configuration parameter.
* <p>
* This constant has the String value "Password Required".
*/
protected static final String _CHAT_ROOM_PASSWORD_REQUIRED
= "Password Required";
/**
* The password required configuration parameter. Indicates that the
* associated chat room requires password.
*/
public static final ChatRoomConfigParam CHAT_ROOM_PASSWORD_REQUIRED
= new ChatRoomConfigParam(_CHAT_ROOM_PASSWORD_REQUIRED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_INVITATION_REQUIRED configuration parameter.
* <p>
* This constant has the String value "Invitation Required".
*/
protected static final String _CHAT_ROOM_INVITATION_REQUIRED
= "Invitation Required";
/**
* The invitation required parameter. Indicates that the associated chat
* room requires an invitation.
*/
public static final ChatRoomConfigParam CHAT_ROOM_INVITATION_REQUIRED
= new ChatRoomConfigParam(_CHAT_ROOM_INVITATION_REQUIRED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_USER_NUMBER_LIMITED configuration parameter.
* <p>
* This constant has the String value "User Number Limited".
*/
protected static final String _CHAT_ROOM_USER_NUMBER_LIMITED
= "User Number Limited";
/**
* The limitted user number parameter. Indicates that the associated chat
* room have a limit on number of users.
*/
public static final ChatRoomConfigParam CHAT_ROOM_USER_NUMBER_LIMITED
= new ChatRoomConfigParam(_CHAT_ROOM_USER_NUMBER_LIMITED);
/**
* This constant contains the String representation of the CHAT_ROOM_MUTE
* configuration parameter.
* <p>
* This constant has the String value "Mute".
*/
protected static final String _CHAT_ROOM_MUTE = "Mute";
/**
* Indicates that the associated chat room is currently
* in a mute mode and no messages could be obtained from it.
*/
public static final ChatRoomConfigParam CHAT_ROOM_MUTE
= new ChatRoomConfigParam(_CHAT_ROOM_MUTE);
/**
* This constant contains the String representation of the
* CHAT_ROOM_EXTERNAL_MESSAGES_ALLOWED configuration parameter.
* <p>
* This constant has the String value "External Messages Allowed".
*/
protected static final String _CHAT_ROOM_EXTERNAL_MESSAGE_ALLOWED
= "External Messages Allowed";
/**
* Indicates that it's possible for someone to send messages to this chat
* room even if they are not present inside the chat room.
*/
public static final ChatRoomConfigParam CHAT_ROOM_EXTERNAL_MESSAGE_ALLOWED
= new ChatRoomConfigParam(_CHAT_ROOM_EXTERNAL_MESSAGE_ALLOWED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_REGISTERED configuration parameter.
* <p>
* This constant has the String value "Registered".
*/
protected static final String _CHAT_ROOM_REGISTERED = "Registered";
/**
* Indicates that the associated chat room is registered.
*/
public static final ChatRoomConfigParam CHAT_ROOM_REGISTERED
= new ChatRoomConfigParam(_CHAT_ROOM_REGISTERED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_SUBJECT_LOCKED configuration parameter.
* <p>
* This constant has the String value "Subject Locked".
*/
protected static final String _CHAT_ROOM_SUBJECT_LOCKED = "Subject Locked";
/**
* Indicates that only admin users can change the subject of this chat room.
*/
public static final ChatRoomConfigParam CHAT_ROOM_SUBJECT_LOCKED
= new ChatRoomConfigParam(_CHAT_ROOM_SUBJECT_LOCKED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_MESSAGE_FORMAT_ALLOWED configuration parameter.
* <p>
* This constant has the String value "Message Format Allowed".
*/
protected static final String _CHAT_ROOM_MESSAGE_FORMAT_ALLOWED
= "Message Format Allowed";
/**
* Indicates that the message format in this chat room could be modified.
* Colored, underlined, etc. messages are allowed.
*/
public static final ChatRoomConfigParam CHAT_ROOM_MESSAGE_FORMAT_ALLOWED
= new ChatRoomConfigParam(_CHAT_ROOM_MESSAGE_FORMAT_ALLOWED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_MESSAGE_FORMAT_FILTERED configuration parameter.
* <p>
* This constant has the String value "Message Format Filtered".
*/
protected static final String _CHAT_ROOM_MESSAGE_FORMAT_FILTERED
= "Message Format Filtered";
/**
* Indicates that the associated chat room is currently in a message format
* filtered mode. All formatted messages (colored, underlined, etc.)are seen
* in standard format by other users.
*/
public static final ChatRoomConfigParam CHAT_ROOM_MESSAGE_FORMAT_FILTERED
= new ChatRoomConfigParam(_CHAT_ROOM_MESSAGE_FORMAT_FILTERED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_JOIN_TIME_LIMITED configuration parameter.
* <p>
* This constant has the String value "Join Time Limited".
*/
protected static final String _CHAT_ROOM_JOIN_TIME_LIMITED
= "Join Time Limited";
/**
* Indicates that users can only join this chat room in an interval of X
* seconds.
*/
public static final ChatRoomConfigParam CHAT_ROOM_JOIN_TIME_LIMITED
= new ChatRoomConfigParam(_CHAT_ROOM_JOIN_TIME_LIMITED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_INVITATION_REQUEST_ALLOWED configuration parameter.
* <p>
* This constant has the String value "Invitation Request Allowed".
*/
protected static final String _CHAT_ROOM_INVITATION_REQUEST_ALLOWED
= "Invitation Request Allowed";
/**
* Indicates that all invitation requests are allowed.
*/
public static final ChatRoomConfigParam CHAT_ROOM_INVITATION_REQUEST_ALLOWED
= new ChatRoomConfigParam(_CHAT_ROOM_INVITATION_REQUEST_ALLOWED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_USER_REDIRECTED configuration parameter.
* <p>
* This constant has the String value "User Redirected".
*/
protected static final String _CHAT_ROOM_USER_REDIRECTED = "User Redirected";
/**
* Indicates that all users which join this chat room are redirected to
* another one.
*/
public static final ChatRoomConfigParam CHAT_ROOM_USER_REDIRECTED
= new ChatRoomConfigParam(_CHAT_ROOM_USER_REDIRECTED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_NICKNAMES_LOCKED configuration parameter.
* <p>
* This constant has the String value "Nicknames Locked".
*/
protected static final String _CHAT_ROOM_NICKNAMES_LOCKED
= "Nicknames Locked";
/**
* Indicates that users in this chat room can not change their nickname.
*/
public static final ChatRoomConfigParam CHAT_ROOM_NICKNAMES_LOCKED
= new ChatRoomConfigParam(_CHAT_ROOM_NICKNAMES_LOCKED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_KICK_LOCKED configuration parameter.
* <p>
* This constant has the String value "Kick Locked".
*/
protected static final String _CHAT_ROOM_KICK_LOCKED = "Kick Locked";
/**
* Indicates that kicks are locked on this chat room. A kick tells the server
* to force a user leave the chat room.
*/
public static final ChatRoomConfigParam CHAT_ROOM_KICK_LOCKED
= new ChatRoomConfigParam(_CHAT_ROOM_KICK_LOCKED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_USERS_REGISTERED configuration parameter.
* <p>
* This constant has the String value "Only Registered User".
*/
protected static final String _CHAT_ROOM_ONLY_REGISTERED_USER
= "Only Registered User";
/**
* Indicates that only registered users can join this chat room.
*/
public static final ChatRoomConfigParam CHAT_ROOM_ONLY_REGISTERED_USER
= new ChatRoomConfigParam(_CHAT_ROOM_ONLY_REGISTERED_USER);
/**
* This constant contains the String representation of the
* CHAT_ROOM_SPECIAL_MESSAGE_ALLOWED configuration parameter.
* <p>
* This constant has the String value "Special Message Allowed".
*/
protected static final String _CHAT_ROOM_SPECIAL_MESSAGE_ALLOWED
= "Special Messages Allowed";
/**
* Indicates that the associated chat room allows special messages.
*/
public static final ChatRoomConfigParam CHAT_ROOM_SPECIAL_MESSAGES_ALLOWED
= new ChatRoomConfigParam(_CHAT_ROOM_SPECIAL_MESSAGE_ALLOWED);
/**
* This constant contains the String representation of the
* CHAT_ROOM_NICKNAME_LIST_VISIBLE configuration parameter.
* <p>
* This constant has the String value "Nickname List Visible".
*/
protected static final String _CHAT_ROOM_NICKNAME_LIST_VISIBLE
= "Nickname List Visible";
/**
* Indicates that the list of nicknames in this chat room is currently
* visible.
*/
public static final ChatRoomConfigParam CHAT_ROOM_NICKNAME_LIST_VISIBLE
= new ChatRoomConfigParam(_CHAT_ROOM_NICKNAME_LIST_VISIBLE);
/**
* This constant contains the String representation of the
* CHAT_ROOM_INVITATION_ALLOWED configuration parameter.
* <p>
* This constant has the String value "Invitation Allowed".
*/
protected static final String _CHAT_ROOM_INVITATION_ALLOWED
= "Invitation Allowed";
/**
* Indicates that users can invite other users in this chat room.
*/
public static final ChatRoomConfigParam CHAT_ROOM_INVITATION_ALLOWED
= new ChatRoomConfigParam(_CHAT_ROOM_INVITATION_ALLOWED);
/**
* A string representation of this Chat Room State.
*/
private String configParamString;
/**
* Creates a chat room configuration parameter object with a value
* corresponding to the specified string.
*
* @param configParamString a string representation of the configuration
* parameter
*/
protected ChatRoomConfigParam(String configParamString)
{
this.configParamString = configParamString;
}
/**
* Returns a String representation of that chat room configuration parameter.
*
* @return a string value (one of the _CHAT_ROOM_XXX constants) representing
* this chat room config parameter).
*/
public String getConfigParamString()
{
return configParamString;
}
/**
* Returns a string represenation of this chat room configuration parameter.
* Strings returned by this method have the following format:
* "ChatRoomConfigParam:<CONFIG_PARAM_STRING>" and are meant to be used for
* loggin/debugging purposes.
*
* @return a string representation of this object.
*/
public String toString()
{
return getClass().getName() + ":" + getConfigParamString();
}
}

@ -7,13 +7,43 @@
package net.java.sip.communicator.service.protocol;
/**
* This interface represents an invitation, which is send from a chat room
* member to another user in order to invite this user to join the chat room.
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomInvitation
public interface ChatRoomInvitation
{
public ChatRoomInvitation()
{
super();
}
/**
* Returns the <tt>ChatRoom</tt>, which is the target of this invitation.
* The chat room returned by this method will be the room to which the user
* is invited to join to.
*
* @return the <tt>ChatRoom</tt>, which is the target of this invitation
*/
public ChatRoom getTarget();
/**
* Returns the reason of this invitation, or null if there is no reason.
*
* @return the reason of this invitation, or null if there is no reason
*/
public String getReason();
/**
* Returns the subject of this invitation or null if the invitation contains
* no subject.
* @return the subject of this invitation or null if the invitation contains
* no subject.
*/
public String getSubject();
/**
* Returns the protocol provider instance where this invitation has originated.
*
* @return the <tt>ProtocolProviderService</tt> instance that created this
* invitation
*/
public ProtocolProviderService getProtocolProvider();
}

@ -1,26 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol;
/**
* Delivered when we receive an invitation for joining an existing chat room.
* If the corresponding chat room requires a password, then it could be
* retreived by the getPassword() method. The method would return null if no
* password is necessary to join the specified chat room.
*
* @author Emil Ivov
*/
public class InvitationReceivedEvent
extends java.util.EventObject
{
public InvitationReceivedEvent(ProtocolProviderService srcProvider,
ChatRoom chatRoom)
{
super(srcProvider);
}
}

@ -45,19 +45,20 @@ public List getExistingChatRooms()
public List getCurrentlyJoinedChatRooms();
/**
* Returns a list of the chat rooms that <tt>contact</tt> has joined and is
* currently active in.
* Returns a list of the chat rooms that <tt>chatRoomMember</tt> has joined
* and is currently active in.
*
* @param contact the contact whose current ChatRooms we will be querying.
* @return a list of the chat rooms that <tt>contact</tt> has joined and is
* currently active in.
* @param chatRoomMember the chatRoomMember whose current ChatRooms we will
* be querying.
* @return a list of the chat rooms that <tt>chatRoomMember</tt> has
* joined and is currently active in.
*
* @throws OperationFailedException if an error occurs while trying to
* discover the room on the server.
* @throws OperationNotSupportedException if the server does not support
* multi user chat
*/
public List getCurrentlyJoinedChatRooms(Contact contact)
public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember)
throws OperationFailedException, OperationNotSupportedException;
/**
@ -82,8 +83,8 @@ public ChatRoom createChatRoom(String roomName, Hashtable roomProperties)
throws OperationFailedException, OperationNotSupportedException;
/**
* Returns a reference to a chatRoom named <tt>roomName</tt> or null if
* no such room exists.
* Returns a reference to a chatRoom named <tt>roomName</tt> or null if no
* such room exists.
* <p>
* @param roomName the name of the <tt>ChatRoom</tt> that we're looking for.
* @return the <tt>ChatRoom</tt> named <tt>roomName</tt> or null if no such
@ -95,7 +96,7 @@ public ChatRoom createChatRoom(String roomName, Hashtable roomProperties)
* multi user chat
*/
public ChatRoom findRoom(String roomName)
throws OperationFailedException, OperationNotSupportedException;
throws OperationFailedException, OperationNotSupportedException;
/**
* Informs the sender of an invitation that we decline their invitation.
@ -110,7 +111,7 @@ public ChatRoom findRoom(String roomName)
*
* @param listener an invitation listener.
*/
public void addInvitationListener(InvitationListener listener);
public void addInvitationListener(ChatRoomInvitationListener listener);
/**
* Removes <tt>listener</tt> from the list of invitation listeners
@ -118,7 +119,7 @@ public ChatRoom findRoom(String roomName)
*
* @param listener the invitation listener to remove.
*/
public void removeInvitationListener(InvitationListener listener);
public void removeInvitationListener(ChatRoomInvitationListener listener);
/**
* Adds a listener to invitation notifications. The listener will be fired
@ -127,7 +128,7 @@ public ChatRoom findRoom(String roomName)
* @param listener an invitation listener.
*/
public void addInvitationRejectionListener(
InvitationRejectionListener listener);
ChatRoomInvitationRejectionListener listener);
/**
* Removes <tt>listener</tt> from the list of invitation listeners
@ -136,7 +137,7 @@ public void addInvitationRejectionListener(
* @param listener the invitation listener to remove.
*/
public void removeInvitationRejectionListener(
InvitationRejectionListener listener);
ChatRoomInvitationRejectionListener listener);
/**
* Returns true if <tt>contact</tt> supports multi user chat sessions.

@ -0,0 +1,25 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
/**
* A listener that dispatches events notifying that an invitation to join a MUC
* room is received.
*
* @author Emil Ivov
*/
public interface ChatRoomInvitationListener
{
/**
* Called when we receive an invitation to join an existing <tt>ChatRoom</tt>.
* <p>
* @param evt the <tt>ChatRoomInvitationReceivedEvent</tt> that contains the
* newly received invitation and its source provider.
*/
public abstract void invitationReceived(ChatRoomInvitationReceivedEvent evt);
}

@ -0,0 +1,102 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* <tt>ChatRoomInvitationReceivedEvent</tt>s indicate reception of an
* invitation to join a chat room.
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomInvitationReceivedEvent
extends EventObject
{
/**
* The chat room member that has sent this invitation.
*/
private ChatRoomMember from = null;
/**
* The chat room member that is the target of this invitation.
*/
private ChatRoomMember to = null;
/**
* A timestamp indicating the exact date when the event occurred.
*/
private Date timestamp = null;
/**
* Creates an <tt>InvitationReceivedEvent</tt> representing reception of
* the <tt>source</tt> invitation received from the specified
* <tt>from</tt> chat room member.
*
* @param source the <tt>ChatRoomInvitation</tt> whose reception this event
* represents.
* @param from the <tt>ChatRoomMember</tt> that has sent this invitation.
* @param to the <tt>ChatRoomMember</tt> that is the target of this
* invitation.
* @param timestamp the exact date when the event ocurred.
*/
public ChatRoomInvitationReceivedEvent(ChatRoomInvitation source,
ChatRoomMember from, ChatRoomMember to, Date timestamp)
{
super(source);
this.from = from;
this.to = to;
this.timestamp = timestamp;
}
/**
* Returns a reference to the <tt>ChatRoomMember</tt> that has sent the
* <tt>ChatRoomInvitation</tt> whose reception this event represents.
*
* @return a reference to the <tt>ChatRoomMember</tt> that has sent the
* <tt>ChatRoomInvitation</tt> whose reception this event represents.
*/
public ChatRoomMember getFrom()
{
return from;
}
/**
* Returns a reference to the <tt>ChatRoomMember</tt> that is the target
* of the <tt>ChatRoomInvitation</tt> whose reception this event represents.
*
* @return a reference to the <tt>ChatRoomMember</tt> that is the target
* of the <tt>ChatRoomInvitation</tt> whose reception this event represents.
*/
public ChatRoomMember getTo()
{
return to;
}
/**
* Returns the <tt>ChatRoomInvitation</tt> that triggered this event
*
* @return the <tt>ChatRoomInvitation</tt> that triggered this event.
*/
public ChatRoomInvitation getSourceInvitation()
{
return (ChatRoomInvitation) getSource();
}
/**
* A timestamp indicating the exact date when the event ocurred.
*
* @return a Date indicating when the event ocurred.
*/
public Date getTimestamp()
{
return timestamp;
}
}

@ -0,0 +1,120 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* <tt>ChatRoomInvitationRejectedEvent</tt>s indicates the reception of a
* rejection of an invitation.
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomInvitationRejectedEvent
extends EventObject
{
/**
* The chat room member that has sent this rejection.
*/
private ChatRoomMember from = null;
/**
* The chat room member that is the target of this rejection.
*/
private ChatRoomMember to = null;
/**
* The reason why this invitation is rejected or null if there is no reason
* specified.
*/
private String reason = null;
/**
* A timestamp indicating the exact date when the event occurred.
*/
private Date timestamp = null;
/**
* Creates a <tt>ChatRoomInvitationRejectedEvent</tt> representing the
* rejection of the <tt>source</tt> invitation, rejected from the specified
* <tt>from</tt> chat room member.
*
* @param source the <tt>ChatRoomInvitation</tt> whose rejection this event
* represents
* @param from the <tt>ChatRoomMember</tt> that has sent this invitation
* rejection
* @param to the <tt>ChatRoomMember</tt> that is the target of this
* invitation rejection
* @param timestamp the exact date when the event ocurred.
*/
public ChatRoomInvitationRejectedEvent(ChatRoomInvitation source,
ChatRoomMember from, ChatRoomMember to, String reason, Date timestamp)
{
super(source);
this.from = from;
this.to = to;
this.reason = reason;
this.timestamp = timestamp;
}
/**
* Returns a reference to the <tt>ChatRoomMember</tt> that has sent the
* rejection.
*
* @return a reference to the <tt>ChatRoomMember</tt> that has sent the
* rejection
*/
public ChatRoomMember getFrom()
{
return from;
}
/**
* Returns a reference to the <tt>ChatRoomMember</tt> that is the target of
* this rejection.
*
* @return a reference to the <tt>ChatRoomMember</tt> that is the target of
* this rejection
*/
public ChatRoomMember getTo()
{
return to;
}
/**
* Returns the reason for which the <tt>ChatRoomInvitation</tt> is rejected.
*
* @return the reason for which the <tt>ChatRoomInvitation</tt> is rejected.
*/
public String getReason()
{
return reason;
}
/**
* Returns the <tt>ChatRoomInvitation</tt> that was rejected.
*
* @return the <tt>ChatRoomInvitation</tt> that was rejected.
*/
public ChatRoomInvitation getSourceInvitation()
{
return (ChatRoomInvitation)getSource();
}
/**
* A timestamp indicating the exact date when the event ocurred.
* @return a Date indicating when the event ocurred.
*/
public Date getTimestamp()
{
return timestamp;
}
}

@ -0,0 +1,25 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
/**
* A listener that dispatches events notifying that an invitation which was
* sent earlier has been rejected by the invitee.
*
* @author Emil Ivov
*/
public interface ChatRoomInvitationRejectionListener
{
/**
* Called when an invitee rejects an invitation previously sent by us.
*
* @param evt the instance of the <tt>ChatRoomInvitationRejectedEvent</tt>
* containing the rejected chat room invitation as well as the source
* provider where this happened.
*/
public void invitationRejected(ChatRoomInvitationRejectedEvent evt);
}

@ -0,0 +1,122 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.EventObject;
import net.java.sip.communicator.service.protocol.*;
/**
* Dispatched to notify interested parties that a change in our presence in
* the source chat room has occured. Changes may include us being kicked, join,
* left, etc.
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomLocalUserPresenceChangeEvent
extends EventObject
{
/**
* Indicates that this event was triggered as a result of the local
* participant joining the source chat room.
*/
public static final String LOCAL_USER_JOINED = "LocalUserJoined";
/**
* Indicates that this event was triggered as a result of the local
* participant leaving the chat room.
*/
public static final String LOCAL_USER_LEFT = "LocalUserLeft";
/**
* Indicates that this event was triggered as a result of the local
* participant being kicked from the source chat room.
*/
public static final String LOCAL_USER_KICKED = "LocalUserKicked";
/**
* Indicates that this event was triggered as a result of the local
* participant beeing disconnected from the server brutally, or ping timeout.
*/
public static final String LOCAL_USER_QUIT = "LocalUserQuit";
/**
* The type of this event. Values can be any of the LOCAL_USER_XXX fields.
*/
private String eventType = null;
/**
* An optional String indicating a possible reason as to why the event
* might have occurred.
*/
private String reason = null;
/**
* Creates a <tt>ChatRoomLocalUserPresenceChangeEvent</tt> representing that
* a change in local participant presence in the source chat room has
* occured.
*
* @param sourceRoom the <tt>ChatRoom</tt> that produced this event
* @param eventType the type of this event. One of the LOCAL_USER_XXX
* constants
* @param reason the reason explaining why this event might have occurred
*/
public ChatRoomLocalUserPresenceChangeEvent(ChatRoom sourceRoom,
String eventType,
String reason)
{
super(sourceRoom);
this.eventType = eventType;
this.reason = reason;
}
/**
* Returns the <tt>ChatRoom</tt>, where this event has occurred.
*
* @return the <tt>ChatRoom</tt>, where this event has occurred
*/
public ChatRoom getChatRoom()
{
return (ChatRoom) getSource();
}
/**
* A reason string indicating a human readable reason for this event.
*
* @return a human readable String containing the reason for this event,
* or null if no particular reason was specified
*/
public String getReason()
{
return reason;
}
/**
* Returns the type of this event which could be one of the LOCAL_USER_XXX
* member fields.
*
* @return one of the LOCAL_USER_XXX fields indicating the type of this event.
*/
public String getEventType()
{
return eventType;
}
/**
* Returns a String representation of this event.
*/
public String toString()
{
return "ChatRoomLocalUserPresenceChangeEvent[type="
+ getEventType()
+ " sourceRoom="
+ getChatRoom()
+ "]";
}
}

@ -0,0 +1,28 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* A listener that will be notified of changes in our presence in the chat
* room such as us being kicked, join, left.
*
* @author Emil Ivov
*/
public interface ChatRoomLocalUserPresenceListener
extends EventListener
{
/**
* Called to notify interested parties that a change in our presence in the
* source chat room has occured. Changes may include us being kicked, join,
* left.
* @param evt the <tt>ChatRoomLocalUserPresenceChangeEvent</tt> instance
* containing the source chat room and the type, and reason of the change
*/
public void localUserPresenceChanged(ChatRoomLocalUserPresenceChangeEvent evt);
}

@ -0,0 +1,82 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* Dispatched to notify interested parties that a change in our role in the
* source chat room has occurred. Changes may include us being granted admin
* permissions, or other permissions.
*
* @see ChatRoomMemberRole
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomLocalUserRoleChangeEvent
extends EventObject
{
/**
* The previous role that local participant had.
*/
private ChatRoomMemberRole previousRole = null;
/**
* The new role that local participant get.
*/
private ChatRoomMemberRole newRole = null;
/**
* Creates a <tt>ChatRoomLocalUserRoleChangeEvent</tt> representing that
* a change in local participant role in the source chat room has
* occured.
*
* @param sourceRoom the <tt>ChatRoom</tt> that produced the event
* @param previousRole the previous role that local participant had
* @param newRole the new role that local participant get
*/
public ChatRoomLocalUserRoleChangeEvent(ChatRoom sourceRoom,
ChatRoomMemberRole previousRole,
ChatRoomMemberRole newRole)
{
super(sourceRoom);
this.previousRole = previousRole;
this.newRole = newRole;
}
/**
* Returns the new role the local participant get.
*
* @return newRole the new role the local participant get
*/
public ChatRoomMemberRole getNewRole()
{
return newRole;
}
/**
* Returns the previous role that local participant had.
*
* @return previousRole the previous role that local participant had
*/
public ChatRoomMemberRole getPreviousRole()
{
return previousRole;
}
/**
* Returns the <tt>ChatRoom</tt>, where this event occured.
*
* @return the <tt>ChatRoom</tt>, where this event occured
*/
public ChatRoom getSourceChatRoom()
{
return (ChatRoom)getSource();
}
}

@ -0,0 +1,30 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* A listener that will be notified of changes in the role of the local
* user participant in a particular chat room. Changes could be us being granted
* any of the roles defined in <tt>ChatRoomMemberRole</tt>.
*
* @see ChatRoomMemberRole
*
* @author Stephane Remy
*/
public interface ChatRoomLocalUserRoleListener
extends EventListener
{
/**
* Called to notify interested parties that a change in the role of the
* local user participant in a particular chat room has occurred.
* @param evt the <tt>ChatRoomLocalUserRoleChangeEvent</tt> instance
* containing the source chat room and role old and new state.
*/
public void localUserRoleChanged(ChatRoomLocalUserRoleChangeEvent evt);
}

@ -1,23 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
/**
* Dispatched to notify interested parties that a change in our status in the
* source room has changed. Changes may include us being kicked, banned, or
* granted admin permissions.
*
* @author Emil Ivov
*/
public class ChatRoomLocalUserStatusChangeEvent
{
public ChatRoomLocalUserStatusChangeEvent()
{
super();
}
}

@ -1,25 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* Adds a listener that will be notified of changes in our status in the room
* such as us being kicked, banned, or granted admin permissions.
* @author Emil Ivov
*/
public interface ChatRoomLocalUserStatusListener
extends EventListener
{
/**
* Called to notify interested parties that a change in our status in the
* source soom has changed. Changes may include us being kicked, banned, or
* granted admin permissions.
*/
public void localUserStatusChanged(ChatRoomLocalUserStatusChangeEvent evt);
}

@ -1,124 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* Dispatched to notify interested parties that a change in the status of the
* source room participant has changed. Changes may include the participant
* being kicked, banned, or granted admin permissions.
*
* @author Emil Ivov
*/
public class ChatRoomMemberEvent
extends EventObject
{
/**
* Indicates that this event was triggered as a result of the source
* participant joining the source chat room.
*/
public static final String MEMBER_JOINED = "MemberJoined";
/**
* Indicates that this event was triggered as a result of the source
* participant being "kicked" out of the chat room.
*/
public static final String MEMBER_LEFT = "MemberJoined";
/**
* Indicates that this event was triggered as a result of the source
* participant leaving the source chat room.
*/
public static final String MEMBER_KICKED = "MemberKicked";
/**
* The member that the event relates to.
*/
private ChatRoomMember sourceMember = null;
/**
* The type of this event. Values can be any of the MEMBER_XXX-ED fields.
*/
private String eventType = null;
/**
* An optional String indicating a possible reason as to why the event
* might have occurred.
*/
private String reason = null;
public ChatRoomMemberEvent(ChatRoom sourceRoom,
ChatRoomMember sourceMember,
String eventType,
String reason )
{
super(sourceRoom);
this.sourceMember = sourceMember;
this.eventType = eventType;
this.reason = reason;
}
/**
* Returns the source chat room for this event.
*
* @return the <tt>ChatRoom</tt> associated with that is the source of this
* event and that the corresponding ChatRoomMemberBelongs to.
*/
public ChatRoom getChatRoom()
{
return (ChatRoom)getSource();
}
/**
* Returns the member that this event is pertaining to.
* @return the <tt>ChatRoomMember</tt> that this event is pertaining to.
*/
public ChatRoomMember getChatRoomMember()
{
return sourceMember;
}
/**
* A reason string indicating a human readable reason for this event.
*
* @return a human readable String containing the reason for this event,
* or null if no particular reason was specified.
*/
public String getReason()
{
return reason;
}
/**
* Returns the type of this event which could be one of the MEMBER_XXX-ed
* member field values.
*
* @return one of the MEMBER_XXXed member field values indicating the type
* of this event.
*/
public String getEventType()
{
return eventType;
}
/**
* Returns a String representation of this event.
*/
public String toString()
{
return "ChatRoomMemberEvent[type="
+ getEventType()
+ " sourceRoom="
+ getChatRoom()
+ " member="
+ getChatRoomMember()
+ "]";
}
}

@ -1,27 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* Adds a listener that will be notified of changes in the status of the chat
* participants in a particular chat room, such as us being kicked, banned, or
* granted admin permissions.
* @author Emil Ivov
*/
public interface ChatRoomMemberListener
extends EventListener
{
/**
* Called to notify interested parties that a change in the status of the
* source room participant has changed. Changes may include the participant
* being kicked, banned, or granted admin permissions.
*/
public void memberStatusChanged( ChatRoomMemberEvent evt );
}

@ -0,0 +1,140 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* Dispatched to notify interested parties that a change in the presence of a
* chat room member has occurred. Changes may include the participant
* being kicked, join, left...
*
* @author Emil Ivov
*/
public class ChatRoomMemberPresenceChangeEvent
extends EventObject
{
/**
* Indicates that this event was triggered as a result of the participant
* joining the source chat room.
*/
public static final String MEMBER_JOINED = "MemberJoined";
/**
* Indicates that this event was triggered as a result of the participant
* leaving the source chat room.
*/
public static final String MEMBER_LEFT = "MemberLeft";
/**
* Indicates that this event was triggered as a result of the participant
* being "kicked" out of the chat room.
*/
public static final String MEMBER_KICKED = "MemberKicked";
/**
* Indicates that this event was triggered as a result of the participant
* being disconnected from the server brutally, or due to a ping timeout.
*/
public static final String MEMBER_QUIT = "MemberQuit";
/**
* The chat room member that the event relates to.
*/
private ChatRoomMember sourceMember = null;
/**
* The type of this event. Values can be any of the MEMBER_XXX fields.
*/
private String eventType = null;
/**
* An optional String indicating a possible reason as to why the event
* might have occurred.
*/
private String reason = null;
/**
* Creates a <tt>ChatRoomMemberPresenceChangeEvent</tt> representing that
* a change in the presence of a <tt>ChatRoomMember</tt> has occurred.
* Changes may include the participant being kicked, join, left, etc.
*
* @param sourceRoom the <tt>ChatRoom</tt> that produced this event
* @param sourceMember the <tt>ChatRoomMember</tt> that this event is about
* @param eventType the event type; one of the MEMBER_XXX constants
* @param reason the reason explaining why this event might have occurred
*/
public ChatRoomMemberPresenceChangeEvent( ChatRoom sourceRoom,
ChatRoomMember sourceMember,
String eventType,
String reason )
{
super(sourceRoom);
this.sourceMember = sourceMember;
this.eventType = eventType;
this.reason = reason;
}
/**
* Returns the chat room that produced this event.
*
* @return the <tt>ChatRoom</tt> that produced this event
*/
public ChatRoom getChatRoom()
{
return (ChatRoom)getSource();
}
/**
* Returns the chat room member that this event is about.
*
* @return the <tt>ChatRoomMember</tt> that this event is about.
*/
public ChatRoomMember getChatRoomMember()
{
return sourceMember;
}
/**
* A reason String indicating a human readable reason for this event.
*
* @return a human readable String containing the reason for this event,
* or null if no particular reason was specified.
*/
public String getReason()
{
return reason;
}
/**
* Returns the type of this event which could be one of the MEMBER_XXX
* member field values.
*
* @return one of the MEMBER_XXX member field values indicating the type
* of this event.
*/
public String getEventType()
{
return eventType;
}
/**
* Returns a String representation of this event.
*/
public String toString()
{
return "ChatRoomMemberPresenceChangeEvent[type="
+ getEventType()
+ " sourceRoom="
+ getChatRoom().toString()
+ " member="
+ getChatRoomMember().toString()
+ "]";
}
}

@ -0,0 +1,31 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* A listener that will be notified of changes in the presence of a member in a
* particular chat room. Changes may include member being kicked, join, left.
*
* @author Emil Ivov
*/
public interface ChatRoomMemberPresenceListener
extends EventListener
{
/**
* Called to notify interested parties that a change in the presence of a
* member in a particular chat room has occurred. Changes may include member
* being kicked, join, left.
*
* @param evt the <tt>ChatRoomMemberPresenceChangeEvent</tt> instance
* containing the source chat room and type, and reason of the presence
* change
*/
public void memberPresenceChanged(ChatRoomMemberPresenceChangeEvent evt );
}

@ -1,23 +1,99 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* <p> </p>
*
* <p> </p>
*
* <p> </p>
*
* <p> </p>
* Dispatched to notify interested parties that a change in a member role in the
* source room has occurred. Changes may include member being granted admin
* permissions, or other permissions.
*
* @see ChatRoomMemberRole
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomMemberRoleChangeEvent
extends EventObject
{
public ChatRoomMemberRoleChangeEvent(Object source)
/**
* The member that the event relates to.
*/
private ChatRoomMember sourceMember = null;
/**
* The previous role that this member had.
*/
private ChatRoomMemberRole previousRole = null;
/**
* The new role that this member get.
*/
private ChatRoomMemberRole newRole = null;
/**
* Creates a <tt>ChatRoomMemberRoleChangeEvent</tt> representing that
* a change in member role in the source chat room has occured.
*
* @param sourceRoom the <tt>ChatRoom</tt> that produced this event
* @param sourceMember the <tt>ChatRoomMember</tt> that this event is about
* @param previousRole the previous role that member had
* @param newRole the new role that member get
*/
public ChatRoomMemberRoleChangeEvent(ChatRoom sourceRoom,
ChatRoomMember sourceMember,
ChatRoomMemberRole previousRole,
ChatRoomMemberRole newRole)
{
super(sourceRoom);
this.sourceMember = sourceMember;
this.previousRole = previousRole;
this.newRole = newRole;
}
/**
* Returns the new role given to the member that this event is about.
*
* @return the new role given to the member that this event is about
*/
public ChatRoomMemberRole getNewRole()
{
return newRole;
}
/**
* Returns the previous role the member that this event is about had.
*
* @return the previous role the member that this event is about had
*/
public ChatRoomMemberRole getPreviousRole()
{
return previousRole;
}
/**
* Returns the chat room that produced this event.
*
* @return the <tt>ChatRoom</tt> that produced this event
*/
public ChatRoom getSourceChatRoom()
{
return (ChatRoom)getSource();
}
/**
* Returns the member that this event is about.
* @return the <tt>ChatRoomMember</tt> that this event is about
*/
public ChatRoomMember getSourceMember()
{
super(source);
return sourceMember;
}
}

@ -0,0 +1,33 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
/**
* A listener that will be notified of changes in the role of a chat
* participant in a particular chat room. Changes may include participant being
* granted any of the roles defined in <tt>ChatRoomMemberRole</tt>.
*
* @see ChatRoomMemberRole
*
* @author Emil Ivov
* @author Stephane Remy
*/
public interface ChatRoomMemberRoleListener
extends EventListener
{
/**
* Called to notify interested parties that a change in the role of a
* chat room member has occurred.
*
* @param evt the <tt>ChatRoomMemberRoleChangeEvent</tt> instance
* containing the source chat room and role old and new state.
*/
public void memberRoleChanged(ChatRoomMemberRoleChangeEvent evt);
}

@ -6,22 +6,123 @@
*/
package net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* <tt>ChatRoomChangeEvent</tt>s are fired to indicate that a property of
* the corresponding chat room (e.g. its subject or type) have been modified.
* The event contains references to the source chat room and provider, the name
* of the property that has just changed as well as its old and new values.
* A <tt>ChatRoomPropertyChangeEvent</tt> is issued whenever a chat room
* property has changed. Event codes defined in this class describe properties
* whose changes are being announced through this event.
*
* @author Emil Ivov
* @author Stephane Remy
*/
public class ChatRoomPropertyChangeEvent
extends EventObject
extends java.beans.PropertyChangeEvent
{
public ChatRoomPropertyChangeEvent(Object source)
/**
* Indicates that this event was triggered as a result of the source
* chat room subject being changed.
*/
public static final String PROPERTY_SUBJECT_CHANGED = "SubjectChanged";
/**
* Indicates that this event was triggered as a result of the source
* chat room ban list being changed.
*/
public static final String PROPERTY_BAN_LIST_CHANGED = "BanListChanged";
/**
* Indicates that this event was triggered as a result of the source
* chat room user limit being changed.
*/
public static final String PROPERTY_USER_LIMIT_CHANGED = "UserLimitChanged";
/**
* Indicates that this event was triggered as a result of the source
* chat room state changed.
*/
public static final String PROPERTY_STATE_CHANGED = "StateChanged";
/**
* Indicates that this event was triggered as a result of the source
* chat room password being changed.
*/
public static final String PROPERTY_PASSWORD_CHANGED = "PasswordChanged";
/**
* The value of the property before the change occurred.
*/
private Object oldValue;
/**
* The value of the property after the change.
*/
private Object newValue;
/**
* Creates a <tt>ChatRoomPropertyChangeEvent</tt> indicating that a change
* has occurred for property <tt>propertyName</tt> in the <tt>source</tt>
* chat room and that its value has changed from <tt>oldValue</tt> to
* <tt>newValue</tt>.
* <p>
* @param source the <tt>ChatRoom</tt> whose property has changed.
* @param propertyName the name of the property that has changed.
* @param oldValue the value of the property before the change occurred.
* @param newValue the value of the property after the change.
*/
public ChatRoomPropertyChangeEvent(ChatRoom source,
String propertyName,
Object oldValue,
Object newValue)
{
super(source, propertyName, oldValue, newValue);
}
/**
* Returns the source chat room for this event.
*
* @return the <tt>ChatRoom</tt> associated with this
* event.
*/
public ChatRoom getSourceChatRoom()
{
return (ChatRoom)getSource();
}
/**
* Return the value of the property before the change occurred.
*
* @return the value of the property before the change occurred.
*/
public Object getOldValue()
{
return oldValue;
}
/**
* Return the value of the property after the change.
*
* @return the value of the property after the change.
*/
public Object getNewValue()
{
return newValue;
}
/**
* Returns a String representation of this event.
*/
public String toString()
{
super(source);
return "ChatRoomPropertyChangeEvent[type="
+ this.getPropertyName()
+ " sourceRoom="
+ this.getSource().toString()
+ "oldValue="
+ this.getOldValue().toString()
+ "newValue="
+ this.getNewValue().toString()
+ "]";
}
}

Loading…
Cancel
Save