changeset 16953:2d2c2913548b

merge of '6c5cdf9bfd5c1acf1c24c55338915947e844d91d' and 'b7ac78b8beb039f7545d74bbc3075947bb5d27e5'
author Richard Laager <rlaager@wiktel.com>
date Tue, 08 May 2007 03:38:21 +0000
parents dd768c576ab2 (current diff) beb960114f7d (diff)
children 816759ae9644
files
diffstat 13 files changed, 147 insertions(+), 137 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Tue May 08 03:38:18 2007 +0000
+++ b/COPYRIGHT	Tue May 08 03:38:21 2007 +0000
@@ -161,6 +161,7 @@
 Nigel Horne
 Jensen Hornick
 Juanjo Molinero Horno
+Dustin Howett
 Nathanael Hoyle
 Greg Hudson
 Magnus Hult
--- a/finch/gntconv.c	Tue May 08 03:38:18 2007 +0000
+++ b/finch/gntconv.c	Tue May 08 03:38:21 2007 +0000
@@ -789,7 +789,7 @@
 	PurpleCmdStatus status;
 
 	if (!g_ascii_strcasecmp(args[0], "version")) {
-		tmp = g_strdup_printf("me is using %s.", VERSION);
+		tmp = g_strdup_printf("me is using Finch v%s.", VERSION);
 		markup = g_markup_escape_text(tmp, -1);
 
 		status = purple_cmd_do_command(conv, tmp, markup, error);
--- a/finch/gntplugin.c	Tue May 08 03:38:18 2007 +0000
+++ b/finch/gntplugin.c	Tue May 08 03:38:21 2007 +0000
@@ -105,6 +105,20 @@
 {
 	PurplePlugin *plugin = current;
 	char *text;
+	GList *list = NULL, *iter = NULL;
+
+	/* If the selected plugin was unseen before, mark it as seen. But save the list
+	 * only when the plugin list is closed. So if the user enables a plugin, and it
+	 * crashes, it won't get marked as seen so the user can fix the bug and still
+	 * quickly find the plugin in the list.
+	 * I probably mean 'plugin developers' by 'users' here. */
+	list = g_object_get_data(G_OBJECT(widget), "seen-list");
+	if (list)
+		iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp);
+	if (!iter) {
+		list = g_list_prepend(list, g_strdup(plugin->path));
+		g_object_set_data(G_OBJECT(widget), "seen-list", list);
+	}
 
 	/* XXX: Use formatting and stuff */
 	gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot));
@@ -121,6 +135,11 @@
 static void
 reset_plugin_window(GntWidget *window, gpointer null)
 {
+	GList *list = g_object_get_data(G_OBJECT(plugins.tree), "seen-list");
+	purple_prefs_set_path_list("/finch/plugins/seen", list);
+	g_list_foreach(list, (GFunc)g_free, NULL);
+	g_list_free(list);
+
 	plugins.window = NULL;
 	plugins.tree = NULL;
 	plugins.aboot = NULL;
@@ -214,6 +233,8 @@
 {
 	GntWidget *window, *tree, *box, *aboot, *button;
 	GList *iter;
+	GList *seen;
+
 	if (plugins.window)
 		return;
 
@@ -244,6 +265,7 @@
 	gnt_widget_set_size(aboot, 40, 20);
 	gnt_box_add_widget(GNT_BOX(box), aboot);
 
+	seen = purple_prefs_get_path_list("/finch/plugins/seen");
 	for (iter = purple_plugins_get_all(); iter; iter = iter->next)
 	{
 		PurplePlugin *plug = iter->data;
@@ -256,10 +278,13 @@
 		gnt_tree_add_choice(GNT_TREE(tree), plug,
 				gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL);
 		gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug));
+		if (!g_list_find_custom(seen, plug->path, (GCompareFunc)strcmp))
+			gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD);
 	}
 	gnt_tree_set_col_width(GNT_TREE(tree), 0, 30);
 	g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL);
 	g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL);
+	g_object_set_data(G_OBJECT(tree), "seen-list", seen);
 
 	box = gnt_hbox_new(FALSE);
 	gnt_box_add_widget(GNT_BOX(window), box);
