about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-03-09 12:00:15 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-03-09 12:00:15 +0100
commit3d7e6fae7cda1d7c871f384c1b94d7c0cb8c9ea7 (patch)
treebcc47bd096439da0faeefb9a10d7f6d923daf1ad
parent0801623018a6630d8104d1fe7cc40e297fca85e0 (diff)
downloadprofani-tty-3d7e6fae7cda1d7c871f384c1b94d7c0cb8c9ea7.tar.gz
Use ProfMessage as parameter for win_println_incoming_muc_msg()
-rw-r--r--src/ui/mucwin.c2
-rw-r--r--src/ui/window.c9
-rw-r--r--src/ui/window.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index 8f9941d3..79a82a61 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -590,7 +590,7 @@ mucwin_incoming_msg(ProfMucWin *mucwin, const ProfMessage *const message, GSList
         win_print_them(window, THEME_ROOMTRIGGER, ch, flags, message->jid->resourcepart);
         _mucwin_print_triggers(window, message->plain, triggers);
     } else {
-        win_println_incoming_muc_msg(window, ch, flags, message->jid->resourcepart, message->id, message->replace_id, message->plain);
+        win_println_incoming_muc_msg(window, ch, flags, message);
     }
 
     free(ch);
diff --git a/src/ui/window.c b/src/ui/window.c
index eb54d24a..4f1d4f05 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1150,15 +1150,15 @@ win_print_them(ProfWin *window, theme_item_t theme_item, const char *const show_
 }
 
 void
-win_println_incoming_muc_msg(ProfWin *window, char *show_char, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message)
+win_println_incoming_muc_msg(ProfWin *window, char *show_char, int flags, const ProfMessage *const message)
 {
     //TODO: we always use current timestamp here. instead of the message->timestamp one if available. i think somewhere else we check whether it exists first.
     GDateTime *timestamp = g_date_time_new_now_local();
 
-    if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && replace_id) {
-        _win_correct(window, message, id, replace_id);
+    if (prefs_get_boolean(PREF_CORRECTION_ALLOW) && message->replace_id) {
+        _win_correct(window, message->plain, message->id, message->replace_id);
     } else {
-        _win_printf(window, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", message);
+        _win_printf(window, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, message->jid->resourcepart, message->id, "%s", message->plain);
     }
 //    buffer_append(window->layout->buffer, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL, NULL);
  //   _win_print_internal(window, show_char, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL);
@@ -1187,7 +1187,6 @@ win_print_outgoing_muc_msg(ProfWin *window, char *show_char, const char *const m
 void
 win_print_outgoing(ProfWin *window, const char *show_char, const char *const id, const char *const replace_id, const char *const message)
 {
-    //TODO: we always use current timestamp here. instead of the message->timestamp one if available. i think somewhere else we check whether it exists first.
     GDateTime *timestamp = g_date_time_new_now_local();
 
     if (replace_id) {
diff --git a/src/ui/window.h b/src/ui/window.h
index 7764c91a..d17560bc 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -66,7 +66,7 @@ void win_print_them(ProfWin *window, theme_item_t theme_item, const char *const
 void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message);
 void win_print_outgoing(ProfWin *window, const char *show_char, 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 *show_char, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message);
+void win_println_incoming_muc_msg(ProfWin *window, char *show_char, int flags, const ProfMessage *const message);
 void win_print_outgoing_muc_msg(ProfWin *window, char *show_char, 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);