diff options
-rw-r--r-- | jabber.c | 7 | ||||
-rw-r--r-- | windows.c | 20 | ||||
-rw-r--r-- | windows.h | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/jabber.c b/jabber.c index 10d0115b..fbd0ccdd 100644 --- a/jabber.c +++ b/jabber.c @@ -221,7 +221,12 @@ static void _jabber_conn_handler(xmpp_conn_t * const conn, jabber_conn.conn_status = JABBER_CONNECTED; } else { - cons_bad_show("Login failed."); + if (jabber_conn.conn_status == JABBER_CONNECTED) { + cons_bad_show("Lost connection."); + win_disconnected(); + } else { + cons_bad_show("Login failed."); + } win_page_off(); log_msg(CONN, "disconnected"); xmpp_stop(ctx); 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(""); diff --git a/windows.h b/windows.h index de72a23e..7996aa1a 100644 --- a/windows.h +++ b/windows.h @@ -63,6 +63,7 @@ void win_contact_online(const char * const from, const char * const show, const char * const status); void win_contact_offline(const char * const from, const char * const show, const char * const status); +void win_disconnected(void); // console window actions void cons_help(void); |