diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-02-17 12:03:23 +0100 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-02-17 12:03:23 +0100 |
commit | 6e68f1812bd5260fa2d833ede300b228d7224851 (patch) | |
tree | 81964f5dc3083c809a8f497c1d1d7db994802505 /src | |
parent | f13ea11f955ce080e9b7947b62658ba4ee9e3f3a (diff) | |
download | profani-tty-6e68f1812bd5260fa2d833ede300b228d7224851.tar.gz |
Refactor win_print_outgoing_muc_msg()
We never use the printf like behaviour anyways.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/mucwin.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 18 | ||||
-rw-r--r-- | src/ui/window.h | 2 |
3 files changed, 7 insertions, 15 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index f1e05cac..beb4a4e1 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -521,7 +521,7 @@ mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, const char *c ch = prefs_get_omemo_char(); } - win_print_outgoing_muc_msg(window, ch, mynick, id, replace_id, "%s", message); + win_print_outgoing_muc_msg(window, ch, mynick, id, replace_id, message); // save last id and message for LMC if (id) { diff --git a/src/ui/window.c b/src/ui/window.c index 42d1654c..1ecbee40 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1163,28 +1163,20 @@ win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *co } void -win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message, ...) +win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message) { GDateTime *timestamp = g_date_time_new_now_local(); - va_list arg; - va_start(arg, message); - GString *fmt_msg = g_string_new(NULL); - g_string_vprintf(fmt_msg, message, arg); - if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && replace_id) { - _win_correct(window, fmt_msg->str, id, replace_id); + _win_correct(window, message, id, replace_id); } else { - _win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, id, "%s", fmt_msg->str); + _win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, id, "%s", message); } -// buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL, NULL); -// _win_print_internal(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, fmt_msg->str, NULL); +// buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL, NULL); +// _win_print_internal(window, ch, 0, timestamp, 0, THEME_TEXT_ME, me, message, NULL); inp_nonblocking(TRUE); g_date_time_unref(timestamp); - - g_string_free(fmt_msg, TRUE); - va_end(arg); } void diff --git a/src/ui/window.h b/src/ui/window.h index 443d4264..a5b79188 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -67,7 +67,7 @@ void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *me void win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message); void win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id, const char *const replace_id); void win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message); -void win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message, ...); +void win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message); void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...); void win_print_http_upload(ProfWin *window, const char *const message, char *url); |