Wed, 01 Dec 2004 01:17:19 +0000
[gaim-migrate @ 11451]
Patch from Scott Shedden to have the blist hidden when Gaim starts.
This actually probably won't work for most people currently, because
on X11, the docklet is added asynchrously, so we usually won't realize the
docklet exists until we've already created the blist. I'm sure there
must be some way around this, though (Scott's solution was to manually hide
the buddy list when the docklet was finally embedded. I may fall back on
that).
committer: Sean Egan <seanegan@pidgin.im>
| 6371 | 1 | /** |
| 2 | * gaim | |
| 3 | * | |
| 8046 | 4 | * Gaim is the legal property of its developers, whose names are too numerous |
| 5 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 6 | * source distribution. | |
|
8007
511119d4c2cd
[gaim-migrate @ 8685]
Christian Hammond <chipx86@chipx86.com>
parents:
7581
diff
changeset
|
7 | * |
| 6371 | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 | */ | |
| 22 | #include "internal.h" | |
| 23 | ||
| 24 | #include "account.h" | |
| 25 | #include "privacy.h" | |
| 26 | #include "server.h" | |
| 27 | #include "util.h" | |
| 28 | ||
| 29 | static GaimPrivacyUiOps *privacy_ops = NULL; | |
| 30 | ||
| 31 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
32 | gaim_privacy_permit_add(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
33 | gboolean local_only) |
| 6371 | 34 | { |
| 35 | GSList *l; | |
| 36 | char *name; | |
| 37 | ||
| 38 | g_return_val_if_fail(account != NULL, FALSE); | |
| 39 | g_return_val_if_fail(who != NULL, FALSE); | |
| 40 | ||
| 7261 | 41 | name = g_strdup(gaim_normalize(account, who)); |
| 6371 | 42 | |
| 43 | for (l = account->permit; l != NULL; l = l->next) { | |
| 7261 | 44 | if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) |
| 6371 | 45 | break; |
| 46 | } | |
| 47 | ||
| 48 | g_free(name); | |
| 49 | ||
| 50 | if (l != NULL) | |
| 51 | return FALSE; | |
| 52 | ||
| 53 | account->permit = g_slist_append(account->permit, g_strdup(who)); | |
| 54 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
55 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
56 | serv_add_permit(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
57 | |
| 6371 | 58 | if (privacy_ops != NULL && privacy_ops->permit_added != NULL) |
| 59 | privacy_ops->permit_added(account, who); | |
| 60 | ||
| 61 | return TRUE; | |
| 62 | } | |
| 63 | ||
| 64 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
65 | gaim_privacy_permit_remove(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
66 | gboolean local_only) |
| 6371 | 67 | { |
| 68 | GSList *l; | |
| 69 | char *name; | |
| 70 | ||
| 71 | g_return_val_if_fail(account != NULL, FALSE); | |
| 72 | g_return_val_if_fail(who != NULL, FALSE); | |
| 73 | ||
| 7261 | 74 | name = g_strdup(gaim_normalize(account, who)); |
| 6371 | 75 | |
| 76 | for (l = account->permit; l != NULL; l = l->next) { | |
| 7261 | 77 | if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) |
| 6371 | 78 | break; |
| 79 | } | |
| 80 | ||
| 81 | g_free(name); | |
| 82 | ||
| 83 | if (l == NULL) | |
| 84 | return FALSE; | |
| 85 | ||
| 86 | account->permit = g_slist_remove(account->permit, l->data); | |
| 87 | g_free(l->data); | |
| 88 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
89 | if (!local_only && gaim_account_is_connected(account)) |
|
7581
5ad7ed003472
[gaim-migrate @ 8199]
Mark Doliner <markdoliner@pidgin.im>
parents:
7261
diff
changeset
|
90 | serv_rem_permit(gaim_account_get_connection(account), who); |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
91 | |
| 6371 | 92 | if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) |
| 93 | privacy_ops->permit_removed(account, who); | |
| 94 | ||
| 95 | return TRUE; | |
| 96 | } | |
| 97 | ||
| 98 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
99 | gaim_privacy_deny_add(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
100 | gboolean local_only) |
| 6371 | 101 | { |
| 102 | GSList *l; | |
| 103 | char *name; | |
| 104 | ||
| 105 | g_return_val_if_fail(account != NULL, FALSE); | |
| 106 | g_return_val_if_fail(who != NULL, FALSE); | |
| 107 | ||
| 7261 | 108 | name = g_strdup(gaim_normalize(account, who)); |
| 6371 | 109 | |
| 110 | for (l = account->deny; l != NULL; l = l->next) { | |
| 7261 | 111 | if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) |
| 6371 | 112 | break; |
| 113 | } | |
| 114 | ||
| 115 | g_free(name); | |
| 116 | ||
| 117 | if (l != NULL) | |
| 118 | return FALSE; | |
| 119 | ||
| 120 | account->deny = g_slist_append(account->deny, g_strdup(who)); | |
| 121 | ||
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
122 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
123 | serv_add_deny(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
124 | |
| 6371 | 125 | if (privacy_ops != NULL && privacy_ops->deny_added != NULL) |
| 126 | privacy_ops->deny_added(account, who); | |
| 127 | ||
| 128 | return TRUE; | |
| 129 | } | |
| 130 | ||
| 131 | gboolean | |
|
6378
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
132 | gaim_privacy_deny_remove(GaimAccount *account, const char *who, |
|
233d1294508f
[gaim-migrate @ 6883]
Christian Hammond <chipx86@chipx86.com>
parents:
6375
diff
changeset
|
133 | gboolean local_only) |
| 6371 | 134 | { |
| 135 | GSList *l; | |
| 136 | char *name; | |
| 137 | ||
| 138 | g_return_val_if_fail(account != NULL, FALSE); | |
| 139 | g_return_val_if_fail(who != NULL, FALSE); | |
| 140 | ||
| 7261 | 141 | name = g_strdup(gaim_normalize(account, who)); |
| 6371 | 142 | |
| 143 | for (l = account->deny; l != NULL; l = l->next) { | |
| 7261 | 144 | if (!gaim_utf8_strcasecmp(name, gaim_normalize(account, (char *)l->data))) |
| 6371 | 145 | break; |
| 146 | } | |
| 147 | ||
| 148 | g_free(name); | |
| 149 | ||
| 150 | if (l == NULL) | |
| 151 | return FALSE; | |
| 152 | ||
| 153 | account->deny = g_slist_remove(account->deny, l->data); | |
| 154 | g_free(l->data); | |
| 155 | ||
|
8150
1b48c11a456e
[gaim-migrate @ 8862]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
156 | if (!local_only && gaim_account_is_connected(account)) |
|
6373
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
157 | serv_rem_deny(gaim_account_get_connection(account), who); |
|
919566d5cc80
[gaim-migrate @ 6878]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
158 | |
| 6371 | 159 | if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) |
| 160 | privacy_ops->deny_removed(account, who); | |
| 161 | ||
| 162 | return TRUE; | |
| 163 | } | |
| 164 | ||
| 165 | void | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
166 | gaim_privacy_set_ui_ops(GaimPrivacyUiOps *ops) |
| 6371 | 167 | { |
| 168 | privacy_ops = ops; | |
| 169 | } | |
| 170 | ||
| 171 | GaimPrivacyUiOps * | |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
172 | gaim_privacy_get_ui_ops(void) |
| 6371 | 173 | { |
| 174 | return privacy_ops; | |
| 175 | } | |
| 176 | ||
| 177 | void | |
| 178 | gaim_privacy_init(void) | |
| 179 | { | |
| 180 | } |