fix(omemo): bootstrap device list on prosody servers (#169) #171

Open
jabber.developer2 wants to merge 1 commits from fix/omemo-prosody-bootstrap into master
Collaborator

Fixes #169

Two gaps kept /omemo gen from ever publishing on a fresh account against Prosody:

_omemo_receive_devicelist() recognised "node does not exist" only via the legacy code='404' error attribute. Prosody sends the RFC 6120 condition instead, so the empty-list bootstrap never ran. Now the defined condition is accepted too, and the expected bootstrap case is logged at debug instead of error.
connection_request_features() queried only the server domain, but XEP-0163 PEP services (including pubsub#publish-options) announce their features on the account's bare JID. The bare JID is now registered in the feature table and disco'd as well, so connection_supports() sees PEP features.
Verification: two fresh accounts on Prosody with mutual presence subscription; /omemo gen on both, then /omemo start — previously failed with "Can't find a OMEMO device id".

Fixes #169 Two gaps kept /omemo gen from ever publishing on a fresh account against Prosody: _omemo_receive_devicelist() recognised "node does not exist" only via the legacy code='404' error attribute. Prosody sends the RFC 6120 <item-not-found/> condition instead, so the empty-list bootstrap never ran. Now the defined condition is accepted too, and the expected bootstrap case is logged at debug instead of error. connection_request_features() queried only the server domain, but XEP-0163 PEP services (including pubsub#publish-options) announce their features on the account's bare JID. The bare JID is now registered in the feature table and disco'd as well, so connection_supports() sees PEP features. Verification: two fresh accounts on Prosody with mutual presence subscription; /omemo gen on both, then /omemo start — previously failed with "Can't find a OMEMO device id".
jabber.developer2 added 1 commit 2026-07-21 06:20:59 +00:00
fix(omemo): bootstrap device list on prosody-class servers
All checks were successful
CI Code / Check coding style (pull_request) Successful in 29s
CI Code / Linux (debian) (pull_request) Successful in 8m38s
CI Code / Check spelling (pull_request) Successful in 14s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m40s
CI Code / Linux (arch) (pull_request) Successful in 12m35s
CI Code / Code Coverage (pull_request) Successful in 10m2s
61a5de6ab9
Two gaps kept /omemo gen from ever publishing on a fresh account:

- _omemo_receive_devicelist() only recognised the legacy code='404'
  error attribute as "node does not exist". Prosody sends the RFC 6120
  <item-not-found/> condition instead, so the empty-list bootstrap never
  ran. Accept the defined condition too, and log the expected bootstrap
  case at debug instead of error.

- connection_request_features() disco'd only the server domain, but
  XEP-0163 PEP services (including pubsub#publish-options) announce
  their features on the account's bare JID. Query the bare JID as well,
  registering it in the feature table, so connection_supports() sees
  PEP features.

Fixes #169
jabber.developer changed title from fix(omemo): bootstrap device list on prosody-class servers to fix(omemo): bootstrap device list on prosody-class servers (#169) 2026-07-29 19:43:00 +00:00
jabber.developer requested changes 2026-07-30 23:26:38 +00:00
jabber.developer left a comment
Owner

I should further verify 404 situation. In theory, we might send onconnect request to barejid instead of server, but I suggest that further testing is required. We should also exercise caution modifying these parts, as there is a high chance to break certain functions.

I should further verify 404 situation. In theory, we might send onconnect request to barejid instead of server, but I suggest that further testing is required. We should also exercise caution modifying these parts, as there is a high chance to break certain functions.
@@ -661,0 +665,4 @@
g_hash_table_insert(conn.features_by_jid, strdup(barejid),
g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL));
}
iq_disco_info_request_onconnect(barejid); // XEP-0163: PEP services announce features on the account's bare JID

so we overwrite the features received from to=server by features from to=barejid here:

// iq.c
void
iq_disco_info_request_onconnect(const char* jid)
{
// ...
    iq_id_handler_add(id, _disco_info_response_id_handler_onconnect, NULL, NULL);
// ...
}

// ...
static int
_disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* const userdata)
{
// ...
    connection_features_received(from);

    return 0;
}

// connection.c
void
connection_features_received(const char* const jid)
{
    const char* key = _get_from_via_jid(jid);
    if (!key) {
        return;
    }
    log_info("[CONNECTION] connection_features_received %s", key);
    if (g_hash_table_remove(conn.requested_features, key) && g_hash_table_size(conn.requested_features) == 0) { // <--- here
        sv_ev_connection_features_received();
    }
}
so we overwrite the features received from `to=server` by features from `to=barejid` here: ```c // iq.c void iq_disco_info_request_onconnect(const char* jid) { // ... iq_id_handler_add(id, _disco_info_response_id_handler_onconnect, NULL, NULL); // ... } // ... static int _disco_info_response_id_handler_onconnect(xmpp_stanza_t* const stanza, void* const userdata) { // ... connection_features_received(from); return 0; } // connection.c void connection_features_received(const char* const jid) { const char* key = _get_from_via_jid(jid); if (!key) { return; } log_info("[CONNECTION] connection_features_received %s", key); if (g_hash_table_remove(conn.requested_features, key) && g_hash_table_size(conn.requested_features) == 0) { // <--- here sv_ev_connection_features_received(); } } ```
jabber.developer changed title from fix(omemo): bootstrap device list on prosody-class servers (#169) to fix(omemo): bootstrap device list on prosody servers (#169) 2026-07-30 23:27:47 +00:00
All checks were successful
CI Code / Check coding style (pull_request) Successful in 29s
Required
Details
CI Code / Linux (debian) (pull_request) Successful in 8m38s
Required
Details
CI Code / Check spelling (pull_request) Successful in 14s
Required
Details
CI Code / Linux (ubuntu) (pull_request) Successful in 4m40s
Required
Details
CI Code / Linux (arch) (pull_request) Successful in 12m35s
Required
Details
CI Code / Code Coverage (pull_request) Successful in 10m2s
Required
Details
This pull request has changes requested by an official reviewer.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/omemo-prosody-bootstrap:fix/omemo-prosody-bootstrap
git checkout fix/omemo-prosody-bootstrap
Sign in to join this conversation.
No description provided.