1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Added preference for encryption char

This commit is contained in:
James Booth 2015-08-26 01:06:10 +01:00
parent 48630d45a4
commit 1bf584793f
4 changed files with 63 additions and 4 deletions

View File

@ -376,6 +376,60 @@ prefs_get_roster_size(void)
}
}
char
prefs_get_otr_char(void)
{
char result = '~';
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_OTR, "otr.char", NULL);
if (!resultstr) {
result = '~';
} else {
result = resultstr[0];
}
free(resultstr);
return result;
}
void
prefs_set_otr_char(char ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_OTR, "otr.char", str);
_save_prefs();
}
char
prefs_get_pgp_char(void)
{
char result = '~';
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_PGP, "pgp.char", NULL);
if (!resultstr) {
result = '~';
} else {
result = resultstr[0];
}
free(resultstr);
return result;
}
void
prefs_set_pgp_char(char ch)
{
char str[2];
str[0] = ch;
str[1] = '\0';
g_key_file_set_string(prefs, PREF_GROUP_PGP, "pgp.char", str);
_save_prefs();
}
gboolean
prefs_add_alias(const char * const name, const char * const value)
{

View File

@ -143,6 +143,11 @@ gint prefs_get_roster_size(void);
gint prefs_get_autoaway_time(void);
void prefs_set_autoaway_time(gint value);
char prefs_get_otr_char(void);
void prefs_set_otr_char(char ch);
char prefs_get_pgp_char(void);
void prefs_set_pgp_char(char ch);
void prefs_add_login(const char *jid);
gboolean prefs_add_alias(const char * const name, const char * const value);

View File

@ -1291,9 +1291,9 @@ ui_outgoing_chat_msg(ProfChatWin *chatwin, const char * const message, char *id,
{
char enc_char = '-';
if (enc_mode == PROF_ENC_OTR) {
enc_char = 'O';
enc_char = prefs_get_otr_char();
} else if (enc_mode == PROF_ENC_PGP) {
enc_char = 'P';
enc_char = prefs_get_pgp_char();
}
if (prefs_get_boolean(PREF_RECEIPTS_REQUEST) && id) {

View File

@ -885,9 +885,9 @@ win_print_incoming_message(ProfWin *window, GDateTime *timestamp,
{
case WIN_CHAT:
if (enc_mode == PROF_ENC_OTR) {
enc_char = 'O';
enc_char = prefs_get_otr_char();
} else if (enc_mode == PROF_ENC_PGP) {
enc_char = 'P';
enc_char = prefs_get_pgp_char();
}
win_print(window, enc_char, 0, timestamp, NO_ME, THEME_TEXT_THEM, from, message);
break;