Mercurial > pidgin
annotate src/protocols/msn/dialog.c @ 13627:3cfdf1653a64
[gaim-migrate @ 16014]
Namespacing the msn prpl's utils.c and utils.h to msn-utils.c and msn-utils.h.
committer: Tailor Script <tailor@pidgin.im>
author | Evan Schoenberg <evan.s@dreskin.net> |
---|---|
date | Tue, 11 Apr 2006 21:52:42 +0000 |
parents | 90f488e08216 |
children | 4e44ecb866bd 852b32710df0 |
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 | |
96 if (group_name != NULL) | |
97 { | |
98 reason = g_strdup_printf(_("%s on the local list is " | |
99 "inside the group \"%s\" but not on " | |
100 "the server list. " | |
101 "Do you want this buddy to be added?"), | |
102 passport, group_name); | |
103 } | |
104 else | |
105 { | |
106 reason = g_strdup_printf(_("%s is on the local list but " | |
107 "not on the server list. " | |
108 "Do you want this buddy to be added?"), | |
109 passport); | |
110 } | |
111 | |
10116 | 112 gaim_request_action(gc, NULL, msg, reason, GAIM_DEFAULT_ACTION_NONE, |
113 data, 2, | |
10044 | 114 _("Yes"), G_CALLBACK(msn_add_cb), |
115 _("No"), G_CALLBACK(msn_rem_cb)); | |
116 | |
117 if (group_name != NULL) | |
118 group = gaim_find_group(group_name); | |
119 | |
120 if (group != NULL) | |
121 buddy = gaim_find_buddy_in_group(account, passport, group); | |
122 else | |
123 buddy = gaim_find_buddy(account, passport); | |
124 | |
125 if (buddy != NULL) | |
126 gaim_blist_remove_buddy(buddy); | |
127 | |
128 g_free(reason); | |
129 g_free(msg); | |
130 } |