From b6b7dd5ad497a71e250b8b3cef0bb987314b141d Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 11 Feb 2020 15:26:58 +0100 Subject: xep-0308: update the UI upon sending a corrected message So far we don't do this for encrypted messages. Still needs to be done. And MUC also needs to be done. --- src/ui/window.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/ui/window.c') diff --git a/src/ui/window.c b/src/ui/window.c index c668bd34..1218b177 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1183,7 +1183,7 @@ win_println_me_message(ProfWin *window, char ch, const char *const me, const cha } void -win_print_outgoing(ProfWin *window, const char ch, const char *const message, ...) +win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message, ...) { GDateTime *timestamp = g_date_time_new_now_local(); @@ -1192,9 +1192,16 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const message, .. GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, message, arg); - buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL, NULL); + if (replace_id) { + win_correct_incoming(window, fmt_msg->str, id, replace_id); + } else { + //TODO: without this it works. + //buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL, id); + + //_win_print(window, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL); + _win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_THEM, "me", id, "%s", fmt_msg->str); + } - _win_print(window, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL); inp_nonblocking(TRUE); g_date_time_unref(timestamp); -- cgit 1.4.1-2-gfad0