From 671e7d589f55f259f647ae5553cdfa82a229b250 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 27 Nov 2012 00:17:35 +0000 Subject: Show message on /msg when windows full --- src/command.c | 2 ++ src/ui.h | 1 + src/windows.c | 13 +++++++++++++ 3 files changed, 16 insertions(+) (limited to 'src') 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) { -- cgit 1.4.1-2-gfad0