示例#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;
 }
示例#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;
  }
示例#3
0
 public synchronized boolean removeChatroom(Chatroom chatroom) {
   checkNotNull(chatroom);
   if (!isChatroomExisting(chatroom.getName())) return false;
   chatrooms.remove(chatroom.getName());
   return true;
 }
示例#4
0
 void initServerData(int maxClients) {
   this.defaultChat = Chatroom.createDefault(defaultChatName, maxClients);
   this.chatrooms.put(defaultChatName, defaultChat);
 }