diff src/prpl.c @ 4333:cc2f780c0505

[gaim-migrate @ 4597] I needed to make gc->login_time set before do_proto_menu was called, so I moved that line into account_online instead of serv_finish_login. serv_finish_login is called directly after account_online, and gc->login_time isn't used for anything anyway, so it shouldn't matter. I use gc->login_time to determine if a gc's protocol actions menu is ready to be drawn or not (should not be draw for accounts that are in the process of signing online). I made the "Show Buddies Awaiting Authorization" thing show something reasonable for when you aren't waiting for authorization from anyone. I swapped the ok and cancel buttons for the search for buddy by information and clear log file so they follow the HIG. I gave the right side of the log viewer a shadowed border. I Robot. I applied a patch from Ryan McCabe that doesn't really do anything for gaim (yet, anyway), but it allows clients using libfaim to call cleansnacs cleanly, which stops a potential build up of SNACs in memory when you don't send an IM for a long period of time. I applied another patch from Mr. McCabe that fixes a potential crash in ssi.c when your buddy list is a few lions short of a pride, if you know what I mean. I re-prettified an authorization dialog or two. The bold stuff and the non-bold stuff got backwardcised somehow. I added support for those messages from the ICQ server. Like the one that tells you not to give your password to anyone when you first signon. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 18 Jan 2003 01:58:00 +0000
parents 5978e3d53f29
children 0c68d402f59f
line wrap: on
line diff
--- a/src/prpl.c	Sat Jan 18 01:09:59 2003 +0000
+++ b/src/prpl.c	Sat Jan 18 01:58:00 2003 +0000
@@ -315,10 +315,10 @@
 	gtk_widget_show_all(window);
 }
 
-static void proto_act(GtkObject *obj, struct gaim_connection *gc)
+static void proto_act(GtkObject *obj, struct proto_actions_menu *pam)
 {
-	char *act = gtk_object_get_user_data(obj);
-	gc->prpl->do_action(gc, act);
+	if (pam->callback && pam->gc)
+		pam->callback(pam->gc);
 }
 
 void do_proto_menu()
@@ -327,6 +327,7 @@
 	GtkWidget *submenu;
 	GList *l;
 	GSList *c = connections;
+	struct proto_actions_menu *pam;
 	struct gaim_connection *gc = NULL;
 	int count = 0;
 	char buf[256];
@@ -336,20 +337,24 @@
 
 	l = gtk_container_children(GTK_CONTAINER(protomenu));
 	while (l) {
-		gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(l->data));
+		menuitem = l->data;
+		pam = gtk_object_get_data(GTK_OBJECT(menuitem), "user_data");
+		if (pam)
+			g_free(pam);
+		gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
 		l = l->next;
 	}
 
 	while (c) {
 		gc = c->data;
-		if (gc->prpl->actions && gc->prpl->do_action)
+		if (gc->prpl->actions && gc->login_time)
 			count++;
 		c = g_slist_next(c);
 	}
 	c = connections;
 
 	if (!count) {
-		g_snprintf(buf, sizeof(buf), "No actions available");
+		g_snprintf(buf, sizeof(buf), _("No actions available"));
 		menuitem = gtk_menu_item_new_with_label(buf);
 		gtk_menu_append(GTK_MENU(protomenu), menuitem);
 		gtk_widget_show(menuitem);
@@ -357,39 +362,35 @@
 	}
 
 	if (count == 1) {
-		GList *tmp, *act;
+		GList *act;
 		while (c) {
 			gc = c->data;
-			if (gc->prpl->actions && gc->prpl->do_action)
+			if (gc->prpl->actions && gc->login_time)
 				break;
 			c = g_slist_next(c);
 		}
 
-		tmp = act = gc->prpl->actions();
+		act = gc->prpl->actions(gc);
 
 		while (act) {
-			if (act->data == NULL) {
+			if (act->data) {
+				struct proto_actions_menu *pam = act->data;
+				menuitem = gtk_menu_item_new_with_label(pam->label);
+				gtk_menu_append(GTK_MENU(protomenu), menuitem);
+				g_signal_connect(GTK_OBJECT(menuitem), "activate",
+							G_CALLBACK(proto_act), pam);
+				gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam);
+				gtk_widget_show(menuitem);
+			} else {
 				gaim_separator(protomenu);
-				act = g_list_next(act);
-				continue;
 			}
-
-			menuitem = gtk_menu_item_new_with_label(act->data);
-			gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
-			gtk_menu_append(GTK_MENU(protomenu), menuitem);
-			g_signal_connect(GTK_OBJECT(menuitem), "activate",
-					   G_CALLBACK(proto_act), gc);
-			gtk_widget_show(menuitem);
-
 			act = g_list_next(act);
 		}
-
-		g_list_free(tmp);
 	} else {
 		while (c) {
-			GList *tmp, *act;
+			GList *act;
 			gc = c->data;
-			if (!gc->prpl->actions || !gc->prpl->do_action) {
+			if (!gc->prpl->actions || !gc->login_time) {
 				c = g_slist_next(c);
 				continue;
 			}
@@ -403,26 +404,22 @@
 			gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
 			gtk_widget_show(submenu);
 
-			tmp = act = gc->prpl->actions();
+			act = gc->prpl->actions(gc);
 
 			while (act) {
-				if (act->data == NULL) {
+				if (act->data) {
+					struct proto_actions_menu *pam = act->data;
+					menuitem = gtk_menu_item_new_with_label(pam->label);
+					gtk_menu_append(GTK_MENU(submenu), menuitem);
+					g_signal_connect(GTK_OBJECT(menuitem), "activate",
+								G_CALLBACK(proto_act), pam);
+					gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam);
+					gtk_widget_show(menuitem);
+				} else {
 					gaim_separator(submenu);
-					act = g_list_next(act);
-					continue;
 				}
-
-				menuitem = gtk_menu_item_new_with_label(act->data);
-				gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
-				gtk_menu_append(GTK_MENU(submenu), menuitem);
-				g_signal_connect(GTK_OBJECT(menuitem), "activate",
-						   G_CALLBACK(proto_act), gc);
-				gtk_widget_show(menuitem);
-
 				act = g_list_next(act);
 			}
-
-			g_list_free(tmp);
 			c = g_slist_next(c);
 		}
 	}
@@ -664,9 +661,9 @@
 		   msg ? msg : "",
 		   find_buddy(gc, ga->who) ? "" : _("\n\nDo you wish to add him or her to your buddy list?"));
 	if (find_buddy(gc, ga->who))
-		do_error_dialog(buf, _("Gaim - Information"), GAIM_INFO);
+		do_error_dialog(_("Gaim - Information"), buf, GAIM_INFO);
 	else
-		do_ask_dialog(buf, _("Gaim - Confirm"), ga, _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE);
+		do_ask_dialog(_("Gaim - Confirm"), buf, ga, _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE);
 }
 
 static GtkWidget *regdlg = NULL;