diff libgaim/protocols/jabber/presence.c @ 15136:31603a03cc02

[gaim-migrate @ 17921] Etan had changed the account notify stuff so that the prpl decides if the person is a buddy or not; I totally wiped that out with my authorization stuff. This brings it back. Additionally, I added a googletalk flag to JabberStream which can determine at runtime if you're connected to Google Talk. All of the Google Talk extensions can be detected individually with disco, but this might be used for working with perfectly standard XMPP that's implemented in what might be considered a quirky way in Google Talk. For instance, Google Talk automatically adds buddies to your roster when you authorize them to add you. I was going to use this flag so that the Jabber prpl would never ask me to add a Google Talk buddy who's just been automatically added anyway. I decided to keep it, though, since I may still want to specify what group he's in. This opens the door for more Google Talk customization though >:) committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 08 Dec 2006 02:51:47 +0000
parents f227feab8c78
children dfaad00e60dd
line wrap: on
line diff
--- a/libgaim/protocols/jabber/presence.c	Thu Dec 07 23:16:04 2006 +0000
+++ b/libgaim/protocols/jabber/presence.c	Fri Dec 08 02:51:47 2006 +0000
@@ -280,13 +280,22 @@
 		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);
+		gboolean onlist = FALSE;
+		GaimBuddy *buddy = gaim_find_buddy(gaim_connection_get_account(js->gc), from);
+		JabberBuddy *jb = NULL;
 
+		if (buddy) {
+			jb = jabber_buddy_find(js, from, TRUE);
+			if ((jb->subscription & JABBER_SUB_TO) == 0)
+				onlist = TRUE;
+		}
+		
 		jap->gc = js->gc;
 		jap->who = g_strdup(from);
 		jap->js = js;
 
-		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);
+		gaim_account_request_authorization(gaim_connection_get_account(js->gc), from, NULL, NULL, NULL, onlist,
+					   	   G_CALLBACK(authorize_add_cb), G_CALLBACK(deny_add_cb), jap);
 		jabber_id_free(jid);
 		return;
 	} else if(type && !strcmp(type, "subscribed")) {