static char * _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 = otrlib_decrypt_message(user_state, &ops, jid, from, message, &decrypted, &tlvs); // internal libotr message if (result == 1) { tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED); if (tlv) { ConnContext *context = otrlib_context_find(user_state, from, jid); if (context != NULL) { otrl_context_force_plaintext(context); ui_gone_insecure(from); } } return NULL; // 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); } }
char * otr_decrypt_message(const char * const from, const char * const message, gboolean *was_decrypted) { char *decrypted = NULL; OtrlTLV *tlvs = NULL; int result = otrlib_decrypt_message(user_state, &ops, jid, from, message, &decrypted, &tlvs); // internal libotr message if (result == 1) { ConnContext *context = otrlib_context_find(user_state, from, jid); // common tlv handling OtrlTLV *tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED); if (tlv) { if (context) { otrl_context_force_plaintext(context); ui_gone_insecure(from); } } // library version specific tlv handling otrlib_handle_tlvs(user_state, &ops, context, tlvs, smp_initiators); return NULL; // message was decrypted, return to user } else if (decrypted) { *was_decrypted = TRUE; return decrypted; // normal non OTR message } else { *was_decrypted = FALSE; return strdup(message); } }