fix(receipts): request receipts when capabilities unknown (upstream 4749645c7)

When the receipts-request preference is on but we have no cached
EntityCapabilities for the recipient (new session, bare-jid only,
disco not finished), the previous check via caps_jid_has_feature()
defaulted to 'not supported' and silently suppressed the receipt.
Per XEP-0184 we should send the receipt request unless we have
positive knowledge that the peer does not advertise the feature.

Restore that behaviour: look up caps with caps_lookup(); only flip
request_receipt off when caps are present AND the feature is
missing from the list. If caps are NULL, leave the request enabled
(falls back to the user preference).
This commit is contained in:
2026-05-21 12:30:56 +03:00
parent fbdef0b9d4
commit 025051505b

View File

@@ -115,7 +115,12 @@ cl_ev_send_msg_correct(ProfChatWin* chatwin, const char* const msg, const char*
gboolean request_receipt = prefs_get_boolean(PREF_RECEIPTS_REQUEST);
if (request_receipt) {
auto_char char* jid = chat_session_get_jid(chatwin->barejid);
request_receipt = caps_jid_has_feature(jid, XMPP_FEATURE_RECEIPTS);
EntityCapabilities* caps = caps_lookup(jid);
if (caps != NULL) {
GSList* found = g_slist_find_custom(caps->features, XMPP_FEATURE_RECEIPTS, (GCompareFunc)g_strcmp0);
request_receipt = (found != NULL);
caps_destroy(caps);
}
}
auto_char char* plugin_msg = plugins_pre_chat_message_send(chatwin->barejid, msg);