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