about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-27 00:17:35 +0000
committerJames Booth <boothj5@gmail.com>2012-11-27 00:17:35 +0000
commit671e7d589f55f259f647ae5553cdfa82a229b250 (patch)
treede483018573e89501f4bb6ec1c7a22ea2126fedd /src
parent213ccc0150ab50084ddb80721a38a552fff76686 (diff)
downloadprofani-tty-671e7d589f55f259f647ae5553cdfa82a229b250.tar.gz
Show message on /msg when windows full
Diffstat (limited to 'src')
-rw-r--r--src/command.c2
-rw-r--r--src/ui.h1
-rw-r--r--src/windows.c13
3 files changed, 16 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index 73180d24..4a177882 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1264,6 +1264,8 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
 
     if (conn_status != JABBER_CONNECTED) {
         cons_show("You are not currently connected.");
+    } else if (ui_windows_full()) {
+        cons_bad_show("Windows all used, close a window and try again.");
     } else {
         jabber_send(msg, usr);
         win_show_outgoing_msg("me", usr, msg);
diff --git a/src/ui.h b/src/ui.h
index f329dc36..02128714 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -75,6 +75,7 @@ void ui_contact_offline(const char * const from, const char * const show,
 void ui_disconnected(void);
 void ui_handle_special_keys(const int * const ch);
 void ui_switch_win(const int i);
+gboolean ui_windows_full(void);
 
 // create windows
 void create_title_bar(void);
diff --git a/src/windows.c b/src/windows.c
index 64a18bd6..f75c0bb9 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -166,6 +166,19 @@ ui_load_colours(void)
     }
 }
 
+gboolean
+ui_windows_full(void)
+{
+    int i;
+    for (i = 1; i < NUM_WINS; i++) {
+        if (windows[i] == NULL) {
+            return FALSE;
+        }
+    }
+
+    return TRUE;
+}
+
 void
 ui_show_typing(const char * const from)
 {