diff src/protocols/msn/userlist.c @ 12380:553dd80f6130

[gaim-migrate @ 14684] Update msn to use gaim_account_notify_added and gaim_account_request_add. I'm not sure that the gaim_account_notify_added will ever get triggered because if you have ever had the buddy on your list they'll be in either your allow or deny list and hence the prompt wont show. It seems flawed that you can't remove a buddy from your allow list w/o having them added to your block list. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 07 Dec 2005 01:32:19 +0000
parents e346a085bb4f
children 29e237c4141b
line wrap: on
line diff
--- a/src/protocols/msn/userlist.c	Wed Dec 07 01:22:14 2005 +0000
+++ b/src/protocols/msn/userlist.c	Wed Dec 07 01:32:19 2005 +0000
@@ -30,6 +30,7 @@
 {
 	GaimConnection *gc;
 	char *who;
+	char *friendly;
 
 } MsnPermitAdd;
 
@@ -43,14 +44,22 @@
 	{
 		MsnSession *session = pa->gc->proto_data;
 		MsnUserList *userlist = session->userlist;
+		GaimBuddy *buddy;
 
 		msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL);
 
-		/* TODO: This ask for the alias, right? */
-		gaim_account_notify_added(pa->gc->account, NULL, pa->who, NULL, NULL);
+		buddy = gaim_find_buddy(pa->gc->account, pa->who);
+
+		if (buddy != NULL)
+			gaim_account_notify_added(pa->gc->account, pa->who,
+				NULL, pa->friendly, NULL);
+		else
+			gaim_account_request_add(pa->gc->account, pa->who,
+				NULL, pa->friendly, NULL);
 	}
 
 	g_free(pa->who);
+	g_free(pa->friendly);
 	g_free(pa);
 }
 
@@ -66,6 +75,7 @@
 	}
 
 	g_free(pa->who);
+	g_free(pa->friendly);
 	g_free(pa);
 }
 
@@ -75,9 +85,10 @@
 	MsnPermitAdd *pa;
 	char *msg;
 
-	pa      = g_new0(MsnPermitAdd, 1);
+	pa = g_new0(MsnPermitAdd, 1);
 	pa->who = g_strdup(passport);
-	pa->gc  = gc;
+	pa->friendly = (friendly != NULL) ? g_strdup(friendly) : NULL;
+	pa->gc = gc;
 
 	if (friendly != NULL)
 	{