diff options
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 ) { |