Frameworks/libpurple.framework/Versions/0.6.2/Headers/privacy.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2539 Frameworks/libpurple.framework/Versions/0.6.0/Headers/privacy.h@2c9881ea8cdf
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
Evan@653
     1
/**
Evan@653
     2
 * @file privacy.h Privacy API
Evan@653
     3
 * @ingroup core
Evan@653
     4
 */
Evan@653
     5
Evan@653
     6
/* purple
Evan@653
     7
 *
Evan@653
     8
 * Purple is the legal property of its developers, whose names are too numerous
Evan@653
     9
 * to list here.  Please refer to the COPYRIGHT file distributed with this
Evan@653
    10
 * source distribution.
Evan@653
    11
 *
Evan@653
    12
 * This program is free software; you can redistribute it and/or modify
Evan@653
    13
 * it under the terms of the GNU General Public License as published by
Evan@653
    14
 * the Free Software Foundation; either version 2 of the License, or
Evan@653
    15
 * (at your option) any later version.
Evan@653
    16
 *
Evan@653
    17
 * This program is distributed in the hope that it will be useful,
Evan@653
    18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Evan@653
    19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Evan@653
    20
 * GNU General Public License for more details.
Evan@653
    21
 *
Evan@653
    22
 * You should have received a copy of the GNU General Public License
Evan@653
    23
 * along with this program; if not, write to the Free Software
Evan@653
    24
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
Evan@653
    25
 */
Evan@653
    26
#ifndef _PURPLE_PRIVACY_H_
Evan@653
    27
#define _PURPLE_PRIVACY_H_
Evan@653
    28
Evan@653
    29
/**
Evan@653
    30
 * Privacy data types.
Evan@653
    31
 */
Evan@653
    32
typedef enum _PurplePrivacyType
Evan@653
    33
{
Evan@653
    34
	PURPLE_PRIVACY_ALLOW_ALL = 1,
Evan@653
    35
	PURPLE_PRIVACY_DENY_ALL,
Evan@653
    36
	PURPLE_PRIVACY_ALLOW_USERS,
Evan@653
    37
	PURPLE_PRIVACY_DENY_USERS,
Evan@653
    38
	PURPLE_PRIVACY_ALLOW_BUDDYLIST
Evan@653
    39
} PurplePrivacyType;
Evan@653
    40
zacw@2539
    41
#include "account.h"
zacw@2539
    42
Evan@653
    43
#ifdef __cplusplus
Evan@653
    44
extern "C" {
Evan@653
    45
#endif
Evan@653
    46
Evan@653
    47
/**
Evan@653
    48
 * Privacy core/UI operations.
Evan@653
    49
 */
Evan@653
    50
typedef struct
Evan@653
    51
{
Evan@653
    52
	void (*permit_added)(PurpleAccount *account, const char *name);
Evan@653
    53
	void (*permit_removed)(PurpleAccount *account, const char *name);
Evan@653
    54
	void (*deny_added)(PurpleAccount *account, const char *name);
Evan@653
    55
	void (*deny_removed)(PurpleAccount *account, const char *name);
Evan@653
    56
Evan@653
    57
	void (*_purple_reserved1)(void);
Evan@653
    58
	void (*_purple_reserved2)(void);
Evan@653
    59
	void (*_purple_reserved3)(void);
Evan@653
    60
	void (*_purple_reserved4)(void);
Evan@653
    61
} PurplePrivacyUiOps;
Evan@653
    62
Evan@653
    63
/**
Evan@653
    64
 * Adds a user to the account's permit list.
Evan@653
    65
 *
Evan@653
    66
 * @param account    The account.
Evan@653
    67
 * @param name       The name of the user to add to the list.
Evan@653
    68
 * @param local_only If TRUE, only the local list is updated, and not
Evan@653
    69
 *                   the server.
Evan@653
    70
 *
Evan@653
    71
 * @return TRUE if the user was added successfully, or @c FALSE otherwise.
Evan@653
    72
 */
Evan@653
    73
gboolean purple_privacy_permit_add(PurpleAccount *account, const char *name,
Evan@653
    74
								 gboolean local_only);
Evan@653
    75
Evan@653
    76
/**
Evan@653
    77
 * Removes a user from the account's permit list.
Evan@653
    78
 *
Evan@653
    79
 * @param account    The account.
Evan@653
    80
 * @param name       The name of the user to add to the list.
Evan@653
    81
 * @param local_only If TRUE, only the local list is updated, and not
Evan@653
    82
 *                   the server.
Evan@653
    83
 *
Evan@653
    84
 * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
Evan@653
    85
 */
Evan@653
    86
gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *name,
Evan@653
    87
									gboolean local_only);
Evan@653
    88
Evan@653
    89
/**
Evan@653
    90
 * Adds a user to the account's deny list.
Evan@653
    91
 *
Evan@653
    92
 * @param account    The account.
Evan@653
    93
 * @param name       The name of the user to add to the list.
Evan@653
    94
 * @param local_only If TRUE, only the local list is updated, and not
Evan@653
    95
 *                   the server.
Evan@653
    96
 *
Evan@653
    97
 * @return TRUE if the user was added successfully, or @c FALSE otherwise.
Evan@653
    98
 */
Evan@653
    99