--- a/finch/gntprefs.c	Tue May 08 03:38:18 2007 +0000
+++ b/finch/gntprefs.c	Tue May 08 03:38:21 2007 +0000
@@ -39,6 +39,7 @@
 
 	purple_prefs_add_none("/finch/plugins");
 	purple_prefs_add_path_list("/finch/plugins/loaded", NULL);
+	purple_prefs_add_path_list("/finch/plugins/seen", NULL);
 
 	purple_prefs_add_none("/finch/conversations");
 	purple_prefs_add_bool("/finch/conversations/timestamps", TRUE);
--- a/libpurple/prefs.c	Tue May 08 03:38:18 2007 +0000
+++ b/libpurple/prefs.c	Tue May 08 03:38:21 2007 +0000
@@ -937,7 +937,7 @@
 
 		if(pref->type != PURPLE_PREF_PATH_LIST) {
 			purple_debug_error("prefs",
-					"purple_prefs_set_path_list: %s not a string list pref\n",
+					"purple_prefs_set_path_list: %s not a path list pref\n",
 					name);
 			return;
 		}
--- a/libpurple/protocols/irc/irc.h	Tue May 08 03:38:18 2007 +0000
+++ b/libpurple/protocols/irc/irc.h	Tue May 08 03:38:21 2007 +0000
@@ -142,8 +142,8 @@
 void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args);
+void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args);
-void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args);
--- a/libpurple/protocols/irc/msgs.c	Tue May 08 03:38:18 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Tue May 08 03:38:21 2007 +0000
@@ -1079,7 +1079,7 @@
 	if (!args || !args[1] || !args[2] || !gc)
 		return;
 
-	msg = g_strdup_printf(_("Cannot join %s:"), args[1]);
+	msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]);
 	purple_notify_error(gc, _("Cannot join channel"), msg, args[2]);
 	g_free(msg);
 }
--- a/libpurple/protocols/irc/parse.c	Tue May 08 03:38:18 2007 +0000
+++ b/libpurple/protocols/irc/parse.c	Tue May 08 03:38:21 2007 +0000
@@ -91,6 +91,7 @@
 	{ "442", "nc:", irc_msg_notinchan },	/* Not in channel		*/
 	{ "473", "nc:", irc_msg_inviteonly },	/* Tried to join invite-only	*/
 	{ "474", "nc:", irc_msg_banned },	/* Banned from channel		*/
+	{ "477", "nc:", irc_msg_regonly },	/* Registration Required	*/
 	{ "478", "nct:", irc_msg_banfull },	/* Banlist is full		*/
 	{ "482", "nc:", irc_msg_notop },	/* Need to be op to do that	*/
 	{ "501", "n:", irc_msg_badmode },	/* Unknown mode flag		*/
--- a/libpurple/protocols/jabber/google.c	Tue May 08 03:38:18 2007 +0000
+++ b/libpurple/protocols/jabber/google.c	Tue May 08 03:38:21 2007 +0000
@@ -398,7 +398,7 @@
 					*(p+1) == '<')) {
 				bold_count++;
 				in_bold = FALSE;
-			} else if (preceding_space && !in_bold) {
+			} else if (preceding_space && !in_bold && !g_unichar_isspace(*(p+1))) {
 				bold_count++;
 				in_bold = TRUE;
 			}
@@ -409,7 +409,7 @@
 					*(p+1) == '<')) {
 				italic_count++;
 				in_italic = FALSE;
-			} else if (preceding_space && !in_italic) {
+			} else if (preceding_space && !in_italic && !g_unichar_isspace(*(p+1))) {
 				italic_count++;
 				in_italic = TRUE;
 			}
@@ -445,7 +445,7 @@
 				str = g_string_append(str, "</b>");
 				in_bold = FALSE;
 				bold_count--;
