Ejemplo n.º 1
0
 public void removeRoom(final String account, final String room) {
   removeInvite(getInvite(account, room));
   RoomChat roomChat = getRoomChat(account, room);
   if (roomChat == null) return;
   leaveRoom(account, room);
   MessageManager.getInstance().removeChat(roomChat);
   RosterManager.getInstance().onContactChanged(account, room);
   Application.getInstance()
       .runInBackground(
           new Runnable() {
             @Override
             public void run() {
               RoomTable.getInstance().remove(account, room);
             }
           });
 }
Ejemplo n.º 2
0
 /**
  * Creates or updates existed room.
  *
  * @param account
  * @param room
  * @param nickname
  * @param password
  */
 public void createRoom(
     String account, String room, String nickname, String password, boolean join, String subject) {
   removeInvite(getInvite(account, room));
   AbstractChat chat = MessageManager.getInstance().getChat(account, room);
   RoomChat roomChat;
   if (chat == null || !(chat instanceof RoomChat)) {
     if (chat != null) MessageManager.getInstance().removeChat(chat);
     roomChat = new RoomChat(account, room, nickname, password, subject);
     MessageManager.getInstance().addChat(roomChat);
   } else {
     roomChat = (RoomChat) chat;
     roomChat.setNickname(nickname);
     roomChat.setPassword(password);
     roomChat.setSubject(subject);
   }
   requestToWriteRoom(account, room, nickname, password, join);
   if (join) joinRoom(account, room, true);
 }