Received messages from different contacts appear in the same tab - the current one. Trying to solve the problem.

cusax-fix
Yana Stamcheva 20 years ago
parent a16b56bc23
commit 43c90a1f4c

@ -291,9 +291,11 @@ public void windowClosing(WindowEvent e) {
== null){
// If there's no open tab for the given contact.
tabbedChatWindow.addChatTab(this.contactItem,
ChatPanel chatPanel = tabbedChatWindow.addChatTab(this.contactItem,
contactStatus);
tabbedChatWindow.setCurrentChatPanel(chatPanel);
if(tabbedChatWindow.getTabCount() > 1)
tabbedChatWindow.setSelectedContactTab(this.contactItem);
@ -436,9 +438,10 @@ public void windowClosing(WindowEvent e) {
if(contactTabsTable.get(metaContact.getMetaUID())
== null){
// If there's no open tab for the given contact.
tabbedChatWindow.addChatTab(metaContact, contactStatus);
tabbedChatWindow.getCurrentChatPanel().getConversationPanel()
ChatPanel chatPanel
= tabbedChatWindow.addChatTab(metaContact, contactStatus);
chatPanel.getConversationPanel()
.processMessage(evt.getSourceContact().getDisplayName(),
calendar, ChatMessage.INCOMING_MESSAGE,
evt.getSourceMessage().getContent());

@ -225,18 +225,19 @@ public void addChat(MetaContact contact,
*
* @param contact The MetaContact added to the chat.
*/
public void addChatTab(MetaContact contact, PresenceStatus status){
public ChatPanel addChatTab(MetaContact contact, PresenceStatus status){
OperationSetBasicInstantMessaging contactIMOperationSet
= this.mainFrame.getProtocolIM
(contact.getDefaultContact().getProtocolProvider());
ChatPanel chatPanel = null;
if(chatTabbedPane == null){
//Initialize the tabbed pane for the first time
chatPanel = new ChatPanel(this, contactIMOperationSet);
this.setCurrentChatPanel(new ChatPanel(this, contactIMOperationSet));
this.currentChatPanel.addContactToChat(contact, status);
chatPanel.addContactToChat(contact, status);
chatTabbedPane = new SIPCommTabbedPane(true);
@ -249,44 +250,45 @@ public void closeOperation(MouseEvent e){
}
});
this.getContentPane().add( this.currentChatPanel,
this.getContentPane().add( chatPanel,
BorderLayout.CENTER);
//Set the tab index even it's not yet shown in tabbed pane
this.currentChatPanel.setTabIndex(0);
chatPanel.setTabIndex(0);
this.contactTabsTable.put(contact.getMetaUID(),
currentChatPanel);
chatPanel);
this.setTitle(contact.getDisplayName());
}
else{
PresenceStatus defaultStatus
= contact.getDefaultContact().getPresenceStatus();
PresenceStatus defaultStatus
= contact.getDefaultContact().getPresenceStatus();
if(chatTabbedPane.getTabCount() > 0){
//The tabbed pane contains already tabs.
this.setCurrentChatPanel(new ChatPanel(this, contactIMOperationSet));
//The tabbed pane contains already tabs.
chatPanel = new ChatPanel(this, contactIMOperationSet);
this.currentChatPanel.addContactToChat(contact, status);
chatPanel.addContactToChat(contact, status);
chatTabbedPane.addTab(contact.getDisplayName(),
new ImageIcon(Constants.getStatusIcon(defaultStatus)),
currentChatPanel);
chatPanel);
chatTabbedPane.getParent().validate();
//Set the tab index to the newly added chat panel
this.currentChatPanel
chatPanel
.setTabIndex(chatTabbedPane.getTabCount() - 1);
this.contactTabsTable.put(contact.getMetaUID(),
currentChatPanel);
chatPanel);
}
else{
PresenceStatus currentContactStatus
= currentChatPanel.getDefaultContact()
.getDefaultContact().getPresenceStatus();
ChatPanel firstChatPanel = (ChatPanel)contactTabsTable.elements().nextElement();
PresenceStatus currentContactStatus
= firstChatPanel.getDefaultContact()
.getDefaultContact().getPresenceStatus();
//Add the first two tabs to the tabbed pane.
chatTabbedPane.addTab
(currentChatPanel.getDefaultContact().getDisplayName(),
@ -294,16 +296,15 @@ public void closeOperation(MouseEvent e){
(currentContactStatus)),
currentChatPanel);
this.setCurrentChatPanel
(new ChatPanel(this, contactIMOperationSet));
chatPanel = new ChatPanel(this, contactIMOperationSet);
this.currentChatPanel.addContactToChat(contact, status);
chatPanel.addContactToChat(contact, status);
chatTabbedPane.addTab( contact.getDisplayName(),
new ImageIcon(Constants.getStatusIcon(defaultStatus)),
currentChatPanel);
chatPanel);
currentChatPanel
chatPanel
.setTabIndex(chatTabbedPane.getTabCount() - 1);
this.contactTabsTable.put(contact.getMetaUID(),
@ -313,6 +314,7 @@ public void closeOperation(MouseEvent e){
this.getContentPane().add(chatTabbedPane, BorderLayout.CENTER);
this.getContentPane().validate();
}
return chatPanel;
}
/**

Loading…
Cancel
Save