Add trusted state after OMEMO decryption
Use it to print message on red background if not trusted.
This commit is contained in:
@@ -832,7 +832,7 @@ out:
|
||||
char *
|
||||
omemo_on_message_recv(const char *const from_jid, uint32_t sid,
|
||||
const unsigned char *const iv, size_t iv_len, GList *keys,
|
||||
const unsigned char *const payload, size_t payload_len, gboolean muc)
|
||||
const unsigned char *const payload, size_t payload_len, gboolean muc, gboolean *trusted)
|
||||
{
|
||||
unsigned char *plaintext = NULL;
|
||||
Jid *sender = NULL;
|
||||
|
||||
@@ -91,4 +91,4 @@ void omemo_start_device_session(const char *const jid, uint32_t device_id, GList
|
||||
|
||||
gboolean omemo_loaded(void);
|
||||
char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc);
|
||||
char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc);
|
||||
char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc, gboolean *trusted);
|
||||
|
||||
@@ -395,10 +395,6 @@ is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data,
|
||||
int ret;
|
||||
identity_key_store_t *identity_key_store = (identity_key_store_t *)user_data;
|
||||
|
||||
if (identity_key_store->recv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GHashTable *trusted = g_hash_table_lookup(identity_key_store->trusted, address->name);
|
||||
if (!trusted) {
|
||||
if (identity_key_store->recv) {
|
||||
@@ -416,7 +412,13 @@ is_trusted_identity(const signal_protocol_address *address, uint8_t *key_data,
|
||||
|
||||
signal_buffer_free(buffer);
|
||||
|
||||
return ret;
|
||||
|
||||
if (identity_key_store->recv) {
|
||||
identity_key_store->trusted = ret;
|
||||
return 1;
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef struct {
|
||||
uint32_t registration_id;
|
||||
GHashTable *trusted;
|
||||
bool recv;
|
||||
bool trusted;
|
||||
} identity_key_store_t;
|
||||
|
||||
GHashTable * session_store_new(void);
|
||||
|
||||
Reference in New Issue
Block a user