Remove the old status API
This has been a long time coming, but it's finally here!!
Testing Done:
April O'Neil covered it on the news!
I also ran the program and verified the demo protocol plugin was still working.
Reviewed at https://reviews.imfreedom.org/r/3103/
--- a/ChangeLog.API Fri Apr 12 01:55:22 2024 -0500
+++ b/ChangeLog.API Fri Apr 12 02:08:00 2024 -0500
@@ -248,6 +248,7 @@
* account-setting-info, account-set-info signals
* account-status-changing signal.
+ * buddy-status-changed signal. * chat-topic-changed signal.
* file-recv-accept, file-recv-cancel, file-recv-complete,
file-recv-start, file-send-accept, file-send-cancel,
@@ -273,6 +274,7 @@
* purple_account_add_buddies_with_invite
* purple_account_add_buddy_with_invite
* purple_account_destroy_log
+ * purple_account_get_active_status * purple_account_get_check_mail
* purple_account_get_name_for_display. Use
@@ -284,11 +286,16 @@
* purple_account_get_private_alias. Use purple_contact_get_alias
* purple_account_get_silence_suppression
+ * purple_account_get_status + * purple_account_get_status_type + * purple_account_get_status_type_with_primitive + * purple_account_get_status_types * purple_account_get_ui_int
* purple_account_get_ui_string
* purple_account_get_ui_bool
* purple_account_get_username. Use purple_contact_info_get_username
+ * purple_account_is_status_active * purple_account_notify_added
* purple_account_privacy_allow
* purple_account_privacy_check
@@ -313,11 +320,15 @@
* purple_account_set_public_alias
* purple_account_set_silence_suppression
+ * purple_account_set_status + * purple_account_set_status_attrs + * purple_account_set_status_types * purple_account_set_ui_int
* purple_account_set_ui_string
* purple_account_set_ui_bool
* purple_account_set_username. Use purple_contact_info_set_username
+ * account-status-changed signal * purple_accounts_get_all
@@ -605,6 +616,12 @@
+ * purple_presence_get_status + * purple_presence_get_statuses + * purple_presence_is_status_active + * purple_presence_is_status_primitive_active + * purple_presence_set_status_active + * purple_presence_switch_status * purple_protocol_got_account_actions
* purple_protocol_got_account_idle
* purple_protocol_got_account_status
--- a/doc/reference/libpurple/libpurple.toml.in Fri Apr 12 01:55:22 2024 -0500
+++ b/doc/reference/libpurple/libpurple.toml.in Fri Apr 12 02:08:00 2024 -0500
@@ -47,7 +47,6 @@
"signals_conversation.md",
- "signals_savedstatus.md",
--- a/doc/reference/libpurple/meson.build Fri Apr 12 01:55:22 2024 -0500
+++ b/doc/reference/libpurple/meson.build Fri Apr 12 02:08:00 2024 -0500
@@ -8,8 +8,6 @@
'signals_conversation.md',
- 'signals_savedstatus.md',
--- a/doc/reference/libpurple/signals_account.md Fri Apr 12 01:55:22 2024 -0500
+++ b/doc/reference/libpurple/signals_account.md Fri Apr 12 02:08:00 2024 -0500
@@ -5,7 +5,6 @@
-* [account-status-changed](#account-status-changed)
* [account-signed-on](#account-signed-on)
* [account-signed-off](#account-signed-off)
@@ -47,33 +46,6 @@
-#### account-status-changed
-void user_function(PurpleAccount *account,
-Emitted when the status of an account changes (after the change).
-: The account that changed status.
-: The status before change.
-: The status after change.
-: User data set when the signal handler was connected.
-----
--- a/doc/reference/libpurple/signals_blist.md Fri Apr 12 01:55:22 2024 -0500
+++ b/doc/reference/libpurple/signals_blist.md Fri Apr 12 02:08:00 2024 -0500
@@ -5,7 +5,6 @@
-* [buddy-status-changed](#buddy-status-changed)
* [buddy-idle-changed](#buddy-idle-changed)
* [buddy-signed-on](#buddy-signed-on)
* [buddy-signed-off](#buddy-signed-off)
@@ -18,33 +17,6 @@
-#### buddy-status-changed
-void user_function(PurpleBuddy *buddy,
- PurpleStatus *old_status,
-Emitted when a buddy on your buddy list goes away.
-: The buddy whose status changed.
-: The status that the buddy just changed from.
-: The status that the buddy just changed to.
-: user data set when the signal handler was connected.
-----
--- a/doc/reference/libpurple/signals_savedstatus.md Fri Apr 12 01:55:22 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-Title: Saved Status Signals
-Slug: saved-status-signals
-* [savedstatus-changed](#savedstatus-changed)
-#### savedstatus-changed
-void user_function(PurpleSavedStatus *new,
- PurpleSavedStatus *old,
-Emitted when a new saved status is activated.
--- a/libpurple/accounts.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/accounts.c Fri Apr 12 02:08:00 2024 -0500
@@ -625,11 +625,6 @@
void *handle = purple_accounts_get_handle();
void *conn_handle = purple_connections_get_handle();
- purple_signal_register(handle, "account-status-changed",
- purple_marshal_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3, PURPLE_TYPE_ACCOUNT,
- PURPLE_TYPE_STATUS, PURPLE_TYPE_STATUS);
purple_signal_register(handle, "account-signed-on",
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
--- a/libpurple/buddy.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/buddy.c Fri Apr 12 02:08:00 2024 -0500
@@ -191,7 +191,8 @@
priv->presence = purple_presence_new();
- purple_presence_set_status_active(priv->presence, "offline", TRUE);
+ purple_presence_set_primitive(priv->presence, + PURPLE_PRESENCE_PRIMITIVE_OFFLINE); purple_blist_new_node(purple_blist_get_default(),
PURPLE_BLIST_NODE(buddy));
@@ -704,78 +705,6 @@
-purple_buddy_update_status(PurpleBuddy *buddy, PurpleStatus *old_status) {
- PurpleBuddyList *blist = NULL;
- PurpleBuddyPrivate *priv = NULL;
- PurpleStatus *status = NULL;
- gpointer handle = NULL;
- gboolean old_online = FALSE, new_online = FALSE;
- g_return_if_fail(PURPLE_IS_BUDDY(buddy));
- priv = purple_buddy_get_instance_private(buddy);
- status = purple_presence_get_active_status(priv->presence);
- blist = purple_blist_get_default();
- handle = purple_blist_get_handle();
- purple_debug_info("blistnodetypes", "Updating buddy status for %s (%s)\n",
- purple_account_get_protocol_name(priv->account));
- old_online = purple_status_is_online(old_status);
- new_online = purple_status_is_online(status);
- if(old_online != new_online) {
- PurpleBlistNode *cnode = NULL, *gnode = NULL;
- PurpleMetaContact *contact = NULL;
- PurpleCountingNode *contact_counter = NULL, *group_counter = NULL;
- gint delta = 0, limit = 0;
- purple_signal_emit(handle, "buddy-signed-on", buddy);
- purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "last_seen",
- purple_signal_emit(handle, "buddy-signed-off", buddy);
- cnode = purple_blist_node_get_parent(PURPLE_BLIST_NODE(buddy));
- contact = PURPLE_META_CONTACT(cnode);
- contact_counter = PURPLE_COUNTING_NODE(contact);
- gnode = purple_blist_node_get_parent(cnode);
- group_counter = PURPLE_COUNTING_NODE(gnode);
- purple_counting_node_change_online_count(contact_counter, delta);
- if(purple_counting_node_get_online_count(contact_counter) == limit) {
- purple_counting_node_change_online_count(group_counter, delta);
- purple_signal_emit(handle, "buddy-status-changed", buddy, old_status,
- * This function used to only call the following two functions if one of
- * the above signals had been triggered, but that's not good, because
- * if someone's away message changes and they don't go from away to back
- * to away then no signal is triggered.
- * It's a safe assumption that SOMETHING called this function. PROBABLY
- * because something, somewhere changed. Calling the stuff below
- * certainly won't hurt anything. Unless you're on a K6-2 300.
- purple_meta_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy));
- purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy));
purple_buddy_get_media_caps(PurpleBuddy *buddy) {
PurpleBuddyPrivate *priv = NULL;
--- a/libpurple/buddy.h Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/buddy.h Fri Apr 12 02:08:00 2024 -0500
@@ -46,7 +46,6 @@
#include "purpleaccount.h"
#include "purplepresence.h"
#include "purpleversion.h"
* PURPLE_BUDDY_IS_ONLINE:
@@ -271,20 +270,6 @@
PurplePresence *purple_buddy_get_presence(PurpleBuddy *buddy);
- * purple_buddy_update_status:
- * @buddy: The buddy whose status has changed.
- * @old_status: The status from which we are changing.
- * Updates a buddy's status.
- * This should only be called from within Purple.
-void purple_buddy_update_status(PurpleBuddy *buddy, PurpleStatus *old_status);
* purple_buddy_get_media_caps:
--- a/libpurple/buddylist.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/buddylist.c Fri Apr 12 02:08:00 2024 -0500
@@ -1912,7 +1912,8 @@
for (iter = list; iter; iter = iter->next)
- purple_presence_set_status_active(iter->data, "offline", TRUE);
+ purple_presence_set_primitive(iter->data, + PURPLE_PRESENCE_PRIMITIVE_OFFLINE); @@ -2084,10 +2085,6 @@
/* Set a default, which can't be done as a static initializer. */
buddy_list_type = PURPLE_TYPE_BUDDY_LIST;
- purple_signal_register(handle, "buddy-status-changed",
- purple_marshal_VOID__POINTER_POINTER_POINTER,
- G_TYPE_NONE, 3, PURPLE_TYPE_BUDDY, PURPLE_TYPE_STATUS,
purple_signal_register(handle, "buddy-privacy-changed",
purple_marshal_VOID__POINTER, G_TYPE_NONE,
--- a/libpurple/connection.h Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/connection.h Fri Apr 12 02:08:00 2024 -0500
@@ -112,7 +112,6 @@
#include "purpleaccount.h"
#include "purpleconnectionerrorinfo.h"
#include "purpleprotocol.h"
struct _PurpleConnectionClass {
--- a/libpurple/core.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/core.c Fri Apr 12 02:08:00 2024 -0500
@@ -44,9 +44,7 @@
#include "purplepresencemanagerprivate.h"
#include "purpleprivate.h"
-#include "savedstatuses.h"
#include "win32/win32dep.h"
@@ -149,17 +147,15 @@
- /* Accounts use status, buddy icons and connection signals, so
- * initialize these before accounts
+ /* Accounts buddy icons and connection signals, so initialize these before - purple_statuses_init();
purple_buddy_icons_init();
purple_connections_init();
purple_account_manager_startup();
purple_contact_manager_startup();
- purple_savedstatuses_init();
purple_presence_manager_startup();
purple_conversations_init();
@@ -241,8 +237,6 @@
purple_connections_uninit();
purple_buddy_icons_uninit();
purple_presence_manager_shutdown();
- purple_savedstatuses_uninit();
- purple_statuses_uninit();
purple_accounts_uninit();
--- a/libpurple/meson.build Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/meson.build Fri Apr 12 02:08:00 2024 -0500
@@ -112,10 +112,8 @@
'request/purplerequestpage.c',
@@ -221,10 +219,8 @@
@@ -312,7 +308,6 @@
--- a/libpurple/purpleaccount.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purpleaccount.c Fri Apr 12 02:08:00 2024 -0500
@@ -74,8 +74,6 @@
PurpleProxyInfo *proxy_info;
PurplePresence *presence;
PurpleConnectionErrorInfo *error;
@@ -807,8 +805,6 @@
purple_account_free_notify_settings(account);
- purple_account_set_status_types(account, NULL);
g_clear_object(&account->proxy_info);
g_clear_pointer(&account->error, purple_connection_error_info_free);
@@ -1419,65 +1415,6 @@
-purple_account_set_status_types(PurpleAccount *account, GList *status_types) {
- g_return_if_fail(PURPLE_IS_ACCOUNT(account));
- /* Out with the old... */
- g_list_free_full(account->status_types,
- (GDestroyNotify)purple_status_type_destroy);
- /* In with the new... */
- account->status_types = status_types;
-purple_account_set_status(PurpleAccount *account, const char *status_id,
- va_start(args, active);
- attrs = purple_attrs_from_vargs(args);
- purple_account_set_status_attrs(account, status_id, active, attrs);
- g_hash_table_destroy(attrs);
-purple_account_set_status_attrs(PurpleAccount *account, const char *status_id,
- gboolean active, GHashTable *attrs)
- g_return_if_fail(PURPLE_IS_ACCOUNT(account));
- g_return_if_fail(status_id != NULL);
- status = purple_account_get_status(account, status_id);
- PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
- purple_debug_error("account",
- "Invalid status ID '%s' for account %s (%s)\n",
- purple_contact_info_get_username(info),
- purple_account_get_protocol_id(account));
- if(active || purple_status_is_independent(status)) {
- purple_status_set_active_with_attributes(status, active, attrs);
- * Our current statuses are saved to accounts.xml (so that when we
- * reconnect, we go back to the previous status).
- purple_accounts_schedule_save();
purple_account_set_int(PurpleAccount *account, const char *name, int value) {
PurpleAccountSetting *setting;
@@ -1631,59 +1568,6 @@
return account->proxy_info;
-purple_account_get_active_status(PurpleAccount *account) {
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- return purple_presence_get_active_status(account->presence);
-purple_account_get_status(PurpleAccount *account, const char *status_id) {
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- g_return_val_if_fail(status_id != NULL, NULL);
- return purple_presence_get_status(account->presence, status_id);
-purple_account_get_status_type(PurpleAccount *account, const char *id) {
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- g_return_val_if_fail(id != NULL, NULL);
- for (l = purple_account_get_status_types(account); l != NULL; l = l->next)
- PurpleStatusType *status_type = (PurpleStatusType *)l->data;
- if(purple_strequal(purple_status_type_get_id(status_type), id)) {
-purple_account_get_status_type_with_primitive(PurpleAccount *account,
- PurpleStatusPrimitive primitive)
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- for(l = purple_account_get_status_types(account); l != NULL; l = l->next) {
- PurpleStatusType *status_type = (PurpleStatusType *)l->data;
- if(purple_status_type_get_primitive(status_type) == primitive) {
purple_account_get_presence(PurpleAccount *account) {
g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
@@ -1691,23 +1575,6 @@
return account->presence;
-purple_account_is_status_active(PurpleAccount *account,
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), FALSE);
- g_return_val_if_fail(status_id != NULL, FALSE);
- return purple_presence_is_status_active(account->presence, status_id);
-purple_account_get_status_types(PurpleAccount *account) {
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- return account->status_types;
purple_account_get_int(PurpleAccount *account, const char *name,
--- a/libpurple/purpleaccount.h Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purpleaccount.h Fri Apr 12 02:08:00 2024 -0500
@@ -41,7 +41,6 @@
#include "purpleprotocol.h"
#include "purpleproxyinfo.h"
#include "purpleversion.h"
@@ -253,71 +252,6 @@
void purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info);
- * purple_account_set_status_types:
- * @account: The account.
- * @status_types: (element-type PurpleStatusType): The list of status types.
- * Sets the account's status types.
-void purple_account_set_status_types(PurpleAccount *account, GList *status_types);
- * purple_account_set_status:
- * @account: The account.
- * @status_id: The ID of the status.
- * @active: Whether @status_id is to be activated (%TRUE) or deactivated
- * @...: A %NULL-terminated list of pairs of `const char *` attribute name
- * followed by `const char *` attribute value for the status. (For
- * example, one pair might be `"message"` followed by `"hello, talk to
- * Activates or deactivates a status.
- * All changes to the statuses of an account go through this function or
- * [method@Purple.Account.set_status_attrs].
- * You can only deactivate an exclusive status by activating another exclusive
- * status. So, if @status_id is an exclusive status and @active is %FALSE, this
- * function does nothing.
- * Variadic version of [method@Purple.Account.set_status_attrs].
-void purple_account_set_status(PurpleAccount *account, const char *status_id, gboolean active, ...) G_GNUC_NULL_TERMINATED;
- * purple_account_set_status_attrs: (rename-to purple_account_set_status):
- * @account: The account.
- * @status_id: The ID of the status.
- * @active: Whether @status_id is to be activated (%TRUE) or deactivated
- * @attrs: (element-type utf8 utf8): A hash table with keys of attribute
- * names and values of attributes for the status. (For example, one
- * pair might be a key of `"message"` with a value of `"hello, talk to
- * Activates or deactivates a status.
- * All changes to the statuses of an account go through this function or
- * [method@Purple.Account.set_status].
- * You can only deactivate an exclusive status by activating another exclusive
- * status. So, if @status_id is an exclusive status and @active is %FALSE, this
- * function does nothing.
-void purple_account_set_status_attrs(PurpleAccount *account, const char *status_id, gboolean active, GHashTable *attrs);
* purple_account_set_int:
* @name: The name of the setting.
@@ -514,67 +448,6 @@
PurpleProxyInfo *purple_account_get_proxy_info(PurpleAccount *account);
- * purple_account_get_active_status:
- * @account: The account.
- * Returns the active status for this account. This looks through
- * the PurplePresence associated with this account and returns the
- * PurpleStatus that has its active flag set to "TRUE." There can be
- * only one active PurpleStatus in a PurplePresence.
- * Returns: (transfer none): The active status.
-PurpleStatus *purple_account_get_active_status(PurpleAccount *account);
- * purple_account_get_status:
- * @account: The account.
- * @status_id: The status ID.
- * Returns the account status with the specified ID.
- * Returns: (transfer none): The status, or %NULL if it was never registered.
-PurpleStatus *purple_account_get_status(PurpleAccount *account, const char *status_id);
- * purple_account_get_status_type:
- * @account: The account.
- * @id: The ID of the status type to find.
- * Returns the account status type with the specified ID.
- * Returns: The status type if found, or %NULL.
-PurpleStatusType *purple_account_get_status_type(PurpleAccount *account, const char *id);
- * purple_account_get_status_type_with_primitive:
- * @account: The account.
- * @primitive: The type of the status type to find.
- * Returns the account status type with the specified primitive.
- * Note: It is possible for an account to have more than one
- * PurpleStatusType with the same primitive. In this case, the
- * first PurpleStatusType is returned.
- * Returns: The status if found, or %NULL.
-PurpleStatusType *purple_account_get_status_type_with_primitive(PurpleAccount *account, PurpleStatusPrimitive primitive);
* purple_account_get_presence:
@@ -588,33 +461,6 @@
PurplePresence *purple_account_get_presence(PurpleAccount *account);
- * purple_account_is_status_active:
- * @account: The account.
- * @status_id: The status ID.
- * Returns whether or not an account status is active.
- * Returns: TRUE if active, or FALSE if not.
-gboolean purple_account_is_status_active(PurpleAccount *account, const char *status_id);
- * purple_account_get_status_types:
- * @account: The account.
- * Returns the account's status types.
- * Returns: (transfer none) (element-type PurpleStatusType): The account's status types.
-GList *purple_account_get_status_types(PurpleAccount *account);
* purple_account_get_int:
* @name: The name of the setting.
--- a/libpurple/purplepresence.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purplepresence.c Fri Apr 12 02:08:00 2024 -0500
@@ -33,10 +33,6 @@
- GHashTable *status_table;
- PurpleStatus *active_status;
PurplePresencePrimitive primitive;
@@ -49,7 +45,6 @@
@@ -62,28 +57,6 @@
G_DEFINE_TYPE_WITH_PRIVATE(PurplePresence, purple_presence, G_TYPE_OBJECT)
/******************************************************************************
- *****************************************************************************/
-purple_presence_set_active_status(PurplePresence *presence,
- PurplePresencePrivate *priv = NULL;
- priv = purple_presence_get_instance_private(presence);
- if(g_set_object(&priv->active_status, status)) {
- GObject *obj = G_OBJECT(presence);
- g_object_freeze_notify(obj);
- g_object_notify_by_pspec(obj, properties[PROP_ACTIVE_STATUS]);
- g_object_notify_by_pspec(obj, properties[PROP_PRIMITIVE]);
- g_object_notify_by_pspec(obj, properties[PROP_MESSAGE]);
- g_object_thaw_notify(obj);
-/******************************************************************************
*****************************************************************************/
@@ -103,10 +76,6 @@
purple_presence_set_login_time(presence, g_value_get_boxed(value));
- case PROP_ACTIVE_STATUS:
- purple_presence_set_active_status(presence,
- g_value_get_object(value));
purple_presence_set_primitive(presence, g_value_get_enum(value));
@@ -145,9 +114,6 @@
g_value_set_boxed(value, purple_presence_get_login_time(presence));
- case PROP_ACTIVE_STATUS:
- g_value_set_object(value, purple_presence_get_active_status(presence));
g_value_set_enum(value, purple_presence_get_primitive(presence));
@@ -171,13 +137,7 @@
-purple_presence_init(PurplePresence *presence) {
- PurplePresencePrivate *priv = NULL;
- priv = purple_presence_get_instance_private(presence);
- priv->status_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
+purple_presence_init(G_GNUC_UNUSED PurplePresence *presence) { @@ -186,9 +146,6 @@
priv = purple_presence_get_instance_private(PURPLE_PRESENCE(obj));
- g_hash_table_destroy(priv->status_table);
- g_clear_object(&priv->active_status);
g_clear_pointer(&priv->idle_time, g_date_time_unref);
g_clear_pointer(&priv->login_time, g_date_time_unref);
@@ -244,21 +201,9 @@
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- * PurplePresence:active-status:
- * The currently active status of the presence.
- properties[PROP_ACTIVE_STATUS] = g_param_spec_object("active-status",
- "The active status for the presence.", PURPLE_TYPE_STATUS,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* PurplePresence:primitive:
- * The [enum@Purple.StatusPrimitive] for this presence.
+ * The [enum@Purple.PresencePrimitive] for this presence. @@ -337,41 +282,6 @@
-purple_presence_set_status_active(PurplePresence *presence,
- const gchar *status_id, gboolean active)
- PurpleStatus *status = NULL;
- g_return_if_fail(PURPLE_IS_PRESENCE(presence));
- g_return_if_fail(status_id != NULL);
- status = purple_presence_get_status(presence, status_id);
- g_return_if_fail(PURPLE_IS_STATUS(status));
- /* TODO: Should we do the following? */
- /* g_return_if_fail(active == status->active); */
- if(purple_status_is_exclusive(status)) {
- purple_debug_warning("presence",
- "Attempted to set a non-independent status "
- "(%s) inactive. Only independent statuses "
- "can be specifically marked inactive.",
- purple_status_set_active(status, active);
-purple_presence_switch_status(PurplePresence *presence, const gchar *status_id)
- purple_presence_set_status_active(presence, status_id, TRUE);
purple_presence_set_idle(PurplePresence *presence, gboolean idle,
@@ -436,126 +346,37 @@
g_object_notify_by_pspec(G_OBJECT(presence), properties[PROP_LOGIN_TIME]);
-purple_presence_get_statuses(PurplePresence *presence) {
- PurplePresenceClass *klass = NULL;
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
- klass = PURPLE_PRESENCE_GET_CLASS(presence);
- if(klass && klass->get_statuses) {
- return klass->get_statuses(presence);
+purple_presence_is_available(PurplePresence *presence) { + PurplePresencePrivate *priv = NULL;
-purple_presence_get_status(PurplePresence *presence, const gchar *status_id) {
- PurplePresencePrivate *priv = NULL;
- PurpleStatus *status = NULL;
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
- g_return_val_if_fail(status_id != NULL, NULL);
+ g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE); priv = purple_presence_get_instance_private(presence);
- /* What's the purpose of this hash table? */
- status = (PurpleStatus *)g_hash_table_lookup(priv->status_table,
- for(l = purple_presence_get_statuses(presence);
- l != NULL && status == NULL; l = l->next)
- PurpleStatus *temp_status = l->data;
- if (purple_strequal(status_id, purple_status_get_id(temp_status))) {
- g_hash_table_insert(priv->status_table,
- g_strdup(purple_status_get_id(status)), status);
-purple_presence_get_active_status(PurplePresence *presence) {
- PurplePresencePrivate *priv = NULL;
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
- priv = purple_presence_get_instance_private(presence);
- return priv->active_status;
-purple_presence_is_available(PurplePresence *presence) {
- PurpleStatus *status = NULL;
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
- status = purple_presence_get_active_status(presence);
- return ((status != NULL && purple_status_is_available(status)) &&
- !purple_presence_is_idle(presence));
+ return priv->primitive == PURPLE_PRESENCE_PRIMITIVE_AVAILABLE; purple_presence_is_online(PurplePresence *presence) {
- PurpleStatus *status = NULL;
+ PurplePresencePrivate *priv = NULL; g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
- if((status = purple_presence_get_active_status(presence)) == NULL) {
+ priv = purple_presence_get_instance_private(presence); + switch(priv->primitive) { + case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE: + case PURPLE_PRESENCE_PRIMITIVE_IDLE: + case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE: + case PURPLE_PRESENCE_PRIMITIVE_AWAY: + case PURPLE_PRESENCE_PRIMITIVE_DO_NOT_DISTURB: + case PURPLE_PRESENCE_PRIMITIVE_STREAMING: + case PURPLE_PRESENCE_PRIMITIVE_OFFLINE:
- return purple_status_is_online(status);
-purple_presence_is_status_active(PurplePresence *presence,
- const gchar *status_id)
- PurpleStatus *status = NULL;
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
- g_return_val_if_fail(status_id != NULL, FALSE);
- status = purple_presence_get_status(presence, status_id);
- return (status != NULL && purple_status_is_active(status));
-purple_presence_is_status_primitive_active(PurplePresence *presence,
- PurpleStatusPrimitive primitive)
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), FALSE);
- g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, FALSE);
- for(l = purple_presence_get_statuses(presence); l != NULL; l = l->next) {
- PurpleStatus *temp_status = l->data;
- PurpleStatusType *type = purple_status_get_status_type(temp_status);
- if(purple_status_type_get_primitive(type) == primitive &&
- purple_status_is_active(temp_status))
@@ -689,15 +510,7 @@
priv = purple_presence_get_instance_private(presence);
- if(priv->message != NULL) {
- if(priv->active_status == NULL) {
- return purple_status_get_attr_string(priv->active_status, "message");
--- a/libpurple/purplepresence.h Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purplepresence.h Fri Apr 12 02:08:00 2024 -0500
@@ -52,8 +52,6 @@
typedef struct _PurplePresence PurplePresence;
* PurplePresencePrimitive:
* @PURPLE_PRESENCE_PRIMITIVE_OFFLINE: The presence is offline or otherwise
@@ -131,38 +129,6 @@
PurplePresence *purple_presence_new(void);
- * purple_presence_set_status_active:
- * @presence: The #PurplePresence instance.
- * @status_id: The ID of the status.
- * @active: The active state.
- * Sets the active state of a status in a presence.
- * Only independent statuses can be set inactive. Normal statuses can only
- * be set active, so if you wish to disable a status, set another
- * non-independent status to active, or use purple_presence_switch_status().
-void purple_presence_set_status_active(PurplePresence *presence, const gchar *status_id, gboolean active);
- * purple_presence_switch_status:
- * @presence: The #PurplePresence instance.
- * @status_id: The status ID to switch to.
- * Switches the active status in a presence.
- * This is similar to purple_presence_set_status_active(), except it won't
- * activate independent statuses.
-void purple_presence_switch_status(PurplePresence *presence, const gchar *status_id);
* purple_presence_set_idle:
* @presence: The #PurplePresence instance.
@@ -190,46 +156,6 @@
void purple_presence_set_login_time(PurplePresence *presence, GDateTime *login_time);
- * purple_presence_get_statuses:
- * @presence: The #PurplePresence instance.
- * Gets a list of all the statuses in @presence.
- * Returns: (element-type PurpleStatus) (transfer none): The statuses.
-GList *purple_presence_get_statuses(PurplePresence *presence);
- * purple_presence_get_status:
- * @presence: The #PurplePresence instance.
- * @status_id: The ID of the status.
- * Gets the status with the specified ID from @presence.
- * Returns: (transfer none): The #PurpleStatus if found, or %NULL.
-PurpleStatus *purple_presence_get_status(PurplePresence *presence, const gchar *status_id);
- * purple_presence_get_active_status:
- * @presence: The #PurplePresence instance.
- * Gets the active exclusive status from @presence.
- * Returns: (transfer none): The active exclusive status.
-PurpleStatus *purple_presence_get_active_status(PurplePresence *presence);
* purple_presence_is_available:
* @presence: The #PurplePresence instance.
@@ -258,39 +184,6 @@
gboolean purple_presence_is_online(PurplePresence *presence);
- * purple_presence_is_status_active:
- * @presence: The #PurplePresence instance.
- * @status_id: The ID of the status.
- * Gets whether or not a status in @presence is active.
- * A status is active if itself or any of its sub-statuses are active.
- * Returns: %TRUE if the status is active, or %FALSE.
-gboolean purple_presence_is_status_active(PurplePresence *presence, const gchar *status_id);
- * purple_presence_is_status_primitive_active:
- * @presence: The #PurplePresence instance.
- * @primitive: The status primitive.
- * Gets whether or not a status with the specified primitive type in @presence
- * A status is active if itself or any of its sub-statuses are active.
- * Returns: %TRUE if the status is active, or %FALSE.
-gboolean purple_presence_is_status_primitive_active(PurplePresence *presence, PurpleStatusPrimitive primitive);
* purple_presence_is_idle:
* @presence: The #PurplePresence instance.
@@ -366,7 +259,7 @@
* @presence: The instance.
* @primitive: The new primitive.
- * Sets the [enum@Purple.StatusPrimitive] for @presence to @primitive.
+ * Sets the [enum@Purple.PresencePrimitive] for @presence to @primitive. --- a/libpurple/purpleprotocolserver.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purpleprotocolserver.c Fri Apr 12 02:08:00 2024 -0500
@@ -69,22 +69,6 @@
-purple_protocol_server_set_status(PurpleProtocolServer *protocol_server,
- PurpleAccount *account, PurpleStatus *status)
- PurpleProtocolServerInterface *iface = NULL;
- g_return_if_fail(PURPLE_IS_PROTOCOL_SERVER(protocol_server));
- g_return_if_fail(PURPLE_IS_ACCOUNT(account));
- g_return_if_fail(PURPLE_IS_STATUS(status));
- iface = PURPLE_PROTOCOL_SERVER_GET_IFACE(protocol_server);
- if(iface != NULL && iface->set_status != NULL) {
- iface->set_status(protocol_server, account, status);
purple_protocol_server_set_idle(PurpleProtocolServer *protocol_server,
PurpleConnection *connection, gint idletime)
--- a/libpurple/purpleprotocolserver.h Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purpleprotocolserver.h Fri Apr 12 02:08:00 2024 -0500
@@ -63,7 +63,6 @@
void (*set_info)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, const gchar *info);
void (*get_info)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, const gchar *who);
- void (*set_status)(PurpleProtocolServer *protocol_server, PurpleAccount *account, PurpleStatus *status);
void (*set_idle)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, gint idletime);
void (*change_passwd)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, const gchar *old_pass, const gchar *new_pass);
@@ -116,19 +115,6 @@
void purple_protocol_server_get_info(PurpleProtocolServer *protocol_server, PurpleConnection *connection, const gchar *who);
- * purple_protocol_server_set_status:
- * @protocol_server: The #PurpleProtocolServer instance.
- * @account: The #PurpleAccount instance.
- * @status: The #PurpleStatus instance.
- * Sets the status for account @account to @status.
-void purple_protocol_server_set_status(PurpleProtocolServer *protocol_server, PurpleAccount *account, PurpleStatus *status);
* purple_protocol_server_set_idle:
* @protocol_server: The #PurpleProtocolServer instance.
* @connection: The #PurpleConnection instance.
--- a/libpurple/purplesavedpresence.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/purplesavedpresence.c Fri Apr 12 02:08:00 2024 -0500
@@ -395,7 +395,7 @@
* PurpleSavedPresence:primitive:
- * The [enum@Purple.StatusPrimitive] for this saved presence.
+ * The [enum@Purple.PresencePrimitive] for this saved presence. --- a/libpurple/savedstatuses.c Fri Apr 12 01:55:22 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1274 +0,0 @@
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
-#include <glib/gi18n-lib.h>
-#include "purpleaccountmanager.h"
-#include "purplemarkup.h"
-#include "savedstatuses.h"
- * The maximum number of transient statuses to save. This
- * is used during the shutdown process to clean out old
-#define MAX_TRANSIENTS 5
- * The default message to use when the user becomes auto-away.
-#define DEFAULT_AUTOAWAY_MESSAGE _("I'm not here right now")
- * The information stores a snap-shot of the statuses of all
- * your accounts. Basically these are your saved away messages.
- * There is an overall status and message that applies to
- * all your accounts, and then each individual account can
- * optionally have a different custom status and message.
- * The changes to status.xml caused by the new status API
- * are fully backward compatible. The new status API just
- * adds the optional sub-statuses to the XML file.
-struct _PurpleSavedStatus
- PurpleStatusPrimitive type;
- /* The timestamp when this saved status was created. This must be unique. */
- unsigned int usage_count;
- GList *substatuses; /* A list of PurpleSavedStatusSub's. */
- * TODO: If a PurpleStatusType is deleted, need to also delete any
- * associated PurpleSavedStatusSub's?
-struct _PurpleSavedStatusSub
- PurpleAccount *account;
- const PurpleStatusType *type;
-static GList *saved_statuses = NULL;
-static guint save_timer = 0;
-static gboolean statuses_loaded = FALSE;
- * This hash table keeps track of which timestamps we've
- * used so that we don't have two saved statuses with the
- * same 'creation_time' timestamp. The 'created' timestamp
- * is used as a unique identifier.
- * So the key in this hash table is the creation_time and
- * the value is a pointer to the PurpleSavedStatus.
-static GHashTable *creation_times;
-static void schedule_save(void);
-/*********************************************************************
- * Private utility functions *
- *********************************************************************/
-free_saved_status_sub(PurpleSavedStatusSub *substatus)
- g_return_if_fail(substatus != NULL);
- g_free(substatus->message);
- purple_request_close_with_handle(substatus);
- g_clear_object(&substatus->account);
-free_saved_status(PurpleSavedStatus *status)
- g_return_if_fail(status != NULL);
- g_free(status->message);
- g_list_free_full(status->substatuses, (GDestroyNotify)free_saved_status_sub);
- purple_request_close_with_handle(status);
- * Set the timestamp for when this saved status was created, and
- * make sure it is unique.
-set_creation_time(PurpleSavedStatus *status, time_t creation_time)
- g_return_if_fail(status != NULL);
- /* Avoid using 0 because it's an invalid hash key */
- status->creation_time = creation_time != 0 ? creation_time : 1;
- while (g_hash_table_lookup(creation_times, (gconstpointer)status->creation_time) != NULL)
- status->creation_time++;
- g_hash_table_insert(creation_times,
- (gpointer)status->creation_time,
- * A magic number is calculated for each status, and then the
- * statuses are ordered by the magic number. The magic number
- * is the date the status was last used offset by one day for
- * each time the status has been used (but only by 10 days at
- * The goal is to have recently used statuses at the top of
- * the list, but to also keep frequently used statuses near
-saved_statuses_sort_func(gconstpointer a, gconstpointer b)
- const PurpleSavedStatus *saved_status_a = a;
- const PurpleSavedStatus *saved_status_b = b;
- time_t time_a = saved_status_a->lastused +
- (MIN(saved_status_a->usage_count, 10) * 86400);
- time_t time_b = saved_status_b->lastused +
- (MIN(saved_status_b->usage_count, 10) * 86400);
- * Transient statuses are added and removed automatically by
- * Purple. If they're not used for a certain length of time then
- * they'll expire and be automatically removed. This function
-remove_old_transient_statuses(void)
- PurpleSavedStatus *saved_status, *startup_status, *current_status;
- startup_status = purple_savedstatus_get_startup();
- current_status = purple_savedstatus_get_current();
- * Iterate through the list of saved statuses. Delete all
- * transient statuses except for the first MAX_TRANSIENTS
- * (remember, the saved statuses are already sorted by popularity).
- * We should also keep the startup status, if any is set.
- for (l = saved_statuses; l != NULL; l = next)
- saved_status = l->data;
- if (purple_savedstatus_is_transient(saved_status))
- if (count == MAX_TRANSIENTS)
- if (saved_status != current_status && saved_status != startup_status)
- saved_statuses = g_list_delete_link(saved_statuses, l);
- creation_time = purple_savedstatus_get_creation_time(saved_status);
- g_hash_table_remove(creation_times, (gconstpointer)creation_time);
- free_saved_status(saved_status);
- if (count == MAX_TRANSIENTS)
-/*********************************************************************
- *********************************************************************/
-substatus_to_xmlnode(PurpleSavedStatusSub *substatus)
- PurpleContactInfo *info = NULL;
- PurpleXmlNode *node, *child;
- const char *name = NULL;
- info = PURPLE_CONTACT_INFO(substatus->account);
- node = purple_xmlnode_new("substatus");
- child = purple_xmlnode_new_child(node, "account");
- purple_xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(substatus->account));
- name = purple_normalize(substatus->account,
- purple_contact_info_get_username(info));
- purple_xmlnode_insert_data(child, name, -1);
- child = purple_xmlnode_new_child(node, "state");
- purple_xmlnode_insert_data(child, purple_status_type_get_id(substatus->type), -1);
- if (substatus->message != NULL)
- child = purple_xmlnode_new_child(node, "message");
- purple_xmlnode_insert_data(child, substatus->message, -1);
-status_to_xmlnode(PurpleSavedStatus *status)
- PurpleXmlNode *node, *child;
- node = purple_xmlnode_new("status");
- if (status->title != NULL)
- purple_xmlnode_set_attrib(node, "name", status->title);
- * Purple 1.5.0 and earlier require a name to be set, so we
- * do this little hack to maintain backward compatibility
- * in the status.xml file. Eventually this should be removed
- * and we should determine if a status is transient by
- * whether the "name" attribute is set to something or if
- * it does not exist at all.
- purple_xmlnode_set_attrib(node, "name", "Auto-Cached");
- purple_xmlnode_set_attrib(node, "transient", "true");
- g_snprintf(buf, sizeof(buf), "%" G_GINT64_FORMAT,
- (gint64)status->creation_time);
- purple_xmlnode_set_attrib(node, "created", buf);
- g_snprintf(buf, sizeof(buf), "%" G_GINT64_FORMAT, (gint64)status->lastused);
- purple_xmlnode_set_attrib(node, "lastused", buf);
- g_snprintf(buf, sizeof(buf), "%u", status->usage_count);
- purple_xmlnode_set_attrib(node, "usage_count", buf);
- child = purple_xmlnode_new_child(node, "state");
- purple_xmlnode_insert_data(child, purple_primitive_get_id_from_type(status->type), -1);
- if (status->message != NULL)
- child = purple_xmlnode_new_child(node, "message");
- purple_xmlnode_insert_data(child, status->message, -1);
- for (cur = status->substatuses; cur != NULL; cur = cur->next)
- child = substatus_to_xmlnode(cur->data);
- purple_xmlnode_insert_child(node, child);
-statuses_to_xmlnode(void)
- PurpleXmlNode *node, *child;
- node = purple_xmlnode_new("statuses");
- purple_xmlnode_set_attrib(node, "version", "1.0");
- for (cur = saved_statuses; cur != NULL; cur = cur->next)
- child = status_to_xmlnode(cur->data);
- purple_xmlnode_insert_child(node, child);
- purple_debug_error("status", "Attempted to save statuses before they "
- node = statuses_to_xmlnode();
- data = purple_xmlnode_to_formatted_str(node, NULL);
- purple_util_write_data_to_config_file("status.xml", data, -1);
- purple_xmlnode_free(node);
-save_cb(G_GNUC_UNUSED gpointer data)
- save_timer = g_timeout_add_seconds(5, save_cb, NULL);
-/*********************************************************************
- *********************************************************************/
-static PurpleSavedStatusSub *
-parse_substatus(PurpleXmlNode *substatus)
- PurpleSavedStatusSub *ret;
- ret = g_new0(PurpleSavedStatusSub, 1);
- node = purple_xmlnode_get_child(substatus, "account");
- acct_name = purple_xmlnode_get_data(node);
- protocol = purple_xmlnode_get_attrib(node, "protocol");
- if(acct_name != NULL && protocol != NULL) {
- PurpleAccountManager *manager = NULL;
- manager = purple_account_manager_get_default();
- ret->account = purple_account_manager_find(manager, acct_name,
- if(ret->account == NULL) {
- free_saved_status_sub(ret);
- node = purple_xmlnode_get_child(substatus, "state");
- if((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) {
- ret->type = purple_status_type_find_with_id(
- purple_account_get_status_types(ret->account), data);
- if(ret->type == NULL) {
- free_saved_status_sub(ret);
- node = purple_xmlnode_get_child(substatus, "message");
- if((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL)) {
- * Parse a saved status and add it to the saved_statuses linked list.
- * Here's an example of the XML for a saved status:
- * <status name="Girls">
- * <message>I like the way that they walk
- * And it's chill to hear them talk
- * And I can always make them smile
- * From White Castle to the Nile</message>
- * <account protocol='aim'>markdoliner</account>
- * <state>available</state>
- * <message>The ladies man is here to answer your queries.</message>
- * <account protocol='aim'>giantgraypanda</account>
- * <message>A.C. ain't in charge no more.</message>
-static PurpleSavedStatus *
-parse_status(PurpleXmlNode *status)
- PurpleSavedStatus *ret;
- ret = g_new0(PurpleSavedStatus, 1);
- attrib = purple_xmlnode_get_attrib(status, "transient");
- if (!purple_strequal(attrib, "true"))
- attrib = purple_xmlnode_get_attrib(status, "name");
- ret->title = g_strdup(attrib);
- if (ret->title != NULL)
- /* Ensure the title is unique */
- while (purple_savedstatus_find(ret->title) != NULL)
- ret->title = g_strdup_printf("%s %d", attrib, i);
- /* Read the creation time */
- attrib = purple_xmlnode_get_attrib(status, "created");
- (attrib != NULL ? g_ascii_strtoll(attrib, NULL, 10) : 0));
- /* Read the last used time */
- attrib = purple_xmlnode_get_attrib(status, "lastused");
- ret->lastused = (attrib != NULL ? g_ascii_strtoll(attrib, NULL, 10) : 0);
- /* Read the usage count */
- attrib = purple_xmlnode_get_attrib(status, "usage_count");
- ret->usage_count = (attrib != NULL ? atol(attrib) : 0);
- /* Read the primitive status type */
- node = purple_xmlnode_get_child(status, "state");
- if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL))
- ret->type = purple_primitive_get_type_from_id(data);
- node = purple_xmlnode_get_child(status, "message");
- if ((node != NULL) && ((data = purple_xmlnode_get_data(node)) != NULL))
- for (node = purple_xmlnode_get_child(status, "substatus"); node != NULL;
- node = purple_xmlnode_get_next_twin(node))
- PurpleSavedStatusSub *new;
- new = parse_substatus(node);
- ret->substatuses = g_list_prepend(ret->substatuses, new);
- * Read the saved statuses from a file in the Purple user dir.
- * Returns: TRUE on success, FALSE on failure (if the file can not
- * be opened, or if it contains invalid XML).
- PurpleXmlNode *statuses, *status;
- statuses_loaded = TRUE;
- statuses = purple_util_read_xml_from_config_file("status.xml", _("saved statuses"));
- for (status = purple_xmlnode_get_child(statuses, "status"); status != NULL;
- status = purple_xmlnode_get_next_twin(status))
- PurpleSavedStatus *new;
- new = parse_status(status);
- saved_statuses = g_list_prepend(saved_statuses, new);
- saved_statuses = g_list_sort(saved_statuses, saved_statuses_sort_func);
- purple_xmlnode_free(statuses);
-/**************************************************************************
-**************************************************************************/
-purple_savedstatus_new(const char *title, PurpleStatusPrimitive type)
- PurpleSavedStatus *status;
- /* Make sure we don't already have a saved status with this title. */
- g_return_val_if_fail(purple_savedstatus_find(title) == NULL, NULL);
- status = g_new0(PurpleSavedStatus, 1);
- status->title = g_strdup(title);
- set_creation_time(status, time(NULL));
- saved_statuses = g_list_insert_sorted(saved_statuses, status, saved_statuses_sort_func);
- purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-added",
-purple_savedstatus_set_title(PurpleSavedStatus *status, const char *title)
- g_return_if_fail(status != NULL);
- /* Make sure we don't already have a saved status with this title. */
- g_return_if_fail(purple_savedstatus_find(title) == NULL);
- status->title = g_strdup(title);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-modified", status);
-purple_savedstatus_set_primitive_type(PurpleSavedStatus *status, PurpleStatusPrimitive type)
- g_return_if_fail(status != NULL);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-modified", status);
-purple_savedstatus_set_message(PurpleSavedStatus *status, const char *message)
- g_return_if_fail(status != NULL);
- g_free(status->message);
- if ((message != NULL) && (*message == '\0'))
- status->message = NULL;
- status->message = g_strdup(message);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-modified", status);
-purple_savedstatus_set_substatus(PurpleSavedStatus *saved_status,
- const PurpleAccount *account,
- const PurpleStatusType *type,
- PurpleSavedStatusSub *substatus;
- g_return_if_fail(saved_status != NULL);
- g_return_if_fail(account != NULL);
- g_return_if_fail(type != NULL);
- /* Find an existing substatus or create a new one */
- substatus = purple_savedstatus_get_substatus(saved_status, account);
- substatus = g_new0(PurpleSavedStatusSub, 1);
- substatus->account = (PurpleAccount *)account;
- saved_status->substatuses = g_list_prepend(saved_status->substatuses, substatus);
- substatus->type = type;
- g_free(substatus->message);
- substatus->message = g_strdup(message);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-modified", saved_status);
-purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status,
- const PurpleAccount *account)
- PurpleSavedStatusSub *substatus;
- g_return_if_fail(saved_status != NULL);
- g_return_if_fail(account != NULL);
- for (iter = saved_status->substatuses; iter != NULL; iter = iter->next)
- substatus = iter->data;
- if (substatus->account == account)
- saved_status->substatuses = g_list_delete_link(saved_status->substatuses, iter);
- free_saved_status_sub(substatus);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-modified", saved_status);
- * This gets called when an account is deleted. We iterate through
- * all of our saved statuses and delete any substatuses that may
- * exist for this account.
-purple_savedstatus_unset_all_substatuses(G_GNUC_UNUSED PurpleAccountManager *manager,
- PurpleAccount *account,
- G_GNUC_UNUSED gpointer data)
- g_return_if_fail(account != NULL);
- g_list_foreach(saved_statuses, (GFunc)purple_savedstatus_unset_substatus, account);
-purple_savedstatus_delete_by_status(PurpleSavedStatus *status)
- time_t creation_time, current, idleaway;
- g_return_if_fail(status != NULL);
- saved_statuses = g_list_remove(saved_statuses, status);
- creation_time = purple_savedstatus_get_creation_time(status);
- g_hash_table_remove(creation_times, (gconstpointer)creation_time);
- * If we just deleted our current status or our idleaway status,
- * then set the appropriate pref back to 0.
- current = purple_prefs_get_int("/purple/savedstatus/default");
- if (current == creation_time)
- purple_prefs_set_int("/purple/savedstatus/default", 0);
- idleaway = purple_prefs_get_int("/purple/savedstatus/idleaway");
- if (idleaway == creation_time)
- purple_prefs_set_int("/purple/savedstatus/idleaway", 0);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-deleted", status);
- free_saved_status(status);
-purple_savedstatus_delete(const char *title)
- PurpleSavedStatus *status;
- status = purple_savedstatus_find(title);
- if (purple_savedstatus_get_current() == status)
- purple_savedstatus_delete_by_status(status);
-purple_savedstatuses_get_all(void)
-purple_savedstatuses_get_popular(unsigned int how_many)
- PurpleSavedStatus *next;
- /* Copy 'how_many' elements to a new list. If 'how_many' is 0, then copy all of 'em. */
- how_many = (unsigned int) -1;
- while ((i < how_many) && (cur != NULL))
- if ((!purple_savedstatus_is_transient(next)
- || purple_savedstatus_get_message(next) != NULL))
- popular = g_list_prepend(popular, next);
- popular = g_list_reverse(popular);
-purple_savedstatus_get_current(void)
- if (purple_savedstatus_is_idleaway())
- return purple_savedstatus_get_idleaway();
- return purple_savedstatus_get_default();
-purple_savedstatus_get_default(void)
- PurpleSavedStatus *saved_status = NULL;
- creation_time = purple_prefs_get_int("/purple/savedstatus/default");
- if (creation_time != 0)
- saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time);
- if (saved_status == NULL)
- * We don't have a current saved status! This is either a new
- * Purple user or someone upgrading from Purple 1.5.0 or older, or
- * possibly someone who deleted the status they were currently
- * using? In any case, add a default status.
- saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE);
- purple_prefs_set_int("/purple/savedstatus/default",
- purple_savedstatus_get_creation_time(saved_status));
-purple_savedstatus_get_idleaway(void)
- PurpleSavedStatus *saved_status = NULL;
- creation_time = purple_prefs_get_int("/purple/savedstatus/idleaway");
- if (creation_time != 0)
- saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time);
- if (saved_status == NULL)
- /* We don't have a specified "idle" status! Weird. */
- saved_status = purple_savedstatus_find_transient_by_type_and_message(
- PURPLE_STATUS_AWAY, DEFAULT_AUTOAWAY_MESSAGE);
- if (saved_status == NULL)
- saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY);
- purple_savedstatus_set_message(saved_status, DEFAULT_AUTOAWAY_MESSAGE);
- purple_prefs_set_int("/purple/savedstatus/idleaway",
- purple_savedstatus_get_creation_time(saved_status));
-purple_savedstatus_is_idleaway(void)
- return purple_prefs_get_bool("/purple/savedstatus/isidleaway");
-purple_savedstatus_set_idleaway(gboolean idleaway) {
- PurpleAccountManager *manager = NULL;
- PurpleSavedStatus *old, *saved_status;
- GList *accounts, *node;
- if(purple_savedstatus_is_idleaway() == idleaway) {
- /* Don't need to do anything */
- old = purple_savedstatus_get_current();
- saved_status = idleaway ? purple_savedstatus_get_idleaway()
- : purple_savedstatus_get_default();
- purple_prefs_set_bool("/purple/savedstatus/isidleaway", idleaway);
- if(idleaway && (purple_savedstatus_get_primitive_type(old) != PURPLE_STATUS_AVAILABLE))
- /* Our global status is already "away," so don't change anything */
- manager = purple_account_manager_get_default();
- accounts = purple_account_manager_get_enabled(manager);
- for (node = accounts; node != NULL; node = node->next) {
- PurpleAccount *account;
- PurplePresence *presence;
- presence = purple_account_get_presence(account);
- status = purple_presence_get_active_status(presence);
- if (!idleaway || purple_status_is_available(status))
- purple_savedstatus_activate_for_account(saved_status, account);
- purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed",
-purple_savedstatus_get_startup(void)
- PurpleSavedStatus *saved_status = NULL;
- creation_time = purple_prefs_get_int("/purple/savedstatus/startup");
- if (creation_time != 0)
- saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time);
- if (saved_status == NULL)
- * We don't have a status to apply.
- * This may be the first login, or the user wants to
- * restore the "current" status.
- saved_status = purple_savedstatus_get_current();
-purple_savedstatus_find(const char *title)
- PurpleSavedStatus *status;
- g_return_val_if_fail(title != NULL, NULL);
- for (iter = saved_statuses; iter != NULL; iter = iter->next)
- status = (PurpleSavedStatus *)iter->data;
- if (purple_strequal(status->title, title))
-purple_savedstatus_find_by_creation_time(time_t creation_time)
- PurpleSavedStatus *status;
- for (iter = saved_statuses; iter != NULL; iter = iter->next)
- status = (PurpleSavedStatus *)iter->data;
- if (status->creation_time == creation_time)
-purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type,
- PurpleSavedStatus *status;
- for (iter = saved_statuses; iter != NULL; iter = iter->next)
- status = (PurpleSavedStatus *)iter->data;
- if ((status->type == type) && purple_savedstatus_is_transient(status) &&
- !purple_savedstatus_has_substatuses(status) &&
- purple_strequal(status->message, message))
-purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, TRUE);
- return (saved_status->title == NULL);
-purple_savedstatus_get_title(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, NULL);
- /* If we have a title then return it */
- if (saved_status->title != NULL)
- return saved_status->title;
- /* Otherwise, this is a transient status and we make up a title on the fly */
- message = purple_savedstatus_get_message(saved_status);
- if ((message == NULL) || (*message == '\0'))
- PurpleStatusPrimitive primitive;
- primitive = purple_savedstatus_get_primitive_type(saved_status);
- return purple_primitive_get_name_from_type(primitive);
- stripped = purple_markup_strip_html(message);
- purple_util_chrreplace(stripped, '\n', ' ');
- strncpy(buf, stripped, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
- if ((strlen(stripped) + 1) > sizeof(buf))
- /* Truncate and ellipsize */
- char *tmp = g_utf8_find_prev_char(buf, &buf[sizeof(buf) - 4]);
-purple_savedstatus_get_primitive_type(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, PURPLE_STATUS_OFFLINE);
- return saved_status->type;
-purple_savedstatus_get_message(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, NULL);
- return saved_status->message;
-purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, 0);
- return saved_status->creation_time;
-purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status)
- g_return_val_if_fail(saved_status != NULL, FALSE);
- return (saved_status->substatuses != NULL);
-purple_savedstatus_get_substatus(const PurpleSavedStatus *saved_status,
- const PurpleAccount *account)
- PurpleSavedStatusSub *substatus;
- g_return_val_if_fail(saved_status != NULL, NULL);
- g_return_val_if_fail(account != NULL, NULL);
- for (iter = saved_status->substatuses; iter != NULL; iter = iter->next)
- substatus = iter->data;
- if (substatus->account == account)
-const PurpleStatusType *
-purple_savedstatus_substatus_get_status_type(const PurpleSavedStatusSub *substatus)
- g_return_val_if_fail(substatus != NULL, NULL);
- return substatus->type;
-purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus)
- g_return_val_if_fail(substatus != NULL, NULL);
- return substatus->message;
-purple_savedstatus_activate(PurpleSavedStatus *saved_status) {
- PurpleAccountManager *manager = NULL;
- PurpleSavedStatus *old = purple_savedstatus_get_current();
- GList *accounts, *node;
- g_return_if_fail(saved_status != NULL);
- /* Make sure our list of saved statuses remains sorted */
- saved_status->lastused = time(NULL);
- saved_status->usage_count++;
- saved_statuses = g_list_remove(saved_statuses, saved_status);
- saved_statuses = g_list_insert_sorted(saved_statuses, saved_status,
- saved_statuses_sort_func);
- purple_prefs_set_int("/purple/savedstatus/default",
- purple_savedstatus_get_creation_time(saved_status));
- manager = purple_account_manager_get_default();
- accounts = purple_account_manager_get_enabled(manager);
- for(node = accounts; node != NULL; node = node->next) {
- PurpleAccount *account;
- purple_savedstatus_activate_for_account(saved_status, account);
- if(purple_savedstatus_is_idleaway()) {
- purple_savedstatus_set_idleaway(FALSE);
- purple_signal_emit(purple_savedstatuses_get_handle(),
- "savedstatus-changed", saved_status, old);
-purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status,
- PurpleAccount *account)
- const PurpleStatusType *status_type;
- const PurpleSavedStatusSub *substatus;
- const char *message = NULL;
- g_return_if_fail(saved_status != NULL);
- g_return_if_fail(account != NULL);
- substatus = purple_savedstatus_get_substatus(saved_status, account);
- status_type = substatus->type;
- message = substatus->message;
- status_type = purple_account_get_status_type_with_primitive(account, saved_status->type);
- if (status_type == NULL)
- message = saved_status->message;
- if ((message != NULL) &&
- (purple_status_type_get_attr(status_type, "message")))
- purple_account_set_status(account, purple_status_type_get_id(status_type),
- TRUE, "message", message, NULL);
- purple_account_set_status(account, purple_status_type_get_id(status_type),
-static PurpleSavedStatus *
-purple_savedstatus_copy(PurpleSavedStatus *savedstatus)
- PurpleSavedStatus *savedstatus_copy;
- g_return_val_if_fail(savedstatus != NULL, NULL);
- savedstatus_copy = g_new(PurpleSavedStatus, 1);
- *savedstatus_copy = *savedstatus;
- return savedstatus_copy;
-purple_savedstatus_get_type(void)
- type = g_boxed_type_register_static("PurpleSavedStatus",
- (GBoxedCopyFunc)purple_savedstatus_copy,
- (GBoxedFreeFunc)g_free);
-purple_savedstatuses_get_handle(void)
-purple_savedstatuses_init(void)
- PurpleAccountManager *manager = purple_account_manager_get_default();
- void *handle = purple_savedstatuses_get_handle();
- creation_times = g_hash_table_new(g_direct_hash, g_direct_equal);
- * Using 0 as the creation_time is a special case.
- * If someone calls purple_savedstatus_get_current() or
- * purple_savedstatus_get_idleaway() and either of those functions
- * sees a creation_time of 0, then it will create a default
- * saved status and return that to the user.
- purple_prefs_add_none("/purple/savedstatus");
- purple_prefs_add_int("/purple/savedstatus/default", 0);
- purple_prefs_add_int("/purple/savedstatus/startup", 0);
- purple_prefs_add_bool("/purple/savedstatus/startup_current_status", TRUE);
- purple_prefs_add_int("/purple/savedstatus/idleaway", 0);
- purple_prefs_add_bool("/purple/savedstatus/isidleaway", FALSE);
- purple_signal_register(handle, "savedstatus-changed",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_SAVEDSTATUS, PURPLE_TYPE_SAVEDSTATUS);
- purple_signal_register(handle, "savedstatus-added",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_SAVEDSTATUS);
- purple_signal_register(handle, "savedstatus-deleted",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_SAVEDSTATUS);
- purple_signal_register(handle, "savedstatus-modified",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_SAVEDSTATUS);
- g_signal_connect(manager, "removed",
- G_CALLBACK(purple_savedstatus_unset_all_substatuses),
-purple_savedstatuses_uninit(void)
- PurpleAccountManager *manager = purple_account_manager_get_default();
- gpointer handle = purple_savedstatuses_get_handle();
- remove_old_transient_statuses();
- g_clear_handle_id(&save_timer, g_source_remove);
- g_clear_list(&saved_statuses, (GDestroyNotify)free_saved_status);
- g_clear_pointer(&creation_times, g_hash_table_destroy);
- g_signal_handlers_disconnect_by_func(manager,
- purple_savedstatus_unset_all_substatuses,
- purple_signals_unregister_by_instance(handle);
- purple_signals_disconnect_by_handle(handle);
--- a/libpurple/savedstatuses.h Fri Apr 12 01:55:22 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,574 +0,0 @@
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#ifndef PURPLE_SAVEDSTATUSES_H
-#define PURPLE_SAVEDSTATUSES_H
-#define PURPLE_TYPE_SAVEDSTATUS (purple_savedstatus_get_type())
- * Saved statuses don't really interact much with the rest of Purple. It
- * could really be a plugin. It's just a list of away states. When
- * a user chooses one of the saved states, their Purple accounts are set
- * to the settings of that state.
- * In the savedstatus API, there is the concept of a 'transient'
- * saved status. A transient saved status is one that is not
- * permanent. Purple will removed it automatically if it isn't
- * used for a period of time. Transient saved statuses don't
- * have titles and they don't show up in the list of saved
- * statuses. In fact, if a saved status does not have a title
- * then it is transient. If it does have a title, then it is not
- * What good is a transient status, you ask? They can be used to
- * keep track of the user's 5 most recently used statuses, for
- * example. Basically if they just set a message on the fly,
- * we'll cache it for them in case they want to use it again. If
- * they don't use it again, we'll just delete it.
- * TODO: Hmm. We should probably just be saving PurplePresences. That's
- * something we should look into once the status box gets fleshed
-typedef struct _PurpleSavedStatus PurpleSavedStatus;
- * PurpleSavedStatusSub:
- * A sub statuses of a saved status.
-typedef struct _PurpleSavedStatusSub PurpleSavedStatusSub;
-#include "purpleversion.h"
-/**************************************************************************/
-/* Saved status subsystem */
-/**************************************************************************/
- * purple_savedstatus_get_type:
- * The standard _get_type function for #PurpleSavedStatus.
- * Returns: The #GType for the #PurpleSavedStatus boxed structure.
-/* TODO Boxing of PurpleSavedStatus is a temporary solution to having a GType
- * for saved statuses. This should rather be a GObject instead of a GBoxed.
-GType purple_savedstatus_get_type(void);
- * purple_savedstatus_new:
- * @title: The title of the saved status. This must be
- * unique. Or, if you want to create a transient
- * saved status, then pass in NULL.
- * @type: The type of saved status.
- * Create a new saved status. This will add the saved status to the
- * list of saved statuses and writes the revised list to status.xml.
- * Returns: The newly created saved status, or NULL if the title you
- * used was already taken.
-PurpleSavedStatus *purple_savedstatus_new(const char *title, PurpleStatusPrimitive type);
- * purple_savedstatus_set_title:
- * @status: The saved status.
- * @title: The title of the saved status.
- * Set the title for the given saved status.
-void purple_savedstatus_set_title(PurpleSavedStatus *status, const char *title);
- * purple_savedstatus_set_primitive_type:
- * @status: The saved status.
- * @type: The type of saved status.
- * Set the type for the given saved status.
-void purple_savedstatus_set_primitive_type(PurpleSavedStatus *status, PurpleStatusPrimitive type);
- * purple_savedstatus_set_message:
- * @status: The saved status.
- * @message: The message, or NULL if you want to unset the
- * message for this status.
- * Set the message for the given saved status.
-void purple_savedstatus_set_message(PurpleSavedStatus *status, const char *message);
- * purple_savedstatus_set_substatus:
- * @status: The saved status.
- * @account: The account.
- * @type: The status type for the account in the saved
- * @message: The message for the account in the substatus.
- * Set a substatus for an account in a saved status.
-void purple_savedstatus_set_substatus(PurpleSavedStatus *status, const PurpleAccount *account, const PurpleStatusType *type, const char *message);
- * purple_savedstatus_unset_substatus:
- * @saved_status: The saved status.
- * @account: The account.
- * Unset a substatus for an account in a saved status. This clears
- * the previously set substatus for the PurpleSavedStatus. If this
- * saved status is activated then this account will use the default
- * status type and message.
-void purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status, const PurpleAccount *account);
- * purple_savedstatus_delete:
- * @title: The title of the saved status.
- * Delete a saved status. This removes the saved status from the list
- * of saved statuses, and writes the revised list to status.xml.
- * Returns: TRUE if the status was successfully deleted. FALSE if the
- * status could not be deleted because no saved status exists
- * with the given title.
-gboolean purple_savedstatus_delete(const char *title);
- * purple_savedstatus_delete_by_status:
- * @saved_status: the status to delete, the pointer is invalid after
- * Delete a saved status. This removes the saved status from the list
- * of saved statuses, and writes the revised list to status.xml.
-void purple_savedstatus_delete_by_status(PurpleSavedStatus *saved_status);
- * purple_savedstatuses_get_all:
- * Returns all saved statuses.
- * Returns: (element-type PurpleSavedStatus) (transfer none): A list of saved
-GList *purple_savedstatuses_get_all(void);
- * purple_savedstatuses_get_popular:
- * @how_many: The maximum number of saved statuses
- * to return, or '0' to get all saved
- * statuses sorted by popularity.
- * Returns the n most popular saved statuses. "Popularity" is
- * determined by when the last time a saved_status was used and
- * how many times it has been used. Transient statuses without
- * messages are not included in the list.
- * Returns: (element-type PurpleSavedStatus) (transfer container): A list containing
- * at most how_many saved statuses.
-GList *purple_savedstatuses_get_popular(unsigned int how_many);
- * purple_savedstatus_get_current:
- * Returns the currently selected saved status. If we are idle
- * then this returns purple_savedstatus_get_idleaway(). Otherwise
- * it returns purple_savedstatus_get_default().
- * Returns: A pointer to the in-use PurpleSavedStatus.
- * This function never returns NULL.
-PurpleSavedStatus *purple_savedstatus_get_current(void);
- * purple_savedstatus_get_default:
- * Returns the default saved status that is used when our
- * accounts are not idle-away.
- * Returns: A pointer to the in-use PurpleSavedStatus.
- * This function never returns NULL.
-PurpleSavedStatus *purple_savedstatus_get_default(void);
- * purple_savedstatus_get_idleaway:
- * Returns the saved status that is used when your
- * accounts become idle-away.
- * Returns: A pointer to the idle-away PurpleSavedStatus.
- * This function never returns NULL.
-PurpleSavedStatus *purple_savedstatus_get_idleaway(void);
- * purple_savedstatus_is_idleaway:
- * Return TRUE if we are currently idle-away. Otherwise
- * Returns: TRUE if our accounts have been set to idle-away.
-gboolean purple_savedstatus_is_idleaway(void);
- * purple_savedstatus_set_idleaway:
- * @idleaway: TRUE if accounts should be switched to use the
- * idle-away saved status. FALSE if they should
- * be switched to use the default status.
- * Set whether accounts in Purple are idle-away or not.
-void purple_savedstatus_set_idleaway(gboolean idleaway);
- * purple_savedstatus_get_startup:
- * Returns the status to be used when purple is starting up
- * Returns: A pointer to the startup PurpleSavedStatus.
- * This function never returns NULL.
-PurpleSavedStatus *purple_savedstatus_get_startup(void);
- * purple_savedstatus_find:
- * @title: The name of the saved status.
- * Finds a saved status with the specified title.
- * Returns: The saved status if found, or NULL.
-PurpleSavedStatus *purple_savedstatus_find(const char *title);
- * purple_savedstatus_find_by_creation_time:
- * @creation_time: The timestamp when the saved
- * Finds a saved status with the specified creation time.
- * Returns: The saved status if found, or NULL.
-PurpleSavedStatus *purple_savedstatus_find_by_creation_time(time_t creation_time);
- * purple_savedstatus_find_transient_by_type_and_message:
- * @type: The PurpleStatusPrimitive for the status you're trying
- * @message: The message for the status you're trying
- * Finds a saved status with the specified primitive and message.
- * Returns: The saved status if found, or NULL.
-PurpleSavedStatus *purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type, const char *message);
- * purple_savedstatus_is_transient:
- * @saved_status: The saved status.
- * Determines if a given saved status is "transient."
- * A transient saved status is one that was not
- * explicitly added by the user. Transient statuses
- * are automatically removed if they are not used
- * for a period of time.
- * A transient saved statuses is automatically
- * created by the status box when the user sets himself
- * to one of the generic primitive statuses. The reason
- * we need to save this status information is so we can
- * restore it when Purple restarts.
- * Returns: TRUE if the saved status is transient.
-gboolean purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_get_title:
- * @saved_status: The saved status.
- * Return the name of a given saved status.
- * Returns: The title. This value may be a static buffer which may
- * be overwritten on subsequent calls to this function. If
- * you need a reference to the title for prolonged use then
- * you should make a copy of it.
-const char *purple_savedstatus_get_title(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_get_primitive_type:
- * @saved_status: The saved status.
- * Return the type of a given saved status.
- * Returns: The primitive type.
-PurpleStatusPrimitive purple_savedstatus_get_primitive_type(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_get_message:
- * @saved_status: The saved status.
- * Return the default message of a given saved status.
- * Returns: The message. This will return NULL if the saved
- * status does not have a message. This will
- * contain the normal markup that is created by
- * Purple's IMHTML (basically HTML markup).
-const char *purple_savedstatus_get_message(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_get_creation_time:
- * @saved_status: The saved status.
- * Return the time in seconds-since-the-epoch when this
- * saved status was created. Note: For any status created
- * by Purple 1.5.0 or older this value will be invalid and
- * very small (close to 0). This is because Purple 1.5.0
- * and older did not record the timestamp when the status
- * However, this value is guaranteed to be a unique
- * identifier for the given saved status.
- * Returns: The timestamp when this saved status was created.
-time_t purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_has_substatuses:
- * @saved_status: The saved status.
- * Determine if a given saved status has "substatuses,"
- * or if it is a simple status (the same for all
- * Returns: TRUE if the saved_status has substatuses.
-gboolean purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status);
- * purple_savedstatus_get_substatus:
- * @saved_status: The saved status.
- * @account: The account.
- * Get the substatus for an account in a saved status.
- * Returns: (transfer none): The PurpleSavedStatusSub for the account, or NULL if
- * the given account does not have a substatus that
- * differs from the default status of this PurpleSavedStatus.
-PurpleSavedStatusSub *purple_savedstatus_get_substatus(const PurpleSavedStatus *saved_status, const PurpleAccount *account);
- * purple_savedstatus_substatus_get_status_type:
- * @substatus: The substatus.
- * Get the status type of a given substatus.
- * Returns: The status type.
-const PurpleStatusType *purple_savedstatus_substatus_get_status_type(const PurpleSavedStatusSub *substatus);
- * purple_savedstatus_substatus_get_message:
- * @substatus: The substatus.
- * Get the message of a given substatus.
- * Returns: The message of the substatus, or NULL if this substatus does
-const char *purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus);
- * purple_savedstatus_activate:
- * @saved_status: The status you want to set your accounts to.
- * Sets the statuses for all your accounts to those specified
- * by the given saved_status. This function calls
- * purple_savedstatus_activate_for_account() for all your accounts.
-void purple_savedstatus_activate(PurpleSavedStatus *saved_status);
- * purple_savedstatus_activate_for_account:
- * @saved_status: The status you want to set your accounts to.
- * @account: The account whose statuses you want to change.
- * Sets the statuses for a given account to those specified
- * by the given saved_status.
-void purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status, PurpleAccount *account);
- * purple_savedstatuses_get_handle:
- * Get the handle for the status subsystem.
- * Returns: the handle to the status subsystem
-void *purple_savedstatuses_get_handle(void);
- * purple_savedstatuses_init:
- * Initializes the status subsystem.
-void purple_savedstatuses_init(void);
- * purple_savedstatuses_uninit:
- * Uninitializes the status subsystem.
-void purple_savedstatuses_uninit(void);
-#endif /* PURPLE_SAVEDSTATUSES_H */
--- a/libpurple/server.c Fri Apr 12 01:55:22 2024 -0500
+++ b/libpurple/server.c Fri Apr 12 02:08:00 2024 -0500
@@ -39,7 +39,6 @@
--- a/libpurple/status.c Fri Apr 12 01:55:22 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1248 +0,0 @@
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
-#include <glib/gi18n-lib.h>
-#include "purpleprivate.h"
-struct _PurpleStatusType
- PurpleStatusPrimitive primitive;
- gboolean user_settable;
-struct _PurpleStatusAttribute
- PurpleStatusType *status_type;
- PurplePresence *presence;
- * The current values of the attributes for this status. The
- * key is a string containing the name of the attribute. It is
- * a borrowed reference from the list of attrs in the
- * PurpleStatusType. The value is a GValue.
- GHashTable *attr_values;
-/* GObject property enums */
-static GParamSpec *properties[N_PROPERTIES] = {NULL, };
-G_DEFINE_FINAL_TYPE(PurpleStatus, purple_status, G_TYPE_OBJECT)
-static int primitive_scores[] =
- -200, /* extended away */
- -10, /* idle, special case. */
- -5, /* idle time, special case. */
- 10 /* Offline messageable */
- SCORE_IDLE = PURPLE_STATUS_NUM_PRIMITIVES,
-/**************************************************************************
- * PurpleStatusPrimitive API
- **************************************************************************/
-static struct PurpleStatusPrimitiveMap
- PurpleStatusPrimitive type;
-} const status_primitive_map[] =
- { PURPLE_STATUS_UNSET, "unset", N_("Unset") },
- { PURPLE_STATUS_OFFLINE, "offline", N_("Offline") },
- { PURPLE_STATUS_AVAILABLE, "available", N_("Available") },
- { PURPLE_STATUS_UNAVAILABLE, "unavailable", N_("Do not disturb") },
- { PURPLE_STATUS_INVISIBLE, "invisible", N_("Invisible") },
- { PURPLE_STATUS_AWAY, "away", N_("Away") },
- { PURPLE_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended away") },
- { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") },
-_purple_statuses_get_primitive_scores(void)
- return primitive_scores;
-purple_primitive_get_id_from_type(PurpleStatusPrimitive type)
- for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
- if (type == status_primitive_map[i].type)
- return status_primitive_map[i].id;
- return status_primitive_map[0].id;
-purple_primitive_get_name_from_type(PurpleStatusPrimitive type)
- for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
- if (type == status_primitive_map[i].type)
- return _(status_primitive_map[i].name);
- return _(status_primitive_map[0].name);
-purple_primitive_get_type_from_id(const char *id)
- g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET);
- for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
- if (purple_strequal(id, status_primitive_map[i].id))
- return status_primitive_map[i].type;
- return status_primitive_map[0].type;
-/**************************************************************************
- **************************************************************************/
-purple_status_type_new_full(PurpleStatusPrimitive primitive, const char *id,
- const char *name, gboolean saveable,
- gboolean user_settable, gboolean independent)
- PurpleStatusType *status_type;
- g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL);
- status_type = g_new0(PurpleStatusType, 1);
- status_type->primitive = primitive;
- status_type->saveable = saveable;
- status_type->user_settable = user_settable;
- status_type->independent = independent;
- status_type->id = g_strdup(id);
- status_type->id = g_strdup(purple_primitive_get_id_from_type(primitive));
- status_type->name = g_strdup(name);
- status_type->name = g_strdup(purple_primitive_get_name_from_type(primitive));
-purple_status_type_new(PurpleStatusPrimitive primitive, const char *id,
- const char *name, gboolean user_settable)
- g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL);
- return purple_status_type_new_full(primitive, id, name, TRUE,
-status_type_add_attr(PurpleStatusType *status_type, const char *id,
- const char *name, GValue *value)
- PurpleStatusAttribute *attr;
- g_return_if_fail(status_type != NULL);
- g_return_if_fail(id != NULL);
- g_return_if_fail(name != NULL);
- g_return_if_fail(value != NULL);
- attr = purple_status_attribute_new(id, name, value);
- status_type->attrs = g_list_append(status_type->attrs, attr);
-status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args)
- g_return_if_fail(status_type != NULL);
- while ((id = va_arg(args, const char *)) != NULL)
- name = va_arg(args, const char *);
- g_return_if_fail(name != NULL);
- value = va_arg(args, GValue *);
- g_return_if_fail(value != NULL);
- status_type_add_attr(status_type, id, name, value);
-purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive,
- const char *id, const char *name,
- gboolean saveable, gboolean user_settable,
- gboolean independent, const char *attr_id,
- const char *attr_name, GValue *attr_value,
- PurpleStatusType *status_type;
- g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL);
- g_return_val_if_fail(attr_id != NULL, NULL);
- g_return_val_if_fail(attr_name != NULL, NULL);
- g_return_val_if_fail(attr_value != NULL, NULL);
- status_type = purple_status_type_new_full(primitive, id, name, saveable,
- user_settable, independent);
- /* Add the first attribute */
- status_type_add_attr(status_type, attr_id, attr_name, attr_value);
- va_start(args, attr_value);
- status_type_add_attrs_vargs(status_type, args);
-purple_status_type_new_with_attrsv(PurpleStatusPrimitive primitive,
- const char *id, const char *name,
- gboolean saveable, gboolean user_settable,
- gboolean independent, guint n_attributes,
- const char *attr_name[],
- PurpleStatusType *status_type;
- g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL);
- g_return_val_if_fail(attr_id != NULL, NULL);
- g_return_val_if_fail(attr_name != NULL, NULL);
- g_return_val_if_fail(attr_value != NULL, NULL);
- status_type = purple_status_type_new_full(primitive, id, name, saveable,
- user_settable, independent);
- for(guint i = 0; i < n_attributes; i++) {
- if(attr_id[i] == NULL || attr_name[i] == NULL ||
- purple_status_type_destroy(status_type);
- g_return_val_if_fail(attr_id[i] != NULL, NULL);
- g_return_val_if_fail(attr_name[i] != NULL, NULL);
- g_return_val_if_fail(attr_value[i] != NULL, NULL);
- status_type_add_attr(status_type, attr_id[i], attr_name[i],
-purple_status_type_destroy(PurpleStatusType *status_type)
- g_return_if_fail(status_type != NULL);
- g_free(status_type->id);
- g_free(status_type->name);
- g_list_free_full(status_type->attrs,
- (GDestroyNotify)purple_status_attribute_destroy);
-purple_status_type_get_primitive(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, PURPLE_STATUS_UNSET);
- return status_type->primitive;
-purple_status_type_get_id(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, NULL);
- return status_type->id;
-purple_status_type_get_name(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, NULL);
- return status_type->name;
-purple_status_type_is_saveable(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, FALSE);
- return status_type->saveable;
-purple_status_type_is_user_settable(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, FALSE);
- return status_type->user_settable;
-purple_status_type_is_independent(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, FALSE);
- return status_type->independent;
-purple_status_type_is_exclusive(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, FALSE);
- return !status_type->independent;
-purple_status_type_is_available(const PurpleStatusType *status_type)
- PurpleStatusPrimitive primitive;
- g_return_val_if_fail(status_type != NULL, FALSE);
- primitive = purple_status_type_get_primitive(status_type);
- return (primitive == PURPLE_STATUS_AVAILABLE);
-purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id)
- g_return_val_if_fail(status_type != NULL, NULL);
- g_return_val_if_fail(id != NULL, NULL);
- for (l = status_type->attrs; l != NULL; l = l->next)
- PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data;
- if (purple_strequal(purple_status_attribute_get_id(attr), id))
-purple_status_type_get_attrs(const PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, NULL);
- return status_type->attrs;
-const PurpleStatusType *
-purple_status_type_find_with_id(GList *status_types, const char *id)
- PurpleStatusType *status_type;
- g_return_val_if_fail(id != NULL, NULL);
- while (status_types != NULL)
- status_type = status_types->data;
- if (purple_strequal(id, status_type->id))
- status_types = status_types->next;
-/**************************************************************************
-* PurpleStatusAttribute API
-**************************************************************************/
-purple_status_attribute_new(const char *id, const char *name, GValue *value_type)
- PurpleStatusAttribute *attr;
- g_return_val_if_fail(id != NULL, NULL);
- g_return_val_if_fail(name != NULL, NULL);
- g_return_val_if_fail(value_type != NULL, NULL);
- attr = g_new0(PurpleStatusAttribute, 1);
- attr->id = g_strdup(id);
- attr->name = g_strdup(name);
- attr->value_type = value_type;
-purple_status_attribute_destroy(PurpleStatusAttribute *attr)
- g_return_if_fail(attr != NULL);
- purple_value_free(attr->value_type);
-purple_status_attribute_get_id(const PurpleStatusAttribute *attr)
- g_return_val_if_fail(attr != NULL, NULL);
-purple_status_attribute_get_name(const PurpleStatusAttribute *attr)
- g_return_val_if_fail(attr != NULL, NULL);
-purple_status_attribute_get_value(const PurpleStatusAttribute *attr)
- g_return_val_if_fail(attr != NULL, NULL);
- return attr->value_type;
-/**************************************************************************
-**************************************************************************/
-status_has_changed(PurpleStatus *status)
- PurplePresence *presence;
- PurpleStatus *old_status;
- presence = purple_status_get_presence(status);
- * If this status is exclusive, then we must be setting it to "active."
- * Since we are setting it to active, we want to set the currently
- * active status to "inactive."
- if (purple_status_is_exclusive(status))
- old_status = purple_presence_get_active_status(presence);
- if (old_status != NULL && (old_status != status)) {
- old_status->active = FALSE;
- g_object_notify_by_pspec(G_OBJECT(old_status),
- properties[PROP_ACTIVE]);
- g_object_set(presence, "active-status", status, NULL);
- g_object_notify_by_pspec(G_OBJECT(status), properties[PROP_ACTIVE]);
-status_set_attr_boolean(PurpleStatus *status, const char *id,
- g_return_if_fail(PURPLE_IS_STATUS(status));
- g_return_if_fail(id != NULL);
- /* Make sure this attribute exists and is the correct type. */
- attr_value = purple_status_get_attr_value(status, id);
- g_return_if_fail(attr_value != NULL);
- g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_BOOLEAN);
- g_value_set_boolean(attr_value, value);
-status_set_attr_int(PurpleStatus *status, const char *id, int value)
- g_return_if_fail(PURPLE_IS_STATUS(status));
- g_return_if_fail(id != NULL);
- /* Make sure this attribute exists and is the correct type. */
- attr_value = purple_status_get_attr_value(status, id);
- g_return_if_fail(attr_value != NULL);
- g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_INT);
- g_value_set_int(attr_value, value);
-status_set_attr_string(PurpleStatus *status, const char *id,
- g_return_if_fail(PURPLE_IS_STATUS(status));
- g_return_if_fail(id != NULL);
- /* Make sure this attribute exists and is the correct type. */
- attr_value = purple_status_get_attr_value(status, id);
- /* This used to be g_return_if_fail, but it's failing a LOT, so
- * let's generate a log error for now. */
- /* g_return_if_fail(attr_value != NULL); */
- if (attr_value == NULL) {
- purple_debug_error("status",
- "Attempted to set status attribute '%s' for "
- "status '%s', which is not legal. Fix "
- purple_status_type_get_name(purple_status_get_status_type(status)));
- g_return_if_fail(G_VALUE_TYPE(attr_value) == G_TYPE_STRING);
- /* XXX: Check if the value has actually changed. If it has, and the status
- * is active, should this trigger 'status_has_changed'? */
- g_value_set_string(attr_value, value);
-purple_status_set_active(PurpleStatus *status, gboolean active)
- purple_status_set_active_with_attributes(status, active, NULL);
-purple_status_set_active_with_attributes(PurpleStatus *status, gboolean active,
- gboolean changed = FALSE;
- GList *specified_attr_ids = NULL;
- PurpleStatusType *status_type;
- g_return_if_fail(PURPLE_IS_STATUS(status));
- if(!active && purple_status_is_exclusive(status)) {
- purple_debug_error("status",
- "Cannot deactivate an exclusive status (%s).",
- purple_status_get_id(status));
- if(status->active != active) {
- status->active = active;
- /* Set any attributes */
- g_hash_table_iter_init(&iter, attrs);
- while(g_hash_table_iter_next(&iter, &key, &data)) {
- gchar *id = (gchar *)key;
- GValue *value = purple_status_get_attr_value(status, id);
- purple_debug_warning("status",
- "The attribute \"%s\" on the status "
- "\"%s\" is not supported.",
- id, status->status_type->name);
- /* Skip over the data and move on to the next attribute */
- specified_attr_ids = g_list_prepend(specified_attr_ids, id);
- if(G_VALUE_HOLDS_STRING(value)) {
- const gchar *string_data = (const gchar *)data;
- if(purple_strequal(string_data, g_value_get_string(value))) {
- status_set_attr_string(status, id, string_data);
- } else if(G_VALUE_HOLDS_INT(value)) {
- gint int_data = GPOINTER_TO_INT(data);
- if(int_data == g_value_get_int(value)) {
- status_set_attr_int(status, id, int_data);
- } else if(G_VALUE_HOLDS_BOOLEAN(value)) {
- gboolean boolean_data = GPOINTER_TO_INT(data);
- if(boolean_data == g_value_get_boolean(value)) {
- status_set_attr_boolean(status, id, boolean_data);
- /* Reset any unspecified attributes to their default value */
- status_type = purple_status_get_status_type(status);
- l = purple_status_type_get_attrs(status_type);
- PurpleStatusAttribute *attr;
- GValue *default_value = NULL;
- found = g_list_find_custom(specified_attr_ids, attr->id,
- (GCompareFunc)g_strcmp0);
- default_value = purple_status_attribute_get_value(attr);
- if(G_VALUE_HOLDS_STRING(default_value)) {
- const gchar *cur = purple_status_get_attr_string(status,
- const gchar *def = g_value_get_string(default_value);
- if (purple_strequal(cur, def)) {
- status_set_attr_string(status, attr->id, def);
- } else if(G_VALUE_HOLDS_INT(default_value)) {
- gint cur = purple_status_get_attr_int(status, attr->id);
- gint def = g_value_get_int(default_value);
- status_set_attr_int(status, attr->id, def);
- } else if(G_VALUE_HOLDS_BOOLEAN(default_value)) {
- gboolean cur = purple_status_get_attr_boolean(status, attr->id);
- gboolean def = g_value_get_boolean(default_value);
- status_set_attr_boolean(status, attr->id, def);
- g_list_free(specified_attr_ids);
- status_has_changed(status);
-purple_status_get_status_type(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- return status->status_type;
-purple_status_get_presence(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- return status->presence;
-purple_status_get_id(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- return purple_status_type_get_id(purple_status_get_status_type(status));
-purple_status_get_name(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- return purple_status_type_get_name(purple_status_get_status_type(status));
-purple_status_is_independent(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
- return purple_status_type_is_independent(purple_status_get_status_type(status));
-purple_status_is_exclusive(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
- return purple_status_type_is_exclusive(purple_status_get_status_type(status));
-purple_status_is_available(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
- return purple_status_type_is_available(purple_status_get_status_type(status));
-purple_status_is_active(PurpleStatus *status)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
-purple_status_is_online(PurpleStatus *status)
- PurpleStatusPrimitive primitive;
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
- primitive = purple_status_type_get_primitive(purple_status_get_status_type(status));
- return (primitive != PURPLE_STATUS_UNSET &&
- primitive != PURPLE_STATUS_OFFLINE);
-purple_status_get_attr_value(PurpleStatus *status, const char *id)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- g_return_val_if_fail(id != NULL, NULL);
- return (GValue *)g_hash_table_lookup(status->attr_values, id);
-purple_status_get_attr_boolean(PurpleStatus *status, const char *id)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), FALSE);
- g_return_val_if_fail(id != NULL, FALSE);
- if ((value = purple_status_get_attr_value(status, id)) == NULL)
- g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_BOOLEAN, FALSE);
- return g_value_get_boolean(value);
-purple_status_get_attr_int(PurpleStatus *status, const char *id)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), 0);
- g_return_val_if_fail(id != NULL, 0);
- if ((value = purple_status_get_attr_value(status, id)) == NULL)
- g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_INT, 0);
- return g_value_get_int(value);
-purple_status_get_attr_string(PurpleStatus *status, const char *id)
- g_return_val_if_fail(PURPLE_IS_STATUS(status), NULL);
- g_return_val_if_fail(id != NULL, NULL);
- if ((value = purple_status_get_attr_value(status, id)) == NULL)
- g_return_val_if_fail(G_VALUE_TYPE(value) == G_TYPE_STRING, NULL);
- return g_value_get_string(value);
-purple_status_compare(PurpleStatus *status1, PurpleStatus *status2)
- PurpleStatusType *type1, *type2;
- int score1 = 0, score2 = 0;
- if ((status1 == NULL && status2 == NULL) ||
- else if (status1 == NULL)
- else if (status2 == NULL)
- type1 = purple_status_get_status_type(status1);
- type2 = purple_status_get_status_type(status2);
- if (purple_status_is_active(status1))
- score1 = primitive_scores[purple_status_type_get_primitive(type1)];
- if (purple_status_is_active(status2))
- score2 = primitive_scores[purple_status_type_get_primitive(type2)];
- else if (score1 < score2)
-/**************************************************************************
-* GBoxed code for PurpleStatusType
-**************************************************************************/
-static PurpleStatusType *
-purple_status_type_ref(PurpleStatusType *status_type)
- g_return_val_if_fail(status_type != NULL, NULL);
- status_type->box_count++;
-purple_status_type_unref(PurpleStatusType *status_type)
- g_return_if_fail(status_type != NULL);
- g_return_if_fail(status_type->box_count >= 0);
- if (!status_type->box_count--)
- purple_status_type_destroy(status_type);
-purple_status_type_get_type(void)
- type = g_boxed_type_register_static("PurpleStatusType",
- (GBoxedCopyFunc)purple_status_type_ref,
- (GBoxedFreeFunc)purple_status_type_unref);
-/**************************************************************************
-* GBoxed code for PurpleStatusAttribute
-**************************************************************************/
-static PurpleStatusAttribute *
-purple_status_attribute_copy(PurpleStatusAttribute *status_attr)
- g_return_val_if_fail(status_attr != NULL, NULL);
- return purple_status_attribute_new(status_attr->id,
- purple_value_dup(status_attr->value_type));
-purple_status_attribute_get_type(void)
- type = g_boxed_type_register_static("PurpleStatusAttribute",
- (GBoxedCopyFunc)purple_status_attribute_copy,
- (GBoxedFreeFunc)purple_status_attribute_destroy);
-/**************************************************************************
-**************************************************************************/
-/* Set method for GObject properties */
-purple_status_set_property(GObject *obj, guint param_id, const GValue *value,
- PurpleStatus *status = PURPLE_STATUS(obj);
- status->status_type = g_value_get_pointer(value);
- status->presence = g_value_get_object(value);
- purple_status_set_active(status, g_value_get_boolean(value));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-/* Get method for GObject properties */
-purple_status_get_property(GObject *obj, guint param_id, GValue *value,
- PurpleStatus *status = PURPLE_STATUS(obj);
- g_value_set_pointer(value, purple_status_get_status_type(status));
- g_value_set_object(value, purple_status_get_presence(status));
- g_value_set_boolean(value, purple_status_is_active(status));
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-/* GObject initialization function */
-purple_status_init(PurpleStatus *status)
- status->attr_values = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
- (GDestroyNotify)purple_value_free);
-/* Called when done constructing */
-purple_status_constructed(GObject *object)
- PurpleStatus *status = PURPLE_STATUS(object);
- G_OBJECT_CLASS(purple_status_parent_class)->constructed(object);
- for (l = purple_status_type_get_attrs(status->status_type); l != NULL; l = l->next)
- PurpleStatusAttribute *attr = (PurpleStatusAttribute *)l->data;
- GValue *value = purple_status_attribute_get_value(attr);
- GValue *new_value = purple_value_dup(value);
- g_hash_table_insert(status->attr_values,
- (char *)purple_status_attribute_get_id(attr),
- * GObject finalize function
- * TODO: If the PurpleStatus is in a PurplePresence, then
- * remove it from the PurplePresence?
-purple_status_finalize(GObject *obj)
- PurpleStatus *status = PURPLE_STATUS(obj);
- g_hash_table_destroy(status->attr_values);
- G_OBJECT_CLASS(purple_status_parent_class)->finalize(obj);
-/* Class initializer function */
-purple_status_class_init(PurpleStatusClass *klass)
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- obj_class->finalize = purple_status_finalize;
- obj_class->constructed = purple_status_constructed;
- obj_class->get_property = purple_status_get_property;
- obj_class->set_property = purple_status_set_property;
- * PurpleStatus:status-type:
- * The type of this status.
- properties[PROP_STATUS_TYPE] = g_param_spec_pointer("status-type",
- "The PurpleStatusType of the status.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- * PurpleStatus:presence:
- * The presence that the status belongs to.
- properties[PROP_PRESENCE] = g_param_spec_object("presence", "Presence",
- "The presence that the status belongs to.",
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- * Whether or not the status is active.
- properties[PROP_ACTIVE] = g_param_spec_boolean("active", "Active",
- "Whether the status is active or not.", FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-purple_status_new(PurpleStatusType *status_type, PurplePresence *presence)
- g_return_val_if_fail(status_type != NULL, NULL);
- g_return_val_if_fail(PURPLE_IS_PRESENCE(presence), NULL);
- return g_object_new(PURPLE_TYPE_STATUS,
- "status-type", status_type,
-/**************************************************************************
-**************************************************************************/
-score_pref_changed_cb(G_GNUC_UNUSED const char *name,
- G_GNUC_UNUSED PurplePrefType type, gconstpointer value,
- int index = GPOINTER_TO_INT(data);
- primitive_scores[index] = GPOINTER_TO_INT(value);
-purple_statuses_get_handle(void) {
-purple_statuses_init(void)
- void *handle = purple_statuses_get_handle();
- purple_prefs_add_none("/purple/status");
- purple_prefs_add_none("/purple/status/scores");
- purple_prefs_add_int("/purple/status/scores/offline",
- primitive_scores[PURPLE_STATUS_OFFLINE]);
- purple_prefs_add_int("/purple/status/scores/available",
- primitive_scores[PURPLE_STATUS_AVAILABLE]);
- purple_prefs_add_int("/purple/status/scores/invisible",
- primitive_scores[PURPLE_STATUS_INVISIBLE]);
- purple_prefs_add_int("/purple/status/scores/away",
- primitive_scores[PURPLE_STATUS_AWAY]);
- purple_prefs_add_int("/purple/status/scores/extended_away",
- primitive_scores[PURPLE_STATUS_EXTENDED_AWAY]);
- purple_prefs_add_int("/purple/status/scores/idle",
- primitive_scores[SCORE_IDLE]);
- purple_prefs_add_int("/purple/status/scores/idle_time",
- primitive_scores[SCORE_IDLE_TIME]);
- purple_prefs_add_int("/purple/status/scores/offline_msg",
- primitive_scores[SCORE_OFFLINE_MESSAGE]);
- purple_prefs_connect_callback(handle, "/purple/status/scores/offline",
- GINT_TO_POINTER(PURPLE_STATUS_OFFLINE));
- purple_prefs_connect_callback(handle, "/purple/status/scores/available",
- GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE));
- purple_prefs_connect_callback(handle, "/purple/status/scores/invisible",
- GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE));
- purple_prefs_connect_callback(handle, "/purple/status/scores/away",
- GINT_TO_POINTER(PURPLE_STATUS_AWAY));
- purple_prefs_connect_callback(handle, "/purple/status/scores/extended_away",
- GINT_TO_POINTER(PURPLE_STATUS_EXTENDED_AWAY));
- purple_prefs_connect_callback(handle, "/purple/status/scores/idle",
- GINT_TO_POINTER(SCORE_IDLE));
- purple_prefs_connect_callback(handle, "/purple/status/scores/idle_time",
- GINT_TO_POINTER(SCORE_IDLE_TIME));
- purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg",
- GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE));
- purple_prefs_trigger_callback("/purple/status/scores/offline");
- purple_prefs_trigger_callback("/purple/status/scores/available");
- purple_prefs_trigger_callback("/purple/status/scores/invisible");
- purple_prefs_trigger_callback("/purple/status/scores/away");
- purple_prefs_trigger_callback("/purple/status/scores/extended_away");
- purple_prefs_trigger_callback("/purple/status/scores/idle");
- purple_prefs_trigger_callback("/purple/status/scores/idle_time");
- purple_prefs_trigger_callback("/purple/status/scores/offline_msg");
-purple_statuses_uninit(void)
- purple_prefs_disconnect_by_handle(purple_statuses_get_handle());
-/**************************************************************************/
-/**************************************************************************/
-purple_attrs_from_vargs(va_list args)
- GHashTable *attrs = g_hash_table_new(g_str_hash, g_str_equal);
- while ((id = va_arg(args, gchar *)) != NULL)
- gpointer data = va_arg(args, gpointer);
- g_hash_table_insert(attrs, id, data);
--- a/libpurple/status.h Fri Apr 12 01:55:22 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,892 +0,0 @@
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#include "purpleversion.h"
-#define PURPLE_TYPE_STATUS (purple_status_get_type())
-typedef struct _PurpleStatus PurpleStatus;
-#define PURPLE_TYPE_STATUS_TYPE (purple_status_type_get_type())
- * PurpleStatusType's are created by each protocol. They outline the
- * available statuses of the protocol. AIM, for example, supports
- * an available state with an optional available message, an away
- * state with a mandatory message, and an invisible state (which is
- * technically "independent" of the other two, but we'll get into
- * that later). PurpleStatusTypes are very permanent. They are
- * hardcoded in each protocol and will not change often. And because
- * they are hardcoded, they do not need to be saved to any XML file.
-typedef struct _PurpleStatusType PurpleStatusType;
-#define PURPLE_TYPE_STATUS_ATTRIBUTE (purple_status_attribute_get_type())
- * A PurpleStatus can be thought of as an "instance" of a PurpleStatusType.
- * If you're familiar with object-oriented programming languages
- * then this should be immediately clear. Say, for example, that
- * one of your AIM buddies has set himself as "away." You have a
- * PurpleBuddy node for this person in your buddy list. Purple wants
- * to mark this buddy as "away," so it creates a new PurpleStatus.
- * The PurpleStatus has its PurpleStatusType set to the "away" state
- * for the oscar protocol. The PurpleStatus also contains the buddy's
- * away message. PurpleStatuses are sometimes saved, depending on
- * the context. The current PurpleStatuses associated with each of
- * your accounts are saved so that the next time you start Purple,
- * your accounts will be set to their last known statuses. There
- * is also a list of saved statuses that are written to the
- * status.xml file. Also, each PurpleStatus has a "saveable" boolean.
- * If "saveable" is set to FALSE then the status is NEVER saved.
- * All PurpleStatuses should be inside a PurplePresence.
- * A PurpleStatus is either "independent" or "exclusive."
- * Independent statuses can be active or inactive and they don't
- * affect anything else. However, you can only have one exclusive
- * status per PurplePresence. If you activate one exclusive status,
- * then the previous exclusive status is automatically deactivated.
- * A PurplePresence is like a collection of PurpleStatuses (plus some
- * See <link linkend="libpurple-purplepresence">Presence API</link>
- * PurpleStatusAttribute:
- * An attribute that can be added to a status.
-typedef struct _PurpleStatusAttribute PurpleStatusAttribute;
- * PurpleStatusPrimitive:
- * @PURPLE_STATUS_UNSET: The status is not set
- * @PURPLE_STATUS_OFFLINE: The status is offline
- * @PURPLE_STATUS_AVAILABLE: The status is available
- * @PURPLE_STATUS_UNAVAILABLE: The status is unavailable
- * @PURPLE_STATUS_INVISIBLE: The stuatus is invisible
- * @PURPLE_STATUS_AWAY: The status is away
- * @PURPLE_STATUS_EXTENDED_AWAY: The status is extended away/do not disturb
- * @PURPLE_STATUS_MOBILE: The status is mobile
- * @PURPLE_STATUS_NUM_PRIMITIVES: The number of #PurpleStatusPrimitive<!-- -->s
- * A primitive defining the basic structure of a status type.
- * If you add a value to this enum, make sure you update
- * the status_primitive_map and primitive_scores arrays in status.c.
- PURPLE_STATUS_UNSET = 0,
- PURPLE_STATUS_AVAILABLE,
- PURPLE_STATUS_UNAVAILABLE,
- PURPLE_STATUS_INVISIBLE,
- PURPLE_STATUS_EXTENDED_AWAY,
- PURPLE_STATUS_NUM_PRIMITIVES, /*< skip >*/
-} PurpleStatusPrimitive;
-#include "purplepresence.h"
-/**************************************************************************/
-/* PurpleStatusPrimitive API */
-/**************************************************************************/
- * purple_primitive_get_id_from_type:
- * @type: A primitive status type.
- * Lookup the id of a primitive status type based on the type. This
- * ID is a unique plain-text name of the status, without spaces.
- * Returns: The unique ID for this type.
-const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type);
- * purple_primitive_get_name_from_type:
- * @type: A primitive status type.
- * Lookup the name of a primitive status type based on the type. This
- * name is the plain-English name of the status type. It is usually one
- * Returns: The name of this type, suitable for users to see.
-const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type);
- * purple_primitive_get_type_from_id:
- * @id: The unique ID of a primitive status type.
- * Lookup the value of a primitive status type based on the id. The
- * ID is a unique plain-text name of the status, without spaces.
- * Returns: The PurpleStatusPrimitive value.
-PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id);
-/**************************************************************************/
-/* PurpleStatusType API */
-/**************************************************************************/
- * purple_status_type_get_type:
- * The standard _get_type function for #PurpleStatusType.
- * Returns: The #GType for #PurpleStatusType.
-GType purple_status_type_get_type(void);
- * purple_status_type_new_full:
- * @primitive: The primitive status type.
- * @id: The ID of the status type, or %NULL to use the id of the primitive
- * @name: The name presented to the user, or %NULL to use the name of the
- * primitive status type.
- * @saveable: %TRUE if the information set for this status by the user can be
- * saved for future sessions.
- * @user_settable: %TRUE if this is a status the user can manually set.
- * @independent: %TRUE if this is an independent (non-exclusive) status type.
- * Creates a new status type.
- * Returns: (transfer full): A new status type.
-PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive,
- const char *id, const char *name,
- gboolean user_settable,
- * purple_status_type_new:
- * @primitive: The primitive status type.
- * @id: The ID of the status type, or %NULL to use the id of the primitive
- * @name: The name presented to the user, or %NULL to use the name of the
- * primitive status type.
- * @user_settable: %TRUE if this is a status the user can manually set.
- * Creates a new status type with some default values (saveable and not
- * Returns: (transfer full): A new status type.
-PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive,
- const char *id, const char *name,
- gboolean user_settable);
- * purple_status_type_new_with_attrs:
- * @primitive: The primitive status type.
- * @id: The ID of the status type, or %NULL to use the id of the primitive
- * @name: The name presented to the user, or %NULL to use the name of the
- * primitive status type.
- * @saveable: %TRUE if the information set for this status by the user can be
- * saved for future sessions.
- * @user_settable: %TRUE if this is a status the user can manually set.
- * @independent: %TRUE if this is an independent (non-exclusive) status type.
- * @attr_id: The ID of the first attribute.
- * @attr_name: The name of the first attribute.
- * @attr_value: The value type of the first attribute.
- * @...: Additional attribute information.
- * Creates a new status type with attributes.
- * Returns: (transfer full): A new status type.
-PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive,
- gboolean user_settable,
- GValue *attr_value, ...) G_GNUC_NULL_TERMINATED;
- * purple_status_type_new_with_attrsv: (rename-to purple_status_type_new_with_attrs):
- * @primitive: The primitive status type.
- * @id: The ID of the status type, or %NULL to use the id of the primitive
- * @name: The name presented to the user, or %NULL to use the name of the
- * primitive status type.
- * @saveable: %TRUE if the information set for this status by the user can be
- * saved for future sessions.
- * @user_settable: %TRUE if this is a status the user can manually set.
- * @independent: %TRUE if this is an independent (non-exclusive) status type.
- * @n_attributes: The number of attributes.
- * @attr_id: (array length=n_attributes): The IDs of the attributes.
- * @attr_name: (array length=n_attributes): The names of the attributes.
- * @attr_value: (array length=n_attributes): The value types of the attributes.
- * Creates a new status type with attributes.
- * Returns: (transfer full): A new status type.
-PurpleStatusType *purple_status_type_new_with_attrsv(PurpleStatusPrimitive primitive,
- gboolean user_settable,
- const gchar *attr_id[],
- const gchar *attr_name[],
- * purple_status_type_destroy:
- * @status_type: The status type to destroy.
- * Destroys a status type.
-void purple_status_type_destroy(PurpleStatusType *status_type);
- * purple_status_type_get_primitive:
- * @status_type: The status type.
- * Returns the primitive type of a status type.
- * Returns: The primitive type of the status type.
-PurpleStatusPrimitive purple_status_type_get_primitive(
- const PurpleStatusType *status_type);
- * purple_status_type_get_id:
- * @status_type: The status type.
- * Returns the ID of a status type.
- * Returns: The ID of the status type.
-const char *purple_status_type_get_id(const PurpleStatusType *status_type);
- * purple_status_type_get_name:
- * @status_type: The status type.
- * Returns the name of a status type.
- * Returns: The name of the status type.
-const char *purple_status_type_get_name(const PurpleStatusType *status_type);
- * purple_status_type_is_saveable:
- * @status_type: The status type.
- * Returns whether or not the status type is saveable.
- * Returns: TRUE if user-defined statuses based off this type are saveable.
-gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type);
- * purple_status_type_is_user_settable:
- * @status_type: The status type.
- * Returns whether or not the status type can be set or modified by the
- * Returns: TRUE if the status type can be set or modified by the user.
- * FALSE if it's a protocol-set setting.
-gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type);
- * purple_status_type_is_independent:
- * @status_type: The status type.
- * Returns whether or not the status type is independent.
- * Independent status types are non-exclusive. If other status types on
- * the same hierarchy level are set, this one will not be affected.
- * Returns: TRUE if the status type is independent, or FALSE otherwise.
-gboolean purple_status_type_is_independent(const PurpleStatusType *status_type);
- * purple_status_type_is_exclusive:
- * @status_type: The status type.
- * Returns whether the status type is exclusive.
- * Returns: TRUE if the status type is exclusive, FALSE otherwise.
-gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type);
- * purple_status_type_is_available:
- * @status_type: The status type.
- * Returns whether or not a status type is available.
- * Available status types are online and possibly invisible, but not away.
- * Returns: TRUE if the status is available, or FALSE otherwise.
-gboolean purple_status_type_is_available(const PurpleStatusType *status_type);
- * purple_status_type_get_attr:
- * @status_type: The status type containing the attribute.
- * @id: The ID of the desired attribute.
- * Returns the attribute with the specified ID.
- * Returns: The attribute, if found. NULL otherwise.
-PurpleStatusAttribute *purple_status_type_get_attr(const PurpleStatusType *status_type,
- * purple_status_type_get_attrs:
- * @status_type: The status type.
- * Returns a list of all attributes in a status type.
- * Returns: (element-type PurpleStatusAttribute) (transfer none): The list of attributes.
-GList *purple_status_type_get_attrs(const PurpleStatusType *status_type);
- * purple_status_type_find_with_id:
- * @status_types: (element-type PurpleStatus) (transfer none): A list of status
- * types. Often account->status_types.
- * @id: The unique ID of the status type you wish to find.
- * Find the PurpleStatusType with the given id.
- * Returns: The status type with the given ID, or NULL if one could
-const PurpleStatusType *purple_status_type_find_with_id(GList *status_types,
-/**************************************************************************/
-/* PurpleStatusAttribute API */
-/**************************************************************************/
- * purple_status_attribute_get_type:
- * The standard _get_type function for #PurpleStatusAttribute.
- * Returns: The #GType for the #PurpleStatusAttribute boxed structure.
-GType purple_status_attribute_get_type(void);
- * purple_status_attribute_new:
- * @id: The ID of the attribute.
- * @name: The name presented to the user.
- * @value_type: The type of data contained in the attribute.
- * Creates a new status attribute.
- * Returns: A new status attribute.
-PurpleStatusAttribute *purple_status_attribute_new(const char *id, const char *name,
- * purple_status_attribute_destroy:
- * @attr: The status attribute to destroy.
- * Destroys a status attribute.
-void purple_status_attribute_destroy(PurpleStatusAttribute *attr);
- * purple_status_attribute_get_id:
- * @attr: The status attribute.
- * Returns the ID of a status attribute.
- * Returns: The status attribute's ID.
-const char *purple_status_attribute_get_id(const PurpleStatusAttribute *attr);
- * purple_status_attribute_get_name:
- * @attr: The status attribute.
- * Returns the name of a status attribute.
- * Returns: The status attribute's name.
-const char *purple_status_attribute_get_name(const PurpleStatusAttribute *attr);
- * purple_status_attribute_get_value:
- * @attr: The status attribute.
- * Returns the value of a status attribute.
- * Returns: The status attribute's value.
-GValue *purple_status_attribute_get_value(const PurpleStatusAttribute *attr);
-/**************************************************************************/
-/**************************************************************************/
- * purple_status_get_type:
- * The standard _get_type function for #PurpleStatus.
- * Returns: The #GType for #PurpleStatus.
-G_DECLARE_FINAL_TYPE(PurpleStatus, purple_status, PURPLE, STATUS, GObject)
- * @status_type: The type of status.
- * @presence: The parent presence.
- * Creates a new status.
- * Returns: The new status.
-PurpleStatus *purple_status_new(PurpleStatusType *status_type,
- PurplePresence *presence);
- * purple_status_set_active:
- * @active: The active state.
- * Sets whether or not a status is active.
- * This should only be called by the account, conversation, and buddy APIs.
-void purple_status_set_active(PurpleStatus *status, gboolean active);
- * purple_status_set_active_with_attributes:
- * @active: The active state.
- * @attrs: (nullable) (element-type utf8 gpointer): A hash table of attributes
- * to set on the status. This hash table's keys are valid attribute
- * names for this PurpleStatusType. The hash table is not modified or
- * freed by this function.
- * Sets whether or not a status is active.
- * This should only be called by the account, conversation, and buddy APIs.
-void purple_status_set_active_with_attributes(PurpleStatus *status, gboolean active, GHashTable *attrs);
- * purple_status_get_status_type:
- * Returns the status's type.
- * Returns: The status's type.
-PurpleStatusType *purple_status_get_status_type(PurpleStatus *status);
- * purple_status_get_presence:
- * Returns the status's presence.
- * Returns: (transfer none): The status's presence.
-PurplePresence *purple_status_get_presence(PurpleStatus *status);
- * purple_status_get_id:
- * Returns the status's type ID.
- * This is a convenience method for
- * purple_status_type_get_id(purple_status_get_status_type(status)).
- * Returns: The status's ID.
-const char *purple_status_get_id(PurpleStatus *status);
- * purple_status_get_name:
- * Returns the status's name.
- * This is a convenience method for
- * purple_status_type_get_name(purple_status_get_status_type(status)).
- * Returns: The status's name.
-const char *purple_status_get_name(PurpleStatus *status);
- * purple_status_is_independent:
- * Returns whether or not a status is independent.
- * This is a convenience method for
- * purple_status_type_is_independent(purple_status_get_status_type(status)).
- * Returns: TRUE if the status is independent, or FALSE otherwise.
-gboolean purple_status_is_independent(PurpleStatus *status);
- * purple_status_is_exclusive:
- * Returns whether or not a status is exclusive.
- * This is a convenience method for
- * purple_status_type_is_exclusive(purple_status_get_status_type(status)).
- * Returns: TRUE if the status is exclusive, FALSE otherwise.
-gboolean purple_status_is_exclusive(PurpleStatus *status);
- * purple_status_is_available:
- * Returns whether or not a status is available.
- * Available statuses are online and possibly invisible, but not away or idle.
- * This is a convenience method for
- * purple_status_type_is_available(purple_status_get_status_type(status)).
- * Returns: TRUE if the status is available, or FALSE otherwise.
-gboolean purple_status_is_available(PurpleStatus *status);
- * purple_status_is_active:
- * Returns the active state of a status.
- * Returns: The active state of the status.
-gboolean purple_status_is_active(PurpleStatus *status);
- * purple_status_is_online:
- * Returns whether or not a status is considered 'online'
- * Returns: TRUE if the status is considered online, FALSE otherwise
-gboolean purple_status_is_online(PurpleStatus *status);
- * purple_status_get_attr_value:
- * @id: The attribute ID.
- * Returns the value of an attribute in a status with the specified ID.
- * Returns: The value of the attribute.
-GValue *purple_status_get_attr_value(PurpleStatus *status,
- * purple_status_get_attr_boolean:
- * @id: The attribute ID.
- * Returns the boolean value of an attribute in a status with the specified ID.
- * Returns: The boolean value of the attribute.
-gboolean purple_status_get_attr_boolean(PurpleStatus *status,
- * purple_status_get_attr_int:
- * @id: The attribute ID.
- * Returns the integer value of an attribute in a status with the specified ID.
- * Returns: The integer value of the attribute.
-int purple_status_get_attr_int(PurpleStatus *status, const char *id);
- * purple_status_get_attr_string:
- * @id: The attribute ID.
- * Returns the string value of an attribute in a status with the specified ID.
- * Returns: The string value of the attribute.
-const char *purple_status_get_attr_string(PurpleStatus *status, const char *id);
- * purple_status_compare:
- * @status1: The first status.
- * @status2: The second status.
- * Compares two statuses for availability.
- * Returns: -1 if @status1 is more available than @status2.
- * 0 if @status1 is equal to @status2.
- * 1 if @status2 is more available than @status1.
-gint purple_status_compare(PurpleStatus *status1, PurpleStatus *status2);
-/**************************************************************************/
-/* Statuses subsystem */
-/**************************************************************************/
- * purple_statuses_get_handle:
- * Get the handle for the status subsystem.
- * Returns: the handle to the status subsystem
-void *purple_statuses_get_handle(void);
- * purple_statuses_init:
- * Initializes the status subsystem.
-void purple_statuses_init(void);
- * purple_statuses_uninit:
- * Uninitializes the status subsystem.
-void purple_statuses_uninit(void);
-/**************************************************************************/
-/**************************************************************************/
- * purple_attrs_from_vargs:
- * @args: A list of attributes to parse. This list is
- * composed of key/value pairs, where each key is a valid
- * attribute name for this PurpleStatusType. The list should
- * Returns a hash table of attributes constructed from args.
- * Returns: (element-type utf8 gpointer) (transfer container): The hash table of attributes.
-GHashTable *purple_attrs_from_vargs(va_list args);
-#endif /* PURPLE_STATUS_H */
--- a/po/POTFILES.in Fri Apr 12 01:55:22 2024 -0500
+++ b/po/POTFILES.in Fri Apr 12 02:08:00 2024 -0500
@@ -97,10 +97,8 @@
libpurple/request/purplerequestgroup.c
libpurple/request/purplerequestpage.c
-libpurple/savedstatuses.c
libpurple/tests/test_account_manager.c
libpurple/tests/test_account_option.c
libpurple/tests/test_circular_buffer.c