about summary refs log tree commit diff stats
path: root/windows.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-04-20 00:57:00 +0100
committerJames Booth <boothj5@gmail.com>2012-04-20 00:57:00 +0100
commit92adad21007fdb40d853d34eca157e6a8d6496b0 (patch)
tree4057e9d2e06fbf920b29287c4f3dc6385f51141c /windows.c
parent4ca5e023a5dec8a8e577aa2f3db377a4d9e54769 (diff)
parent6ab1a84c65750c6b8ce453a06ade94e69994d9c5 (diff)
downloadprofani-tty-92adad21007fdb40d853d34eca157e6a8d6496b0.tar.gz
Merge branch 'master' into resize
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/windows.c b/windows.c
index 3acda7b7..ec30310f 100644
--- a/windows.c
+++ b/windows.c
@@ -168,12 +168,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, 
@@ -190,8 +193,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, 
@@ -224,6 +230,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("");
@@ -415,10 +441,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;