Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jChatBox.Chat
Class Chatroom

    java.lang.Object
      |
      +--jChatBox.Chat.Chatroom

public class Chatroom
extends java.lang.Object
implements java.io.Serializable, LogListener

This class implements all features for jChatBox rooms.
Description :
- open/close chatroom.
- setup chatroom's name,topic,...
- reopen chatroom.
- add/remove user to chatroom.
- blackList management.
- Chatroom management (MAX users).

See Also:
  Serialized Form

Constructor Summary
`Chatroom(ChatroomParams params)` Chatroom constructor.

Method Summary
`void` | `addMsg(Msg msg)` Adds message to Chat.
`void` | `addToBlacklist(ChatroomUser user, java.lang.String reason)` Add user to blacklist.
`void` | `addUser(ChatroomUser newUser)` Adds user to Chatroom.
`void` | `close()` Close the Chatroom.
`Blacklist` | `getBlacklist()` Returns Blacklist.
`java.util.Vector` | `getChat()` Returns the whole Chat.
`java.util.Vector` | `getChat(java.lang.String username)` Returns the Chat content for an user only.
`java.util.Date` | `getDate()` Returns opening date.
`ChatroomParams` | `getParams()` Returns Chatroom's parameters.
`int` | `getTotalUsers()` Counts Users.
`ChatroomUser` | `getUser(java.lang.String name)` Returns an User.
`java.util.Hashtable` | `getUsers()` Returns Users.
`void` | `open()` Opens the Chatroom.
`void` | `performLogin(ChatroomUser user)` LogListener dummy implementation.
`void` | `performLogout(ChatroomUser user)` Remove user from chatroom is its HttpSession timed out or invalidated.
`void` | `removeFromBlacklist(java.lang.String ip)` Remove IP from blacklist.
`void` | `removeUser(java.lang.String name)` Removes an User.
`void` | `reOpen()` ReOpen the Chatroom (Should be used after servlet container crash ot stop).
`void` | `resetBlacklist()` Reset Blacklist.
`void` | `updateParams(ChatroomParams params)` Updates Chatroom's parameters.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Chatroom

    public Chatroom(ChatroomParams params)

  Chatroom constructor.

Method Detail

### open

    public void open()

  Opens the Chatroom.

### reOpen

    public void reOpen()

  ReOpen the Chatroom (Should be used after servlet container crash ot stop).
  We keep the whole thanks to Serialization but we lost all user's session
  because we're not sure HTTPSession is serializable (depending on Servlet/JSP engine).
  We update chatroom's opening date too.

### close

    public void close()

  Close the Chatroom.

### getDate

    public java.util.Date getDate()

  Returns opening date.

### addUser

    public void addUser(ChatroomUser newUser)
                 throws ChatException

  Adds user to Chatroom.
  Check Chatroom's state.
  Check blacklist entries.
  Check quota. (No apply if SYSTEM user)
  Check duplicate nickname.
  Allow SystemLogin only for SYSTEM users (no case sensitive).

### getUser

    public ChatroomUser getUser(java.lang.String name)

  Returns an User.

### getTotalUsers

    public int getTotalUsers()

  Counts Users.

### getParams

    public ChatroomParams getParams()

  Returns Chatroom's parameters.

### updateParams

    public void updateParams(ChatroomParams params)

  Updates Chatroom's parameters.

### addToBlacklist

    public void addToBlacklist(ChatroomUser user,
                               java.lang.String reason)

  Add user to blacklist.

### removeFromBlacklist

    public void removeFromBlacklist(java.lang.String ip)

  Remove IP from blacklist.

### resetBlacklist

    public void resetBlacklist()

  Reset Blacklist.

### getBlacklist

    public Blacklist getBlacklist()

  Returns Blacklist.

### removeUser

    public void removeUser(java.lang.String name)
                    throws ChatException

  Removes an User.

### addMsg

    public void addMsg(Msg msg)
                throws ChatException

  Adds message to Chat.

### getChat

    public java.util.Vector getChat()

  Returns the whole Chat.

### getChat

    public java.util.Vector getChat(java.lang.String username)

  Returns the Chat content for an user only.
  We filter on "To" field. (To==username OR To==ALL OR To=BROADCAST OR myPrivateMsg)
  myPrivateMsg = (Type==PRIVATE AND From==username)

### getUsers

    public java.util.Hashtable getUsers()

  Returns Users.

### performLogout

    public void performLogout(ChatroomUser user)

  Remove user from chatroom is its HttpSession timed out or invalidated.
  Specified by:
    performLogout in interface LogListener

### performLogin

    public void performLogin(ChatroomUser user)

  LogListener dummy implementation.
  Specified by:
    performLogin in interface LogListener

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD