Fri, 22 Aug 2003 11:58:12 +0000
[gaim-migrate @ 7092]
Ambrose C. LI (acli) writes:
" Several corrections against the latest anon cvs:
1. Current translators for zh_TW corrected; Paladin Liu
is not a past translator, he is still current (and is
the lead translator)
2. Past translators for zh_* added (from old po files)
3. Minor error in a French translator's name
4. zh_CN and zh_TW by convention does not mean "Chinese -
China" and "Chinese - Taiwan", but rather
"Simplified
Chinese" and "Traditional Chinese" (irrespective
of actual
locality and dialect)"
committer: Luke Schierer <lschiere@pidgin.im>
| 6371 | 1 | /** |
| 2 | * gaim | |
| 3 | * | |
| 4 | * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | */ | |
| 20 | #include "internal.h" | |
| 21 | ||
| 22 | #include "account.h" | |
|
6375
2378950122af
[gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents:
6373
diff
changeset
|
23 | #include "debug.h" |
| 6371 | 24 | #include "privacy.h" |
| 25 | #include "server.h" | |
| 26 | #include "util.h" | |
| 27 | ||
| 28 | static GaimPrivacyUiOps *privacy_ops = NULL; | |
| 29 | ||
| 30 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
31 | gaim_privacy_permit_add(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
32 | gboolean local_only) |
| 6371 | 33 | { |
| 34 | GSList *l; | |
| 35 | char *name; | |
| 36 | ||
| 37 | g_return_val_if_fail(account != NULL, FALSE); | |
| 38 | g_return_val_if_fail(who != NULL, FALSE); | |
| 39 | ||
| 40 | name = g_strdup(normalize(who)); | |
| 41 | ||
| 42 | for (l = account->permit; l != NULL; l = l->next) { | |
| 43 | if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data))) | |
| 44 | break; | |
| 45 | } | |
| 46 | ||
| 47 | g_free(name); | |
| 48 | ||
| 49 | if (l != NULL) | |
| 50 | return FALSE; | |
| 51 | ||
| 52 | account->permit = g_slist_append(account->permit, g_strdup(who)); | |
| 53 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
54 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
55 | serv_add_permit(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
56 | |
| 6371 | 57 | gaim_blist_save(); |
| 58 | ||
| 59 | if (privacy_ops != NULL && privacy_ops->permit_added != NULL) | |
| 60 | privacy_ops->permit_added(account, who); | |
| 61 | ||
| 62 | return TRUE; | |
| 63 | } | |
| 64 | ||
| 65 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
66 | gaim_privacy_permit_remove(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
67 | gboolean local_only) |
| 6371 | 68 | { |
| 69 | GSList *l; | |
| 70 | char *name; | |
| 71 | ||
| 72 | g_return_val_if_fail(account != NULL, FALSE); | |
| 73 | g_return_val_if_fail(who != NULL, FALSE); | |
| 74 | ||
| 75 | name = g_strdup(normalize(who)); | |
| 76 | ||
| 77 | for (l = account->permit; l != NULL; l = l->next) { | |
| 78 | if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data))) | |
| 79 | break; | |
| 80 | } | |
| 81 | ||
| 82 | g_free(name); | |
| 83 | ||
| 84 | if (l == NULL) | |
| 85 | return FALSE; | |
| 86 | ||
| 87 | account->permit = g_slist_remove(account->permit, l->data); | |
| 88 | g_free(l->data); | |
| 89 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
90 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
91 | serv_rem_deny(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
92 | |
| 6371 | 93 | gaim_blist_save(); |
| 94 | ||
| 95 | if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) | |
| 96 | privacy_ops->permit_removed(account, who); | |
| 97 | ||
| 98 | return TRUE; | |
| 99 | } | |
| 100 | ||
| 101 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
102 | gaim_privacy_deny_add(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
103 | gboolean local_only) |
| 6371 | 104 | { |
| 105 | GSList *l; | |
| 106 | char *name; | |
| 107 | ||
| 108 | g_return_val_if_fail(account != NULL, FALSE); | |
| 109 | g_return_val_if_fail(who != NULL, FALSE); | |
| 110 | ||
| 111 | name = g_strdup(normalize(who)); | |
| 112 | ||
| 113 | for (l = account->deny; l != NULL; l = l->next) { | |
| 114 | if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data))) | |
| 115 | break; | |
| 116 | } | |
| 117 | ||
| 118 | g_free(name); | |
| 119 | ||
| 120 | if (l != NULL) | |
| 121 | return FALSE; | |
| 122 | ||
| 123 | account->deny = g_slist_append(account->deny, g_strdup(who)); | |
| 124 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
125 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
126 | serv_add_deny(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
127 | |
| 6371 | 128 | gaim_blist_save(); |
| 129 | ||
| 130 | if (privacy_ops != NULL && privacy_ops->deny_added != NULL) | |
| 131 | privacy_ops->deny_added(account, who); | |
| 132 | ||
| 133 | return TRUE; | |
| 134 | } | |
| 135 | ||
| 136 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
137 | gaim_privacy_deny_remove(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
138 | gboolean local_only) |
| 6371 | 139 | { |
| 140 | GSList *l; | |
| 141 | char *name; | |
| 142 | ||
| 143 | g_return_val_if_fail(account != NULL, FALSE); | |
| 144 | g_return_val_if_fail(who != NULL, FALSE); | |
| 145 | ||
| 146 | name = g_strdup(normalize(who)); | |
| 147 | ||
| 148 | for (l = account->deny; l != NULL; l = l->next) { | |
| 149 | if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data))) | |
| 150 | break; | |
| 151 | } | |
| 152 | ||
| 153 | g_free(name); | |
| 154 | ||
| 155 | if (l == NULL) | |
| 156 | return FALSE; | |
| 157 | ||
| 158 | account->deny = g_slist_remove(account->deny, l->data); | |
| 159 | g_free(l->data); | |
| 160 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
161 | if (!local_only && gaim_account_is_connected(account)) { |
|
6375
2378950122af
[gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents:
6373
diff
changeset
|
162 | gaim_debug(GAIM_DEBUG_INFO, "privacy", |
|
2378950122af
[gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents:
6373
diff
changeset
|
163 | "Removing %s from server-side deny list\n", who); |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
164 | serv_rem_deny(gaim_account_get_connection(account), who); |
|
6375
2378950122af
[gaim-migrate @ 6880]
Christian Hammond <chipx86@chipx86.com>
parents:
6373
diff
changeset
|
165 | } |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
166 | |
| 6371 | 167 | gaim_blist_save(); |
| 168 | ||
| 169 | if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) | |
| 170 | privacy_ops->deny_removed(account, who); | |
| 171 | ||
| 172 | return TRUE; | |
| 173 | } | |
| 174 | ||
| 175 | void | |
| 176 | gaim_set_privacy_ui_ops(GaimPrivacyUiOps *ops) | |
| 177 | { | |
| 178 | privacy_ops = ops; | |
| 179 | } | |
| 180 | ||
| 181 | GaimPrivacyUiOps * | |
| 182 | gaim_get_privacy_ui_ops(void) | |
| 183 | { | |
| 184 | return privacy_ops; | |
| 185 | } | |
| 186 | ||
| 187 | void | |
| 188 | gaim_privacy_init(void) | |
| 189 | { | |
| 190 | } |