annotate src/protocols/msn/dialog.c @ 11936:2af814f836e6

[gaim-migrate @ 14227] Patch from Kevin Stange to "properly ignore placement with tabs off" see: http://sourceforge.net/tracker/?func=detail&aid=1343648&group_id=235&atid=300235 for more details committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Mon, 31 Oct 2005 22:55:16 +0000
parents 926bd0e5f487
children fc464a0abccc
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"
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
26
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
27 typedef struct
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
28 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
29 GaimConnection *gc;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
30 char *who;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
31 char *group;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
32 gboolean add;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
33
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
34 } MsnAddRemData;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
35
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
36 static void
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
37 msn_add_cb(MsnAddRemData *data)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
38 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
39 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
40 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
41 MsnSession *session = data->gc->proto_data;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
42 MsnUserList *userlist = session->userlist;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
43
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
44 msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
45 }
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 if (data->group != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
48 g_free(data->group);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
49
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
50 g_free(data->who);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
51 g_free(data);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
52 }
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 static void
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
55 msn_rem_cb(MsnAddRemData *data)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
56 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
57 if (g_list_find(gaim_connections_get_all(), data->gc) != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
58 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
59 MsnSession *session = data->gc->proto_data;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
60 MsnUserList *userlist = session->userlist;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
61
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
62 msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
63 }
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 if (data->group != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
66 g_free(data->group);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
67
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
68 g_free(data->who);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
69 g_free(data);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
70 }
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 void
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
73 msn_show_sync_issue(MsnSession *session, const char *passport,
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
74 const char *group_name)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
75 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
76 GaimConnection *gc;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
77 GaimAccount *account;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
78 MsnAddRemData *data;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
79 char *msg, *reason;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
80 GaimBuddy *buddy;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
81 GaimGroup *group = NULL;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
82
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
83 account = session->account;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
84 gc = gaim_account_get_connection(account);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
85
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
86 data = g_new0(MsnAddRemData, 1);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
87 data->who = g_strdup(passport);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
88 data->group = g_strdup(group_name);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
89 data->gc = gc;
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
90
10310
926bd0e5f487 [gaim-migrate @ 11504]
Mark Doliner <mark@kingant.net>
parents: 10116
diff changeset
91 msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
10044
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
92 gaim_account_get_username(account),
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
93 gaim_account_get_protocol_name(account));
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
94
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
95 if (group_name != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
96 {
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);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
102 }
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
103 else
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
104 {
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
105 reason = g_strdup_printf(_("%s is on the local list but "
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
106 "not on the server list. "
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
107 "Do you want this buddy to be added?"),
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
108 passport);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
109 }
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
110
10116
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10044
diff changeset
111 gaim_request_action(gc, NULL, msg, reason, GAIM_DEFAULT_ACTION_NONE,
9f358a718f38 [gaim-migrate @ 11153]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10044
diff changeset
112 data, 2,
10044
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
113 _("Yes"), G_CALLBACK(msn_add_cb),
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
114 _("No"), G_CALLBACK(msn_rem_cb));
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
115
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
116 if (group_name != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
117 group = gaim_find_group(group_name);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
118
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
119 if (group != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
120 buddy = gaim_find_buddy_in_group(account, passport, group);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
121 else
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
122 buddy = gaim_find_buddy(account, passport);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
123
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
124 if (buddy != NULL)
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
125 gaim_blist_remove_buddy(buddy);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
126
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
127 g_free(reason);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
128 g_free(msg);
86a6d78b070b [gaim-migrate @ 11003]
Luke Schierer <lschiere@pidgin.im>
parents:
diff changeset
129 }