diff options
author | James Booth <boothj5@gmail.com> | 2012-02-18 21:23:26 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-02-18 21:23:26 +0000 |
commit | 2e62950f336a61dfe30304907ae620a2045f5c01 (patch) | |
tree | 7317b78922936f36c08f92e723066be877d1442a | |
parent | 3fab294c3958df3b079398c9e2c06bd67500f133 (diff) | |
download | profani-tty-2e62950f336a61dfe30304907ae620a2045f5c01.tar.gz |
Target chat window changes
-rw-r--r-- | windows.c | 20 |
1 files 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() |