diff src/protocols/icq/gaim_icq.c @ 4249:9c7fcb211886

[gaim-migrate @ 4499] If anyone is curious, the commit before this fixed a bug which didn't allow you to delete AIM or ICQ people from a deny list. They'll show up when you sign back online, and will be deleteable now. This is a patch from the good Mr. McQueen. "Twofold attack: 1) Make sure all the callback functions don't throw a mental if the gc the dialog was asking about has disappeared. Make sure the functions still free up the data structs as necessary in this case. 2) When setting up a ask dialog, plugins (including prpls) pass in their handle. The ask dialog struct gets kept in a slist. When unloading a plugin or prpl, Gaim checks the handle against the list, and sends a cancel-type message for any outstanding dialogs. Should avoid crashes from non-modal ask dialogs lying around." Yeah, so that's a nice lil' improvement. I also fixed a think where SSI "authorization denied" messages would be gibberish. That was a bug from just a few hours ago. Whoops. Also, since this is like a grown up version of show and tell, I thought this was funny: * Robot101 fixes idiocy <KingAnt> Does that mean I'm going to be nuetered? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 08 Jan 2003 08:18:49 +0000
parents cd84b0fd63fc
children 0c68d402f59f
line wrap: on
line diff
--- a/src/protocols/icq/gaim_icq.c	Wed Jan 08 07:28:54 2003 +0000
+++ b/src/protocols/icq/gaim_icq.c	Wed Jan 08 08:18:49 2003 +0000
@@ -15,6 +15,8 @@
 
 #define USEROPT_NICK 0
 
+static struct prpl *my_protocol = NULL;
+
 struct icq_data {
 	icq_Link *link;
 	int cur_status;
@@ -254,29 +256,34 @@
 
 static void icq_add_after_auth(struct icq_auth *iq)
 {
-	char uin[16];
-	g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
-	show_add_buddy(iq->gc, uin, NULL, iq->nick);
+	if (g_slist_find(connections, iq->gc)) {
+		char uin[16];
+		g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
+		show_add_buddy(iq->gc, uin, NULL, iq->nick);
+	}
 	icq_den_auth(iq);
 }
 
 static void icq_acc_auth(struct icq_auth *iq)
 {
-	char msg[1024];
-	char uin[16];
-	struct icq_auth *iqnew;
-	
-	icq_SendAuthMsg(iq->link, iq->uin);
+	if (g_slist_find(connections, iq->gc)) {
+		char msg[1024];
+		char uin[16];
+		struct icq_auth *iqnew;
+
+		icq_SendAuthMsg(iq->link, iq->uin);
 
-	g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
-	if (find_buddy(iq->gc, uin))
-		return;
+		g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
+		if (find_buddy(iq->gc, uin))
+			return;
 
-	iqnew = g_memdup(iq, sizeof(struct icq_auth));
-	iqnew->nick = g_strdup(iq->nick);
+		iqnew = g_memdup(iq, sizeof(struct icq_auth));
+		iqnew->nick = g_strdup(iq->nick);
 
-	g_snprintf(msg, sizeof(msg), "Add %ld to your buddy list?", iq->uin);
-	do_ask_dialog(msg, NULL, iqnew, _("Add"), icq_add_after_auth, _("Cancel"), icq_den_auth, FALSE);
+		g_snprintf(msg, sizeof(msg), "Add %ld to your buddy list?", iq->uin);
+		do_ask_dialog(msg, NULL, iqnew, _("Add"), icq_add_after_auth, _("Cancel"), icq_den_auth, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
+	}
+
 	icq_den_auth(iq);
 }
 
@@ -294,7 +301,7 @@
 	g_snprintf(msg, sizeof(msg), "The user %s (%s%s%s%s%s) wants you to authorize them.",
 			nick, first ? first : "", first && last ? " " : "", last ? last : "",
 			(first || last) && email ? ", " : "", email ? email : "");
-	do_ask_dialog(msg, NULL, iq, _("Authorize"), icq_acc_auth, _("Deny"), icq_den_auth, FALSE);
+	do_ask_dialog(msg, NULL, iq, _("Authorize"), icq_acc_auth, _("Deny"), icq_den_auth, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
 }
 
 static void icq_login(struct aim_user *user) {
@@ -488,8 +495,6 @@
 	return m;
 }
 
-static struct prpl *my_protocol = NULL;
-
 void icq_init(struct prpl *ret) {
 	struct proto_user_opt *puo;
 	ret->protocol = PROTO_ICQ;