fr.paris.lutece.plugins.chat.business
Class ChatRoom

java.lang.Object
  extended by fr.paris.lutece.plugins.chat.business.ChatRoom

public class ChatRoom
extends java.lang.Object

This class provides methods for the ChatRoom objects


Field Summary
static int INVALID_ROOM
           
static int USER_ADDED
           
static int USER_ALREADY_EXISTS
           
static int USER_IS_BANNED
           
 
Constructor Summary
ChatRoom(java.lang.String strName, java.lang.String strDescription)
          Creates a new ChatRoom object.
 
Method Summary
 void addChatEntry(ChatEntry entry, ChatUser userRecipient)
          Adds an entry to this chat room
 void addChatEntry(ChatUser userSender, ChatEntry entry, ChatUser userRecipient)
          Adds an entry to this chat room
 int addUser(ChatUser user)
          Checks if the user specified in parameter is not already existent in the room and if it is not banned.
 void banUser(java.lang.String strPseudo, java.lang.String strComment)
          Bannes a user from the room and comments it.
 int changePseudo(java.lang.String strPseudo, java.lang.String strNewNickname)
          Modifies the nick name of the user
 void debanUser(java.lang.String strIpAddress)
          Removes an ip address from the list of those which are banned from the room
 java.lang.String getAdminPassword()
          The password of the admin
 java.util.Enumeration getBannedUsers()
          Returns the list of the users banned from this room
 java.lang.String getBgColor()
          Returns the background color of the room
 java.lang.String getButtonBgColor()
          Returns the background color of the button
 java.lang.String getButtonFgColor()
          Returns the foreground color of the button
 java.lang.String getDescription()
          Retruns the description of this room
 java.lang.String getFieldBgColor()
          Returns the background color of the text field
 java.lang.String getName()
          The name of this room
 java.util.Vector getRoomEntries()
          The list of the entries of the room
 ChatUser getUser(java.lang.String strPseudo)
          Returns the ChatUser object whose pseudo is specified in parameter
 int getUserCount()
          Returns the numbers of users in the room
 java.util.Enumeration getUsers()
          Returns the list of the users of this room
 void removeOldPseudo(java.lang.String strPseudo)
          Removes the user which has this pseudo in the room.
 void removeUser(java.lang.String strPseudo)
          Removes the user which has this pseudo in the room.
 void setAdminPassword(java.lang.String strAdminPassword)
          Sets the password of the room
 void setBgColor(java.lang.String strBgColor)
          Sets the background color of the room
 void setButtonBgColor(java.lang.String strButtonBgColor)
          Sets the button background color
 void setButtonFgColor(java.lang.String strButtonFgColor)
          Sets the foreground color of the button
 void setDescription(java.lang.String strDescription)
          Sets the description of this room whith the specified string
 void setFieldBgColor(java.lang.String strFieldBgColor)
          Sets the background color of the text field
 void setLastAccessTime(java.lang.String strPseudo)
          Sets the last access to the room of the user which corresponds to the pseudo specified in parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_ROOM

public static final int INVALID_ROOM
See Also:
Constant Field Values

USER_ADDED

public static final int USER_ADDED
See Also:
Constant Field Values

USER_ALREADY_EXISTS

public static final int USER_ALREADY_EXISTS
See Also:
Constant Field Values

USER_IS_BANNED

public static final int USER_IS_BANNED
See Also:
Constant Field Values
Constructor Detail

ChatRoom

public ChatRoom(java.lang.String strName,
                java.lang.String strDescription)
Creates a new ChatRoom object.

Parameters:
strName - The name of the room
strDescription - The description of the room
Method Detail

addChatEntry

public void addChatEntry(ChatEntry entry,
                         ChatUser userRecipient)
Adds an entry to this chat room

Parameters:
entry - The chat entry to add to the room
userRecipient - The user which receives the message

addChatEntry

public void addChatEntry(ChatUser userSender,
                         ChatEntry entry,
                         ChatUser userRecipient)
Adds an entry to this chat room

Parameters:
userSender - The user which sends the message
entry - The chat entry to add to the room
userRecipient - The user which receives the message

