src/protocols/msn/userlist.c

changeset 12380
0b1e1b2ad52a
parent 12318
942b7c089acb
child 12381
9a27a50d3864
equal deleted inserted replaced
12379:c8d19d5bf238 12380:0b1e1b2ad52a
28 28
29 typedef struct 29 typedef struct
30 { 30 {
31 GaimConnection *gc; 31 GaimConnection *gc;
32 char *who; 32 char *who;
33 char *friendly;
33 34
34 } MsnPermitAdd; 35 } MsnPermitAdd;
35 36
36 /************************************************************************** 37 /**************************************************************************
37 * Callbacks 38 * Callbacks
41 { 42 {
42 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL) 43 if (g_list_find(gaim_connections_get_all(), pa->gc) != NULL)
43 { 44 {
44 MsnSession *session = pa->gc->proto_data; 45 MsnSession *session = pa->gc->proto_data;
45 MsnUserList *userlist = session->userlist; 46 MsnUserList *userlist = session->userlist;
47 GaimBuddy *buddy;
46 48
47 msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL); 49 msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL);
48 50
49 /* TODO: This ask for the alias, right? */ 51 buddy = gaim_find_buddy(pa->gc->account, pa->who);
50 gaim_account_notify_added(pa->gc->account, NULL, pa->who, NULL, NULL); 52
53 if (buddy != NULL)
54 gaim_account_notify_added(pa->gc->account, pa->who,
55 NULL, pa->friendly, NULL);
56 else
57 gaim_account_request_add(pa->gc->account, pa->who,
58 NULL, pa->friendly, NULL);
51 } 59 }
52 60
53 g_free(pa->who); 61 g_free(pa->who);
62 g_free(pa->friendly);
54 g_free(pa); 63 g_free(pa);
55 } 64 }
56 65
57 static void 66 static void
58 msn_cancel_add_cb(MsnPermitAdd *pa) 67 msn_cancel_add_cb(MsnPermitAdd *pa)
64 73
65 msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_BL, NULL); 74 msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_BL, NULL);
66 } 75 }
67 76
68 g_free(pa->who); 77 g_free(pa->who);
78 g_free(pa->friendly);
69 g_free(pa); 79 g_free(pa);
70 } 80 }
71 81
72 static void 82 static void
73 got_new_entry(GaimConnection *gc, const char *passport, const char *friendly) 83 got_new_entry(GaimConnection *gc, const char *passport, const char *friendly)
74 { 84 {
75 MsnPermitAdd *pa; 85 MsnPermitAdd *pa;
76 char *msg; 86 char *msg;
77 87
78 pa = g_new0(MsnPermitAdd, 1); 88 pa = g_new0(MsnPermitAdd, 1);
79 pa->who = g_strdup(passport); 89 pa->who = g_strdup(passport);
80 pa->gc = gc; 90 pa->friendly = (friendly != NULL) ? g_strdup(friendly) : NULL;
91 pa->gc = gc;
81 92
82 if (friendly != NULL) 93 if (friendly != NULL)
83 { 94 {
84 msg = g_strdup_printf( 95 msg = g_strdup_printf(
85 _("The user %s (%s) wants to add %s to his or her " 96 _("The user %s (%s) wants to add %s to his or her "

mercurial