Mercurial > pidgin
annotate src/protocols/msn/dialog.c @ 19840:5568b3ac6fce
[gaim-migrate @ 17481]
gradually got SOAP contact list and address book from Server.
Cache the info in blist.xml
committer: Ethan Blanton <elb@pidgin.im>
author | Ma Yuan <mayuan2006@gmail.com> |
---|---|
date | Sat, 14 Oct 2006 20:00:56 +0000 |
parents | c590e780b3a0 |
children |
rev | line source |
---|---|
10044 | 1 /** |
2 * @file dialog.c Dialog functions | |
3 * | |
4 * gaim | |
5 * | |
6 * Gaim is the legal property of its developers, whose names are too numerous | |
7 * to list here. Please refer to the COPYRIGHT file distributed with this | |
8 * source distribution. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
12 * the Free Software Foundation; either version 2 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU General Public License | |
21 * along with this program; if not, write to the Free Software | |
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 */ | |
24 | |
25 #include "msn.h" | |
12324
90f488e08216
[gaim-migrate @ 14628]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
26 #include "dialog.h" |
10044 | 27 |
28 typedef struct | |
29 { | |
30 GaimConnection *gc; | |
31 char *who; | |
32 char *group; | |
33 gboolean add; | |
34 | |
35 } MsnAddRemData; | |
36 | |
37 static void | |
38 msn_add_cb(MsnAddRemData *data) | |
39 { | |
40 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL) | |
41 { | |
42 MsnSession *session = data->gc->proto_data; | |
43 MsnUserList *userlist = session->userlist; | |
44 | |
45 msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
46 } | |
47 | |
48 if (data->group != NULL) | |
49 g_free(data->group); | |
50 | |
51 g_free(data->who); | |
52 g_free(data); | |
53 } | |
54 | |
55 static void | |
56 msn_rem_cb(MsnAddRemData *data) | |
57 { | |
58 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL) | |
59 { | |
60 MsnSession *session = data->gc->proto_data; | |
61 MsnUserList *userlist = session->userlist; | |
62 | |
63 msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
64 } | |
65 | |
66 if (data->group != NULL) | |
67 g_free(data->group); | |
68 | |
69 g_free(data->who); | |
70 g_free(data); | |
71 } | |
72 | |
12324
90f488e08216
[gaim-migrate @ 14628]
Richard Laager <rlaager@wiktel.com>
parents:
12323
diff
changeset
|
73 void |
10044 | 74 msn_show_sync_issue(MsnSession *session, const char *passport, |
75 const char *group_name) | |
76 { | |
77 GaimConnection *gc; | |
78 GaimAccount *account; | |
79 MsnAddRemData *data; | |
80 char *msg, *reason; | |
81 GaimBuddy *buddy; | |
82 GaimGroup *group = NULL; | |
83 | |
84 account = session->account; | |
85 gc = gaim_account_get_connection(account); | |
86 | |
87 data = g_new0(MsnAddRemData, 1); | |
88 data->who = g_strdup(passport); | |
89 data->group = g_strdup(group_name); | |
90 data->gc = gc; | |
91 | |
10310 | 92 msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), |
10044 | 93 gaim_account_get_username(account), |
94 gaim_account_get_protocol_name(account)); | |
95 | |
19785 | 96 if (group_name != NULL){ |
10044 | 97 reason = g_strdup_printf(_("%s on the local list is " |
98 "inside the group \"%s\" but not on " | |
99 "the server list. " | |
100 "Do you want this buddy to be added?"), | |
101 passport, group_name); | |
19785 | 102 }else{ |
10044 | 103 reason = g_strdup_printf(_("%s is on the local list but " |
104 "not on the server list. " | |
105 "Do you want this buddy to be added?"), | |
106 passport); | |
107 } | |
108 | |
10116 | 109 gaim_request_action(gc, NULL, msg, reason, GAIM_DEFAULT_ACTION_NONE, |
110 data, 2, | |
10044 | 111 _("Yes"), G_CALLBACK(msn_add_cb), |
112 _("No"), G_CALLBACK(msn_rem_cb)); | |
113 | |
114 if (group_name != NULL) | |
115 group = gaim_find_group(group_name); | |
116 | |
19829 | 117 if (group != NULL){ |
10044 | 118 buddy = gaim_find_buddy_in_group(account, passport, group); |
19829 | 119 }else{ |
10044 | 120 buddy = gaim_find_buddy(account, passport); |
19829 | 121 } |
10044 | 122 |
123 if (buddy != NULL) | |
124 gaim_blist_remove_buddy(buddy); | |
125 | |
126 g_free(reason); | |
127 g_free(msg); | |
128 } |