mirror of
https://github.com/profanity-im/profanity.git
synced 2024-06-16 21:35:24 +00:00
Add correction.char preference
This commit is contained in:
parent
62cfe0fbdc
commit
fa5e9d4555
|
@ -733,6 +733,33 @@ prefs_get_roster_size(void)
|
|||
}
|
||||
}
|
||||
|
||||
char
|
||||
prefs_get_correction_char(void)
|
||||
{
|
||||
char result = '+';
|
||||
|
||||
char *resultstr = g_key_file_get_string(prefs, PREF_GROUP_UI, "correction.char", NULL);
|
||||
if (!resultstr) {
|
||||
result = '+';
|
||||
} else {
|
||||
result = resultstr[0];
|
||||
}
|
||||
free(resultstr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_correction_char(char ch)
|
||||
{
|
||||
char str[2];
|
||||
str[0] = ch;
|
||||
str[1] = '\0';
|
||||
|
||||
g_key_file_set_string(prefs, PREF_GROUP_UI, "correction.char", str);
|
||||
_save_prefs();
|
||||
}
|
||||
|
||||
char
|
||||
prefs_get_otr_char(void)
|
||||
{
|
||||
|
|
|
@ -200,6 +200,9 @@ void prefs_free_plugins(gchar **plugins);
|
|||
void prefs_add_plugin(const char *const name);
|
||||
void prefs_remove_plugin(const char *const name);
|
||||
|
||||
char prefs_get_correction_char(void);
|
||||
void prefs_set_correction_char(char ch);
|
||||
|
||||
char prefs_get_otr_char(void);
|
||||
void prefs_set_otr_char(char ch);
|
||||
char prefs_get_pgp_char(void);
|
||||
|
|
|
@ -250,7 +250,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
|
|||
// currently viewing chat window with sender
|
||||
if (wins_is_current(window)) {
|
||||
if (correct_id && win_created == FALSE) {
|
||||
win_correct_incoming(window, '+', message, id, correct_id);
|
||||
win_correct_incoming(window, message, id, correct_id);
|
||||
} else {
|
||||
win_print_incoming(window, timestamp, display_name, id, plugin_message, enc_mode);
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, const char *const resource, const cha
|
|||
}
|
||||
|
||||
if (correct_id && win_created == FALSE) {
|
||||
win_correct_incoming(window, '+', message, id, correct_id);
|
||||
win_correct_incoming(window, message, id, correct_id);
|
||||
} else {
|
||||
win_print_incoming(window, timestamp, display_name, id, plugin_message, enc_mode);
|
||||
}
|
||||
|
@ -322,7 +322,9 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
|
|||
assert(chatwin != NULL);
|
||||
|
||||
if (correct_id) {
|
||||
win_correct_outgoing((ProfWin*)chatwin, '+', message, id, request_receipt, correct_id);
|
||||
char corr_char = prefs_get_correction_char();
|
||||
|
||||
win_correct_outgoing((ProfWin*)chatwin, corr_char, message, id, request_receipt, correct_id);
|
||||
_chatwin_set_last_message(chatwin, id, message);
|
||||
|
||||
return;
|
||||
|
|
|
@ -1227,7 +1227,7 @@ win_correct_outgoing(ProfWin *window, const char ch, const char *const message,
|
|||
}
|
||||
|
||||
void
|
||||
win_correct_incoming(ProfWin *window, const char ch, const char *const message, const char *const id,
|
||||
win_correct_incoming(ProfWin *window, const char *const message, const char *const id,
|
||||
const char *const correct_id)
|
||||
{
|
||||
ProfBuffEntry *entry = buffer_get_entry_by_incoming_id(window->layout->entries, correct_id);
|
||||
|
@ -1243,7 +1243,7 @@ win_correct_incoming(ProfWin *window, const char ch, const char *const message,
|
|||
}
|
||||
|
||||
entry->date = buffer_date_new_now();
|
||||
entry->show_char = ch;
|
||||
entry->show_char = prefs_get_correction_char();
|
||||
|
||||
if (entry->message) {
|
||||
free(entry->message);
|
||||
|
|
|
@ -69,7 +69,7 @@ void win_print_incoming(ProfWin *window, GDateTime *timestamp, const char *const
|
|||
void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message);
|
||||
void win_correct_outgoing(ProfWin *window, const char ch, const char *const message, const char *const id, gboolean request_receipt,
|
||||
const char *const correct_id);
|
||||
void win_correct_incoming(ProfWin *window, const char ch, const char *const message, const char *const id,
|
||||
void win_correct_incoming(ProfWin *window, const char *const message, const char *const id,
|
||||
const char *const correct_id);
|
||||
|
||||
void win_print_upload(ProfWin *window, const char *const message, char *url);
|
||||
|
|
Loading…
Reference in New Issue
Block a user