about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-11 15:26:58 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-11 15:26:58 +0100
commitb6b7dd5ad497a71e250b8b3cef0bb987314b141d (patch)
tree150adcde6b07ad55f6bfb5a9db8db10c239bc6ac /src/ui/window.c
parent11181100712fc2a1c2f310b4470d752488e8961e (diff)
downloadprofani-tty-b6b7dd5ad497a71e250b8b3cef0bb987314b141d.tar.gz
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.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c13
1 files changed, 10 insertions, 3 deletions
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);