fix(xmpp): show message for empty disco#items results (XEP-0030) #89

Manually merged
jabber.developer2 merged 1 commits from fix/xep-0030-empty-disco-items into master 2026-02-11 08:41:25 +00:00
Collaborator

Summary

Fixes XEP-0030 compliance issue where empty disco#items results were silently ignored instead of showing a user-friendly message.

Problem

When a server returns an empty <query/> element for disco#items (which is valid per XEP-0030), the client silently returned without displaying any message to the user.

Per XEP-0030 Section 3.1:

"If there are no items associated with an entity (or if those items are not publicly available), the target entity MUST return an empty query element to the requesting entity"

Solution

Removed erroneous early return in _disco_items_result_handler() when child == NULL. Now the function continues to display "No service discovery items for X" as intended.

Changes

// Removed from src/xmpp/iq.c:
xmpp_stanza_t* child = xmpp_stanza_get_children(query);
-   if (child == NULL) {
-       return;
-   }

Root Cause

This update introduced in commit f28655c5c (2016-05-08) "Move logic to connection_set_disco_items" which added the early return check.

Testing

  • Verified with functional test disco_items_empty_result (in PR #88)
  • [] Manual testing with /disco items against server with no items
### Summary Fixes XEP-0030 compliance issue where empty disco#items results were silently ignored instead of showing a user-friendly message. ### Problem When a server returns an empty `<query/>` element for disco#items (which is valid per XEP-0030), the client silently returned without displaying any message to the user. Per [XEP-0030 Section 3.1](https://xmpp.org/extensions/xep-0030.html#items): > "If there are no items associated with an entity (or if those items are not publicly available), the target entity MUST return an empty query element to the requesting entity" ### Solution Removed erroneous early return in `_disco_items_result_handler()` when `child == NULL`. Now the function continues to display "No service discovery items for X" as intended. ### Changes ```c // Removed from src/xmpp/iq.c: xmpp_stanza_t* child = xmpp_stanza_get_children(query); - if (child == NULL) { - return; - } ``` ### Root Cause This update introduced in commit f28655c5c (2016-05-08) "Move logic to connection_set_disco_items" which added the early return check. ### Testing - [x] Verified with functional test `disco_items_empty_result` (in PR #88) - [] Manual testing with `/disco items` against server with no items ### Related - PR #88 (test/autoping-functional-tests) - contains functional test for this fix - Closes #90
jabber.developer2 added 1 commit 2026-02-10 22:19:52 +00:00
fix(xmpp): show message for empty disco#items results (XEP-0030)
All checks were successful
CI Code / Check spelling (pull_request) Successful in 23s
CI Code / Check coding style (pull_request) Successful in 34s
CI Code / Code Coverage (pull_request) Successful in 4m45s
CI Code / Linux (debian) (pull_request) Successful in 6m10s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m17s
CI Code / Linux (arch) (pull_request) Successful in 6m24s
CI Code / Check spelling (push) Successful in 17s
CI Code / Check coding style (push) Successful in 30s
CI Code / Linux (debian) (push) Successful in 6m16s
CI Code / Linux (ubuntu) (push) Successful in 6m22s
CI Code / Linux (arch) (push) Successful in 6m27s
CI Code / Code Coverage (push) Successful in 9m41s
4fce333c9a
Per XEP-0030 section 3.1: 'if an entity has no associated items,
it MUST return an empty <query/> element.'

The client should display 'No service discovery items for X' when
receiving an empty result, not silently ignore it.

Previous version introduced in commit f28655c5c (2016-05-08) which added an early
return when child == NULL, preventing the message from being shown.
jabber.developer2 added the
Kind/Bug
label 2026-02-10 22:29:03 +00:00
jabber.developer added the
Priority
Medium
3
Reviewed
Confirmed
1
labels 2026-02-11 08:38:08 +00:00
jabber.developer2 manually merged commit 4fce333c9a into master 2026-02-11 08:41:25 +00:00
Sign in to join this conversation.
No description provided.