Implemented chat logging options for OTR messages

on - Log OTR messages as plaintext
off - Do not log OTR messages
redact - Log, but replace the text with '[redacted]'

Defaults to redact
This commit is contained in:
James Booth
2014-01-13 20:38:19 +00:00
parent 60820007ee
commit ecf323de31
5 changed files with 27 additions and 7 deletions

View File

@@ -429,14 +429,14 @@ otr_encrypt_message(const char * const to, const char * const message)
}
char *
otr_decrypt_message(const char * const from, const char * const message)
otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted)
{
char *decrypted = NULL;
OtrlTLV *tlvs = NULL;
OtrlTLV *tlv = NULL;
int result = otrl_message_receiving(user_state, &ops, NULL, jid, "xmpp", from, message, &decrypted, &tlvs, NULL, NULL);
// internal libotr message, ignore
// internal libotr message
if (result == 1) {
tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
if (tlv) {
@@ -452,10 +452,12 @@ otr_decrypt_message(const char * const from, const char * const message)
// message was decrypted, return to user
} else if (decrypted != NULL) {
*was_decrypted = TRUE;
return decrypted;
// normal non OTR message
} else {
*was_decrypted = FALSE;
return strdup(message);
}
}