/**
  * Removes a specific <tt>UserCapsNodeListener</tt> from the list of
  * <tt>UserCapsNodeListener</tt>s interested in events notifying about changes in the list of user
  * caps nodes of this <tt>EntityCapsManager</tt>.
  *
  * @param listener the <tt>UserCapsNodeListener</tt> which is no longer interested in events
  *     notifying about changes in the list of user caps nodes of this <tt>EntityCapsManager</tt>
  */
 public void removeUserCapsNodeListener(UserCapsNodeListener listener) {
   if (listener != null) {
     synchronized (userCapsNodeListeners) {
       userCapsNodeListeners.remove(listener);
     }
   }
 }
  private void mockLeave(MockRoomMember member) {
    synchronized (members) {
      if (!members.remove(member)) {
        throw new RuntimeException("Member is not in the room " + member);
      }

      fireMemberPresenceEvent(member, member, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, null);
    }
  }
  @Override
  public void leave() {
    if (!isJoined) return;

    isJoined = false;

    synchronized (members) {
      members.remove(me);

      fireMemberPresenceEvent(me, me, ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, null);
    }

    me = null;
  }
  /**
   * Permanently removes locally stored message history for the chatroom, remove any recent contacts
   * if any.
   */
  public void eraseLocallyStoredHistory(ChatRoom room) {
    ComparableEvtObj toRemove = null;
    synchronized (recentMessages) {
      for (ComparableEvtObj msg : recentMessages) {
        if (msg.getRoom() != null && msg.getRoom().equals(room)) {
          toRemove = msg;
          break;
        }
      }

      if (toRemove == null) return;

      recentMessages.remove(toRemove);
    }

    if (recentQuery != null) recentQuery.fireContactRemoved(toRemove);
  }
  /**
   * Retrieves a server stored contact list and checks whether it contains all contacts that have
   * been added there during the initialization phase by the testerAgent.
   */
  public void testRetrievingServerStoredContactList() {
    ContactGroup rootGroup = opSetPersPresence1.getServerStoredContactListRoot();

    logger.debug("=========== Server Stored Contact List =================");

    logger.debug(
        "rootGroup="
            + rootGroup.getGroupName()
            + " rootGroup.childContacts="
            + rootGroup.countContacts()
            + "rootGroup.childGroups="
            + rootGroup.countSubgroups()
            + "Printing rootGroupContents=\n"
            + rootGroup.toString());

    Hashtable<String, List<String>> expectedContactList =
        GibberishSlickFixture.preInstalledBuddyList;

    logger.debug("============== Expected Contact List ===================");
    logger.debug(expectedContactList);

    // Go through the contact list retrieved by the persistence presence set
    // and remove the name of every contact and group that we find there from
    // the expected contct list hashtable.
    Iterator<ContactGroup> groups = rootGroup.subgroups();
    while (groups.hasNext()) {
      ContactGroup group = groups.next();

      List<String> expectedContactsInGroup = expectedContactList.get(group.getGroupName());

      // When sending the offline message
      // the sever creates a group NotInContactList,
      // because the buddy we are sending message to is not in
      // the contactlist. So this group must be ignored
      if (!group.getGroupName().equals("NotInContactList")) {
        assertNotNull(
            "Group "
                + group.getGroupName()
                + " was returned by "
                + "the server but was not in the expected contact list.",
            expectedContactsInGroup);

        Iterator<Contact> contactsIter = group.contacts();
        while (contactsIter.hasNext()) {
          String contactID = contactsIter.next().getAddress();
          expectedContactsInGroup.remove(contactID);
        }

        // If we've removed all the sub contacts, remove the group too.
        if (expectedContactsInGroup.size() == 0) expectedContactList.remove(group.getGroupName());
      }
    }

    // whatever we now have in the expected contact list snapshot are groups,
    // that have been added by the testerAgent but that were not retrieved
    // by the persistent presence operation set.
    assertTrue(
        "The following contacts were on the server sidec contact "
            + "list, but were not returned by the pers. pres. op. set"
            + expectedContactList.toString(),
        expectedContactList.isEmpty());
  }
 /**
  * Removes a specific <tt>SoundLevelListener</tt> of the list of listeners interested in and
  * notified about changes in conference members sound level.
  *
  * @param listener the <tt>SoundLevelListener</tt> to remove
  */
 public void removeConferenceMembersSoundLevelListener(
     ConferenceMembersSoundLevelListener listener) {
   synchronized (confMemebrSoundLevelListeners) {
     confMemebrSoundLevelListeners.remove(listener);
   }
 }
 /**
  * Removes a specific <tt>SoundLevelListener</tt> of the list of listeners interested in and
  * notified about changes in stream sound level related information.
  *
  * @param listener the <tt>SoundLevelListener</tt> to remove
  */
 public void removeStreamSoundLevelListener(SoundLevelListener listener) {
   synchronized (soundLevelListeners) {
     soundLevelListeners.remove(listener);
   }
 }