about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-17 11:58:36 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-17 11:58:36 +0100
commitf13ea11f955ce080e9b7947b62658ba4ee9e3f3a (patch)
treeaa285b48653d192f7687f24a3000a49718b3f46a
parent69d474b3a7c581c4a44329ddf2065e7e158e2657 (diff)
downloadprofani-tty-f13ea11f955ce080e9b7947b62658ba4ee9e3f3a.tar.gz
Refactor win_println_incoming_muc_msg()
We never use the printf like behaviour anyways.
-rw-r--r--src/ui/mucwin.c2
-rw-r--r--src/ui/window.c18
-rw-r--r--src/ui/window.h2
3 files changed, 7 insertions, 15 deletions
diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c
index 28c3beea..f1e05cac 100644
--- a/src/ui/mucwin.c
+++ b/src/ui/mucwin.c
@@ -566,7 +566,7 @@ mucwin_incoming_msg(ProfMucWin *mucwin, ProfMessage *message, GSList *mentions,
         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, "%s", message->plain);
+        win_println_incoming_muc_msg(window, ch, flags, message->jid->resourcepart, message->id, message->replace_id, message->plain);
     }
 }
 
diff --git a/src/ui/window.c b/src/ui/window.c
index 8039ab8f..42d1654c 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1145,29 +1145,21 @@ win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags, con
 }
 
 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, ...)
+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)
 {
     //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();
 
-    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, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", fmt_msg->str);
+        _win_printf(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, id, "%s", message);
     }
-//    buffer_append(window->layout->buffer, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL, NULL);
- //   _win_print_internal(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, fmt_msg->str, NULL);
+//    buffer_append(window->layout->buffer, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, message, NULL, NULL);
+ //   _win_print_internal(window, ch, 0, timestamp, flags | NO_ME, THEME_TEXT_THEM, them, 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 25cfbbbf..443d4264 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, char ch, int flags
 void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message);
 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_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_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...);