Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/privacy.h
branchadium-1.5.11
changeset 6014 fcb71cb71a3d
parent 5941 307f53385811
parent 6013 f8d0dc659e3f
child 6016 325e2ab3406f
equal deleted inserted replaced
5941:307f53385811 6014:fcb71cb71a3d
     1 /**
       
     2  * @file privacy.h Privacy API
       
     3  * @ingroup core
       
     4  */
       
     5 
       
     6 /* purple
       
     7  *
       
     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.
       
    11  *
       
    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.
       
    16  *
       
    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.
       
    21  *
       
    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
       
    25  */
       
    26 #ifndef _PURPLE_PRIVACY_H_
       
    27 #define _PURPLE_PRIVACY_H_
       
    28 
       
    29 /**
       
    30  * Privacy data types.
       
    31  */
       
    32 typedef enum _PurplePrivacyType
       
    33 {
       
    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
       
    39 } PurplePrivacyType;
       
    40 
       
    41 #include "account.h"
       
    42 
       
    43 #ifdef __cplusplus
       
    44 extern "C" {
       
    45 #endif
       
    46 
       
    47 /**
       
    48  * Privacy core/UI operations.
       
    49  */
       
    50 typedef struct
       
    51 {
       
    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);
       
    56 
       
    57 	void (*_purple_reserved1)(void);
       
    58 	void (*_purple_reserved2)(void);
       
    59 	void (*_purple_reserved3)(void);
       
    60 	void (*_purple_reserved4)(void);
       
    61 } PurplePrivacyUiOps;
       
    62 
       
    63 /**
       
    64  * Adds a user to the account's permit list.
       
    65  *
       
    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
       
    69  *                   the server.
       
    70  *
       
    71  * @return TRUE if the user was added successfully, or @c FALSE otherwise.
       
    72  */
       
    73 gboolean purple_privacy_permit_add(PurpleAccount *account, const char *name,
       
    74 								 gboolean local_only);
       
    75 
       
    76 /**
       
    77  * Removes a user from the account's permit list.
       
    78  *
       
    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
       
    82  *                   the server.
       
    83  *
       
    84  * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
       
    85  */
       
    86 gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *name,
       
    87 									gboolean local_only);
       
    88 
       
    89 /**
       
    90  * Adds a user to the account's deny list.
       
    91  *
       
    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
       
    95  *                   the server.
       
    96  *
       
    97  * @return TRUE if the user was added successfully, or @c FALSE otherwise.
       
    98  */
       
    99 gboolean purple_privacy_deny_add(PurpleAccount *account, const char *name,
       
   100 							   gboolean local_only);
       
   101 
       
   102 /**
       
   103  * Removes a user from the account's deny list.
       
   104  *
       
   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
       
   108  *                   the server.
       
   109  *
       
   110  * @return TRUE if the user was removed successfully, or @c FALSE otherwise.
       
   111  */
       
   112 gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *name,
       
   113 								  gboolean local_only);
       
   114 
       
   115 /**
       
   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.
       
   128  *
       
   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.
       
   134  */
       
   135 void purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
       
   136 						gboolean restore);
       
   137 
       
   138 /**
       
   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.
       
   151  *
       
   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.
       
   157  */
       
   158 void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
       
   159 						gboolean restore);
       
   160 
       
   161 /**
       
   162  * Check the privacy-setting for a user.
       
   163  *
       
   164  * @param account	The account.
       
   165  * @param who		The name of the user.
       
   166  *
       
   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.
       
   168  */
       
   169 gboolean purple_privacy_check(PurpleAccount *account, const char *who);
       
   170 
       
   171 /**
       
   172  * Sets the UI operations structure for the privacy subsystem.
       
   173  *
       
   174  * @param ops The UI operations structure.
       
   175  */
       
   176 void purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops);
       
   177 
       
   178 /**
       
   179  * Returns the UI operations structure for the privacy subsystem.
       
   180  *
       
   181  * @return The UI operations structure.
       
   182  */
       
   183 PurplePrivacyUiOps *purple_privacy_get_ui_ops(void);
       
   184 
       
   185 /**
       
   186  * Initializes the privacy subsystem.
       
   187  */
       
   188 void purple_privacy_init(void);
       
   189 
       
   190 #ifdef __cplusplus
       
   191 }
       
   192 #endif
       
   193 
       
   194 #endif /* _PURPLE_PRIVACY_H_ */