From 5aba98c6aaae6025699afbe8421bd532e675d5c4 Mon Sep 17 00:00:00 2001 From: James Booth Date: Wed, 29 Feb 2012 23:46:25 +0000 Subject: [PATCH] _win_show_message function --- windows.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/windows.c b/windows.c index 456131ae..fcfa9a1e 100644 --- a/windows.c +++ b/windows.c @@ -35,6 +35,7 @@ static void _current_window_refresh(); static void _win_switch_if_active(int i); static void _win_show_time(int win); static void _win_show_user(int win, char *user, int colour); +static void _win_show_message(WINDOW *win, char *message); void gui_init(void) { @@ -110,9 +111,7 @@ void win_show_incomming_msg(char *from, char *message) int win = _find_win(short_from); _win_show_time(win); _win_show_user(win, short_from, 1); - wattroff(_wins[win].win, A_BOLD); - wprintw(_wins[win].win, "%s\n", message); - wattron(_wins[win].win, A_BOLD); + _win_show_message(_wins[win].win, message); status_bar_active(win); } @@ -122,9 +121,7 @@ void win_show_outgoing_msg(char *from, char *to, char *message) int win = _find_win(to); _win_show_time(win); _win_show_user(win, from, 0); - wattroff(_wins[win].win, A_BOLD); - wprintw(_wins[win].win, "%s\n", message); - wattron(_wins[win].win, A_BOLD); + _win_show_message(_wins[win].win, message); status_bar_active(win); } @@ -399,6 +396,13 @@ static void _win_show_user(int win, char *user, int colour) wattroff(_wins[win].win, COLOR_PAIR(2)); } +static void _win_show_message(WINDOW *win, char *message) +{ + wattroff(win, A_BOLD); + wprintw(win, "%s\n", message); + wattron(win, A_BOLD); +} + static void _current_window_refresh() { touchwin(_wins[_curr_win].win);