Show encryption for historical messages

Refactor getting char, introduce get_show_char() to follow DRY principle.

In theory, performance might be negatively affected after this change.

Ideally get_show_char should be optimized in the future.
This commit is contained in:
John Hernandez
2023-11-03 11:27:30 +01:00
parent 0b957d6207
commit 7af0e9b1e1
4 changed files with 35 additions and 38 deletions

View File

@@ -433,16 +433,8 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, char* id,
auto_char char* enc_char;
if (chatwin->outgoing_char) {
enc_char = chatwin->outgoing_char;
} else if (enc_mode == PROF_MSG_ENC_OTR) {
enc_char = prefs_get_otr_char();
} else if (enc_mode == PROF_MSG_ENC_PGP) {
enc_char = prefs_get_pgp_char();
} else if (enc_mode == PROF_MSG_ENC_OMEMO) {
enc_char = prefs_get_omemo_char();
} else if (enc_mode == PROF_MSG_ENC_OX) {
enc_char = prefs_get_ox_char();
} else {
enc_char = strdup("-");
enc_char = get_show_char(enc_mode);
}
if (request_receipt && id) {