-			} else if (preceding_space && bold_count > 1) {
+			} else if (preceding_space && bold_count > 1 && !g_unichar_isspace(*(p+1))) {
 				str = g_string_append(str, "<b>");
 				bold_count--;
 				in_bold = TRUE;
@@ -459,7 +459,7 @@
 				str = g_string_append(str, "</i>");
 				italic_count--;
 				in_italic = FALSE;
-			} else if (preceding_space && italic_count > 1) {
+			} else if (preceding_space && italic_count > 1 && !g_unichar_isspace(*(p+1))) {
 				str = g_string_append(str, "<i>");
 				italic_count--;
 				in_italic = TRUE;
--- a/pidgin/gtkdocklet-x11.c	Tue May 08 03:38:18 2007 +0000
+++ b/pidgin/gtkdocklet-x11.c	Tue May 08 03:38:21 2007 +0000
@@ -42,7 +42,6 @@
 static GtkTooltips *tooltips = NULL;
 static GdkPixbuf *blank_icon = NULL;
 static int embed_timeout = 0;
-static DockletStatus icon_status = 0;
 static int docklet_height = 0;
 
 /* protos */
@@ -90,39 +89,38 @@
 }
 
 static void
-docklet_x11_update_icon(DockletStatus icon)
+docklet_x11_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending)
 {
 	const gchar *icon_name = NULL;
 
 	g_return_if_fail(image != NULL);
 
-	switch (icon) {
-		case DOCKLET_STATUS_OFFLINE:
+	switch (status) {
+		case PURPLE_STATUS_OFFLINE:
 			icon_name = PIDGIN_STOCK_TRAY_OFFLINE;
 			break;
-		case DOCKLET_STATUS_CONNECTING:
-			icon_name = PIDGIN_STOCK_TRAY_CONNECT;
+		case PURPLE_STATUS_AWAY:
+			icon_name = PIDGIN_STOCK_TRAY_AWAY;
+			break;
+		case PURPLE_STATUS_UNAVAILABLE:
+			icon_name = PIDGIN_STOCK_TRAY_BUSY;
 			break;
-		case DOCKLET_STATUS_AVAILABLE:
+		case PURPLE_STATUS_EXTENDED_AWAY:
+			icon_name = PIDGIN_STOCK_TRAY_XA;
+			break;
+		case PURPLE_STATUS_INVISIBLE:
+			icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
+			break;
+		default:
 			icon_name = PIDGIN_STOCK_TRAY_AVAILABLE;
 			break;
-		case DOCKLET_STATUS_PENDING:
-			icon_name = PIDGIN_STOCK_TRAY_PENDING;
-			break;
-		case DOCKLET_STATUS_AWAY:
-			icon_name = PIDGIN_STOCK_TRAY_AWAY;
-			break;
-		case DOCKLET_STATUS_BUSY:
-			icon_name = PIDGIN_STOCK_TRAY_BUSY;
-			break;
-		case DOCKLET_STATUS_XA:
-			icon_name = PIDGIN_STOCK_TRAY_XA;
-			break;
-		case DOCKLET_STATUS_INVISIBLE:
-			icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
-			break;
 	}
 
+	if (pending)
+		icon_name = PIDGIN_STOCK_TRAY_PENDING;
+	if (connecting)
+		icon_name = PIDGIN_STOCK_TRAY_CONNECT;
+
 	if(icon_name) {
 		int icon_size;
 		if (docklet_height < 22)
@@ -132,7 +130,6 @@
 
 		gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, icon_size);
 	}
-	icon_status = icon;
 }
 
 static void
@@ -141,7 +138,7 @@
 	if (docklet_height == widget->allocation.height)
 		return;
 	docklet_height = widget->allocation.height;
-	docklet_x11_update_icon(icon_status);
+	pidgin_docklet_update_icon();
 }
 
 static void
--- a/pidgin/gtkdocklet.c	Tue May 08 03:38:18 2007 +0000
+++ b/pidgin/gtkdocklet.c	Tue May 08 03:38:21 2007 +0000
@@ -49,7 +49,9 @@
 
 /* globals */
 static struct docklet_ui_ops *ui_ops = NULL;
-static DockletStatus status = DOCKLET_STATUS_OFFLINE;
+static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE;
+static gboolean pending = FALSE;
+static gboolean connecting = FALSE;
 static gboolean enable_join_chat = FALSE;
 static guint docklet_blinking_timer = 0;
 static gboolean visible = FALSE;
@@ -66,21 +68,17 @@
 
 	blinked = !blinked;
 
