Skip to content

Commit 57ec5c8

Browse files
committed
Don't publish keys if the server doesn't support pubsub.
Related-to: #2078 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent aa1e22f commit 57ec5c8

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/omemo/omemo.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,6 @@ omemo_generate_crypto_materials(ProfAccount* account)
346346
void
347347
omemo_publish_crypto_materials(void)
348348
{
349-
log_debug("[OMEMO] publish crypto materials");
350-
351349
if (omemo_ctx.loaded != TRUE) {
352350
cons_show("OMEMO: cannot publish crypto materials before they are generated");
353351
log_error("[OMEMO] cannot publish crypto materials before they are generated");

src/xmpp/omemo.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ omemo_devicelist_request(const char* const jid)
116116
void
117117
omemo_bundle_publish(gboolean first)
118118
{
119+
if (!connection_supports(XMPP_FEATURE_PUBSUB_PUBLISH_OPTIONS)) {
120+
cons_show("OMEMO: Cannot publish bundle: no PUBSUB feature announced");
121+
log_debug("[OMEMO] Cannot publish bundle: no PUBSUB feature announced");
122+
return;
123+
}
119124
log_debug("[OMEMO] publish own OMEMO bundle");
120125
xmpp_ctx_t* const ctx = connection_get_ctx();
121126
unsigned char* identity_key = NULL;
@@ -141,14 +146,10 @@ omemo_bundle_publish(gboolean first)
141146
g_list_free(lengths);
142147
g_list_free(ids);
143148

144-
if (connection_supports(XMPP_FEATURE_PUBSUB_PUBLISH_OPTIONS)) {
145-
stanza_attach_publish_options_va(ctx, iq,
146-
4, // 2 * number of key-value pairs
147-
"pubsub#persist_items", "true",
148-
"pubsub#access_model", "open");
149-
} else {
150-
log_debug("[OMEMO] Cannot publish bundle: no PUBSUB feature announced");
151-
}
149+
stanza_attach_publish_options_va(ctx, iq,
150+
4, // 2 * number of key-value pairs
151+
"pubsub#persist_items", "true",
152+
"pubsub#access_model", "open");
152153

153154
iq_id_handler_add(id, _omemo_bundle_publish_result, NULL, GINT_TO_POINTER(first));
154155

0 commit comments

Comments
 (0)