diff --git a/src/java/org/jivesoftware/resource/SparkRes.java b/src/java/org/jivesoftware/resource/SparkRes.java index 7bff121c..3ac41112 100644 --- a/src/java/org/jivesoftware/resource/SparkRes.java +++ b/src/java/org/jivesoftware/resource/SparkRes.java @@ -243,9 +243,13 @@ public class SparkRes { public static final String AIM_TRANSPORT_INACTIVE_IMAGE = "AIM_TRANSPORT_INACTIVE_IMAGE"; public static final String MSN_TRANSPORT_ACTIVE_IMAGE = "MSN_TRANSPORT_ACTIVE_IMAGE"; public static final String MSN_TRANSPORT_INACTIVE_IMAGE = "MSN_TRANSPORT_INACTIVE_IMAGE"; - public static final String YAHOO_TRANSPORT_ACTIVE_IMAGE = "YAHOO_TRANSPORT_ACTIVE_IMAGE"; + public static final String YAHOO_TRANSPORT_ACTIVE_IMAGE = "YAHOO_TRANSPORT_ACTIVE_IMAGE"; public static final String YAHOO_TRANSPORT_INACTIVE_IMAGE = "YAHOO_TRANSPORT_INACTIVE_IMAGE"; - + public static final String IM_AVAILABLE_STALE_IMAGE = "IM_AVAILABLE_STALE_IMAGE"; + public static final String IM_AWAY_STALE_IMAGE = "IM_AWAY_STALE_IMAGE"; + public static final String IM_DND_STALE_IMAGE = "IM_AWAY_STALE_IMAGE"; + public static final String IM_FREE_CHAT_STALE_IMAGE = "IM_FREE_CHAT_STALE_IMAGE"; + public static final String IM_UNAVAILABLE_STALE_IMAGE = "IM_UNAVAILABLE_STALE_IMAGE"; static ClassLoader cl = SparkRes.class.getClassLoader(); diff --git a/src/java/org/jivesoftware/resource/spark.properties b/src/java/org/jivesoftware/resource/spark.properties index 5b5e5603..6f870a97 100644 --- a/src/java/org/jivesoftware/resource/spark.properties +++ b/src/java/org/jivesoftware/resource/spark.properties @@ -89,7 +89,7 @@ MAIL_16x16 = images/mail_16x16.png MAIL_FORWARD_16x16 = images/mail_forward_16x16.png MAIL_INTO_16x16 = images/mail_into_16x16.png RED_BALL = images/red-ball.png -GREEN_BALL = images/green-ball.png +GREEN_BALL = images/im_available.png BLUE_BALL = images/blue-ball.png YELLOW_BALL = images/yellow-ball.png PAWN_GLASS_GREEN = images/pawn_glass_green.png @@ -180,7 +180,7 @@ SERVER_ICON = images/server.png BOOKMARK_ICON = images/bookmark.png ADD_BOOKMARK_ICON = images/bookmark_add.png DELETE_BOOKMARK_ICON = images/bookmark_delete.png -CLEAR_BALL_ICON = images/bullet_ball_glass_clear.png +CLEAR_BALL_ICON = images/im_unavailable.png CALL_ICON = images/call.png PROFILE_ICON = images/profile.png SEND_FILE_ICON = images/document_into.png @@ -245,4 +245,11 @@ AIM_TRANSPORT_INACTIVE_IMAGE = images/aim-gray.gif MSN_TRANSPORT_ACTIVE_IMAGE = images/msn.gif MSN_TRANSPORT_INACTIVE_IMAGE = images/msn-gray.gif YAHOO_TRANSPORT_ACTIVE_IMAGE = images/yahoo.gif -YAHOO_TRANSPORT_INACTIVE_IMAGE = images/yahoo-gray.gif \ No newline at end of file +YAHOO_TRANSPORT_INACTIVE_IMAGE = images/yahoo-gray.gif + +#Stale Images +IM_AVAILABLE_STALE_IMAGE = images/im_available_stale.png +IM_AWAY_STALE_IMAGE = images/im_away_stale.png +IM_DND_STALE_IMAGE = images/im_dnd_stale.png +IM_FREE_CHAT_STALE_IMAGE = images/im_free_chat_stale.png +IM_UNAVAILABLE_STALE_IMAGE = images/im_unavailable_stale.png \ No newline at end of file diff --git a/src/java/org/jivesoftware/spark/ui/ChatContainer.java b/src/java/org/jivesoftware/spark/ui/ChatContainer.java index a25b2ee6..47d5c951 100644 --- a/src/java/org/jivesoftware/spark/ui/ChatContainer.java +++ b/src/java/org/jivesoftware/spark/ui/ChatContainer.java @@ -34,20 +34,6 @@ import org.jivesoftware.spark.util.log.Log; import org.jivesoftware.sparkimpl.settings.local.LocalPreferences; import org.jivesoftware.sparkimpl.settings.local.SettingsManager; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.KeyStroke; -import javax.swing.SwingUtilities; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - import java.awt.Color; import java.awt.Component; import java.awt.Dimension; @@ -69,6 +55,20 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + /** * Contains all ChatRoom objects within Spark. * @@ -705,7 +705,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C } final int ok = JOptionPane.showConfirmDialog(SparkManager.getMainWindow(), message, - "Confirmation", JOptionPane.YES_NO_OPTION); + "Confirmation", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) { room.closeChatRoom(); return; @@ -924,6 +924,11 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C final JLabel titleLabel = tab.getTitleLabel(); + if(room instanceof ChatRoomImpl){ + Icon icon = ((ChatRoomImpl)room).getTabIcon(); + tab.setIcon(icon); + } + titleLabel.setForeground(Color.black); titleLabel.setFont(defaultFont); } @@ -997,7 +1002,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C }); // Start timer - checkRoomsForTimeout(); + checkForStaleRooms(); } @@ -1147,7 +1152,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C /** * Checks every room every 30 seconds to see if it's timed out. */ - private void checkRoomsForTimeout() { + private void checkForStaleRooms() { int delay = 1000; // delay for 1 minute int period = 60000; // repeat every 30 seconds. Timer timer = new Timer(); @@ -1162,6 +1167,32 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C final JLabel titleLabel = tab.getTitleLabel(); titleLabel.setForeground(Color.gray); titleLabel.setFont(tab.getDefaultFont()); + + String jid = ((ChatRoomImpl)chatRoom).getParticipantJID(); + Presence presence = SparkManager.getConnection().getRoster().getPresence(jid); + + if (presence == null || presence.getType() == Presence.Type.unavailable) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_UNAVAILABLE_STALE_IMAGE)); + } + else if (presence != null) { + Presence.Mode mode = presence.getMode(); + if (mode == Presence.Mode.available) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AVAILABLE_STALE_IMAGE)); + } + else if (mode == Presence.Mode.away) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AWAY_STALE_IMAGE)); + } + else if (mode == Presence.Mode.chat) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_FREE_CHAT_STALE_IMAGE)); + } + else if (mode == Presence.Mode.dnd) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE)); + } + else if (mode == Presence.Mode.xa) { + tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE)); + } + } + titleLabel.validate(); titleLabel.repaint(); }