1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-02-02 15:08:15 -05:00

Target chat window changes

This commit is contained in:
James Booth 2012-02-18 21:23:26 +00:00
parent 3fab294c39
commit 2e62950f33

View File

@ -7,7 +7,7 @@ static struct prof_win _wins[10];
static int _curr_win = 0; static int _curr_win = 0;
static void _create_windows(void); 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(); static void _current_window_refresh();
void gui_init(void) void gui_init(void)
@ -100,7 +100,11 @@ void win_show_incomming_msg(char *from, char *message)
get_time(tstmp); get_time(tstmp);
sprintf(line, " [%s] <%s> %s\n", tstmp, short_from, message); 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) 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); get_time(tstmp);
sprintf(line, " [%s] <%s> %s\n", tstmp, from, message); 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) 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 // find the chat window for recipient
int i; int i;
@ -208,9 +216,7 @@ static void _send_message_to_win(char *contact, char *line)
wclear(_wins[i].win); wclear(_wins[i].win);
} }
// send message to it return i;
wprintw(_wins[i].win, line);
status_bar_active(i);
} }
static void _current_window_refresh() static void _current_window_refresh()