about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-05-16 22:34:05 +0100
committerJames Booth <boothj5@gmail.com>2013-05-16 22:34:05 +0100
commit2f927523657fa3949c8b9d7365152b21f2ab2f0c (patch)
tree712403e2dd4b50d4a93fdd8f60d7e9fc484596cb /src/command
parent57e64bebe58f051eafc90b27ebe328128fe47095 (diff)
downloadprofani-tty-2f927523657fa3949c8b9d7365152b21f2ab2f0c.tar.gz
Added "read" parameter to /close
Closes all windows where there are no unread messages
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c
index b986239f..4f2c1932 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -482,12 +482,13 @@ static struct cmd_t main_commands[] =
 
     { "/close",
         _cmd_close, parse_args, 0, 1,
-        { "/close [win|all]", "Close a window window.",
-        { "/close [win|all]",
-          "----------------",
+        { "/close [win|read|all]", "Close a window window.",
+        { "/close [win|read|all]",
+          "---------------------",
           "Passing no argument will close the current window.",
           "Passing 2,3,4,5,6,7,8,9 or 0 will close the specified window.",
           "Passing 'all' will close all currently open windows.",
+          "Passing 'read' will close all windows that have no unread messages.",
           "The console window cannot be closed.",
           "If in a chat room, you will leave the room.",
           NULL } } },
@@ -2520,6 +2521,17 @@ _cmd_close(gchar **args, struct cmd_help_t help)
 
         cons_show("Closed all windows.");
         return TRUE;
+    } else if (strcmp(args[0], "read") == 0) {
+        for (curr = 1; curr <= 9; curr++) {
+            if (ui_win_exists(curr) && (ui_win_unread(curr) == 0)) {
+                if (conn_status == JABBER_CONNECTED) {
+                    _close_connected_win(curr);
+                }
+                ui_close_win(curr);
+            }
+        }
+        cons_show("Closed windows.");
+        return TRUE;
     } else {
         index = atoi(args[0]);
         if (index == 0) {