[asterisk-commits] mmichelson: branch mmichelson/queue-reset r167162 - /team/mmichelson/queue-re...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 4 13:37:43 CST 2009


Author: mmichelson
Date: Sun Jan  4 13:37:42 2009
New Revision: 167162

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167162
Log:
Allow for the new CLI commands to operate on multiple queues

This again passes the compilation test, but I have not yet
tested it. That's next on the agenda.


Modified:
    team/mmichelson/queue-reset/apps/app_queue.c

Modified: team/mmichelson/queue-reset/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/apps/app_queue.c?view=diff&rev=167162&r1=167161&r2=167162
==============================================================================
--- team/mmichelson/queue-reset/apps/app_queue.c (original)
+++ team/mmichelson/queue-reset/apps/app_queue.c Sun Jan  4 13:37:42 2009
@@ -6772,16 +6772,16 @@
 static char *handle_queue_reset(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_flags mask = {0,};
-	char *queuename = NULL;
+	int i;
 
 	switch (cmd) {
 		case CLI_INIT:
 			e->command = "queue reset stats";
 			e->usage =
-				"Usage: queue reset stats [<queuename>]\n"
+				"Usage: queue reset stats [<queuenames>]\n"
 				"\n"
 				"Issuing this command will reset statistics for\n"
-				"<queuename>, or for all queues if no queue is\n"
+				"<queuenames>, or for all queues if no queue is\n"
 				"specified.\n";
 			return NULL;
 		case CLI_GENERATE:
@@ -6796,27 +6796,32 @@
 		return CLI_SHOWUSAGE;
 	}
 
-	if (a->argc == 4) {
-		queuename = a->argv[3];
-	}
-
 	ast_set_flag(&mask, QUEUE_RESET_STATS);
 
-	reload_handler(1, &mask, queuename);
+	if (a->argc == 3) {
+		reload_handler(1, &mask, NULL);
+		return CLI_SUCCESS;
+	}
+
+	for (i = 3; i < a->argc; ++i) {
+		reload_handler(1, &mask, a->argv[i]);
+	}
+
 	return CLI_SUCCESS;
 }
 
 static char *handle_queue_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_flags mask = {0,};
-	char *queuename = NULL;
+	int i;
+
 	switch (cmd) {
 		case CLI_INIT:
 			e->command = "queue reload {parameters|members|rules|all}";
 			e->usage =
-				"Usage: queue reload {parameters|members|rules|all} [<queuename>]\n"
-				"Reload queues. If <queuename> is specified, only reload information pertaining\n"
-				"to <queuename>. One of 'parameters,' 'members,' 'rules,' or 'all' must be\n"
+				"Usage: queue reload {parameters|members|rules|all} [<queuenames>]\n"
+				"Reload queues. If <queuenames> are specified, only reload information pertaining\n"
+				"to <queuenames>. One of 'parameters,' 'members,' 'rules,' or 'all' must be\n"
 				"specified in order to know what information to reload. Below is an explanation\n"
 				"of each of these qualifiers.\n"
 				"\n"
@@ -6851,11 +6856,14 @@
 		ast_set_flag(&mask, AST_FLAGS_ALL);
 	}
 
-	if (a->argc == 4) {
-		queuename = a->argv[3];
-	}
-
-	reload_handler(1, &mask, queuename);
+	if (a->argc == 3) {
+		reload_handler(1, &mask, NULL);
+		return CLI_SUCCESS;
+	}
+
+	for (i = 3; i < a->argc; ++i) {
+		reload_handler(1, &mask, a->argv[i]);
+	}
 
 	return CLI_SUCCESS;
 }




More information about the asterisk-commits mailing list