Add OMEMO message encryption and decryption

This commit is contained in:
Paul Fariello
2019-02-26 20:33:06 +01:40
parent b1ae220aa4
commit 0fb27dc496
18 changed files with 681 additions and 35 deletions

View File

@@ -304,6 +304,23 @@ chat_log_pgp_msg_out(const char *const barejid, const char *const msg)
}
}
void
chat_log_omemo_msg_out(const char *const barejid, const char *const msg)
{
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = connection_get_fulljid();
Jid *jidp = jid_create(jid);
char *pref_omemo_log = prefs_get_string(PREF_OMEMO_LOG);
if (strcmp(pref_omemo_log, "on") == 0) {
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
} else if (strcmp(pref_omemo_log, "redact") == 0) {
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL);
}
prefs_free_string(pref_omemo_log);
jid_destroy(jidp);
}
}
void
chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp)
{
@@ -338,6 +355,23 @@ chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime
}
}
void
chat_log_omemo_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
{
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = connection_get_fulljid();
Jid *jidp = jid_create(jid);
char *pref_omemo_log = prefs_get_string(PREF_OMEMO_LOG);
if (strcmp(pref_omemo_log, "on") == 0) {
_chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, timestamp);
} else if (strcmp(pref_omemo_log, "redact") == 0) {
_chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_IN_LOG, timestamp);
}
prefs_free_string(pref_omemo_log);
jid_destroy(jidp);
}
}
void
chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
{