Ejemplo n.º 1
0
 public synchronized boolean addChatroom(Chatroom chatroom) {
   checkNotNull(chatroom);
   if (isChatroomExisting(chatroom.getName())) return false;
   if (chatroom.getName().equals(defaultChatName)) return false;
   chatrooms.put(chatroom.getName(), chatroom);
   return true;
 }
Ejemplo n.º 2
0
  public boolean renameChatroom(Chatroom chatroom, String newName) {
    checkNotNull(chatroom);
    checkNotNull(newName);
    if (isChatroomExisting(newName)) return false;
    if (newName.equals(defaultChatName)) return false;

    String oldName = chatroom.getName();
    chatrooms.remove(oldName);
    chatrooms.put(newName, chatroom);
    return true;
  }
Ejemplo n.º 3
0
 public synchronized boolean removeChatroom(Chatroom chatroom) {
   checkNotNull(chatroom);
   if (!isChatroomExisting(chatroom.getName())) return false;
   chatrooms.remove(chatroom.getName());
   return true;
 }
Ejemplo n.º 4
0
 void initServerData(int maxClients) {
   this.defaultChat = Chatroom.createDefault(defaultChatName, maxClients);
   this.chatrooms.put(defaultChatName, defaultChat);
 }