Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 145187) +++ apps/app_meetme.c (working copy) @@ -938,8 +938,7 @@ } AST_LIST_UNLOCK(&confs); return usr ? ast_strdup(usrno) : NULL; - } else if (strstr(line, "list") && (state == 0)) - return ast_strdup("concise"); + } } return NULL; @@ -950,11 +949,11 @@ /* Process the command */ struct ast_conference *cnf; int hr, min, sec; - int i = 0, total = 0; + int total = 0; time_t now; - struct ast_str *cmdline = NULL; + struct ast_str *cmdline; #define MC_HEADER_FORMAT "%-14s %-14s %-10s %-8s %-8s %-6s\n" -#define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" +#define MC_DATA_FORMAT "%-12.12s %4.4d %4.4s %02d:%02d:%02d %-8s %-6s\n" switch (cmd) { case CLI_INIT: @@ -967,20 +966,9 @@ return complete_meetmecmd(a->line, a->word, a->pos, a->n); } - /* Check for length so no buffer will overflow... */ - for (i = 0; i < a->argc; i++) { - if (strlen(a->argv[i]) > 100) - ast_cli(a->fd, "Invalid Arguments.\n"); - } - - /* Max confno length */ - if (!(cmdline = ast_str_create(MAX_CONFNUM))) { - return CLI_FAILURE; - } - - if (a->argc == 1 || (a->argc == 2 && !strcasecmp(a->argv[1], "concise"))) { + if (a->argc <= e->args + 1) { /* 'MeetMe': List all the conferences */ - int concise = (a->argc == 2 && !strcasecmp(a->argv[1], "concise")); + int concise = (a->argc >= 3 && !strcasecmp(a->argv[2], "concise")); now = time(NULL); AST_LIST_LOCK(&confs); if (AST_LIST_EMPTY(&confs)) { @@ -988,13 +976,20 @@ ast_cli(a->fd, "No active MeetMe conferences.\n"); } AST_LIST_UNLOCK(&confs); - ast_free(cmdline); return CLI_SUCCESS; } if (!concise) { ast_cli(a->fd, MC_HEADER_FORMAT, "Conf Num", "Parties", "Marked", "Activity", "Creation", "Locked"); } + /* Max confno length */ + if (!(cmdline = ast_str_create(MAX_CONFNUM))) { + return CLI_FAILURE; + } AST_LIST_TRAVERSE(&confs, cnf, list) { + if ((a->argc == 3 && !concise && strcmp(cnf->confno, a->argv[2])) + || (a->argc == 4 && concise && strcmp(cnf->confno, a->argv[3]))) { + continue; + } if (cnf->markedusers == 0) { ast_str_set(&cmdline, 0, "N/A "); } else { @@ -1024,16 +1019,7 @@ ast_free(cmdline); return CLI_SUCCESS; } - if (a->argc < 2) { - ast_free(cmdline); - return CLI_SHOWUSAGE; - } - ast_debug(1, "Cmdline: %s\n", cmdline->str); - - admin_exec(NULL, cmdline->str); - ast_free(cmdline); - return CLI_SUCCESS; }