From 9805b2b2b22e277ee150ddaabe8f542b267e3e4b Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 19 Apr 2012 21:03:48 +0100 Subject: Show different message when disconnected Also show message in active chat windows --- windows.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'windows.c') diff --git a/windows.c b/windows.c index ad0c0fb1..ebafa543 100644 --- a/windows.c +++ b/windows.c @@ -214,6 +214,26 @@ void win_contact_offline(const char * const from, const char * const show, dirty = TRUE; } +void win_disconnected(void) +{ + int i; + // show message in all active chats + for (i = 1; i < NUM_WINS; i++) { + if (strcmp(_wins[i].from, "") != 0) { + WINDOW *win = _wins[_curr_prof_win].win; + _win_show_time(win); + wattron(win, COLOR_PAIR(6)); + wprintw(win, "%s\n", "Lost connection."); + wattroff(win, COLOR_PAIR(6)); + + // if current win, set dirty + if (i == _curr_prof_win) { + dirty = TRUE; + } + } + } +} + void cons_help(void) { cons_show(""); -- cgit 1.4.1-2-gfad0 From 6ab1a84c65750c6b8ce453a06ade94e69994d9c5 Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 19 Apr 2012 23:32:44 +0100 Subject: Added blinking notifications When something happens in the a active window, the status bar shows a blinking notification. Moving to the window stops the blinking. --- status_bar.c | 17 +++++++++++++++++ windows.c | 24 ++++++++++++++++-------- windows.h | 1 + 3 files changed, 34 insertions(+), 8 deletions(-) (limited to 'windows.c') diff --git a/status_bar.c b/status_bar.c index d15997b4..c343f3fe 100644 --- a/status_bar.c +++ b/status_bar.c @@ -96,6 +96,23 @@ void status_bar_active(const int win) dirty = TRUE; } +void status_bar_new(const int win) +{ + int active_pos = 1 + ((win -1) * 3); + + int rows, cols; + getmaxyx(stdscr, rows, cols); + + wattron(status_bar, A_BLINK); + if (win < 9) + mvwprintw(status_bar, 0, cols - 29 + active_pos, "%d", win+1); + else + mvwprintw(status_bar, 0, cols - 29 + active_pos, "10"); + wattroff(status_bar, A_BLINK); + + dirty = TRUE; +} + void status_bar_get_password(void) { mvwprintw(status_bar, 0, 9, "Enter password:"); diff --git a/windows.c b/windows.c index ebafa543..c58b5096 100644 --- a/windows.c +++ b/windows.c @@ -158,12 +158,15 @@ void win_show_incomming_msg(const char * const from, const char * const message) _win_show_time(win); _win_show_user(win, short_from, 1); _win_show_message(win, message); - - status_bar_active(win_index); - _cons_show_incoming_message(short_from, win_index); - - if (win_index == _curr_prof_win) + + if (win_index == _curr_prof_win) { + status_bar_active(win_index); dirty = TRUE; + } else { + status_bar_new(win_index); + _cons_show_incoming_message(short_from, win_index); + } + } void win_show_outgoing_msg(const char * const from, const char * const to, @@ -180,8 +183,11 @@ void win_show_outgoing_msg(const char * const from, const char * const to, status_bar_active(win_index); - if (win_index == _curr_prof_win) + if (win_index == _curr_prof_win) { dirty = TRUE; + } else { + status_bar_new(win_index); + } } void win_contact_online(const char * const from, const char * const show, @@ -425,10 +431,12 @@ static void _win_switch_if_active(const int i) _curr_prof_win = i; win_page_off(); - if (i == 0) + if (i == 0) { title_bar_title(); - else + } else { title_bar_show(_wins[i].from); + status_bar_active(i); + } } dirty = TRUE; diff --git a/windows.h b/windows.h index 7996aa1a..46648605 100644 --- a/windows.h +++ b/windows.h @@ -84,6 +84,7 @@ void status_bar_get_password(void); void status_bar_print_message(const char * const msg); void status_bar_inactive(const int win); void status_bar_active(const int win); +void status_bar_new(const int win); void status_bar_update_time(void); // input window actions -- cgit 1.4.1-2-gfad0