about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-10-06 19:20:03 +0100
committerJames Booth <boothj5@gmail.com>2013-10-06 19:20:03 +0100
commiteee49e8ad8e72f083e4019e7452e9405ce7cb037 (patch)
treee66f586e263f465d5f6bcf9ac55f8f6883f6d26c
parent3e7c6e295169028b14d6da6a88ec6cc3a546b9bd (diff)
downloadprofani-tty-eee49e8ad8e72f083e4019e7452e9405ce7cb037.tar.gz
Refactor ui_incoming_message
-rw-r--r--src/ui/core.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 0d949361..5559639a 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -305,28 +305,7 @@ ui_incoming_msg(const char * const from, const char * const message,
             }
         }
 
-        if (tv_stamp == NULL) {
-            window->print_time(window, '-');
-        } else {
-            GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
-            gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
-            wattron(window->win, COLOUR_TIME);
-            wprintw(window->win, "%s - ", date_fmt);
-            wattroff(window->win, COLOUR_TIME);
-            g_date_time_unref(time);
-            g_free(date_fmt);
-        }
-
-        if (strncmp(message, "/me ", 4) == 0) {
-            wattron(window->win, COLOUR_THEM);
-            wprintw(window->win, "*%s ", display_from);
-            waddstr(window->win, message + 4);
-            wprintw(window->win, "\n");
-            wattroff(window->win, COLOUR_THEM);
-        } else {
-            _win_show_user(window->win, display_from, 1);
-            _win_show_message(window->win, message);
-        }
+        window->print_incoming_message(window, tv_stamp, display_from, message);
     }
 
     int ui_index = num;