From f458d6ebdfec1d4b1533fb58b0391363c405eda0 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 28 Dec 2023 19:08:44 +0100 Subject: [PATCH] Fix when feature discovery is finished Feature discovery was marked as finished once we received a reply to the initial request. The discovery mechanism allows to delegate the real feature discovery to another service running on different domain and those requests are created dynamically. This was another instance causing the warning message described in #1940 Fixes #1940 (once more) Signed-off-by: Steffen Jaeckel --- src/event/server_events.c | 2 ++ src/xmpp/iq.c | 7 ++++++- src/xmpp/iq.h | 1 + tests/unittests/xmpp/stub_xmpp.c | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/event/server_events.c b/src/event/server_events.c index c79f990a..051b0776 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -58,6 +58,7 @@ #include "ui/window.h" #include "tools/bookmark_ignore.h" #include "xmpp/xmpp.h" +#include "xmpp/iq.h" #include "xmpp/muc.h" #include "xmpp/chat_session.h" #include "xmpp/roster_list.h" @@ -196,6 +197,7 @@ sv_ev_roster_received(void) void sv_ev_connection_features_received(void) { + iq_feature_retrieval_complete_handler(); #ifdef HAVE_OMEMO omemo_publish_crypto_materials(); #endif diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index f5aed560..96ca2ee3 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -2539,7 +2539,6 @@ _disco_items_result_handler(xmpp_stanza_t* const stanza) if (g_strcmp0(id, "discoitemsreq") == 0) { cons_show_disco_items(items, from); } else if (g_strcmp0(id, "discoitemsreq_onconnect") == 0) { - received_disco_items = TRUE; connection_set_disco_items(items); while (late_delivery_windows) { @@ -2554,6 +2553,12 @@ _disco_items_result_handler(xmpp_stanza_t* const stanza) g_slist_free_full(items, (GDestroyNotify)_item_destroy); } +void +iq_feature_retrieval_complete_handler(void) +{ + received_disco_items = TRUE; +} + void iq_send_stanza(xmpp_stanza_t* const stanza) { diff --git a/src/xmpp/iq.h b/src/xmpp/iq.h index 9c36035e..13192780 100644 --- a/src/xmpp/iq.h +++ b/src/xmpp/iq.h @@ -40,6 +40,7 @@ typedef int (*ProfIqCallback)(xmpp_stanza_t* const stanza, void* const userdata) typedef void (*ProfIqFreeCallback)(void* userdata); void iq_handlers_init(void); +void iq_feature_retrieval_complete_handler(void); void iq_send_stanza(xmpp_stanza_t* const stanza); void iq_id_handler_add(const char* const id, ProfIqCallback func, ProfIqFreeCallback free_func, void* userdata); void iq_disco_info_request_onconnect(const char* jid); diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c index f4e10a1e..bffe976c 100644 --- a/tests/unittests/xmpp/stub_xmpp.c +++ b/tests/unittests/xmpp/stub_xmpp.c @@ -450,6 +450,11 @@ iq_mam_request(ProfChatWin* win, GDateTime* enddate) { } +void +iq_feature_retrieval_complete_handler(void) +{ +} + void publish_user_mood(const char* const mood, const char* const text) {