diff options
author | Michael Vetter <jubalh@iodoru.org> | 2021-06-03 15:43:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 15:43:56 +0200 |
commit | e1fbe3be90089d99d4996ff6e146e053124fb419 (patch) | |
tree | b3bf44bfca5ab12f499f47a45ee253dc3686d8fc /src | |
parent | e9ef3cf1d26400b47a276c758edc87e15e2de50a (diff) | |
parent | 64bcc06259cc74e5a368c09092e3d4ad422bbcd0 (diff) | |
download | profani-tty-e1fbe3be90089d99d4996ff6e146e053124fb419.tar.gz |
Merge pull request #1542 from DebXWoody/bugfix/fix1541
OMEMO: Don't encrypt to yourself (MUC)
Diffstat (limited to 'src')
-rw-r--r-- | src/omemo/omemo.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index 192d3d2a..9b2b35f5 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -791,6 +791,19 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_ .device_id = GPOINTER_TO_INT(device_ids_iter->data) }; + // Don't encrypt for this device (according to + // <https://xmpp.org/extensions/xep-0384.html#encrypt>). + // Yourself as recipients in case of MUC + char* mybarejid = connection_get_barejid(); + if ( !g_strcmp0(mybarejid, recipients_iter->data) ) { + if (GPOINTER_TO_INT(device_ids_iter->data) == omemo_ctx.device_id) { + free(mybarejid); + log_debug("[OMEMO][SEND] Skipping %d (my device) ", GPOINTER_TO_INT(device_ids_iter->data)); + continue; + } + } + free(mybarejid); + log_debug("[OMEMO][SEND] recipients with device id %d for %s", GPOINTER_TO_INT(device_ids_iter->data), recipients_iter->data); res = session_cipher_create(&cipher, omemo_ctx.store, &address, omemo_ctx.signal); if (res != SG_SUCCESS ) { |