Fixes chat room reconnect related issues (duplicated member's list, unable to send messages after reconnect).

cusax-fix
Yana Stamcheva 15 years ago
parent fd02ba901d
commit c500090d14

@ -1844,6 +1844,15 @@ public void removeChatContact(ChatContact<?> chatContact)
chatContactListPanel.removeContact(chatContact);
}
/**
* Removes all chat contacts from the contact list of the chat.
*/
public void removeAllChatContacts()
{
if (chatContactListPanel != null)
chatContactListPanel.removeAllChatContacts();
}
/**
* Updates the contact status.
* @param chatContact the chat contact to update

@ -51,6 +51,11 @@ public interface ChatSessionRenderer
*/
public void removeChatContact(ChatContact<?> chatContact);
/**
* Removes all chat contacts from the contact list of the chat.
*/
public void removeAllChatContacts();
/**
* Updates the status of the given chat transport.
*

@ -191,4 +191,21 @@ public void removeElement(ChatContact<?> chatContact)
fireIntervalRemoved(this, index, index);
}
}
/**
* Removes all the elements from this model.
*/
public void removeAllElements()
{
if (chatContacts == null || chatContacts.size() <= 0)
return;
synchronized(chatContacts)
{
int contactsSize = chatContacts.size();
chatContacts.clear();
fireIntervalRemoved(this, 0, contactsSize - 1);
}
}
}

@ -132,6 +132,14 @@ public void removeContact(ChatContact<?> chatContact)
memberListModel.removeElement(chatContact);
}
/**
* Removes all chat contacts from the contact list of the chat.
*/
public void removeAllChatContacts()
{
memberListModel.removeAllElements();
}
/**
* In the corresponding <tt>ChatContactPanel</tt> changes the name of the
* given <tt>Contact</tt>.

@ -152,11 +152,12 @@ public boolean containsChatRoom(ChatRoomWrapper chatRoom)
*/
public ChatRoomWrapper findChatRoomWrapperForChatRoom(ChatRoom chatRoom)
{
// compare ids, cause saved chatrooms don't have ChatRoom object
// but Id's are the same
// Compare ids, cause saved chatrooms don't have ChatRoom object
// but Id's are the same.
for (ChatRoomWrapper chatRoomWrapper : chatRoomsOrderedCopy)
{
if (chatRoomWrapper.getChatRoomID().equals(chatRoom.getIdentifier()))
if (chatRoomWrapper.getChatRoomID()
.equals(chatRoom.getIdentifier()))
{
return chatRoomWrapper;
}

@ -494,9 +494,23 @@ public boolean isDescriptorPersistent()
*/
public void loadChatRoom(ChatRoom chatRoom)
{
// Re-init the chat transport, as we have a new chat room object.
currentChatTransport
= new ConferenceChatTransport(this, chatRoomWrapper.getChatRoom());
chatTransports.clear();
chatTransports.add(currentChatTransport);
// Remove all existing contacts.
sessionRenderer.removeAllChatContacts();
// Add the new list of members.
for (ChatRoomMember member : chatRoom.getMembers())
{
sessionRenderer.addChatContact(new ConferenceChatContact(member));
}
// Add all listeners to the new chat room.
chatRoom.addPropertyChangeListener(this);
chatRoom.addMemberPresenceListener(this);

@ -280,8 +280,10 @@ public ChatRoomWrapper findChatRoomWrapperFromChatRoom(ChatRoom chatRoom)
{
// stored chatrooms has no chatroom, but their
// id is the same as the chatroom we are searching wrapper
// for
if(chatRoomWrapper.getChatRoom() == null)
// for. Also during reconnect we don't have the same chat
// id for another chat room object.
if(chatRoomWrapper.getChatRoom() == null
|| !chatRoomWrapper.getChatRoom().equals(chatRoom))
{
chatRoomWrapper.setChatRoom(chatRoom);
}

Loading…
Cancel
Save