annotate src/privacy.c @ 7796:e04c0044c56f

[gaim-migrate @ 8442] Why do I always miss one? committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sun, 07 Dec 2003 20:49:00 +0000
parents 48f31501c3c1
children a13118091bc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * gaim
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org>
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * (at your option) any later version.
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * GNU General Public License for more details.
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 */
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 #include "internal.h"
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 #include "account.h"
6375
72023626d5b8 [gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents: 6373
diff changeset
23 #include "debug.h"
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "privacy.h"
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "server.h"
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 #include "util.h"
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 static GaimPrivacyUiOps *privacy_ops = NULL;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 gboolean
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
31 gaim_privacy_permit_add(GaimAccount *account, const char *who,
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
32 gboolean local_only)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 GSList *l;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 char *name;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 g_return_val_if_fail(account != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 g_return_val_if_fail(who != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
40 name = g_strdup(gaim_normalize(account, who));
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 for (l = account->permit; l != NULL; l = l->next) {
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
43 if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data)))
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 break;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 g_free(name);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 if (l != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 return FALSE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 account->permit = g_slist_append(account->permit, g_strdup(who));
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
54 if (!local_only && gaim_account_is_connected(account))
6373
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
55 serv_add_permit(gaim_account_get_connection(account), who);
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
56
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 gaim_blist_save();
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 if (privacy_ops != NULL && privacy_ops->permit_added != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 privacy_ops->permit_added(account, who);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 return TRUE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 gboolean
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
66 gaim_privacy_permit_remove(GaimAccount *account, const char *who,
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
67 gboolean local_only)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 GSList *l;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 char *name;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 g_return_val_if_fail(account != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 g_return_val_if_fail(who != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
75 name = g_strdup(gaim_normalize(account, who));
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 for (l = account->permit; l != NULL; l = l->next) {
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
78 if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data)))
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 break;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 g_free(name);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 if (l == NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 return FALSE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 account->permit = g_slist_remove(account->permit, l->data);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 g_free(l->data);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
90 if (!local_only && gaim_account_is_connected(account))
7581
48f31501c3c1 [gaim-migrate @ 8199]
Mark Doliner <mark@kingant.net>
parents: 7261
diff changeset
91 serv_rem_permit(gaim_account_get_connection(account), who);
6373
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
92
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 gaim_blist_save();
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 if (privacy_ops != NULL && privacy_ops->permit_removed != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 privacy_ops->permit_removed(account, who);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 return TRUE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 gboolean
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
102 gaim_privacy_deny_add(GaimAccount *account, const char *who,
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
103 gboolean local_only)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 GSList *l;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 char *name;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 g_return_val_if_fail(account != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 g_return_val_if_fail(who != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
111 name = g_strdup(gaim_normalize(account, who));
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 for (l = account->deny; l != NULL; l = l->next) {
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
114 if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data)))
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 break;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 g_free(name);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 if (l != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 return FALSE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 account->deny = g_slist_append(account->deny, g_strdup(who));
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
125 if (!local_only && gaim_account_is_connected(account))
6373
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
126 serv_add_deny(gaim_account_get_connection(account), who);
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
127
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 gaim_blist_save();
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 privacy_ops->deny_added(account, who);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 return TRUE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 gboolean
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
137 gaim_privacy_deny_remove(GaimAccount *account, const char *who,
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
138 gboolean local_only)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140 GSList *l;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 char *name;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 g_return_val_if_fail(account != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 g_return_val_if_fail(who != NULL, FALSE);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
146 name = g_strdup(gaim_normalize(account, who));
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 for (l = account->deny; l != NULL; l = l->next) {
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7107
diff changeset
149 if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data)))
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 break;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 g_free(name);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 if (l == NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 return FALSE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 account->deny = g_slist_remove(account->deny, l->data);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 g_free(l->data);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160
6378
01289157fc37 [gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents: 6375
diff changeset
161 if (!local_only && gaim_account_is_connected(account)) {
6375
72023626d5b8 [gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents: 6373
diff changeset
162 gaim_debug(GAIM_DEBUG_INFO, "privacy",
72023626d5b8 [gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents: 6373
diff changeset
163 "Removing %s from server-side deny list\n", who);
6373
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
164 serv_rem_deny(gaim_account_get_connection(account), who);
6375
72023626d5b8 [gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents: 6373
diff changeset
165 }
6373
4d61775a5741 [gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
166
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 gaim_blist_save();
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 if (privacy_ops != NULL && privacy_ops->deny_removed != NULL)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 privacy_ops->deny_removed(account, who);
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 return TRUE;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 void
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6378
diff changeset
176 gaim_privacy_set_ui_ops(GaimPrivacyUiOps *ops)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 privacy_ops = ops;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 GaimPrivacyUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6378
diff changeset
182 gaim_privacy_get_ui_ops(void)
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 return privacy_ops;
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 }
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 void
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 gaim_privacy_init(void)
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 {
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 }