2 * @file privacy.h Privacy API
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _PURPLE_PRIVACY_H_
27 #define _PURPLE_PRIVACY_H_
32 typedef enum _PurplePrivacyType
34 PURPLE_PRIVACY_ALLOW_ALL = 1,
35 PURPLE_PRIVACY_DENY_ALL,
36 PURPLE_PRIVACY_ALLOW_USERS,
37 PURPLE_PRIVACY_DENY_USERS,
38 PURPLE_PRIVACY_ALLOW_BUDDYLIST
48 * Privacy core/UI operations.
52 void (*permit_added)(PurpleAccount *account, const char *name);
53 void (*permit_removed)(PurpleAccount *account, const char *name);
54 void (*deny_added)(PurpleAccount *account, const char *name);
55 void (*deny_removed)(PurpleAccount *account, const char *name);
57 void (*_purple_reserved1)(void);
58 void (*_purple_reserved2)(void);
59 void (*_purple_reserved3)(void);
60 void (*_purple_reserved4)(void);
64 * Adds a user to the account's permit list.
66 * @param account The account.
67 * @param name The name of the user to add to the list.
68 * @param local_only If TRUE, only the local list is updated, and not
71 * @return TRUE if the user was added successfully, or @c FALSE otherwise.
73 gboolean purple_privacy_permit_add(PurpleAccount *account, const char *name,
77 * Removes a user from the account's permit list.
79 * @param account The account.
80 * @param name The name of the user to add to the list.
81 * @param local_only If TRUE, only the local list is updated, and not
84 * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
86 gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *name,
90 * Adds a user to the account's deny list.
92 * @param account The account.
93 * @param name The name of the user to add to the list.
94 * @param local_only If TRUE, only the local list is updated, and not
97 * @return TRUE if the user was added successfully, or @c FALSE otherwise.
99 gboolean purple_privacy_deny_add(PurpleAccount *account, const char *name,
100 gboolean local_only);
103 * Removes a user from the account's deny list.
105 * @param account The account.
106 * @param name The name of the user to add to the list.
107 * @param local_only If TRUE, only the local list is updated, and not
110 * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
112 gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *name,
113 gboolean local_only);
116 * Allow a user to send messages. If current privacy setting for the account is:
117 * PURPLE_PRIVACY_ALLOW_USERS: The user is added to the allow-list.
118 * PURPLE_PRIVACY_DENY_USERS : The user is removed from the deny-list.
119 * PURPLE_PRIVACY_ALLOW_ALL : No changes made.
120 * PURPLE_PRIVACY_DENY_ALL : The privacy setting is changed to
121 * PURPLE_PRIVACY_ALLOW_USERS and the user
122 * is added to the allow-list.
123 * PURPLE_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in
124 * the buddy-list. Otherwise the setting is
125 * changed to PURPLE_PRIVACY_ALLOW_USERS, all the
126 * buddies are added to the allow-list, and the
127 * user is also added to the allow-list.
129 * @param account The account.
130 * @param who The name of the user.
131 * @param local Whether the change is local-only.
132 * @param restore Should the previous allow/deny list be restored if the
133 * privacy setting is changed.
135 void purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
139 * Block messages from a user. If current privacy setting for the account is:
140 * PURPLE_PRIVACY_ALLOW_USERS: The user is removed from the allow-list.
141 * PURPLE_PRIVACY_DENY_USERS : The user is added to the deny-list.
142 * PURPLE_PRIVACY_DENY_ALL : No changes made.
143 * PURPLE_PRIVACY_ALLOW_ALL : The privacy setting is changed to
144 * PURPLE_PRIVACY_DENY_USERS and the user is
145 * added to the deny-list.
146 * PURPLE_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list,
147 * then no changes made. Otherwise, the setting
148 * is changed to PURPLE_PRIVACY_ALLOW_USERS, all
149 * the buddies are added to the allow-list, and
150 * this user is removed from the list.
152 * @param account The account.
153 * @param who The name of the user.
154 * @param local Whether the change is local-only.
155 * @param restore Should the previous allow/deny list be restored if the
156 * privacy setting is changed.
158 void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
162 * Check the privacy-setting for a user.
164 * @param account The account.
165 * @param who The name of the user.
167 * @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.
169 gboolean purple_privacy_check(PurpleAccount *account, const char *who);
172 * Sets the UI operations structure for the privacy subsystem.
174 * @param ops The UI operations structure.
176 void purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops);
179 * Returns the UI operations structure for the privacy subsystem.
181 * @return The UI operations structure.
183 PurplePrivacyUiOps *purple_privacy_get_ui_ops(void);
186 * Initializes the privacy subsystem.
188 void purple_privacy_init(void);
194 #endif /* _PURPLE_PRIVACY_H_ */