From 2e62950f336a61dfe30304907ae620a2045f5c01 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 18 Feb 2012 21:23:26 +0000 Subject: [PATCH] Target chat window changes --- windows.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/windows.c b/windows.c index ea6c5b03..ac85fd59 100644 --- a/windows.c +++ b/windows.c @@ -7,7 +7,7 @@ static struct prof_win _wins[10]; static int _curr_win = 0; static void _create_windows(void); -static void _send_message_to_win(char *contact, char *line); +static int _find_win(char *contact); static void _current_window_refresh(); void gui_init(void) @@ -100,7 +100,11 @@ void win_show_incomming_msg(char *from, char *message) get_time(tstmp); sprintf(line, " [%s] <%s> %s\n", tstmp, short_from, message); - _send_message_to_win(short_from, line); + + int win = _find_win(short_from); + + wprintw(_wins[win].win, line); + status_bar_active(win); } void win_show_outgoing_msg(char *from, char *to, char *message) @@ -110,7 +114,11 @@ void win_show_outgoing_msg(char *from, char *to, char *message) get_time(tstmp); sprintf(line, " [%s] <%s> %s\n", tstmp, from, message); - _send_message_to_win(to, line); + + int win = _find_win(to); + + wprintw(_wins[win].win, line); + status_bar_active(win); } void cons_help(void) @@ -188,7 +196,7 @@ static void _create_windows(void) } } -static void _send_message_to_win(char *contact, char *line) +static int _find_win(char *contact) { // find the chat window for recipient int i; @@ -208,9 +216,7 @@ static void _send_message_to_win(char *contact, char *line) wclear(_wins[i].win); } - // send message to it - wprintw(_wins[i].win, line); - status_bar_active(i); + return i; } static void _current_window_refresh()