feat: Provide descriptive fallback messages for OMEMO decryption failures

If an incoming OMEMO message failed to decrypt (due to missing session
keys or untrusted identities), Profanity would fall back to displaying
the raw XMPP body. This usually contained a generic string like "This
message is encrypted with OMEMO,".

We wrote the detailed reason in the debug logs but the user only saw the
fallback message and probably wondered *why* the message wasn't
displayed properly.

I'm unsure if we should display the fallback message as well though.
This commit is contained in:
Michael Vetter
2026-03-07 00:31:44 +01:00
parent b20e3f1a0c
commit 4d49c2b746
7 changed files with 169 additions and 12 deletions

View File

@@ -150,6 +150,17 @@ typedef enum {
PROF_MSG_TYPE_MUCPM
} prof_msg_type_t;
typedef enum {
OMEMO_ERR_NONE = 0,
OMEMO_ERR_NO_KEY,
OMEMO_ERR_NOT_TRUSTED,
OMEMO_ERR_NO_SESSION,
OMEMO_ERR_DECRYPT_FAILED,
OMEMO_ERR_INVALID_JID,
OMEMO_ERR_MUC_SENDER_NOT_FOUND,
OMEMO_ERR_OTHER
} omemo_error_t;
typedef struct prof_message_t
{
Jid* from_jid;
@@ -172,6 +183,7 @@ typedef struct prof_message_t
char* plain;
GDateTime* timestamp;
prof_enc_t enc;
omemo_error_t omemo_err;
gboolean trusted;
gboolean is_mam;
prof_msg_type_t type;