-	switch (status) {
-		case DOCKLET_STATUS_PENDING:
-			if (blinked) {
-				if (ui_ops && ui_ops->blank_icon)
-					ui_ops->blank_icon();
-			} else {
-				if (ui_ops && ui_ops->update_icon)
-					ui_ops->update_icon(status);
-			}
-			ret = TRUE; /* keep blinking */
-			break;
-		default:
-			docklet_blinking_timer = 0;
-			blinked = FALSE;
-			break;
+	if(pending && !connecting) {
+		if (blinked) {
+			if (ui_ops && ui_ops->blank_icon)
+				ui_ops->blank_icon();
+		} else {
+			pidgin_docklet_update_icon();
+		}
+		ret = TRUE; /* keep blinking */
+	} else {
+		docklet_blinking_timer = 0;
+		blinked = FALSE;
 	}
 
 	return ret;
@@ -114,9 +112,8 @@
 	GList *convs, *l;
 	int count;
 	PurpleSavedStatus *saved_status;
-	PurpleStatusPrimitive prim;
-	DockletStatus newstatus = DOCKLET_STATUS_OFFLINE;
-	gboolean pending = FALSE, connecting = FALSE;
+	PurpleStatusPrimitive newstatus = PURPLE_STATUS_OFFLINE;
+	gboolean newpending = FALSE, newconnecting = FALSE;
 
 	/* get the current savedstatus */
 	saved_status = purple_savedstatus_get_current();
@@ -141,7 +138,7 @@
 	}
 
 	if (convs != NULL) {
-		pending = TRUE;
+		newpending = TRUE;
 
 		/* set tooltip if messages are pending */
 		if (ui_ops->set_tooltip) {
@@ -190,38 +187,22 @@
 
 		account_status = purple_account_get_active_status(account);
 		if (purple_account_is_connecting(account))
-			connecting = TRUE;
+			newconnecting = TRUE;
 	}
 
-	prim = purple_savedstatus_get_type(saved_status);
-	if (pending)
-		newstatus = DOCKLET_STATUS_PENDING;
-	else if (connecting)
-		newstatus = DOCKLET_STATUS_CONNECTING;
-	else if (prim == PURPLE_STATUS_UNAVAILABLE)
-		newstatus = DOCKLET_STATUS_BUSY;
-	else if (prim == PURPLE_STATUS_AWAY)
-		newstatus = DOCKLET_STATUS_AWAY;
-	else if (prim == PURPLE_STATUS_EXTENDED_AWAY)
-		newstatus = DOCKLET_STATUS_XA;
-	else if (prim == PURPLE_STATUS_OFFLINE)
-		newstatus = DOCKLET_STATUS_OFFLINE;
-	else if (prim == PURPLE_STATUS_INVISIBLE)
-		newstatus = DOCKLET_STATUS_INVISIBLE;
-	else
-		newstatus = DOCKLET_STATUS_AVAILABLE;
+	newstatus = purple_savedstatus_get_type(saved_status);
 
 	/* update the icon if we changed status */
-	if (status != newstatus) {
+	if (status != newstatus || pending!=newpending || connecting!=newconnecting) {
 		status = newstatus;
+		pending = newpending;
+		connecting = newconnecting;
 
-		if (ui_ops && ui_ops->update_icon)
-			ui_ops->update_icon(status);
+		pidgin_docklet_update_icon();
 
 		/* and schedule the blinker function if messages are pending */
-		if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") &&
-		    status == DOCKLET_STATUS_PENDING
-		    && docklet_blinking_timer == 0) {
+		if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")
+			&& pending && !connecting && docklet_blinking_timer == 0) {
 			docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL);
 		}
 	}
@@ -510,7 +491,7 @@
 
 	menuitem = gtk_menu_item_new_with_label(_("Unread Messages"));
 