gboolean purple_privacy_deny_add(PurpleAccount *account, const char *name,
Evan@653
   100
							   gboolean local_only);
Evan@653
   101
Evan@653
   102
/**
Evan@653
   103
 * Removes a user from the account's deny list.
Evan@653
   104
 *
Evan@653
   105
 * @param account    The account.
Evan@653
   106
 * @param name       The name of the user to add to the list.
Evan@653
   107
 * @param local_only If TRUE, only the local list is updated, and not
Evan@653
   108
 *                   the server.
Evan@653
   109
 *
Evan@653
   110
 * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
Evan@653
   111
 */
Evan@653
   112
gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *name,
Evan@653
   113
								  gboolean local_only);
Evan@653
   114
Evan@653
   115
/**
Evan@653
   116
 * Allow a user to send messages. If current privacy setting for the account is:
Evan@653
   117
 *		PURPLE_PRIVACY_ALLOW_USERS:	The user is added to the allow-list.
Evan@653
   118
 *		PURPLE_PRIVACY_DENY_USERS	:	The user is removed from the deny-list.
Evan@653
   119
 *		PURPLE_PRIVACY_ALLOW_ALL	:	No changes made.
Evan@653
   120
 *		PURPLE_PRIVACY_DENY_ALL	:	The privacy setting is changed to
Evan@653
   121
 *									PURPLE_PRIVACY_ALLOW_USERS and the user
Evan@653
   122
 *									is added to the allow-list.
Evan@653
   123
 *		PURPLE_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in
Evan@653
   124
 *									the buddy-list. Otherwise the setting is
Evan@653
   125
 *									changed to PURPLE_PRIVACY_ALLOW_USERS, all the
Evan@653
   126
 *									buddies are added to the allow-list, and the
Evan@653
   127
 *									user is also added to the allow-list.
Evan@1427
   128
 *
Evan@653
   129
 * @param account	The account.
Evan@653
   130
 * @param who		The name of the user.
Evan@653
   131
 * @param local		Whether the change is local-only.
Evan@653
   132
 * @param restore	Should the previous allow/deny list be restored if the
Evan@653
   133
 *					privacy setting is changed.
Evan@653
   134
 */
Evan@653
   135
void purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
Evan@653
   136
						gboolean restore);
Evan@653
   137
Evan@653
   138
/**
Evan@653
   139
 * Block messages from a user. If current privacy setting for the account is:
Evan@653
   140
 *		PURPLE_PRIVACY_ALLOW_USERS:	The user is removed from the allow-list.
Evan@653
   141
 *		PURPLE_PRIVACY_DENY_USERS	:	The user is added to the deny-list.
Evan@653
   142
 *		PURPLE_PRIVACY_DENY_ALL	:	No changes made.
Evan@653
   143
 *		PURPLE_PRIVACY_ALLOW_ALL	:	The privacy setting is changed to
Evan@653
   144
 *									PURPLE_PRIVACY_DENY_USERS and the user is
Evan@653
   145
 *									added to the deny-list.
Evan@653
   146
 *		PURPLE_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list,
Evan@653
   147
 *									then no changes made. Otherwise, the setting
Evan@653
   148
 *									is changed to PURPLE_PRIVACY_ALLOW_USERS, all
Evan@653
   149
 *									the buddies are added to the allow-list, and
Evan@653
   150
 *									this user is removed from the list.
Evan@653
   151
 *
Evan@653
   152
 * @param account	The account.
Evan@653
   153
 * @param who		The name of the user.
Evan@653
   154
 * @param local		Whether the change is local-only.
Evan@653
   155
 * @param restore	Should the previous allow/deny list be restored if the
Evan@653
   156
 *					privacy setting is changed.
Evan@653
   157
 */
Evan@653
   158
void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
Evan@653
   159
						gboolean restore);
Evan@653
   160
Evan@653
   161
/**
Evan@653
   162
 * Check the privacy-setting for a user.
Evan@653
   163
 *
Evan@653
   164
 * @param account	The account.
Evan@653
   165
 * @param who		The name of the user.
Evan@653
   166
 *
Evan@653
   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.
Evan@653
   168
 */
Evan@653
   169
gboolean purple_privacy_check(PurpleAccount *account, const char *who);
Evan@653
   170
Evan@653
   171
/**
Evan@653
   172
 * Sets the UI operations structure for the privacy subsystem.
Evan@653
   173
 *
Evan@653
   174
 * @param ops The UI operations structure.
Evan@653
   175
 */
Evan@653
   176
void purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops);
Evan@653
   177
Evan@653
   178
/**
Evan@653
   179
 * Returns the UI operations structure for the privacy subsystem.
Evan@653
   180
 *
Evan@653
   181
 * @return The UI operations structure.
Evan@653
   182
 */
Evan@653
   183
PurplePrivacyUiOps *purple_privacy_get_ui_ops(void);
Evan@653
   184
Evan@653
   185
/**
Evan@653
   186
 * Initializes the privacy subsystem.
Evan@653
   187
 */
Evan@653
   188
void purple_privacy_init(void);
Evan@653
   189
Evan@653
   190
#ifdef __cplusplus
Evan@653
   191
}
Evan@653
   192
#endif
Evan@653
   193
Evan@653
   194
#endif /* _PURPLE_PRIVACY_H_ */