about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-10-06 18:00:22 +0100
committerJames Booth <boothj5@gmail.com>2013-10-06 18:00:22 +0100
commita527beabd31e22bce17a0745e92cabb415fde06f (patch)
tree6d4c478281b34a5bf1f86e75b7fb9a4b776bb85d
parentfc8982e7616ae1e0086acedef1b7e223ba68757c (diff)
downloadprofani-tty-a527beabd31e22bce17a0745e92cabb415fde06f.tar.gz
Added show_char and attrs to ProfWin->print_line
-rw-r--r--src/ui/core.c2
-rw-r--r--src/ui/muc_window.c2
-rw-r--r--src/ui/window.c7
-rw-r--r--src/ui/window.h6
4 files changed, 11 insertions, 6 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 2249a944..8e84274f 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -824,7 +824,7 @@ ui_current_print_line(const char * const msg, ...)
     ProfWin *current = wins_get_current();
     va_list arg;
     va_start(arg, msg);
-    current->print_line(current, msg, arg);
+    current->print_line(current, '-', 0, msg, arg);
     va_end(arg);
     current->refresh_win(current);
 }
diff --git a/src/ui/muc_window.c b/src/ui/muc_window.c
index ef4e1c9b..72382032 100644
--- a/src/ui/muc_window.c
+++ b/src/ui/muc_window.c
@@ -30,7 +30,7 @@ muc_handle_error_message(ProfWin *self, const char * const from,
 {
     gboolean handled = FALSE;
     if (g_strcmp0(err_msg, "conflict") == 0) {
-        win_print_line(self, "Nickname already in use.");
+        win_print_line(self, '-', 0, "Nickname already in use.");
         win_refresh(self);
         handled = TRUE;
     }
diff --git a/src/ui/window.c b/src/ui/window.c
index a1d5a0fc..3ba49fff 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -100,14 +100,17 @@ _win_print_time(ProfWin* self, char show_char)
 }
 
 void
-win_print_line(ProfWin *self, const char * const msg, ...)
+win_print_line(ProfWin *self, const char show_char, int attrs,
+    const char * const msg, ...)
 {
     va_list arg;
     va_start(arg, msg);
     GString *fmt_msg = g_string_new(NULL);
     g_string_vprintf(fmt_msg, msg, arg);
-    _win_print_time(self, '-');
+    _win_print_time(self, show_char);
+    wattron(self->win, attrs);
     wprintw(self->win, "%s\n", fmt_msg->str);
+    wattroff(self->win, attrs);
     g_string_free(fmt_msg, TRUE);
     va_end(arg);
 }
diff --git a/src/ui/window.h b/src/ui/window.h
index 5f8a0e36..9be3a7fd 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -53,7 +53,8 @@ typedef struct prof_win_t {
     int unread;
     int history_shown;
     void (*print_time)(struct prof_win_t *self, char show_char);
-    void (*print_line)(struct prof_win_t *self, const char * const msg, ...);
+    void (*print_line)(struct prof_win_t *self, const char show_char,
+        int attrs, const char * const msg, ...);
     void (*refresh_win)(struct prof_win_t *self);
     void (*presence_colour_on)(struct prof_win_t *self, const char * const presence);
     void (*presence_colour_off)(struct prof_win_t *self, const char * const presence);
@@ -64,7 +65,8 @@ typedef struct prof_win_t {
 
 ProfWin* win_create(const char * const title, int cols, win_type_t type);
 void win_free(ProfWin *window);
-void win_print_line(ProfWin *self, const char * const msg, ...);
+void win_print_line(ProfWin *self, const char show_char, int attrs,
+    const char * const msg, ...);
 void win_refresh(ProfWin *self);
 
 #endif