1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Show how many windows closed with /close all and /close read

This commit is contained in:
James Booth 2013-05-16 23:47:33 +01:00
parent 5a3db018dc
commit aa1f8b655c

View File

@ -2514,6 +2514,7 @@ _cmd_close(gchar **args, struct cmd_help_t help)
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = 0;
int curr = 0;
int count = 0;
if (args[0] == NULL) {
index = ui_current_win_index();
@ -2524,10 +2525,16 @@ _cmd_close(gchar **args, struct cmd_help_t help)
_close_connected_win(curr);
}
ui_close_win(curr);
count++;
}
}
cons_show("Closed all windows.");
if (count == 0) {
cons_show("No windows to close.");
} else if (count == 1) {
cons_show("Closed 1 window.");
} else {
cons_show("Closed %d windows.", count);
}
return TRUE;
} else if (strcmp(args[0], "read") == 0) {
for (curr = 1; curr <= 9; curr++) {
@ -2536,9 +2543,16 @@ _cmd_close(gchar **args, struct cmd_help_t help)
_close_connected_win(curr);
}
ui_close_win(curr);
count++;
}
}
cons_show("Closed windows.");
if (count == 0) {
cons_show("No windows to close.");
} else if (count == 1) {
cons_show("Closed 1 window.");
} else {
cons_show("Closed %d windows.", count);
}
return TRUE;
} else {
index = atoi(args[0]);