Fix crashes when filenames end up being NULL in some prpls.
[pidgin-git.git] / libpurple / account.h
blob89f55bed69ebf881787cce4f857df0d2cc496ef2
1 /**
2 * @file account.h Account API
3 * @ingroup core
4 * @see @ref account-signals
5 */
7 /* purple
9 * Purple is the legal property of its developers, whose names are too numerous
10 * to list here. Please refer to the COPYRIGHT file distributed with this
11 * source distribution.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef _PURPLE_ACCOUNT_H_
28 #define _PURPLE_ACCOUNT_H_
30 #include <glib.h>
31 #include <glib-object.h>
33 /** @copydoc _PurpleAccountUiOps */
34 typedef struct _PurpleAccountUiOps PurpleAccountUiOps;
35 /** @copydoc _PurpleAccount */
36 typedef struct _PurpleAccount PurpleAccount;
38 typedef gboolean (*PurpleFilterAccountFunc)(PurpleAccount *account);
39 typedef void (*PurpleAccountRequestAuthorizationCb)(void *);
40 typedef void (*PurpleAccountRegistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data);
41 typedef void (*PurpleAccountUnregistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data);
43 #include "connection.h"
44 #include "log.h"
45 #include "proxy.h"
46 #include "prpl.h"
47 #include "status.h"
49 /**
50 * Account request types.
52 typedef enum
54 PURPLE_ACCOUNT_REQUEST_AUTHORIZATION = 0 /* Account authorization request */
55 } PurpleAccountRequestType;
58 /** Account UI operations, used to notify the user of status changes and when
59 * buddies add this account to their buddy lists.
61 struct _PurpleAccountUiOps
63 /** A buddy who is already on this account's buddy list added this account
64 * to their buddy list.
66 void (*notify_added)(PurpleAccount *account,
67 const char *remote_user,
68 const char *id,
69 const char *alias,
70 const char *message);
72 /** This account's status changed. */
73 void (*status_changed)(PurpleAccount *account,
74 PurpleStatus *status);
76 /** Someone we don't have on our list added us; prompt to add them. */
77 void (*request_add)(PurpleAccount *account,
78 const char *remote_user,
79 const char *id,
80 const char *alias,
81 const char *message);
83 /** Prompt for authorization when someone adds this account to their buddy
84 * list. To authorize them to see this account's presence, call \a
85 * authorize_cb (\a user_data); otherwise call \a deny_cb (\a user_data);
86 * @return a UI-specific handle, as passed to #close_account_request.
88 void *(*request_authorize)(PurpleAccount *account,
89 const char *remote_user,
90 const char *id,
91 const char *alias,
92 const char *message,
93 gboolean on_list,
94 PurpleAccountRequestAuthorizationCb authorize_cb,
95 PurpleAccountRequestAuthorizationCb deny_cb,
96 void *user_data);
98 /** Close a pending request for authorization. \a ui_handle is a handle
99 * as returned by #request_authorize.
101 void (*close_account_request)(void *ui_handle);
103 void (*_purple_reserved1)(void);
104 void (*_purple_reserved2)(void);
105 void (*_purple_reserved3)(void);
106 void (*_purple_reserved4)(void);
109 /** Structure representing an account.
111 struct _PurpleAccount
113 char *username; /**< The username. */
114 char *alias; /**< How you appear to yourself. */
115 char *password; /**< The account password. */
116 char *user_info; /**< User information. */
118 char *buddy_icon_path; /**< The buddy icon's non-cached path. */
120 gboolean remember_pass; /**< Remember the password. */
122 char *protocol_id; /**< The ID of the protocol. */
124 PurpleConnection *gc; /**< The connection handle. */
125 gboolean disconnecting; /**< The account is currently disconnecting */
127 GHashTable *settings; /**< Protocol-specific settings. */
128 GHashTable *ui_settings; /**< UI-specific settings. */
130 PurpleProxyInfo *proxy_info; /**< Proxy information. This will be set */
131 /* to NULL when the account inherits */
132 /* proxy settings from global prefs. */
135 * TODO: Supplementing the next two linked lists with hash tables
136 * should help performance a lot when these lists are long. This
137 * matters quite a bit for protocols like MSN, where all your
138 * buddies are added to your permit list. Currently we have to
139 * iterate through the entire list if we want to check if someone
140 * is permitted or denied. We should do this for 3.0.0.
142 GSList *permit; /**< Permit list. */
143 GSList *deny; /**< Deny list. */
144 int perm_deny; /**< The permit/deny setting. */
146 GList *status_types; /**< Status types. */
148 PurplePresence *presence; /**< Presence. */
149 PurpleLog *system_log; /**< The system log */
151 void *ui_data; /**< The UI can put data here. */
152 PurpleAccountRegistrationCb registration_cb;
153 void *registration_cb_user_data;
155 gpointer priv; /**< Pointer to opaque private data. */
158 #ifdef __cplusplus
159 extern "C" {
160 #endif
162 /**************************************************************************/
163 /** @name Account API */
164 /**************************************************************************/
165 /*@{*/
168 * Creates a new account.
170 * @param username The username.
171 * @param protocol_id The protocol ID.
173 * @return The new account.
175 PurpleAccount *purple_account_new(const char *username, const char *protocol_id);
178 * Destroys an account.
180 * @param account The account to destroy.
182 void purple_account_destroy(PurpleAccount *account);
185 * Connects to an account.
187 * @param account The account to connect to.
189 void purple_account_connect(PurpleAccount *account);
192 * Sets the callback for successful registration.
194 * @param account The account for which this callback should be used
195 * @param cb The callback
196 * @param user_data The user data passed to the callback
198 void purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data);
201 * Registers an account.
203 * @param account The account to register.
205 void purple_account_register(PurpleAccount *account);
208 * Unregisters an account (deleting it from the server).
210 * @param account The account to unregister.
211 * @param cb Optional callback to be called when unregistration is complete
212 * @param user_data user data to pass to the callback
214 void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data);
217 * Disconnects from an account.
219 * @param account The account to disconnect from.
221 void purple_account_disconnect(PurpleAccount *account);
224 * Notifies the user that the account was added to a remote user's
225 * buddy list.
227 * This will present a dialog informing the user that he was added to the
228 * remote user's buddy list.
230 * @param account The account that was added.
231 * @param remote_user The name of the user that added this account.
232 * @param id The optional ID of the local account. Rarely used.
233 * @param alias The optional alias of the user.
234 * @param message The optional message sent from the user adding you.
236 void purple_account_notify_added(PurpleAccount *account, const char *remote_user,
237 const char *id, const char *alias,
238 const char *message);
241 * Notifies the user that the account was addded to a remote user's buddy
242 * list and asks ther user if they want to add the remote user to their buddy
243 * list.
245 * This will present a dialog informing the local user that the remote user
246 * added them to the remote user's buddy list and will ask if they want to add
247 * the remote user to the buddy list.
249 * @param account The account that was added.
250 * @param remote_user The name of the user that added this account.
251 * @param id The optional ID of the local account. Rarely used.
252 * @param alias The optional alias of the user.
253 * @param message The optional message sent from the user adding you.
255 void purple_account_request_add(PurpleAccount *account, const char *remote_user,
256 const char *id, const char *alias,
257 const char *message);
260 * Notifies the user that a remote user has wants to add the local user
261 * to his or her buddy list and requires authorization to do so.
263 * This will present a dialog informing the user of this and ask if the
264 * user authorizes or denies the remote user from adding him.
266 * @param account The account that was added
267 * @param remote_user The name of the user that added this account.
268 * @param id The optional ID of the local account. Rarely used.
269 * @param alias The optional alias of the remote user.
270 * @param message The optional message sent by the user wanting to add you.
271 * @param on_list Is the remote user already on the buddy list?
272 * @param auth_cb The callback called when the local user accepts
273 * @param deny_cb The callback called when the local user rejects
274 * @param user_data Data to be passed back to the above callbacks
276 * @return A UI-specific handle.
278 void *purple_account_request_authorization(PurpleAccount *account, const char *remote_user,
279 const char *id, const char *alias, const char *message, gboolean on_list,
280 PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data);
283 * Close account requests registered for the given PurpleAccount
285 * @param account The account for which requests should be closed
287 void purple_account_request_close_with_account(PurpleAccount *account);
290 * Close the account request for the given ui handle
292 * @param ui_handle The ui specific handle for which requests should be closed
294 void purple_account_request_close(void *ui_handle);
297 * Requests a password from the user for the account. Does not set the
298 * account password on success; do that in ok_cb if desired.
300 * @param account The account to request the password for.
301 * @param ok_cb The callback for the OK button.
302 * @param cancel_cb The callback for the cancel button.
303 * @param user_data User data to be passed into callbacks.
305 void purple_account_request_password(PurpleAccount *account, GCallback ok_cb,
306 GCallback cancel_cb, void *user_data);
309 * Requests information from the user to change the account's password.
311 * @param account The account to change the password on.
313 void purple_account_request_change_password(PurpleAccount *account);
316 * Requests information from the user to change the account's
317 * user information.
319 * @param account The account to change the user information on.
321 void purple_account_request_change_user_info(PurpleAccount *account);
324 * Sets the account's username.
326 * @param account The account.
327 * @param username The username.
329 void purple_account_set_username(PurpleAccount *account, const char *username);
332 * Sets the account's password.
334 * @param account The account.
335 * @param password The password.
337 void purple_account_set_password(PurpleAccount *account, const char *password);
340 * Sets the account's alias.
342 * @param account The account.
343 * @param alias The alias.
345 void purple_account_set_alias(PurpleAccount *account, const char *alias);
348 * Sets the account's user information
350 * @param account The account.
351 * @param user_info The user information.
353 void purple_account_set_user_info(PurpleAccount *account, const char *user_info);
356 * Sets the account's buddy icon path.
358 * @param account The account.
359 * @param path The buddy icon non-cached path.
361 void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path);
364 * Sets the account's protocol ID.
366 * @param account The account.
367 * @param protocol_id The protocol ID.
369 void purple_account_set_protocol_id(PurpleAccount *account,
370 const char *protocol_id);
373 * Sets the account's connection.
375 * @param account The account.
376 * @param gc The connection.
378 void purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc);
381 * Sets whether or not this account should save its password.
383 * @param account The account.
384 * @param value @c TRUE if it should remember the password.
386 void purple_account_set_remember_password(PurpleAccount *account, gboolean value);
389 * Sets whether or not this account should check for mail.
391 * @param account The account.
392 * @param value @c TRUE if it should check for mail.
394 void purple_account_set_check_mail(PurpleAccount *account, gboolean value);
397 * Sets whether or not this account is enabled for the specified
398 * UI.
400 * @param account The account.
401 * @param ui The UI.
402 * @param value @c TRUE if it is enabled.
404 void purple_account_set_enabled(PurpleAccount *account, const char *ui,
405 gboolean value);
408 * Sets the account's proxy information.
410 * @param account The account.
411 * @param info The proxy information.
413 void purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info);
416 * Sets the account's status types.
418 * @param account The account.
419 * @param status_types The list of status types.
421 void purple_account_set_status_types(PurpleAccount *account, GList *status_types);
424 * Variadic version of purple_account_set_status_list(); the variadic list
425 * replaces @a attrs, and should be <tt>NULL</tt>-terminated.
427 * @copydoc purple_account_set_status_list()
429 void purple_account_set_status(PurpleAccount *account, const char *status_id,
430 gboolean active, ...) G_GNUC_NULL_TERMINATED;
434 * Activates or deactivates a status. All changes to the statuses of
435 * an account go through this function or purple_account_set_status().
437 * You can only deactivate an exclusive status by activating another exclusive
438 * status. So, if @a status_id is an exclusive status and @a active is @c
439 * FALSE, this function does nothing.
441 * @param account The account.
442 * @param status_id The ID of the status.
443 * @param active Whether @a status_id is to be activated (<tt>TRUE</tt>) or
444 * deactivated (<tt>FALSE</tt>).
445 * @param attrs A list of <tt>const char *</tt> attribute names followed by
446 * <tt>const char *</tt> attribute values for the status.
447 * (For example, one pair might be <tt>"message"</tt> followed
448 * by <tt>"hello, talk to me!"</tt>.)
450 void purple_account_set_status_list(PurpleAccount *account,
451 const char *status_id, gboolean active, GList *attrs);
454 * Clears all protocol-specific settings on an account.
456 * @param account The account.
458 void purple_account_clear_settings(PurpleAccount *account);
461 * Sets a protocol-specific integer setting for an account.
463 * @param account The account.
464 * @param name The name of the setting.
465 * @param value The setting's value.
467 void purple_account_set_int(PurpleAccount *account, const char *name, int value);
470 * Sets a protocol-specific string setting for an account.
472 * @param account The account.
473 * @param name The name of the setting.
474 * @param value The setting's value.
476 void purple_account_set_string(PurpleAccount *account, const char *name,
477 const char *value);
480 * Sets a protocol-specific boolean setting for an account.
482 * @param account The account.
483 * @param name The name of the setting.
484 * @param value The setting's value.
486 void purple_account_set_bool(PurpleAccount *account, const char *name,
487 gboolean value);
490 * Sets a UI-specific integer setting for an account.
492 * @param account The account.
493 * @param ui The UI name.
494 * @param name The name of the setting.
495 * @param value The setting's value.
497 void purple_account_set_ui_int(PurpleAccount *account, const char *ui,
498 const char *name, int value);
501 * Sets a UI-specific string setting for an account.
503 * @param account The account.
504 * @param ui The UI name.
505 * @param name The name of the setting.
506 * @param value The setting's value.
508 void purple_account_set_ui_string(PurpleAccount *account, const char *ui,
509 const char *name, const char *value);
512 * Sets a UI-specific boolean setting for an account.
514 * @param account The account.
515 * @param ui The UI name.
516 * @param name The name of the setting.
517 * @param value The setting's value.
519 void purple_account_set_ui_bool(PurpleAccount *account, const char *ui,
520 const char *name, gboolean value);
523 * Returns whether or not the account is connected.
525 * @param account The account.
527 * @return @c TRUE if connected, or @c FALSE otherwise.
529 gboolean purple_account_is_connected(const PurpleAccount *account);
532 * Returns whether or not the account is connecting.
534 * @param account The account.
536 * @return @c TRUE if connecting, or @c FALSE otherwise.
538 gboolean purple_account_is_connecting(const PurpleAccount *account);
541 * Returns whether or not the account is disconnected.
543 * @param account The account.
545 * @return @c TRUE if disconnected, or @c FALSE otherwise.
547 gboolean purple_account_is_disconnected(const PurpleAccount *account);
550 * Returns the account's username.
552 * @param account The account.
554 * @return The username.
556 const char *purple_account_get_username(const PurpleAccount *account);
559 * Returns the account's password.
561 * @param account The account.
563 * @return The password.
565 const char *purple_account_get_password(const PurpleAccount *account);
568 * Returns the account's alias.
570 * @param account The account.
572 * @return The alias.
574 const char *purple_account_get_alias(const PurpleAccount *account);
577 * Returns the account's user information.
579 * @param account The account.
581 * @return The user information.
583 const char *purple_account_get_user_info(const PurpleAccount *account);
586 * Gets the account's buddy icon path.
588 * @param account The account.
590 * @return The buddy icon's non-cached path.
592 const char *purple_account_get_buddy_icon_path(const PurpleAccount *account);
595 * Returns the account's protocol ID.
597 * @param account The account.
599 * @return The protocol ID.
601 const char *purple_account_get_protocol_id(const PurpleAccount *account);
604 * Returns the account's protocol name.
606 * @param account The account.
608 * @return The protocol name.
610 const char *purple_account_get_protocol_name(const PurpleAccount *account);
613 * Returns the account's connection.
615 * @param account The account.
617 * @return The connection.
619 PurpleConnection *purple_account_get_connection(const PurpleAccount *account);
622 * Returns whether or not this account should save its password.
624 * @param account The account.
626 * @return @c TRUE if it should remember the password.
628 gboolean purple_account_get_remember_password(const PurpleAccount *account);
631 * Returns whether or not this account should check for mail.
633 * @param account The account.
635 * @return @c TRUE if it should check for mail.
637 gboolean purple_account_get_check_mail(const PurpleAccount *account);
640 * Returns whether or not this account is enabled for the
641 * specified UI.
643 * @param account The account.
644 * @param ui The UI.
646 * @return @c TRUE if it enabled on this UI.
648 gboolean purple_account_get_enabled(const PurpleAccount *account,
649 const char *ui);
652 * Returns the account's proxy information.
654 * @param account The account.
656 * @return The proxy information.
658 PurpleProxyInfo *purple_account_get_proxy_info(const PurpleAccount *account);
661 * Returns the active status for this account. This looks through
662 * the PurplePresence associated with this account and returns the
663 * PurpleStatus that has its active flag set to "TRUE." There can be
664 * only one active PurpleStatus in a PurplePresence.
666 * @param account The account.
668 * @return The active status.
670 PurpleStatus *purple_account_get_active_status(const PurpleAccount *account);
673 * Returns the account status with the specified ID.
675 * Note that this works differently than purple_buddy_get_status() in that
676 * it will only return NULL if the status was not registered.
678 * @param account The account.
679 * @param status_id The status ID.
681 * @return The status, or NULL if it was never registered.
683 PurpleStatus *purple_account_get_status(const PurpleAccount *account,
684 const char *status_id);
687 * Returns the account status type with the specified ID.
689 * @param account The account.
690 * @param id The ID of the status type to find.
692 * @return The status type if found, or NULL.
694 PurpleStatusType *purple_account_get_status_type(const PurpleAccount *account,
695 const char *id);
698 * Returns the account status type with the specified primitive.
699 * Note: It is possible for an account to have more than one
700 * PurpleStatusType with the same primitive. In this case, the
701 * first PurpleStatusType is returned.
703 * @param account The account.
704 * @param primitive The type of the status type to find.
706 * @return The status if found, or NULL.
708 PurpleStatusType *purple_account_get_status_type_with_primitive(
709 const PurpleAccount *account,
710 PurpleStatusPrimitive primitive);
713 * Returns the account's presence.
715 * @param account The account.
717 * @return The account's presence.
719 PurplePresence *purple_account_get_presence(const PurpleAccount *account);
722 * Returns whether or not an account status is active.
724 * @param account The account.
725 * @param status_id The status ID.
727 * @return TRUE if active, or FALSE if not.
729 gboolean purple_account_is_status_active(const PurpleAccount *account,
730 const char *status_id);
733 * Returns the account's status types.
735 * @param account The account.
737 * @constreturn The account's status types.
739 GList *purple_account_get_status_types(const PurpleAccount *account);
742 * Returns a protocol-specific integer setting for an account.
744 * @param account The account.
745 * @param name The name of the setting.
746 * @param default_value The default value.
748 * @return The value.
750 int purple_account_get_int(const PurpleAccount *account, const char *name,
751 int default_value);
754 * Returns a protocol-specific string setting for an account.
756 * @param account The account.
757 * @param name The name of the setting.
758 * @param default_value The default value.
760 * @return The value.
762 const char *purple_account_get_string(const PurpleAccount *account,
763 const char *name,
764 const char *default_value);
767 * Returns a protocol-specific boolean setting for an account.
769 * @param account The account.
770 * @param name The name of the setting.
771 * @param default_value The default value.
773 * @return The value.
775 gboolean purple_account_get_bool(const PurpleAccount *account, const char *name,
776 gboolean default_value);
779 * Returns a UI-specific integer setting for an account.
781 * @param account The account.
782 * @param ui The UI name.
783 * @param name The name of the setting.
784 * @param default_value The default value.
786 * @return The value.
788 int purple_account_get_ui_int(const PurpleAccount *account, const char *ui,
789 const char *name, int default_value);
792 * Returns a UI-specific string setting for an account.
794 * @param account The account.
795 * @param ui The UI name.
796 * @param name The name of the setting.
797 * @param default_value The default value.
799 * @return The value.
801 const char *purple_account_get_ui_string(const PurpleAccount *account,
802 const char *ui, const char *name,
803 const char *default_value);
806 * Returns a UI-specific boolean setting for an account.
808 * @param account The account.
809 * @param ui The UI name.
810 * @param name The name of the setting.
811 * @param default_value The default value.
813 * @return The value.
815 gboolean purple_account_get_ui_bool(const PurpleAccount *account, const char *ui,
816 const char *name, gboolean default_value);
820 * Returns the system log for an account.
822 * @param account The account.
823 * @param create Should it be created if it doesn't exist?
825 * @return The log.
827 * @note Callers should almost always pass @c FALSE for @a create.
828 * Passing @c TRUE could result in an existing log being reopened,
829 * if the log has already been closed, which not all loggers deal
830 * with appropriately.
832 PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create);
835 * Frees the system log of an account
837 * @param account The account.
839 void purple_account_destroy_log(PurpleAccount *account);
842 * Adds a buddy to the server-side buddy list for the specified account.
844 * @param account The account.
845 * @param buddy The buddy to add.
847 void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy);
849 * Adds a list of buddies to the server-side buddy list.
851 * @param account The account.
852 * @param buddies The list of PurpleBlistNodes representing the buddies to add.
854 void purple_account_add_buddies(PurpleAccount *account, GList *buddies);
857 * Removes a buddy from the server-side buddy list.
859 * @param account The account.
860 * @param buddy The buddy to remove.
861 * @param group The group to remove the buddy from.
863 void purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
864 PurpleGroup *group);
867 * Removes a list of buddies from the server-side buddy list.
869 * @note The lists buddies and groups are parallel lists. Be sure that node n of
870 * groups matches node n of buddies.
872 * @param account The account.
873 * @param buddies The list of buddies to remove.
874 * @param groups The list of groups to remove buddies from. Each node of this
875 * list should match the corresponding node of buddies.
877 void purple_account_remove_buddies(PurpleAccount *account, GList *buddies,
878 GList *groups);
881 * Removes a group from the server-side buddy list.
883 * @param account The account.
884 * @param group The group to remove.
886 void purple_account_remove_group(PurpleAccount *account, PurpleGroup *group);
889 * Changes the password on the specified account.
891 * @param account The account.
892 * @param orig_pw The old password.
893 * @param new_pw The new password.
895 void purple_account_change_password(PurpleAccount *account, const char *orig_pw,
896 const char *new_pw);
899 * Whether the account supports sending offline messages to buddy.
901 * @param account The account
902 * @param buddy The buddy
904 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy);
907 * Get the error that caused the account to be disconnected, or @c NULL if the
908 * account is happily connected or disconnected without an error.
910 * @param account The account whose error should be retrieved.
911 * @constreturn The type of error and a human-readable description of the
912 * current error, or @c NULL if there is no current error. This
913 * pointer is guaranteed to remain valid until the @ref
914 * account-error-changed signal is emitted for @a account.
916 const PurpleConnectionErrorInfo *purple_account_get_current_error(PurpleAccount *account);
919 * Clear an account's current error state, resetting it to @c NULL.
921 * @param account The account whose error state should be cleared.
923 void purple_account_clear_current_error(PurpleAccount *account);
925 /*@}*/
927 /**************************************************************************/
928 /** @name Accounts API */
929 /**************************************************************************/
930 /*@{*/
933 * Adds an account to the list of accounts.
935 * @param account The account.
937 void purple_accounts_add(PurpleAccount *account);
940 * Removes an account from the list of accounts.
942 * @param account The account.
944 void purple_accounts_remove(PurpleAccount *account);
947 * Deletes an account.
949 * This will remove any buddies from the buddy list that belong to this
950 * account, buddy pounces that belong to this account, and will also
951 * destroy @a account.
953 * @param account The account.
955 void purple_accounts_delete(PurpleAccount *account);
958 * Reorders an account.
960 * @param account The account to reorder.
961 * @param new_index The new index for the account.
963 void purple_accounts_reorder(PurpleAccount *account, gint new_index);
966 * Returns a list of all accounts.
968 * @constreturn A list of all accounts.
970 GList *purple_accounts_get_all(void);
973 * Returns a list of all enabled accounts
975 * @return A list of all enabled accounts. The list is owned
976 * by the caller, and must be g_list_free()d to avoid
977 * leaking the nodes.
979 GList *purple_accounts_get_all_active(void);
982 * Finds an account with the specified name and protocol id.
984 * @param name The account username.
985 * @param protocol The account protocol ID.
987 * @return The account, if found, or @c FALSE otherwise.
989 PurpleAccount *purple_accounts_find(const char *name, const char *protocol);
992 * This is called by the core after all subsystems and what
993 * not have been initialized. It sets all enabled accounts
994 * to their startup status by signing them on, setting them
995 * away, etc.
997 * You probably shouldn't call this unless you really know
998 * what you're doing.
1000 void purple_accounts_restore_current_statuses(void);
1002 /*@}*/
1005 /**************************************************************************/
1006 /** @name UI Registration Functions */
1007 /**************************************************************************/
1008 /*@{*/
1010 * Sets the UI operations structure to be used for accounts.
1012 * @param ops The UI operations structure.
1014 void purple_accounts_set_ui_ops(PurpleAccountUiOps *ops);
1017 * Returns the UI operations structure used for accounts.
1019 * @return The UI operations structure in use.
1021 PurpleAccountUiOps *purple_accounts_get_ui_ops(void);
1023 /*@}*/
1026 /**************************************************************************/
1027 /** @name Accounts Subsystem */
1028 /**************************************************************************/
1029 /*@{*/
1032 * Returns the accounts subsystem handle.
1034 * @return The accounts subsystem handle.
1036 void *purple_accounts_get_handle(void);
1039 * Initializes the accounts subsystem.
1041 void purple_accounts_init(void);
1044 * Uninitializes the accounts subsystem.
1046 void purple_accounts_uninit(void);
1048 /*@}*/
1050 #ifdef __cplusplus
1052 #endif
1054 #endif /* _PURPLE_ACCOUNT_H_ */