changeset 21640:ed57eeb486d5

merge of 'a3da14876c865437f0916509629a649308081104' and 'b1278944ccaa36c30b7f00edf5b79dc38347c931'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 26 Nov 2007 05:41:09 +0000
parents fa5d1f426332 (current diff) 6636546aeacf (diff)
children ee7638c696f1
files
diffstat 5 files changed, 46 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntconn.c	Mon Nov 26 05:30:36 2007 +0000
+++ b/finch/gntconn.c	Mon Nov 26 05:41:09 2007 +0000
@@ -152,6 +152,10 @@
 				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
 			continue;
 		purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
+		purple_conversation_write(conv, NULL, _("The account has disconnected and you are no "
+					"longer in this chat. You will be automatically rejoined in the chat when "
+					"the account reconnects."),
+				PURPLE_MESSAGE_SYSTEM, time(NULL));
 	}
 }
 
--- a/finch/libgnt/gntbox.c	Mon Nov 26 05:30:36 2007 +0000
+++ b/finch/libgnt/gntbox.c	Mon Nov 26 05:41:09 2007 +0000
@@ -851,8 +851,14 @@
 
 void gnt_box_give_focus_to_child(GntBox *box, GntWidget *widget)
 {
-	GList *find = g_list_find(box->focus, widget);
-	gpointer now = box->active;
+	GList *find;
+	gpointer now;
+
+	while (GNT_WIDGET(box)->parent)
+		box = GNT_BOX(GNT_WIDGET(box)->parent);
+
+	find = g_list_find(box->focus, widget);
+	now = box->active;
 	if (find)
 		box->active = widget;
 	if (now && now != box->active)
--- a/finch/libgnt/gntmenu.c	Mon Nov 26 05:30:36 2007 +0000
+++ b/finch/libgnt/gntmenu.c	Mon Nov 26 05:41:09 2007 +0000
@@ -47,6 +47,8 @@
 static void (*org_size_request)(GntWidget *wid);
 static gboolean (*org_key_pressed)(GntWidget *w, const char *t);
 
+static void menuitem_activate(GntMenu *menu, GntMenuItem *item);
+
 static void
 menu_hide_all(GntMenu *menu)
 {
@@ -56,6 +58,20 @@
 }
 
 static void
+show_submenu(GntMenu *menu)
+{
+	GntMenuItem *item;
+
+	if (menu->type != GNT_MENU_TOPLEVEL)
+			return;
+
+	item = g_list_nth_data(menu->list, menu->selected);
+	if (!item || !item->submenu)
+		return;
+	menuitem_activate(menu, item);
+}
+
+static void
 gnt_menu_draw(GntWidget *widget)
 {
 	GntMenu *menu = GNT_MENU(widget);
@@ -276,6 +292,8 @@
 			gnt_widget_hide(widget);
 		} else
 			gnt_widget_hide(widget);
+		if (par && par->type == GNT_MENU_TOPLEVEL)
+			gnt_menu_key_pressed(GNT_WIDGET(par), text);
 		return TRUE;
 	}
 
@@ -297,6 +315,7 @@
 			GntMenu *sub = menu->submenu;
 			if (sub)
 				gnt_widget_hide(GNT_WIDGET(sub));
+			show_submenu(menu);
 			gnt_widget_draw(widget);
 			return TRUE;
 		}
--- a/libpurple/protocols/jabber/presence.c	Mon Nov 26 05:30:36 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Mon Nov 26 05:41:09 2007 +0000
@@ -99,8 +99,6 @@
 {
 	PurpleConnection *gc = NULL;
 	JabberStream *js = NULL;
-	gboolean disconnected;
-	int primitive;
 	xmlnode *presence, *x, *photo;
 	char *stripped = NULL;
 	JabberBuddyState state;
@@ -108,22 +106,26 @@
 	const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL;
 	int length = -1;
 	gboolean allowBuzz;
-	PurplePresence *p = purple_account_get_presence(account);
+	PurplePresence *p;
 	PurpleStatus *tune;
 
+	if (purple_account_is_disconnected(account))
+		return;
+
+	p = purple_account_get_presence(account);
 	if (NULL == status) {
 		status = purple_presence_get_active_status(p);
 	}
 
-	if(!purple_status_is_active(status))
-		return;
-
-	disconnected = purple_account_is_disconnected(account);
-
-	if(disconnected)
-		return;
-
-	primitive = purple_status_type_get_primitive(purple_status_get_type(status));
+	if (purple_status_is_exclusive(status)) {
+		/* An exclusive status can't be deactivated. You should just
+		 * activate some other exclusive status. */
+		if (!purple_status_is_active(status))
+			return;
+	} else {
+		/* Work with the exclusive status. */
+		status = purple_presence_get_active_status(p);
+	}
 
 	gc = purple_account_get_connection(account);
 	js = gc->proto_data;
--- a/libpurple/prpl.c	Mon Nov 26 05:30:36 2007 +0000
+++ b/libpurple/prpl.c	Mon Nov 26 05:41:09 2007 +0000
@@ -258,8 +258,8 @@
 								PurpleStatus *old_status, PurpleStatus *new_status)
 {
 	g_return_if_fail(account    != NULL);
-	g_return_if_fail(old_status != NULL);
 	g_return_if_fail(new_status != NULL);
+	g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL);
 
 	do_prpl_change_account_status(account, old_status, new_status);