Mercurial > pidgin
comparison libpurple/protocols/msnp9/dialog.c @ 21312:a07cfce78345
Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly
old fools like me who prefer the stability of our MSNP9 code over the
features of MSNP14 can enable this using the --disable-msnp14 ./configure
option.
If we want to release from i.p.p and MSN stability is the only blocker, we
can trivially flick the default to use MSNP9 in configure.ac
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 11 Nov 2007 12:57:52 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
21311:7d031cec5ba2 | 21312:a07cfce78345 |
---|---|
1 /** | |
2 * @file dialog.c Dialog functions | |
3 * | |
4 * purple | |
5 * | |
6 * Purple 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
23 */ | |
24 | |
25 #include "msn.h" | |
26 #include "dialog.h" | |
27 | |
28 typedef struct | |
29 { | |
30 PurpleConnection *gc; | |
31 char *who; | |
32 char *group; | |
33 gboolean add; | |
34 | |
35 } MsnAddRemData; | |
36 | |
37 /* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. | |
38 * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ | |
39 static void | |
40 msn_complete_sync_issue(MsnAddRemData *data) | |
41 { | |
42 PurpleBuddy *buddy; | |
43 PurpleGroup *group = NULL; | |
44 | |
45 if (data->group != NULL) | |
46 group = purple_find_group(data->group); | |
47 | |
48 if (group != NULL) | |
49 buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group); | |
50 else | |
51 buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who); | |
52 | |
53 if (buddy != NULL) | |
54 purple_blist_remove_buddy(buddy); | |
55 } | |
56 | |
57 static void | |
58 msn_add_cb(MsnAddRemData *data) | |
59 { | |
60 MsnSession *session; | |
61 MsnUserList *userlist; | |
62 | |
63 msn_complete_sync_issue(data); | |
64 | |
65 session = data->gc->proto_data; | |
66 userlist = session->userlist; | |
67 | |
68 msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
69 | |
70 g_free(data->group); | |
71 g_free(data->who); | |
72 g_free(data); | |
73 } | |
74 | |
75 static void | |
76 msn_rem_cb(MsnAddRemData *data) | |
77 { | |
78 MsnSession *session; | |
79 MsnUserList *userlist; | |
80 | |
81 msn_complete_sync_issue(data); | |
82 | |
83 session = data->gc->proto_data; | |
84 userlist = session->userlist; | |
85 | |
86 msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group); | |
87 | |
88 g_free(data->group); | |
89 g_free(data->who); | |
90 g_free(data); | |
91 } | |
92 | |
93 void | |
94 msn_show_sync_issue(MsnSession *session, const char *passport, | |
95 const char *group_name) | |
96 { | |
97 PurpleConnection *gc; | |
98 PurpleAccount *account; | |
99 MsnAddRemData *data; | |
100 char *msg, *reason; | |
101 | |
102 account = session->account; | |
103 gc = purple_account_get_connection(account); | |
104 | |
105 data = g_new0(MsnAddRemData, 1); | |
106 data->who = g_strdup(passport); | |
107 data->group = g_strdup(group_name); | |
108 data->gc = gc; | |
109 | |
110 msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), | |
111 purple_account_get_username(account), | |
112 purple_account_get_protocol_name(account)); | |
113 | |
114 if (group_name != NULL) | |
115 { | |
116 reason = g_strdup_printf(_("%s on the local list is " | |
117 "inside the group \"%s\" but not on " | |
118 "the server list. " | |
119 "Do you want this buddy to be added?"), | |
120 passport, group_name); | |
121 } | |
122 else | |
123 { | |
124 reason = g_strdup_printf(_("%s is on the local list but " | |
125 "not on the server list. " | |
126 "Do you want this buddy to be added?"), | |
127 passport); | |
128 } | |
129 | |
130 purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE, | |
131 purple_connection_get_account(gc), data->who, NULL, | |
132 data, 2, | |
133 _("Yes"), G_CALLBACK(msn_add_cb), | |
134 _("No"), G_CALLBACK(msn_rem_cb)); | |
135 | |
136 g_free(reason); | |
137 g_free(msg); | |
138 } |