Skip to content

fix(otr): prevent sending message when contact goes offline#2169

Open
jubalh wants to merge 2 commits into
masterfrom
feat/otr
Open

fix(otr): prevent sending message when contact goes offline#2169
jubalh wants to merge 2 commits into
masterfrom
feat/otr

Conversation

@jubalh
Copy link
Copy Markdown
Member

@jubalh jubalh commented May 19, 2026

Don't automatically end an OTR session when a contact disconnects.

Now we have clearer separation:
chatwin->is_otr tracks whether the user wants to use OTR.
otr_is_secure tracks whether the encryption is still activated.

We can now use this when sending a message to make sure we don't send
unencrypted text in case the contact goes offline.
We will display a hint that the user first needs to stop to use otr by
disabling it (/otr end).

This as well improves the situation when the connection flickers
(contact goes offline/online).

Fixes: #952

jubalh added 2 commits May 19, 2026 22:39
`cb_is_logged_in()` incorrectly returned `PRESENCE_ONLINE`
for contacts not in the roster or without a presence subscription.

According to libotr API documentation, returning 1 informs the library that it
is safe to send automated background traffic (heartbeats or handshake responses).

Because of this, when spammers sent an initial OTR query (`?OTR?v23?`),
we would automatically inject a handshake response, confirming the
users network availability.

This violates XMPP Presence Privacy best practices defined in RFC 6121 Section 4.1,
which states that presence information must not be revealed to entities
without explicit authorization.

Fixes: #2166
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Don't automatically end an OTR session when a contact disconnects.

Now we have clearer separation:
`chatwin->is_otr` tracks whether the user wants to use OTR.
`otr_is_secure` tracks whether the encryption is still activated.

We can now use this when sending a message to make sure we don't send
unencrypted text in case the contact goes offline.
We will display a hint that the user first needs to stop to use otr by
disabling it (`/otr end`).

This as well improves the situation when the connection flickers
(contact goes offline/online).

Fixes: #952
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OTR: Prevent input when contact disconnects

1 participant