Beispiel #1
0
 public void setMucRoomAttributes(String domain, String roomName, Map newAttributes)
     throws NotFoundException {
   MultiUserChatService mucService = this.multiUserChatManager.getMultiUserChatService(domain);
   MUCRoom mucRoom = mucService.getChatRoom(roomName);
   if (mucRoom == null) {
     throw new NotFoundException("Room not found " + domain + " roomName " + roomName);
   }
   Map<String, String> attribs = (Map<String, String>) newAttributes;
   boolean isModerated = Boolean.parseBoolean(attribs.get("isModerated"));
   mucRoom.setModerated(isModerated);
   boolean isLogEnabled = Boolean.parseBoolean(attribs.get("isLogEnabled"));
   mucRoom.setLogEnabled(isLogEnabled);
   boolean isMembersOnly = Boolean.parseBoolean(attribs.get("isMembersOnly"));
   mucRoom.setMembersOnly(isMembersOnly);
   boolean isPublicRoom = Boolean.parseBoolean(attribs.get("isPublicRoom"));
   mucRoom.setPublicRoom(isPublicRoom);
   boolean isLoginRestrictedToNickName =
       Boolean.parseBoolean(attribs.get("isLoginRestrictedToNickName"));
   mucRoom.setLoginRestrictedToNickname(isLoginRestrictedToNickName);
   boolean isRegistrationEnabled = Boolean.parseBoolean(attribs.get("isRegistrationEnabled"));
   mucRoom.setRegistrationEnabled(isRegistrationEnabled);
   boolean canAnyoneDiscoverJID = Boolean.parseBoolean(attribs.get("canAnyoneDiscoverJID"));
   mucRoom.setCanAnyoneDiscoverJID(canAnyoneDiscoverJID);
   boolean canChangeNickName = Boolean.parseBoolean(attribs.get("canChangeNickName"));
   mucRoom.setChangeNickname(canChangeNickName);
   boolean canOccupantsInvite = Boolean.parseBoolean(attribs.get("canOccupantsInvite"));
   mucRoom.setCanOccupantsInvite(canOccupantsInvite);
   boolean canOccupantsChangeSubject =
       Boolean.parseBoolean(attribs.get("canOccupantsChangeSubject"));
   mucRoom.setCanOccupantsChangeSubject(canOccupantsChangeSubject);
 }
Beispiel #2
0
  public void createChatRoom(
      String domain,
      String ownerJid,
      String roomName,
      boolean listRoomInDirectory,
      boolean makeRoomModerated,
      boolean makeRoomMembersOnly,
      boolean allowOccupantsToInviteOthers,
      boolean isPublicRoom,
      boolean logRoomConversations,
      boolean isPersistent,
      String password,
      String description,
      String conferenceExtension)
      throws Exception {
    MultiUserChatService mucService =
        XMPPServer.getInstance().getMultiUserChatManager().getMultiUserChatService(domain);
    if (mucService == null) {
      mucService =
          XMPPServer.getInstance()
              .getMultiUserChatManager()
              .createMultiUserChatService(domain, description, false);
      Collection<JID> admins = XMPPServer.getInstance().getAdmins();
      JID admin = admins.iterator().next();
      mucService.addUserAllowedToCreate(admin.toBareJID());
    }
    MUCRoom mucRoom = mucService.getChatRoom(roomName, new JID(ownerJid));

    mucRoom.setPersistent(isPersistent);
    mucRoom.setCanAnyoneDiscoverJID(true);
    mucRoom.setChangeNickname(true);
    mucRoom.setModerated(makeRoomModerated);
    mucRoom.setMembersOnly(makeRoomMembersOnly);
    mucRoom.setRegistrationEnabled(true);
    mucRoom.setPublicRoom(isPublicRoom);
    mucRoom.setCanAnyoneDiscoverJID(true);
    mucRoom.setCanOccupantsInvite(allowOccupantsToInviteOthers);
    mucRoom.setDescription(description);
    mucRoom.setPassword(password);
    mucRoom.setCanOccupantsChangeSubject(true);
    mucRoom.setChangeNickname(true);
    mucRoom.setLogEnabled(logRoomConversations);

    mucRoom.setDescription(description);

    mucRoom.setPassword(password);
    /* The conference extension is the voice conf bridge extension */
    this.roomNameToConferenceExtensionMap.put(domain + "." + roomName, conferenceExtension);
  }