comparison libpurple/privacy.h @ 15374:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15373:f79e0f4df793 15374:5fe8042783c1
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
110 /**
111 * Allow a user to send messages. If current privacy setting for the account is:
112 * GAIM_PRIVACY_ALLOW_USERS: The user is added to the allow-list.
113 * GAIM_PRIVACY_DENY_USERS : The user is removed from the deny-list.
114 * GAIM_PRIVACY_ALLOW_ALL : No changes made.
115 * GAIM_PRIVACY_DENY_ALL : The privacy setting is changed to
116 * GAIM_PRIVACY_ALLOW_USERS and the user
117 * is added to the allow-list.
118 * GAIM_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in
119 * the buddy-list. Otherwise the setting is
120 * changed to GAIM_PRIVACY_ALLOW_USERS, all the
121 * buddies are added to the allow-list, and the
122 * user is also added to the allow-list.
123 *
124 * @param account The account.
125 * @param who The name of the user.
126 * @param local Whether the change is local-only.
127 * @param restore Should the previous allow/deny list be restored if the
128 * privacy setting is changed.
129 */
130 void gaim_privacy_allow(GaimAccount *account, const char *who, gboolean local,
131 gboolean restore);
132
133 /**
134 * Block messages from a user. If current privacy setting for the account is:
135 * GAIM_PRIVACY_ALLOW_USERS: The user is removed from the allow-list.
136 * GAIM_PRIVACY_DENY_USERS : The user is added to the deny-list.
137 * GAIM_PRIVACY_DENY_ALL : No changes made.
138 * GAIM_PRIVACY_ALLOW_ALL : The privacy setting is changed to
139 * GAIM_PRIVACY_DENY_USERS and the user is
140 * added to the deny-list.
141 * GAIM_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list,
142 * then no changes made. Otherwise, the setting
143 * is changed to GAIM_PRIVACY_ALLOW_USERS, all
144 * the buddies are added to the allow-list, and
145 * this user is removed from the list.
146 *
147 * @param account The account.
148 * @param who The name of the user.
149 * @param local Whether the change is local-only.
150 * @param restore Should the previous allow/deny list be restored if the
151 * privacy setting is changed.
152 */
153 void gaim_privacy_deny(GaimAccount *account, const char *who, gboolean local,
154 gboolean restore);
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_ */