addUser

public int addUser(ChatUser user)
Checks if the user specified in parameter is not already existent in the room and if it is not banned. If not, it is added to the room. It returns an int code which describes the status of the user.

Parameters:
user - The user to add to the room
Returns:
an int code which describes the result of the process

changePseudo

public int changePseudo(java.lang.String strPseudo,
                        java.lang.String strNewNickname)
Modifies the nick name of the user

Parameters:
strPseudo - The old pseudo
strNewNickname - The new pseudo
Returns:
The result of the process

removeOldPseudo

public void removeOldPseudo(java.lang.String strPseudo)
Removes the user which has this pseudo in the room.

Parameters:
strPseudo - The pseudo of the user to delete from the room

getUserCount

public int getUserCount()
Returns the numbers of users in the room

Returns:
The number of users as an int

removeUser

public void removeUser(java.lang.String strPseudo)
Removes the user which has this pseudo in the room.

Parameters:
strPseudo - The pseudo of the user to delete from the room

banUser

public void banUser(java.lang.String strPseudo,
                    java.lang.String strComment)
Bannes a user from the room and comments it.

Parameters:
strPseudo - The pseudo to ban
strComment - The comment to add to this ban

debanUser

public void debanUser(java.lang.String strIpAddress)
Removes an ip address from the list of those which are banned from the room

Parameters:
strIpAddress - The ip address to authorize again

getUsers

public java.util.Enumeration getUsers()
Returns the list of the users of this room

Returns:
The enumeration which contains the users of the room

getRoomEntries

public java.util.Vector getRoomEntries()
The list of the entries of the room

Returns:
A vector which contains the list of the entries

getBannedUsers

public java.util.Enumeration getBannedUsers()
Returns the list of the users banned from this room

Returns:
An enumeration of the banned users

getDescription

public java.lang.String getDescription()
Retruns the description of this room

Returns:
The string description of this room

getName

public java.lang.String getName()
The name of this room

Returns:
The string name of this room

setLastAccessTime

public void setLastAccessTime(java.lang.String strPseudo)
Sets the last access to the room of the user which corresponds to the pseudo specified in parameter

Parameters:
strPseudo - The user's pseudo

getUser

public ChatUser getUser(java.lang.String strPseudo)
Returns the ChatUser object whose pseudo is specified in parameter

Parameters:
strPseudo - The pseudo of the user to get
Returns:
The ChatUser object

setAdminPassword

public void setAdminPassword(java.lang.String strAdminPassword)
Sets the password of the room

Parameters:
strAdminPassword - The new password of the admin

getAdminPassword

public java.lang.String getAdminPassword()
The password of the admin

Returns:
The admin password

setDescription

public void setDescription(java.lang.String strDescription)
Sets the description of this room whith the specified string

Parameters:
strDescription - The description of the room

setBgColor

public void setBgColor(java.lang.String strBgColor)
Sets the background color of the room

Parameters:
strBgColor - The background color

getBgColor

public java.lang.String getBgColor()
Returns the background color of the room

Returns:
The background color of the room as a String

setButtonBgColor

public void setButtonBgColor(java.lang.String strButtonBgColor)
Sets the button background color

Parameters:
strButtonBgColor - The button's background color

getButtonBgColor

public java.lang.String getButtonBgColor()
Returns the background color of the button

Returns:
The background color of the button as a String

setButtonFgColor

public void setButtonFgColor(java.lang.String strButtonFgColor)
Sets the foreground color of the button

Parameters:
strButtonFgColor - The button's foreground color

getButtonFgColor

public java.lang.String getButtonFgColor()
Returns the foreground color of the button

Returns:
The foreground color of the button as a String

setFieldBgColor

public void setFieldBgColor(java.lang.String strFieldBgColor)
Sets the background color of the text field

Parameters:
strFieldBgColor - The text field's background color

getFieldBgColor

public java.lang.String getFieldBgColor()
Returns the background color of the text field

Returns:
The background color of the text field as a String


Copyright © 2010 Mairie de Paris. All Rights Reserved.