@Override public void chatRoomProviderWrapperRemoved(ChatRoomProviderWrapper provider) { LinkedList<ChatRoomSourceContact> tmpContactResults; synchronized (contactResults) { tmpContactResults = new LinkedList<ChatRoomSourceContact>(contactResults); for (ChatRoomSourceContact contact : tmpContactResults) { if (contact.getProvider().equals(provider.getProtocolProvider())) { contactResults.remove(contact); fireContactRemoved(contact); } } } }
/** * Finds the <tt>ChatRoomWrapper</tt> instance associated with the source contact. * * @param contact the source contact. * @return the <tt>ChatRoomWrapper</tt> instance. */ public ChatRoomWrapper findChatRoomWrapperFromSourceContact(SourceContact contact) { if (!(contact instanceof ChatRoomSourceContact)) return null; ChatRoomSourceContact chatRoomContact = (ChatRoomSourceContact) contact; return chatRoomList.findChatRoomWrapperFromChatRoomID( chatRoomContact.getChatRoomID(), chatRoomContact.getProvider()); }
/** * Test equality of contact to chat room wrapper. This method does not rely on a chat room * instance, since that may not be available in case of removal. * * @param contact the contact * @param chatRoomWrapper the chat room wrapper * @return returns <tt>true</tt> if they are equal, or <tt>false</tt> if they are different. */ private boolean contactEqualsChatRoom( final ChatRoomSourceContact contact, final ChatRoomWrapper chatRoomWrapper) { return contact.getProvider() == chatRoomWrapper.getParentProvider().getProtocolProvider() && contact.getContactAddress().equals(chatRoomWrapper.getChatRoomID()); }
/** * Test equality of contact to chat room. This test recognizes that chat rooms may have equal * names but connected to different accounts. * * @param contact the contact * @param chatRoom the chat room * @return returns <tt>true</tt> if they are equal, or <tt>false</tt> if they are different */ private boolean contactEqualsChatRoom( final ChatRoomSourceContact contact, final ChatRoom chatRoom) { return contact.getProvider() == chatRoom.getParentProvider() && chatRoom.getIdentifier().equals(contact.getContactAddress()); }