diff libgaim/protocols/jabber/presence.c @ 15058:f227feab8c78

[gaim-migrate @ 17841] Ok... let's throw this to the wild. Support for "So-and-so want's authorization" in the core. It creates a new mini-dialog in the blist for this with an Authorize and Deny button, which do as you might imagine. Clicking Authorize will also spawn an "Add buddy" dialog if that person isn't already a buddy. I'm not sure I like this, since I never add buddies that I authorize, but it seems the best option. I considered a checkbox in the dialog (but it only applies when you hit "Authorize," which could be weird), and a third "Authorize and Add" button (but that was too big for the blist). I'll come back to the UI later, I'm sure. I'd like to see that the prpl changes all work. Yahoo, especially, looked confusing, and had the most changes. I'm mostly happy with this. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 29 Nov 2006 01:13:21 +0000
parents 7ac8259f355d
children 31603a03cc02
line wrap: on
line diff
--- a/libgaim/protocols/jabber/presence.c	Tue Nov 28 21:29:12 2006 +0000
+++ b/libgaim/protocols/jabber/presence.c	Wed Nov 29 01:13:21 2006 +0000
@@ -181,32 +181,8 @@
 
 static void authorize_add_cb(struct _jabber_add_permit *jap)
 {
-	GaimBuddy *buddy = NULL;
-
 	jabber_presence_subscription_set(jap->gc->proto_data, jap->who,
 			"subscribed");
-#if 0
-	buddy = gaim_find_buddy(jap->gc->account, jap->who);
-
-	if (buddy) {
-		JabberBuddy *jb = NULL;
-
-		jb = jabber_buddy_find(jap->js, jap->who, TRUE);
-
-		if ((jb->subscription & JABBER_SUB_TO) == 0) {
-			gaim_account_request_add(jap->gc->account,
-				                         jap->who, NULL,
-			                         NULL, NULL);
-		} else {
-			gaim_account_notify_added(jap->gc->account,
-			                          jap->who, NULL,
-			                          NULL, NULL);
-		}
-	} else {
-		gaim_account_request_add(jap->gc->account, jap->who,
-		                         NULL, NULL, NULL);
-	}
-#endif
 	g_free(jap->who);
 	g_free(jap);
 }
@@ -304,20 +280,13 @@
 		jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence"));
 	} else if(type && !strcmp(type, "subscribe")) {
 		struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
-		char *msg;
 
-		msg = g_strdup_printf(_("The user %s wants to add %s to his or "
-								"her buddy list."),
-							  from, gaim_account_get_username(js->gc->account));
 		jap->gc = js->gc;
 		jap->who = g_strdup(from);
 		jap->js = js;
 
-		gaim_request_action(js->gc, NULL, msg, NULL, GAIM_DEFAULT_ACTION_NONE,
-				jap, 2,
-				_("_Authorize"), G_CALLBACK(authorize_add_cb),
-				_("_Deny"), G_CALLBACK(deny_add_cb));
-		g_free(msg);
+		gaim_account_request_authorization(gaim_connection_get_account(js->gc), from, NULL, NULL, NULL,
+				G_CALLBACK(authorize_add_cb), G_CALLBACK(deny_add_cb), jap);
 		jabber_id_free(jid);
 		return;
 	} else if(type && !strcmp(type, "subscribed")) {