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_ACCOUNT_H_
23 #define _PURPLE_ACCOUNT_H_
26 * @section_id: libpurple-account
27 * @short_description: <filename>account.h</filename>
28 * @title: Account Object
32 #include <glib-object.h>
34 #define PURPLE_TYPE_ACCOUNT (purple_account_get_type())
35 #define PURPLE_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_ACCOUNT, PurpleAccount))
36 #define PURPLE_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_ACCOUNT, PurpleAccountClass))
37 #define PURPLE_IS_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_ACCOUNT))
38 #define PURPLE_IS_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_ACCOUNT))
39 #define PURPLE_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_ACCOUNT, PurpleAccountClass))
41 typedef struct _PurpleAccount PurpleAccount
;
42 typedef struct _PurpleAccountClass PurpleAccountClass
;
44 typedef gboolean (*PurpleFilterAccountFunc
)(PurpleAccount
*account
);
45 typedef void (*PurpleAccountRequestAuthorizationCb
)(const char *, void *);
46 typedef void (*PurpleAccountRegistrationCb
)(PurpleAccount
*account
, gboolean succeeded
, void *user_data
);
47 typedef void (*PurpleAccountUnregistrationCb
)(PurpleAccount
*account
, gboolean succeeded
, void *user_data
);
48 typedef void (*PurpleSetPublicAliasSuccessCallback
)(PurpleAccount
*account
, const char *new_alias
);
49 typedef void (*PurpleSetPublicAliasFailureCallback
)(PurpleAccount
*account
, const char *error
);
50 typedef void (*PurpleGetPublicAliasSuccessCallback
)(PurpleAccount
*account
, const char *alias
);
51 typedef void (*PurpleGetPublicAliasFailureCallback
)(PurpleAccount
*account
, const char *error
);
53 #include "connection.h"
62 * PurpleAccountRequestType:
63 * @PURPLE_ACCOUNT_REQUEST_AUTHORIZATION: Account authorization request
65 * Account request types.
69 PURPLE_ACCOUNT_REQUEST_AUTHORIZATION
= 0
70 } PurpleAccountRequestType
;
73 * PurpleAccountRequestResponse:
75 * Account request response types
79 PURPLE_ACCOUNT_RESPONSE_IGNORE
= -2,
80 PURPLE_ACCOUNT_RESPONSE_DENY
= -1,
81 PURPLE_ACCOUNT_RESPONSE_PASS
= 0,
82 PURPLE_ACCOUNT_RESPONSE_ACCEPT
= 1
83 } PurpleAccountRequestResponse
;
86 * PurpleAccountPrivacyType:
92 PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL
= 1,
93 PURPLE_ACCOUNT_PRIVACY_DENY_ALL
,
94 PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS
,
95 PURPLE_ACCOUNT_PRIVACY_DENY_USERS
,
96 PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST
97 } PurpleAccountPrivacyType
;
101 * @ui_data: The UI data associated with this account. This is a convenience
102 * field provided to the UIs -- it is not used by the libpurple core.
104 * Structure representing an account.
106 struct _PurpleAccount
115 * PurpleAccountClass:
117 * The base class for all #PurpleAccount's.
119 struct _PurpleAccountClass
{
120 GObjectClass parent_class
;
123 void (*_purple_reserved1
)(void);
124 void (*_purple_reserved2
)(void);
125 void (*_purple_reserved3
)(void);
126 void (*_purple_reserved4
)(void);
131 /**************************************************************************/
133 /**************************************************************************/
136 * purple_account_get_type:
138 * Returns: The #GType for the Account object.
140 GType
purple_account_get_type(void);
143 * purple_account_new:
144 * @username: The username.
145 * @protocol_id: The protocol ID.
147 * Creates a new account.
149 * Returns: The new account.
151 PurpleAccount
*purple_account_new(const char *username
, const char *protocol_id
);
154 * purple_account_connect:
155 * @account: The account to connect to.
157 * Connects to an account.
159 void purple_account_connect(PurpleAccount
*account
);
162 * purple_account_set_register_callback:
163 * @account: The account for which this callback should be used
164 * @cb: (scope call): The callback
165 * @user_data: The user data passed to the callback
167 * Sets the callback for successful registration.
169 void purple_account_set_register_callback(PurpleAccount
*account
, PurpleAccountRegistrationCb cb
, void *user_data
);
172 * purple_account_register:
173 * @account: The account to register.
175 * Registers an account.
177 void purple_account_register(PurpleAccount
*account
);
180 * purple_account_register_completed:
181 * @account: The account being registered.
182 * @succeeded: Was the account registration successful?
184 * Registration of the account was completed.
185 * Calls the registration call-back set with purple_account_set_register_callback().
187 void purple_account_register_completed(PurpleAccount
*account
, gboolean succeeded
);
190 * purple_account_unregister:
191 * @account: The account to unregister.
192 * @cb: (scope call): Optional callback to be called when unregistration is
194 * @user_data: user data to pass to the callback
196 * Unregisters an account (deleting it from the server).
198 void purple_account_unregister(PurpleAccount
*account
, PurpleAccountUnregistrationCb cb
, void *user_data
);
201 * purple_account_disconnect:
202 * @account: The account to disconnect from.
204 * Disconnects from an account.
206 void purple_account_disconnect(PurpleAccount
*account
);
209 * purple_account_is_disconnecting:
210 * @account: The account
212 * Indicates if the account is currently being disconnected.
214 * Returns: TRUE if the account is being disconnected.
216 gboolean
purple_account_is_disconnecting(const PurpleAccount
*account
);
219 * purple_account_notify_added:
220 * @account: The account that was added.
221 * @remote_user: The name of the user that added this account.
222 * @id: The optional ID of the local account. Rarely used.
223 * @alias: The optional alias of the user.
224 * @message: The optional message sent from the user adding you.
226 * Notifies the user that the account was added to a remote user's
229 * This will present a dialog informing the user that he was added to the
230 * remote user's buddy list.
232 void purple_account_notify_added(PurpleAccount
*account
, const char *remote_user
,
233 const char *id
, const char *alias
,
234 const char *message
);
237 * purple_account_request_add:
238 * @account: The account that was added.
239 * @remote_user: The name of the user that added this account.
240 * @id: The optional ID of the local account. Rarely used.
241 * @alias: The optional alias of the user.
242 * @message: The optional message sent from the user adding you.
244 * Notifies the user that the account was addded to a remote user's buddy
245 * list and asks ther user if they want to add the remote user to their buddy
248 * This will present a dialog informing the local user that the remote user
249 * added them to the remote user's buddy list and will ask if they want to add
250 * the remote user to the buddy list.
252 void purple_account_request_add(PurpleAccount
*account
, const char *remote_user
,
253 const char *id
, const char *alias
,
254 const char *message
);
257 * purple_account_request_authorization:
258 * @account: The account that was added
259 * @remote_user: The name of the user that added this account.
260 * @id: The optional ID of the local account. Rarely used.
261 * @alias: The optional alias of the remote user.
262 * @message: The optional message sent by the user wanting to add you.
263 * @on_list: Is the remote user already on the buddy list?
264 * @auth_cb: (scope call): The callback called when the local user accepts
265 * @deny_cb: (scope call): The callback called when the local user rejects
266 * @user_data: Data to be passed back to the above callbacks
268 * Notifies the user that a remote user has wants to add the local user
269 * to his or her buddy list and requires authorization to do so.
271 * This will present a dialog informing the user of this and ask if the
272 * user authorizes or denies the remote user from adding him.
274 * Returns: A UI-specific handle.
276 void *purple_account_request_authorization(PurpleAccount
*account
, const char *remote_user
,
277 const char *id
, const char *alias
, const char *message
, gboolean on_list
,
278 PurpleAccountRequestAuthorizationCb auth_cb
, PurpleAccountRequestAuthorizationCb deny_cb
, void *user_data
);
281 * purple_account_request_close_with_account:
282 * @account: The account for which requests should be closed
284 * Close account requests registered for the given PurpleAccount
286 void purple_account_request_close_with_account(PurpleAccount
*account
);
289 * purple_account_request_close:
290 * @ui_handle: The ui specific handle for which requests should be closed
292 * Close the account request for the given ui handle
294 void purple_account_request_close(void *ui_handle
);
297 * purple_account_request_password:
298 * @account: The account to request the password for.
299 * @ok_cb: (scope call): The callback for the OK button.
300 * @cancel_cb: (scope call): The callback for the cancel button.
301 * @user_data: User data to be passed into callbacks.
303 * Requests a password from the user for the account. Does not set the
304 * account password on success; do that in ok_cb if desired.
306 void purple_account_request_password(PurpleAccount
*account
, GCallback ok_cb
,
307 GCallback cancel_cb
, void *user_data
);
310 * purple_account_request_change_password:
311 * @account: The account to change the password on.
313 * Requests information from the user to change the account's password.
315 void purple_account_request_change_password(PurpleAccount
*account
);
318 * purple_account_request_change_user_info:
319 * @account: The account to change the user information on.
321 * Requests information from the user to change the account's
324 void purple_account_request_change_user_info(PurpleAccount
*account
);
327 * purple_account_set_username:
328 * @account: The account.
329 * @username: The username.
331 * Sets the account's username.
333 void purple_account_set_username(PurpleAccount
*account
, const char *username
);
336 * purple_account_set_password:
337 * @account: The account.
338 * @password: The password.
339 * @cb: (scope call): A callback for once the password is saved.
340 * @data: A pointer to be passed to the callback.
342 * Sets the account's password.
344 * The password in the keyring might not be immediately updated, but the cached
345 * version will be, and it is therefore safe to read the password back before
346 * the callback has been triggered. One can also set a %NULL callback if
347 * notification of saving to the keyring is not required.
349 void purple_account_set_password(PurpleAccount
*account
, const gchar
*password
,
350 PurpleKeyringSaveCallback cb
, gpointer data
);
353 * purple_account_set_private_alias:
354 * @account: The account.
357 * Sets the account's private alias.
359 void purple_account_set_private_alias(PurpleAccount
*account
, const char *alias
);
362 * purple_account_set_user_info:
363 * @account: The account.
364 * @user_info: The user information.
366 * Sets the account's user information
368 void purple_account_set_user_info(PurpleAccount
*account
, const char *user_info
);
371 * purple_account_set_buddy_icon_path:
372 * @account: The account.
373 * @path: The buddy icon non-cached path.
375 * Sets the account's buddy icon path.
377 void purple_account_set_buddy_icon_path(PurpleAccount
*account
, const char *path
);
380 * purple_account_set_protocol_id:
381 * @account: The account.
382 * @protocol_id: The protocol ID.
384 * Sets the account's protocol ID.
386 void purple_account_set_protocol_id(PurpleAccount
*account
,
387 const char *protocol_id
);
390 * purple_account_set_connection:
391 * @account: The account.
392 * @gc: The connection.
394 * Sets the account's connection.
396 void purple_account_set_connection(PurpleAccount
*account
, PurpleConnection
*gc
);
399 * purple_account_set_remember_password:
400 * @account: The account.
401 * @value: %TRUE if it should remember the password.
403 * Sets whether or not this account should save its password.
405 void purple_account_set_remember_password(PurpleAccount
*account
, gboolean value
);
408 * purple_account_set_check_mail:
409 * @account: The account.
410 * @value: %TRUE if it should check for mail.
412 * Sets whether or not this account should check for mail.
414 void purple_account_set_check_mail(PurpleAccount
*account
, gboolean value
);
417 * purple_account_set_enabled:
418 * @account: The account.
420 * @value: %TRUE if it is enabled.
422 * Sets whether or not this account is enabled for the specified
425 void purple_account_set_enabled(PurpleAccount
*account
, const char *ui
,
429 * purple_account_set_proxy_info:
430 * @account: The account.
431 * @info: The proxy information.
433 * Sets the account's proxy information.
435 void purple_account_set_proxy_info(PurpleAccount
*account
, PurpleProxyInfo
*info
);
438 * purple_account_set_privacy_type:
439 * @account: The account.
440 * @privacy_type: The privacy type.
442 * Sets the account's privacy type.
444 void purple_account_set_privacy_type(PurpleAccount
*account
, PurpleAccountPrivacyType privacy_type
);
447 * purple_account_set_status_types:
448 * @account: The account.
449 * @status_types: The list of status types.
451 * Sets the account's status types.
453 void purple_account_set_status_types(PurpleAccount
*account
, GList
*status_types
);
456 * purple_account_set_status:
457 * @account: The account.
458 * @status_id: The ID of the status.
459 * @active: Whether @a status_id is to be activated (%TRUE) or
460 * deactivated (%FALSE).
461 * @...: A %NULL-terminated list of pairs of <type>const char *</type>
462 * attribute name followed by <type>const char *</type> attribute
463 * value for the status. (For example, one pair might be
464 * <literal>"message"</literal> followed by
465 * <literal>"hello, talk to me!"</literal>.)
467 * Variadic version of purple_account_set_status_list().
469 void purple_account_set_status(PurpleAccount
*account
, const char *status_id
,
470 gboolean active
, ...) G_GNUC_NULL_TERMINATED
;
474 * purple_account_set_status_list:
475 * @account: The account.
476 * @status_id: The ID of the status.
477 * @active: Whether @a status_id is to be activated (%TRUE) or
478 * deactivated (%FALSE).
479 * @attrs: A list of <type>const char *</type> attribute names followed by
480 * <type>const char *</type> attribute values for the status.
481 * (For example, one pair might be <literal>"message"</literal>
482 * followed by <literal>"hello, talk to me!"</literal>.)
484 * Activates or deactivates a status. All changes to the statuses of
485 * an account go through this function or purple_account_set_status().
487 * You can only deactivate an exclusive status by activating another exclusive
488 * status. So, if @a status_id is an exclusive status and @a active is @c
489 * FALSE, this function does nothing.
491 void purple_account_set_status_list(PurpleAccount
*account
,
492 const char *status_id
, gboolean active
, GList
*attrs
);
495 * purple_account_set_public_alias:
496 * @account: The account
497 * @alias: The new public alias for this account or %NULL
498 * to unset the alias/nickname (or return it to
499 * a protocol-specific "default", like the username)
500 * @success_cb: (scope call): A callback which will be called if the alias
501 * is successfully set on the server (or %NULL).
502 * @failure_cb: (scope call): A callback which will be called if the alias
503 * is not successfully set on the server (or %NULL).
505 * Set a server-side (public) alias for this account. The account
506 * must already be connected.
508 * Currently, the public alias is not stored locally, although this
509 * may change in a later version.
511 void purple_account_set_public_alias(PurpleAccount
*account
,
512 const char *alias
, PurpleSetPublicAliasSuccessCallback success_cb
,
513 PurpleSetPublicAliasFailureCallback failure_cb
);
516 * purple_account_get_public_alias:
517 * @account: The account
518 * @success_cb: (scope call): A callback which will be called with the alias
519 * @failure_cb: (scope call): A callback which will be called if the protocol is
520 * unable to retrieve the server-side alias.
522 * Fetch the server-side (public) alias for this account. The account
523 * must already be connected.
525 void purple_account_get_public_alias(PurpleAccount
*account
,
526 PurpleGetPublicAliasSuccessCallback success_cb
,
527 PurpleGetPublicAliasFailureCallback failure_cb
);
530 * purple_account_get_silence_suppression:
531 * @account: The account.
533 * Return whether silence suppression is used during voice call.
535 * Returns: %TRUE if suppression is used, or %FALSE if not.
537 gboolean
purple_account_get_silence_suppression(const PurpleAccount
*account
);
540 * purple_account_set_silence_suppression:
541 * @account: The account.
542 * @value: %TRUE if suppression should be used.
544 * Sets whether silence suppression is used during voice call.
546 void purple_account_set_silence_suppression(PurpleAccount
*account
,
550 * purple_account_clear_settings:
551 * @account: The account.
553 * Clears all protocol-specific settings on an account.
555 void purple_account_clear_settings(PurpleAccount
*account
);
558 * purple_account_remove_setting:
559 * @account: The account.
560 * @setting: The setting to remove.
562 * Removes an account-specific setting by name.
564 void purple_account_remove_setting(PurpleAccount
*account
, const char *setting
);
567 * purple_account_set_int:
568 * @account: The account.
569 * @name: The name of the setting.
570 * @value: The setting's value.
572 * Sets a protocol-specific integer setting for an account.
574 void purple_account_set_int(PurpleAccount
*account
, const char *name
, int value
);
577 * purple_account_set_string:
578 * @account: The account.
579 * @name: The name of the setting.
580 * @value: The setting's value.
582 * Sets a protocol-specific string setting for an account.
584 void purple_account_set_string(PurpleAccount
*account
, const char *name
,
588 * purple_account_set_bool:
589 * @account: The account.
590 * @name: The name of the setting.
591 * @value: The setting's value.
593 * Sets a protocol-specific boolean setting for an account.
595 void purple_account_set_bool(PurpleAccount
*account
, const char *name
,
599 * purple_account_set_ui_int:
600 * @account: The account.
602 * @name: The name of the setting.
603 * @value: The setting's value.
605 * Sets a UI-specific integer setting for an account.
607 void purple_account_set_ui_int(PurpleAccount
*account
, const char *ui
,
608 const char *name
, int value
);
611 * purple_account_set_ui_string:
612 * @account: The account.
614 * @name: The name of the setting.
615 * @value: The setting's value.
617 * Sets a UI-specific string setting for an account.
619 void purple_account_set_ui_string(PurpleAccount
*account
, const char *ui
,
620 const char *name
, const char *value
);
623 * purple_account_set_ui_bool:
624 * @account: The account.
626 * @name: The name of the setting.
627 * @value: The setting's value.
629 * Sets a UI-specific boolean setting for an account.
631 void purple_account_set_ui_bool(PurpleAccount
*account
, const char *ui
,
632 const char *name
, gboolean value
);
635 * purple_account_set_ui_data:
636 * @account: The account.
637 * @ui_data: A pointer to associate with this object.
639 * Set the UI data associated with this account.
641 void purple_account_set_ui_data(PurpleAccount
*account
, gpointer ui_data
);
644 * purple_account_get_ui_data:
645 * @account: The account.
647 * Returns the UI data associated with this account.
649 * Returns: The UI data associated with this account. This is a
650 * convenience field provided to the UIs--it is not
651 * used by the libpurple core.
653 gpointer
purple_account_get_ui_data(const PurpleAccount
*account
);
656 * purple_account_is_connected:
657 * @account: The account.
659 * Returns whether or not the account is connected.
661 * Returns: %TRUE if connected, or %FALSE otherwise.
663 gboolean
purple_account_is_connected(const PurpleAccount
*account
);
666 * purple_account_is_connecting:
667 * @account: The account.
669 * Returns whether or not the account is connecting.
671 * Returns: %TRUE if connecting, or %FALSE otherwise.
673 gboolean
purple_account_is_connecting(const PurpleAccount
*account
);
676 * purple_account_is_disconnected:
677 * @account: The account.
679 * Returns whether or not the account is disconnected.
681 * Returns: %TRUE if disconnected, or %FALSE otherwise.
683 gboolean
purple_account_is_disconnected(const PurpleAccount
*account
);
686 * purple_account_get_username:
687 * @account: The account.
689 * Returns the account's username.
691 * Returns: The username.
693 const char *purple_account_get_username(const PurpleAccount
*account
);
696 * purple_account_get_password:
697 * @account: The account.
698 * @cb: (scope call): The callback to give the password.
699 * @data: A pointer passed to the callback.
701 * Reads the password for the account.
703 * This is an asynchronous call, that will return the password in a callback
704 * once it has been read from the keyring. If the account is connected, and you
705 * require the password immediately, then consider using @ref
706 * purple_connection_get_password instead.
708 void purple_account_get_password(PurpleAccount
*account
,
709 PurpleKeyringReadCallback cb
, gpointer data
);
712 * purple_account_get_private_alias:
713 * @account: The account.
715 * Returns the account's private alias.
717 * Returns: The alias.
719 const char *purple_account_get_private_alias(const PurpleAccount
*account
);
722 * purple_account_get_user_info:
723 * @account: The account.
725 * Returns the account's user information.
727 * Returns: The user information.
729 const char *purple_account_get_user_info(const PurpleAccount
*account
);
732 * purple_account_get_buddy_icon_path:
733 * @account: The account.
735 * Gets the account's buddy icon path.
737 * Returns: The buddy icon's non-cached path.
739 const char *purple_account_get_buddy_icon_path(const PurpleAccount
*account
);
742 * purple_account_get_protocol_id:
743 * @account: The account.
745 * Returns the account's protocol ID.
747 * Returns: The protocol ID.
749 const char *purple_account_get_protocol_id(const PurpleAccount
*account
);
752 * purple_account_get_protocol_name:
753 * @account: The account.
755 * Returns the account's protocol name.
757 * Returns: The protocol name.
759 const char *purple_account_get_protocol_name(const PurpleAccount
*account
);
762 * purple_account_get_connection:
763 * @account: The account.
765 * Returns the account's connection.
767 * Returns: (transfer none): The connection.
769 PurpleConnection
*purple_account_get_connection(const PurpleAccount
*account
);
772 * purple_account_get_name_for_display:
773 * @account: The account.
775 * Returns a name for this account appropriate for display to the user. In
776 * order of preference: the account's alias; the contact or buddy alias (if
777 * the account exists on its own buddy list); the connection's display name;
778 * the account's username.
780 * Returns: The name to display.
782 const gchar
*purple_account_get_name_for_display(const PurpleAccount
*account
);
785 * purple_account_get_remember_password:
786 * @account: The account.
788 * Returns whether or not this account should save its password.
790 * Returns: %TRUE if it should remember the password.
792 gboolean
purple_account_get_remember_password(const PurpleAccount
*account
);
795 * purple_account_get_check_mail:
796 * @account: The account.
798 * Returns whether or not this account should check for mail.
800 * Returns: %TRUE if it should check for mail.
802 gboolean
purple_account_get_check_mail(const PurpleAccount
*account
);
805 * purple_account_get_enabled:
806 * @account: The account.
809 * Returns whether or not this account is enabled for the
812 * Returns: %TRUE if it enabled on this UI.
814 gboolean
purple_account_get_enabled(const PurpleAccount
*account
,
818 * purple_account_get_proxy_info:
819 * @account: The account.
821 * Returns the account's proxy information.
823 * Returns: The proxy information.
825 PurpleProxyInfo
*purple_account_get_proxy_info(const PurpleAccount
*account
);
828 * purple_account_get_privacy_type:
829 * @account: The account.
831 * Returns the account's privacy type.
833 * Returns: The privacy type.
835 PurpleAccountPrivacyType
purple_account_get_privacy_type(const PurpleAccount
*account
);
838 * purple_account_privacy_permit_add:
839 * @account: The account.
840 * @name: The name of the user to add to the list.
841 * @local_only: If TRUE, only the local list is updated, and not
844 * Adds a user to the account's permit list.
846 * Returns: TRUE if the user was added successfully, or %FALSE otherwise.
848 gboolean
purple_account_privacy_permit_add(PurpleAccount
*account
,
849 const char *name
, gboolean local_only
);
852 * purple_account_privacy_permit_remove:
853 * @account: The account.
854 * @name: The name of the user to add to the list.
855 * @local_only: If TRUE, only the local list is updated, and not
858 * Removes a user from the account's permit list.
860 * Returns: TRUE if the user was removed successfully, or %FALSE otherwise.
862 gboolean
purple_account_privacy_permit_remove(PurpleAccount
*account
,
863 const char *name
, gboolean local_only
);
866 * purple_account_privacy_deny_add:
867 * @account: The account.
868 * @name: The name of the user to add to the list.
869 * @local_only: If TRUE, only the local list is updated, and not
872 * Adds a user to the account's deny list.
874 * Returns: TRUE if the user was added successfully, or %FALSE otherwise.
876 gboolean
purple_account_privacy_deny_add(PurpleAccount
*account
,
877 const char *name
, gboolean local_only
);
880 * purple_account_privacy_deny_remove:
881 * @account: The account.
882 * @name: The name of the user to add to the list.
883 * @local_only: If TRUE, only the local list is updated, and not
886 * Removes a user from the account's deny list.
888 * Returns: TRUE if the user was removed successfully, or %FALSE otherwise.
890 gboolean
purple_account_privacy_deny_remove(PurpleAccount
*account
,
891 const char *name
, gboolean local_only
);
894 * purple_account_privacy_allow:
895 * @account: The account.
896 * @who: The name of the user.
898 * Allow a user to send messages. If current privacy setting for the account is:
899 * PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: The user is added to the allow-list.
900 * PURPLE_ACCOUNT_PRIVACY_DENY_USERS : The user is removed from the
902 * PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL : No changes made.
903 * PURPLE_ACCOUNT_PRIVACY_DENY_ALL : The privacy setting is changed to
904 * PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS and the
905 * user is added to the allow-list.
906 * PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is
907 * already in the buddy-list. Otherwise the
908 * setting is changed to
909 * PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS, all the buddies are added to the
910 * allow-list, and the user is also added to
913 * The changes are reflected on the server. The previous allow/deny list is not
914 * restored if the privacy setting is changed.
916 void purple_account_privacy_allow(PurpleAccount
*account
, const char *who
);
919 * purple_account_privacy_deny:
920 * @account: The account.
921 * @who: The name of the user.
923 * Block messages from a user. If current privacy setting for the account is:
924 * PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: The user is removed from the
926 * PURPLE_ACCOUNT_PRIVACY_DENY_USERS: The user is added to the deny-list.
927 * PURPLE_ACCOUNT_PRIVACY_DENY_ALL: No changes made.
928 * PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL: The privacy setting is changed to
929 * PURPLE_ACCOUNT_PRIVACY_DENY_USERS and the
930 * user is added to the deny-list.
931 * PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the
932 * buddy-list, then no changes made. Otherwise,
933 * the setting is changed to
934 * PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS, all
935 * the buddies are added to the allow-list, and
936 * this user is removed from the list.
938 * The changes are reflected on the server. The previous allow/deny list is not
939 * restored if the privacy setting is changed.
941 void purple_account_privacy_deny(PurpleAccount
*account
, const char *who
);
944 * purple_account_privacy_get_permitted:
945 * @account: The account.
947 * Returns the account's permit list.
949 * Returns: (transfer none): A list of the permitted users
951 GSList
*purple_account_privacy_get_permitted(PurpleAccount
*account
);
954 * purple_account_privacy_get_denied:
955 * @account: The account.
957 * Returns the account's deny list.
959 * Returns: (transfer none): A list of the denied users
961 GSList
*purple_account_privacy_get_denied(PurpleAccount
*account
);
964 * purple_account_privacy_check:
965 * @account: The account.
966 * @who: The name of the user.
968 * Check the privacy-setting for a user.
970 * Returns: %FALSE if the specified account's privacy settings block the user
971 * or %TRUE otherwise. The meaning of "block" is protocol-dependent and
972 * generally relates to status and/or sending of messages.
974 gboolean
purple_account_privacy_check(PurpleAccount
*account
, const char *who
);
977 * purple_account_get_active_status:
978 * @account: The account.
980 * Returns the active status for this account. This looks through
981 * the PurplePresence associated with this account and returns the
982 * PurpleStatus that has its active flag set to "TRUE." There can be
983 * only one active PurpleStatus in a PurplePresence.
985 * Returns: The active status.
987 PurpleStatus
*purple_account_get_active_status(const PurpleAccount
*account
);
990 * purple_account_get_status:
991 * @account: The account.
992 * @status_id: The status ID.
994 * Returns the account status with the specified ID.
996 * Returns: The status, or %NULL if it was never registered.
998 PurpleStatus
*purple_account_get_status(const PurpleAccount
*account
,
999 const char *status_id
);
1002 * purple_account_get_status_type:
1003 * @account: The account.
1004 * @id: The ID of the status type to find.
1006 * Returns the account status type with the specified ID.
1008 * Returns: The status type if found, or %NULL.
1010 PurpleStatusType
*purple_account_get_status_type(const PurpleAccount
*account
,
1014 * purple_account_get_status_type_with_primitive:
1015 * @account: The account.
1016 * @primitive: The type of the status type to find.
1018 * Returns the account status type with the specified primitive.
1019 * Note: It is possible for an account to have more than one
1020 * PurpleStatusType with the same primitive. In this case, the
1021 * first PurpleStatusType is returned.
1023 * Returns: The status if found, or %NULL.
1025 PurpleStatusType
*purple_account_get_status_type_with_primitive(
1026 const PurpleAccount
*account
,
1027 PurpleStatusPrimitive primitive
);
1030 * purple_account_get_presence:
1031 * @account: The account.
1033 * Returns the account's presence.
1035 * Returns: The account's presence.
1037 PurplePresence
*purple_account_get_presence(const PurpleAccount
*account
);
1040 * purple_account_is_status_active:
1041 * @account: The account.
1042 * @status_id: The status ID.
1044 * Returns whether or not an account status is active.
1046 * Returns: TRUE if active, or FALSE if not.
1048 gboolean
purple_account_is_status_active(const PurpleAccount
*account
,
1049 const char *status_id
);
1052 * purple_account_get_status_types:
1053 * @account: The account.
1055 * Returns the account's status types.
1057 * Returns: (transfer none): The account's status types.
1059 GList
*purple_account_get_status_types(const PurpleAccount
*account
);
1062 * purple_account_get_int:
1063 * @account: The account.
1064 * @name: The name of the setting.
1065 * @default_value: The default value.
1067 * Returns a protocol-specific integer setting for an account.
1069 * Returns: The value.
1071 int purple_account_get_int(const PurpleAccount
*account
, const char *name
,
1075 * purple_account_get_string:
1076 * @account: The account.
1077 * @name: The name of the setting.
1078 * @default_value: The default value.
1080 * Returns a protocol-specific string setting for an account.
1082 * Returns: The value.
1084 const char *purple_account_get_string(const PurpleAccount
*account
,
1086 const char *default_value
);
1089 * purple_account_get_bool:
1090 * @account: The account.
1091 * @name: The name of the setting.
1092 * @default_value: The default value.
1094 * Returns a protocol-specific boolean setting for an account.
1096 * Returns: The value.
1098 gboolean
purple_account_get_bool(const PurpleAccount
*account
, const char *name
,
1099 gboolean default_value
);
1102 * purple_account_get_ui_int:
1103 * @account: The account.
1105 * @name: The name of the setting.
1106 * @default_value: The default value.
1108 * Returns a UI-specific integer setting for an account.
1110 * Returns: The value.
1112 int purple_account_get_ui_int(const PurpleAccount
*account
, const char *ui
,
1113 const char *name
, int default_value
);
1116 * purple_account_get_ui_string:
1117 * @account: The account.
1119 * @name: The name of the setting.
1120 * @default_value: The default value.
1122 * Returns a UI-specific string setting for an account.
1124 * Returns: The value.
1126 const char *purple_account_get_ui_string(const PurpleAccount
*account
,
1127 const char *ui
, const char *name
,
1128 const char *default_value
);
1131 * purple_account_get_ui_bool:
1132 * @account: The account.
1134 * @name: The name of the setting.
1135 * @default_value: The default value.
1137 * Returns a UI-specific boolean setting for an account.
1139 * Returns: The value.
1141 gboolean
purple_account_get_ui_bool(const PurpleAccount
*account
, const char *ui
,
1142 const char *name
, gboolean default_value
);
1146 * purple_account_get_log:
1147 * @account: The account.
1148 * @create: Should it be created if it doesn't exist?
1150 * Returns the system log for an account.
1152 * Note: Callers should almost always pass %FALSE for @a create.
1153 * Passing %TRUE could result in an existing log being reopened,
1154 * if the log has already been closed, which not all loggers deal
1155 * with appropriately.
1159 PurpleLog
*purple_account_get_log(PurpleAccount
*account
, gboolean create
);
1162 * purple_account_destroy_log:
1163 * @account: The account.
1165 * Frees the system log of an account
1167 void purple_account_destroy_log(PurpleAccount
*account
);
1170 * purple_account_add_buddy:
1171 * @account: The account.
1172 * @buddy: The buddy to add.
1173 * @message: The invite message. This may be ignored by a protocol.
1175 * Adds a buddy to the server-side buddy list for the specified account.
1177 void purple_account_add_buddy(PurpleAccount
*account
, PurpleBuddy
*buddy
, const char *message
);
1180 * purple_account_add_buddies:
1181 * @account: The account.
1182 * @buddies: The list of PurpleBlistNodes representing the buddies to add.
1183 * @message: The invite message. This may be ignored by a protocol.
1185 * Adds a list of buddies to the server-side buddy list.
1187 void purple_account_add_buddies(PurpleAccount
*account
, GList
*buddies
, const char *message
);
1190 * purple_account_remove_buddy:
1191 * @account: The account.
1192 * @buddy: The buddy to remove.
1193 * @group: The group to remove the buddy from.
1195 * Removes a buddy from the server-side buddy list.
1197 void purple_account_remove_buddy(PurpleAccount
*account
, PurpleBuddy
*buddy
,
1198 PurpleGroup
*group
);
1201 * purple_account_remove_buddies:
1202 * @account: The account.
1203 * @buddies: The list of buddies to remove.
1204 * @groups: The list of groups to remove buddies from. Each node of this
1205 * list should match the corresponding node of buddies.
1207 * Removes a list of buddies from the server-side buddy list.
1209 * Note: The lists buddies and groups are parallel lists. Be sure that node n of
1210 * groups matches node n of buddies.
1212 void purple_account_remove_buddies(PurpleAccount
*account
, GList
*buddies
,
1216 * purple_account_remove_group:
1217 * @account: The account.
1218 * @group: The group to remove.
1220 * Removes a group from the server-side buddy list.
1222 void purple_account_remove_group(PurpleAccount
*account
, PurpleGroup
*group
);
1225 * purple_account_change_password:
1226 * @account: The account.
1227 * @orig_pw: The old password.
1228 * @new_pw: The new password.
1230 * Changes the password on the specified account.
1232 void purple_account_change_password(PurpleAccount
*account
, const char *orig_pw
,
1233 const char *new_pw
);
1236 * purple_account_supports_offline_message:
1237 * @account: The account
1240 * Whether the account supports sending offline messages to buddy.
1242 gboolean
purple_account_supports_offline_message(PurpleAccount
*account
, PurpleBuddy
*buddy
);
1245 * purple_account_get_current_error:
1246 * @account: The account whose error should be retrieved.
1248 * Get the error that caused the account to be disconnected, or %NULL if the
1249 * account is happily connected or disconnected without an error.
1251 * Returns: (transfer none): The type of error and a human-readable description
1252 * of the current error, or %NULL if there is no current error. This
1253 * pointer is guaranteed to remain valid until the @ref
1254 * account-error-changed signal is emitted for @a account.
1256 const PurpleConnectionErrorInfo
*purple_account_get_current_error(PurpleAccount
*account
);
1259 * purple_account_clear_current_error:
1260 * @account: The account whose error state should be cleared.
1262 * Clear an account's current error state, resetting it to %NULL.
1264 void purple_account_clear_current_error(PurpleAccount
*account
);
1268 #endif /* _PURPLE_ACCOUNT_H_ */