Mercurial > pidgin
annotate libgaim/privacy.h @ 15323:99dcbb8c4557
[gaim-migrate @ 18114]
Patch #1575852 from Denis Washington to fix group count display in the buddy
list when expanding/collapsing the groups.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 12 Jan 2007 17:43:25 +0000 |
parents | b17a907065cc |
children |
rev | line source |
---|---|
14192 | 1 /** |
2 * @file privacy.h Privacy API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #ifndef _GAIM_PRIVACY_H_ | |
26 #define _GAIM_PRIVACY_H_ | |
27 | |
28 #include "account.h" | |
29 | |
30 /** | |
31 * Privacy data types. | |
32 */ | |
33 typedef enum _GaimPrivacyType | |
34 { | |
35 GAIM_PRIVACY_ALLOW_ALL = 1, | |
36 GAIM_PRIVACY_DENY_ALL, | |
37 GAIM_PRIVACY_ALLOW_USERS, | |
38 GAIM_PRIVACY_DENY_USERS, | |
39 GAIM_PRIVACY_ALLOW_BUDDYLIST | |
40 } GaimPrivacyType; | |
41 | |
42 #ifdef __cplusplus | |
43 extern "C" { | |
44 #endif | |
45 | |
46 /** | |
47 * Privacy core/UI operations. | |
48 */ | |
49 typedef struct | |
50 { | |
51 void (*permit_added)(GaimAccount *account, const char *name); | |
52 void (*permit_removed)(GaimAccount *account, const char *name); | |
53 void (*deny_added)(GaimAccount *account, const char *name); | |
54 void (*deny_removed)(GaimAccount *account, const char *name); | |
55 | |
56 } GaimPrivacyUiOps; | |
57 | |
58 /** | |
59 * Adds a user to the account's permit list. | |
60 * | |
61 * @param account The account. | |
62 * @param name The name of the user to add to the list. | |
63 * @param local_only If TRUE, only the local list is updated, and not | |
64 * the server. | |
65 * | |
66 * @return TRUE if the user was added successfully, or @c FALSE otherwise. | |
67 */ | |
68 gboolean gaim_privacy_permit_add(GaimAccount *account, const char *name, | |
69 gboolean local_only); | |
70 | |
71 /** | |
72 * Removes a user from the account's permit list. | |
73 * | |
74 * @param account The account. | |
75 * @param name The name of the user to add to the list. | |
76 * @param local_only If TRUE, only the local list is updated, and not | |
77 * the server. | |
78 * | |
79 * @return TRUE if the user was removed successfully, or @c FALSE otherwise. | |
80 */ | |
81 gboolean gaim_privacy_permit_remove(GaimAccount *account, const char *name, | |
82 gboolean local_only); | |
83 | |
84 /** | |
85 * Adds a user to the account's deny list. | |
86 * | |
87 * @param account The account. | |
88 * @param name The name of the user to add to the list. | |
89 * @param local_only If TRUE, only the local list is updated, and not | |
90 * the server. | |
91 * | |
92 * @return TRUE if the user was added successfully, or @c FALSE otherwise. | |
93 */ | |
94 gboolean gaim_privacy_deny_add(GaimAccount *account, const char *name, | |
95 gboolean local_only); | |
96 | |
97 /** | |
98 * Removes a user from the account's deny list. | |
99 * | |
100 * @param account The account. | |
101 * @param name The name of the user to add to the list. | |
102 * @param local_only If TRUE, only the local list is updated, and not | |
103 * the server. | |
104 * | |
105 * @return TRUE if the user was removed successfully, or @c FALSE otherwise. | |
106 */ | |
107 gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name, | |
108 gboolean local_only); | |
109 | |
15318
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
110 /** |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
111 * Allow a user to send messages. If current privacy setting for the account is: |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
112 * GAIM_PRIVACY_ALLOW_USERS: The user is added to the allow-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
113 * GAIM_PRIVACY_DENY_USERS : The user is removed from the deny-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
114 * GAIM_PRIVACY_ALLOW_ALL : No changes made. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
115 * GAIM_PRIVACY_DENY_ALL : The privacy setting is changed to |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
116 * GAIM_PRIVACY_ALLOW_USERS and the user |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
117 * is added to the allow-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
118 * GAIM_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
119 * the buddy-list. Otherwise the setting is |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
120 * changed to GAIM_PRIVACY_ALLOW_USERS, all the |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
121 * buddies are added to the allow-list, and the |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
122 * user is also added to the allow-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
123 * |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
124 * @param account The account. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
125 * @param who The name of the user. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
126 * @param local Whether the change is local-only. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
127 * @param restore Should the previous allow/deny list be restored if the |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
128 * privacy setting is changed. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
129 */ |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
130 void gaim_privacy_allow(GaimAccount *account, const char *who, gboolean local, |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
131 gboolean restore); |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
132 |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
133 /** |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
134 * Block messages from a user. If current privacy setting for the account is: |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
135 * GAIM_PRIVACY_ALLOW_USERS: The user is removed from the allow-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
136 * GAIM_PRIVACY_DENY_USERS : The user is added to the deny-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
137 * GAIM_PRIVACY_DENY_ALL : No changes made. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
138 * GAIM_PRIVACY_ALLOW_ALL : The privacy setting is changed to |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
139 * GAIM_PRIVACY_DENY_USERS and the user is |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
140 * added to the deny-list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
141 * GAIM_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list, |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
142 * then no changes made. Otherwise, the setting |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
143 * is changed to GAIM_PRIVACY_ALLOW_USERS, all |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
144 * the buddies are added to the allow-list, and |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
145 * this user is removed from the list. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
146 * |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
147 * @param account The account. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
148 * @param who The name of the user. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
149 * @param local Whether the change is local-only. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
150 * @param restore Should the previous allow/deny list be restored if the |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
151 * privacy setting is changed. |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
152 */ |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
153 void gaim_privacy_deny(GaimAccount *account, const char *who, gboolean local, |
b17a907065cc
[gaim-migrate @ 18109]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14192
diff
changeset
|
154 gboolean restore); |
14192 | 155 |
156 /** | |
157 * Check the privacy-setting for a user. | |
158 * | |
159 * @param account The account. | |
160 * @param who The name of the user. | |
161 * | |
162 * @return @c FALSE if the specified account's privacy settings block the user or @c TRUE otherwise. The meaning of "block" is protocol-dependent and generally relates to status and/or sending of messages. | |
163 */ | |
164 gboolean gaim_privacy_check(GaimAccount *account, const char *who); | |
165 | |
166 /** | |
167 * Sets the UI operations structure for the privacy subsystem. | |
168 * | |
169 * @param ops The UI operations structure. | |
170 */ | |
171 void gaim_privacy_set_ui_ops(GaimPrivacyUiOps *ops); | |
172 | |
173 /** | |
174 * Returns the UI operations structure for the privacy subsystem. | |
175 * | |
176 * @return The UI operations structure. | |
177 */ | |
178 GaimPrivacyUiOps *gaim_privacy_get_ui_ops(void); | |
179 | |
180 /** | |
181 * Initializes the privacy subsystem. | |
182 */ | |
183 void gaim_privacy_init(void); | |
184 | |
185 #ifdef __cplusplus | |
186 } | |
187 #endif | |
188 | |
189 #endif /* _GAIM_PRIVACY_H_ */ |