aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java16
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java22
-rwxr-xr-xsrc/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java9
3 files changed, 37 insertions, 10 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
index 30c8215..d255db7 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java
@@ -1999,6 +1999,13 @@ public class ChatPanel
public void removeChatTransport(ChatTransport chatTransport)
{
writeMessagePanel.removeChatTransport(chatTransport);
+
+ if (chatSession != null
+ && !chatTransport.equals(chatSession.getCurrentChatTransport()))
+ return;
+
+ setChatIcon(new ImageIcon(
+ Constants.getStatusIcon(chatTransport.getStatus())));
}
/**
@@ -2007,7 +2014,7 @@ public class ChatPanel
* @param chatTransport the chat transport to be selected
* @param isMessageOrFileTransferReceived Boolean telling us if this change
* of the chat transport correspond to an effective switch to this new
- * transform (a mesaage received from this transport, or a file transfer
+ * transform (a message received from this transport, or a file transfer
* request received, or if the resource timeouted), or just a status update
* telling us a new chatTransport is now available (i.e. another device has
* startup).
@@ -2019,6 +2026,13 @@ public class ChatPanel
writeMessagePanel.setSelectedChatTransport(
chatTransport,
isMessageOrFileTransferReceived);
+
+ if (chatSession != null
+ && !chatTransport.equals(chatSession.getCurrentChatTransport()))
+ return;
+
+ setChatIcon(new ImageIcon(
+ Constants.getStatusIcon(chatTransport.getStatus())));
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java
index c334fc8..a6590c0 100644
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransportSelectorBox.java
@@ -249,13 +249,21 @@ public class ChatTransportSelectorBox
ChatTransport newChatTransport
= getParentContactTransport(chatTransport);
- ChatTransport onlineTransport = getOnlineTransport();
+ ChatTransport onlineTransport = getTransport(true);
if(newChatTransport != null
&& newChatTransport.getStatus().isOnline())
setSelected(newChatTransport);
else if (onlineTransport != null)
setSelected(onlineTransport);
+ else
+ {
+ // update when going to offline
+ ChatTransport offlineTransport = getTransport(false);
+
+ if(offlineTransport != null)
+ setSelected(offlineTransport);
+ }
}
menuItem = transportMenuItems.get(chatTransport);
@@ -372,15 +380,17 @@ public class ChatTransportSelectorBox
/**
* Searches online contacts in the send via combo box.
*
- * @param chatTransport the chat transport to check
- * @return TRUE if the send via combo box contains online contacts,
- * otherwise returns FALSE.
+ * @param online if <tt>TRUE</tt> will return online transport, otherwise
+ * will return offline one.
+ * @return online or offline contact transport from combo box.
*/
- private ChatTransport getOnlineTransport()
+ private ChatTransport getTransport(boolean online)
{
for (ChatTransport comboChatTransport : transportMenuItems.keySet())
{
- if(comboChatTransport.getStatus().isOnline())
+ if(online && comboChatTransport.getStatus().isOnline())
+ return comboChatTransport;
+ else if(!online && !comboChatTransport.getStatus().isOnline())
return comboChatTransport;
}
return null;
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
index 9cd92a6..35baa43 100755
--- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
+++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWritePanel.java
@@ -91,7 +91,7 @@ public class ChatWritePanel
/**
* A timer used to reset the transport resource to the bare ID if there was
- * no activity from this resource since a buch a time.
+ * no activity from this resource since a bunch of time.
*/
private java.util.Timer outdatedResourceTimer = null;
@@ -1104,9 +1104,12 @@ public class ChatWritePanel
}
}
- // Sets the new reousrce transport is really effective (i.e. we have
+ // Sets the new resource transport is really effective (i.e. we have
// received a message from this resource).
- if(transportSelectorBox != null && isMessageOrFileTransferReceived)
+ // or if it is the last one
+ if(transportSelectorBox != null
+ && (isMessageOrFileTransferReceived
+ || transportSelectorBox.getMenu().getItemCount() == 1))
{
transportSelectorBox.setSelected(chatTransport);
}