1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Merge pull request #1542 from DebXWoody/bugfix/fix1541

OMEMO: Don't encrypt to yourself (MUC)
This commit is contained in:
Michael Vetter 2021-06-03 15:43:56 +02:00 committed by GitHub
commit e1fbe3be90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ) {