From e1ce7ac6300178908709f482f5d4d54b6076d717 Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Sat, 19 Jul 2025 18:33:03 +0200 Subject: [PATCH] fix(caps): Add features in `caps_init` to avoid redundant presence updates Previously, features like `XMPP_FEATURE_OMEMO_DEVICELIST_NOTIFY` were added in separate init methods (e.g., `omemo_devicelist_subscribe`) via `caps_add_feature`, triggering `cl_ev_presence_send` and sending multiple "online" XMPP presence stanzas. This caused other clients to see users as appearing "online" multiple times. This change adds `STANZA_NS_MOOD_NOTIFY` and `XMPP_FEATURE_OMEMO_DEVICELIST_NOTIFY` in `caps_init`, ensuring they are in `prof_features` early. This allows `caps_add_feature` to exit early when called for these features, avoiding redundant presence updates. --- src/xmpp/capabilities.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c index 8f1cf6d6..a9aa5cbb 100644 --- a/src/xmpp/capabilities.c +++ b/src/xmpp/capabilities.c @@ -119,6 +119,14 @@ caps_init(void) g_hash_table_add(prof_features, strdup(STANZA_NS_LAST_MESSAGE_CORRECTION)); } + if (prefs_get_boolean(PREF_MOOD)) { + g_hash_table_add(prof_features, strdup(STANZA_NS_MOOD_NOTIFY)); + } + +#ifdef HAVE_OMEMO + g_hash_table_add(prof_features, strdup(XMPP_FEATURE_OMEMO_DEVICELIST_NOTIFY)); +#endif + my_sha1 = NULL; } -- 2.49.1