3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_ACCOUNTS_H_
23 #define _PURPLE_ACCOUNTS_H_
26 * @section_id: libpurple-accounts
27 * @short_description: <filename>accounts.h</filename>
28 * @title: Accounts Subsystem API
29 * @see_also: <link linkend="chapter-signals-account">Account signals</link>
35 #define PURPLE_TYPE_ACCOUNT_UI_OPS (purple_account_ui_ops_get_type())
37 typedef struct _PurpleAccountUiOps PurpleAccountUiOps
;
41 * @notify_added: A buddy who is already on this account's buddy list
42 * added this account to their buddy list.
43 * @status_changed: This account's status changed.
44 * @request_add: Someone we don't have on our list added us; prompt
46 * @request_authorize: Prompt for authorization when someone adds this
47 * account to their buddy list. To authorize them to
48 * see this account's presence, call
49 * @authorize_cb (@message, @user_data) otherwise call
50 * @deny_cb (@message, @user_data).
51 * <sbr/>Returns: A UI-specific handle, as passed to
52 * @close_account_request.
53 * @close_account_request: Close a pending request for authorization.
54 * @ui_handle is a handle as returned by
57 * Account UI operations, used to notify the user of status changes and when
58 * buddies add this account to their buddy lists.
60 struct _PurpleAccountUiOps
62 void (*notify_added
)(PurpleAccount
*account
,
63 const char *remote_user
,
68 void (*status_changed
)(PurpleAccount
*account
,
69 PurpleStatus
*status
);
71 void (*request_add
)(PurpleAccount
*account
,
72 const char *remote_user
,
77 void *(*request_authorize
)(PurpleAccount
*account
,
78 const char *remote_user
,
83 PurpleAccountRequestAuthorizationCb authorize_cb
,
84 PurpleAccountRequestAuthorizationCb deny_cb
,
87 void (*close_account_request
)(void *ui_handle
);
89 void (*permit_added
)(PurpleAccount
*account
, const char *name
);
90 void (*permit_removed
)(PurpleAccount
*account
, const char *name
);
91 void (*deny_added
)(PurpleAccount
*account
, const char *name
);
92 void (*deny_removed
)(PurpleAccount
*account
, const char *name
);
95 void (*_purple_reserved1
)(void);
96 void (*_purple_reserved2
)(void);
97 void (*_purple_reserved3
)(void);
98 void (*_purple_reserved4
)(void);
103 /**************************************************************************/
105 /**************************************************************************/
108 * purple_accounts_add:
109 * @account: The account.
111 * Adds an account to the list of accounts.
113 void purple_accounts_add(PurpleAccount
*account
);
116 * purple_accounts_remove:
117 * @account: The account.
119 * Removes an account from the list of accounts.
121 void purple_accounts_remove(PurpleAccount
*account
);
124 * purple_accounts_delete:
125 * @account: The account.
127 * Deletes an account.
129 * This will remove any buddies from the buddy list that belong to this
130 * account, buddy pounces that belong to this account, and will also
133 void purple_accounts_delete(PurpleAccount
*account
);
136 * purple_accounts_reorder:
137 * @account: The account to reorder.
138 * @new_index: The new index for the account.
140 * Reorders an account.
142 void purple_accounts_reorder(PurpleAccount
*account
, guint new_index
);
145 * purple_accounts_get_all:
147 * Returns a list of all accounts.
149 * Returns: (transfer none): A list of all accounts.
151 GList
*purple_accounts_get_all(void);
154 * purple_accounts_get_all_active:
156 * Returns a list of all enabled accounts
158 * Returns: A list of all enabled accounts. The list is owned
159 * by the caller, and must be g_list_free()d to avoid
162 GList
*purple_accounts_get_all_active(void);
165 * purple_accounts_find:
166 * @name: The account username.
167 * @protocol: The account protocol ID.
169 * Finds an account with the specified name and protocol id.
171 * Returns: The account, if found, or %FALSE otherwise.
173 PurpleAccount
*purple_accounts_find(const char *name
, const char *protocol
);
176 * purple_accounts_restore_current_statuses:
178 * This is called by the core after all subsystems and what
179 * not have been initialized. It sets all enabled accounts
180 * to their startup status by signing them on, setting them
183 * You probably shouldn't call this unless you really know
186 void purple_accounts_restore_current_statuses(void);
189 /**************************************************************************/
190 /* UI Registration Functions */
191 /**************************************************************************/
194 * purple_account_ui_ops_get_type:
196 * Returns: The #GType for the #PurpleAccountUiOps boxed structure.
198 GType
purple_account_ui_ops_get_type(void);
201 * purple_accounts_set_ui_ops:
202 * @ops: The UI operations structure.
204 * Sets the UI operations structure to be used for accounts.
206 void purple_accounts_set_ui_ops(PurpleAccountUiOps
*ops
);
209 * purple_accounts_get_ui_ops:
211 * Returns the UI operations structure used for accounts.
213 * Returns: The UI operations structure in use.
215 PurpleAccountUiOps
*purple_accounts_get_ui_ops(void);
218 /**************************************************************************/
219 /* Accounts Subsystem */
220 /**************************************************************************/
223 * purple_accounts_get_handle:
225 * Returns the accounts subsystem handle.
227 * Returns: The accounts subsystem handle.
229 void *purple_accounts_get_handle(void);
232 * purple_accounts_init:
234 * Initializes the accounts subsystem.
236 void purple_accounts_init(void);
239 * purple_accounts_uninit:
241 * Uninitializes the accounts subsystem.
243 void purple_accounts_uninit(void);
246 * purple_accounts_schedule_save:
248 * Schedules saving of accounts
250 void purple_accounts_schedule_save(void);
254 #endif /* _PURPLE_ACCOUNTS_H_ */