-	if (status == DOCKLET_STATUS_PENDING) {
+	if (pending) {
 		GtkWidget *submenu = gtk_menu_new();
 		GList *l = get_pending_list(0);
 		if (l == NULL) {
@@ -530,7 +511,7 @@
 	pidgin_separator(menu);
 
 	menuitem = pidgin_new_item_from_stock(menu, _("New Message..."), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, G_CALLBACK(pidgin_dialogs_im), NULL, 0, 0, NULL);
-	if (status == DOCKLET_STATUS_OFFLINE)
+	if (status == PURPLE_STATUS_OFFLINE)
 		gtk_widget_set_sensitive(menuitem, FALSE);
 
 	menuitem = docklet_status_submenu();
@@ -558,10 +539,6 @@
 
 	pidgin_separator(menu);
 
-	/* TODO: need a submenu to change status, this needs to "link"
-	 * to the status in the buddy list gtkstatusbox
-	 */
-
 	pidgin_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(purple_core_quit), NULL, 0, 0, NULL);
 
 #ifdef _WIN32
@@ -578,11 +555,18 @@
  * public api for ui_ops
  **************************************************************************/
 void
+pidgin_docklet_update_icon()
+{
+	if (ui_ops && ui_ops->update_icon)
+		ui_ops->update_icon(status, connecting, pending);
+}
+
+void
 pidgin_docklet_clicked(int button_type)
 {
 	switch (button_type) {
 		case 1:
-			if (status == DOCKLET_STATUS_PENDING) {
+			if (pending) {
 				GList *l = get_pending_list(1);
 				if (l != NULL) {
 					purple_conversation_present((PurpleConversation *)l->data);
@@ -608,8 +592,7 @@
 	}
 	visible = TRUE;
 	docklet_update_status();
-	if (ui_ops && ui_ops->update_icon)
-		ui_ops->update_icon(status);
+	pidgin_docklet_update_icon();
 }
 
 void
@@ -625,7 +608,7 @@
 			docklet_blinking_timer = 0;
 		}
 		visible = FALSE;
-		status = DOCKLET_STATUS_OFFLINE;
+		status = PURPLE_STATUS_OFFLINE;
 	}
 }
 
--- a/pidgin/gtkdocklet.h	Tue May 08 03:38:18 2007 +0000
+++ b/pidgin/gtkdocklet.h	Tue May 08 03:38:21 2007 +0000
@@ -25,23 +25,13 @@
 #ifndef _GTKDOCKLET_H_
 #define _GTKDOCKLET_H_
 
-typedef enum
-{
-	DOCKLET_STATUS_OFFLINE,
-	DOCKLET_STATUS_AVAILABLE,
-	DOCKLET_STATUS_INVISIBLE,
-	DOCKLET_STATUS_PENDING,
-	DOCKLET_STATUS_AWAY,
-	DOCKLET_STATUS_BUSY,
-	DOCKLET_STATUS_XA,
-	DOCKLET_STATUS_CONNECTING
-} DockletStatus;
+#include "status.h"
 
 struct docklet_ui_ops
 {
 	void (*create)(void);
 	void (*destroy)(void);
-	void (*update_icon)(DockletStatus);
+	void (*update_icon)(PurpleStatusPrimitive, gboolean, gboolean);
 	void (*blank_icon)(void);
 	void (*set_tooltip)(gchar *);
 	GtkMenuPositionFunc position_menu;
@@ -49,6 +39,7 @@
 
 
 /* functions in gtkdocklet.c */
+void pidgin_docklet_update_icon(void);
 void pidgin_docklet_clicked(int);
 void pidgin_docklet_embedded(void);
 void pidgin_docklet_remove(void);
--- a/pidgin/win32/gtkdocklet-win32.c	Tue May 08 03:38:18 2007 +0000
+++ b/pidgin/win32/gtkdocklet-win32.c	Tue May 08 03:38:21 2007 +0000
@@ -45,7 +45,8 @@
  *  LOCALS
  */
 static HWND systray_hwnd = NULL;
-static HICON cached_icons[DOCKLET_STATUS_CONNECTING + 1];
+/* additional two cached_icons entries for pending and connecting icons */
+static HICON cached_icons[PURPLE_STATUS_NUM_PRIMITIVES + 2];
 static GtkWidget *image = NULL;
 static NOTIFYICONDATA _nicon_data;
 
@@ -466,46 +467,56 @@
 	Shell_NotifyIcon(NIM_DELETE, &_nicon_data);
 }
 
-static void winpidgin_tray_update_icon(DockletStatus icon) {
+static void winpidgin_tray_update_icon(PurpleStatusPrimitive status,
+		gboolean connecting, gboolean pending) {
+
+	int icon_index;
+	g_return_if_fail(image != NULL);
 
-	g_return_if_fail(image != NULL);
-	g_return_if_fail(icon < (sizeof(cached_icons) / sizeof(HICON)));
+	if(connecting)
+		icon_index = PURPLE_STATUS_NUM_PRIMITIVES;
+	else if(pending)
+		icon_index = PURPLE_STATUS_NUM_PRIMITIVES+1;
+	else
+		icon_index = status;
+
+	g_return_if_fail(icon_index < (sizeof(cached_icons) / sizeof(HICON)));
 
 	/* Look up and cache the HICON if we don't already have it */
-	if (cached_icons[icon] == NULL) {
+	if (cached_icons[icon_index] == NULL) {
 		const gchar *icon_name = NULL;
-		switch (icon) {
-		case DOCKLET_STATUS_OFFLINE:
-			icon_name = PIDGIN_STOCK_TRAY_OFFLINE;
-			break;
-		case DOCKLET_STATUS_CONNECTING:
-			icon_name = PIDGIN_STOCK_TRAY_CONNECT;
-			break;
-		case DOCKLET_STATUS_AVAILABLE:
-			icon_name = PIDGIN_STOCK_TRAY_AVAILABLE;
-			break;
-		case DOCKLET_STATUS_PENDING:
-			icon_name = PIDGIN_STOCK_TRAY_PENDING;
-			break;
-		case DOCKLET_STATUS_AWAY:
-			icon_name = PIDGIN_STOCK_TRAY_AWAY;
-			break;
-		case DOCKLET_STATUS_BUSY:
-			icon_name = PIDGIN_STOCK_TRAY_BUSY;
-			break;
-		case DOCKLET_STATUS_XA:
-			icon_name = PIDGIN_STOCK_TRAY_XA;
-			break;
-		case DOCKLET_STATUS_INVISIBLE:
-			icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
+		switch (status) {
+			case PURPLE_STATUS_OFFLINE:
+				icon_name = PIDGIN_STOCK_TRAY_OFFLINE;
+				break;
+			case PURPLE_STATUS_AWAY:
+				icon_name = PIDGIN_STOCK_TRAY_AWAY;
+				break;
+			case PURPLE_STATUS_UNAVAILABLE:
+				icon_name = PIDGIN_STOCK_TRAY_BUSY;
+				break;
+			case PURPLE_STATUS_EXTENDED_AWAY:
+				icon_name = PIDGIN_STOCK_TRAY_XA;
+				break;
+			case PURPLE_STATUS_INVISIBLE:
+				icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
+				break;
+			default:
+				icon_name = PIDGIN_STOCK_TRAY_AVAILABLE;
+				break;
 		}
 
+		if (pending)
+			icon_name = PIDGIN_STOCK_TRAY_PENDING;
+		if (connecting)
+			icon_name = PIDGIN_STOCK_TRAY_CONNECT;
+	
 		g_return_if_fail(icon_name != NULL);
 
-		cached_icons[icon] = load_hicon_from_stock(icon_name);
+		cached_icons[icon_index] = load_hicon_from_stock(icon_name);
 	}
 
-	systray_change_icon(cached_icons[icon]);
+	systray_change_icon(cached_icons[icon_index]);
 }
 
 static void winpidgin_tray_blank_icon() {
@@ -557,21 +568,21 @@
 	 * That is why we use custom 4-bit icons for pre XP Windowses */
 	if (osinfo.dwMajorVersion < 5 || (osinfo.dwMajorVersion == 5 && osinfo.dwMinorVersion == 0))
 	{
-		cached_icons[DOCKLET_STATUS_OFFLINE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_OFFLINE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_OFFLINE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_AVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_AVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_AVAILABLE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_AWAY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_XA] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_EXTENDED_AWAY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_XA_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_BUSY] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_UNAVAILABLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_BUSY_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_CONNECTING] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_NUM_PRIMITIVES] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_CONNECTING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_PENDING] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_NUM_PRIMITIVES+1] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_PENDING_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
-		cached_icons[DOCKLET_STATUS_INVISIBLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
+		cached_icons[PURPLE_STATUS_INVISIBLE] = (HICON) LoadImage(winpidgin_dll_hinstance(),
 			MAKEINTRESOURCE(PIDGIN_TRAY_INVISIBLE_4BIT), IMAGE_ICON, 16, 16, LR_CREATEDIBSECTION);
 	}