diff src/protocols/jabber/jabber.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 ff0642fab1d5
line wrap: on
line diff
--- a/src/protocols/jabber/jabber.c	Wed Jan 08 07:28:54 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Wed Jan 08 08:18:49 2003 +0000
@@ -67,11 +67,15 @@
 #include "pixmaps/protocols/jabber/available-dnd.xpm"
 #include "pixmaps/protocols/jabber/available-error.xpm"
 
+static struct prpl *my_protocol = NULL;
+
 /* for win32 compatability */
 G_MODULE_IMPORT GSList *connections;
 
 /* The priv member of gjconn's is a gaim_connection for now. */
 #define GJ_GC(x) ((struct gaim_connection *)(x)->priv)
+/* Confused? That makes three of us. -Robot101 */
+#define GC_GJ(x) ((gjconn)((struct jabber_data *)(x)->proto_data)->gjc)
 
 #define IQID_AUTH "__AUTH__"
 
@@ -1580,7 +1584,7 @@
  * Used only by Jabber accept/deny add stuff just below
  */
 struct jabber_add_permit {
-	gjconn gjc;
+	struct gaim_connection *gc;
 	gchar *user;
 };
 
@@ -1595,7 +1599,7 @@
 
 	xmlnode_put_attrib(g, "to", jap->user);
 	xmlnode_put_attrib(g, "type", type);
-	gjab_send(jap->gjc, g);
+	gjab_send(GC_GJ(jap->gc), g);
 
 	xmlnode_free(g);
 }
@@ -1605,14 +1609,17 @@
  */
 static void jabber_accept_add(struct jabber_add_permit *jap)
 {
-	jabber_accept_deny_add(jap, "subscribed");
-	/*
-	 * If we don't already have the buddy on *our* buddylist,
-	 * ask if we want him or her added.
-	 */
-	if(find_buddy(GJ_GC(jap->gjc), jap->user) == NULL) {
-		show_got_added(GJ_GC(jap->gjc), NULL, jap->user, NULL, NULL);
+	if(g_slist_find(connections, jap->gc)) {
+		jabber_accept_deny_add(jap, "subscribed");
+		/*
+		 * If we don't already have the buddy on *our* buddylist,
+		 * ask if we want him or her added.
+		 */
+		if(find_buddy(jap->gc, jap->user) == NULL) {
+			show_got_added(jap->gc, NULL, jap->user, NULL, NULL);
+		}
 	}
+
 	g_free(jap->user);
 	g_free(jap);
 }
@@ -1622,7 +1629,10 @@
  */
 static void jabber_deny_add(struct jabber_add_permit *jap)
 {
-	jabber_accept_deny_add(jap, "unsubscribed");
+	if(g_slist_find(connections, jap->gc)) {
+		jabber_accept_deny_add(jap, "unsubscribed");
+	}
+
 	g_free(jap->user);
 	g_free(jap);
 }
@@ -1647,9 +1657,9 @@
 		gchar *msg = g_strdup_printf(_("The user %s wants to add you to their buddy list."),
 				Jid);
 
-		jap->gjc = gjc;
+		jap->gc = GJ_GC(gjc);
 		jap->user = g_strdup(Jid);
-		do_ask_dialog(msg, NULL, jap, _("Authorize"), jabber_accept_add, _("Deny"), jabber_deny_add, FALSE);
+		do_ask_dialog(msg, NULL, jap, _("Authorize"), jabber_accept_add, _("Deny"), jabber_deny_add, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
 
 		g_free(msg);
 		xmlnode_free(g);	/* Never needed it here anyway */
@@ -4162,8 +4172,6 @@
 	return m;
 }
 
-static struct prpl *my_protocol = NULL;
-
 G_MODULE_EXPORT void jabber_init(struct prpl *ret)
 {
 	/* the NULL's aren't required but they're nice to have */