--- apps/app_meetme.c 2004-11-28 23:09:48.421673880 -0500 +++ apps/app_meetme.c 2004-11-28 23:09:35.028709920 -0500 @@ -62,6 +62,7 @@ " 'X' -- allow user to exit the conference by entering a valid single\n" " digit extension ${MEETME_EXIT_CONTEXT} or the current context\n" " if that variable is not defined.\n" +" 'c' -- override cloaked status of a conference\n" " 'd' -- dynamically add conference\n" " 'D' -- dynamically add conference, prompting for a PIN\n" " 'e' -- select an empty conference\n" @@ -88,6 +89,8 @@ " MeetMeAdmin(confno,command[,user]): Run admin command for conference\n" " 'K' -- Kick all users out of conference\n" " 'k' -- Kick one user out of conference\n" +" 'C' -- Cloak a conference\n" +" 'c' -- Uncloak a conference\n" " 'L' -- Lock conference\n" " 'l' -- Unlock conference\n" " 'M' -- Mute conference\n" @@ -112,6 +115,7 @@ time_t start; /* Start time (s) */ int isdynamic; /* Created on the fly? */ int locked; /* Is the conference locked? */ + int cloaked; /* Is the conference cloaked? */ char pin[AST_MAX_EXTENSION]; /* If protected by a PIN */ struct ast_conference *next; } *confs; @@ -157,7 +161,6 @@ #define CONFFLAG_EXIT_CONTEXT (1 << 12) /* If set, the MeetMe will exit to the specified context */ #define CONFFLAG_MARKEDUSER (1 << 13) /* If set, the user will be marked */ - static int careful_write(int fd, unsigned char *data, int len) { int res; @@ -257,6 +260,7 @@ cnf->firstuser = NULL; cnf->lastuser = NULL; cnf->locked = 0; + cnf->cloaked = 0; if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno); cnf->next = confs; @@ -337,6 +341,14 @@ /* Unlock */ strncat(cmdline, "|l", sizeof(cmdline) - strlen(cmdline) - 1); } + } else if (strstr(argv[1], "cloak")) { + if (strcmp(argv[1], "cloak") == 0) { + /* Cloak */ + strncat(cmdline, "|C", sizeof(cmdline) - strlen(cmdline) - 1); + } else { + /* Uncloak */ + strncat(cmdline, "|c", sizeof(cmdline) - strlen(cmdline) - 1); + } } else if (strstr(argv[1], "mute")) { if (argc < 4) return RESULT_SHOWUSAGE; @@ -386,6 +398,9 @@ return RESULT_SUCCESS; } } + /* Display status of conference if locked or cloaked */ + if (cnf->locked == 1 || cnf->cloaked == 1) + ast_cli(fd, "Conference: %s %s\n", (cnf->locked) ? "Locked " : "", (cnf->cloaked) ? "Cloaked " : ""); /* Show all the users */ user = cnf->firstuser; while(user) { @@ -401,13 +416,13 @@ } static char *complete_confcmd(char *line, char *word, int pos, int state) { - #define CONF_COMMANDS 6 + #define CONF_COMMANDS 8 int which = 0, x = 0; struct ast_conference *cnf = NULL; struct ast_conf_user *usr = NULL; char *confno = NULL; char usrno[50] = ""; - char cmds[CONF_COMMANDS][20] = {"lock", "unlock", "mute", "unmute", "kick", "list"}; + char cmds[CONF_COMMANDS][20] = {"lock", "unlock", "mute", "unmute", "kick", "list", "cloak", "uncloak"}; char *myline; if (pos == 1) { @@ -475,7 +490,7 @@ } static char conf_usage[] = -"Usage: meetme (un)lock|(un)mute|kick|list \n" +"Usage: meetme (un)cloak|(un)lock|(un)mute|kick|list \n" " Executes a command for the conference or on a conferee\n"; static struct ast_cli_entry cli_conf = { @@ -1181,8 +1196,10 @@ int retrycnt = 0; struct ast_conference *cnf; int confflags = 0; + int cloak_override = 0; int dynamic = 0; int empty = 0, empty_no_pin = 0; + int confno_int = 0; char *notdata, *info, *inflags = NULL, *inpin = NULL, the_pin[AST_MAX_EXTENSION] = ""; if (!data || ast_strlen_zero(data)) { @@ -1212,6 +1229,8 @@ strncpy(the_pin, inpin, sizeof(the_pin) - 1); if (inflags) { + if (strchr(inflags, 'c')) + cloak_override = 1; if (strchr(inflags, 'a')) confflags |= CONFFLAG_ADMIN; if (strchr(inflags, 'm')) @@ -1368,6 +1387,16 @@ if (!ast_strlen_zero(confno)) { /* Check the validity of the conference */ cnf = find_conf(chan, confno, 1, dynamic, the_pin); + if (cnf->cloaked == 1 && cloak_override == 0) { + /* Conference is cloaked... create their own conference! */ + dynamic = 1; /* Automagically create their own place! */ + confno_int = 1; /* Let's start fresh! */ + while (confno_int > 0 && 1024 > confno_int) { + snprintf(confno, sizeof(confno) - 1, "%d", confno_int); + cnf = find_conf(chan, confno, 1, dynamic, the_pin); + if (cnf->users == 0) break; + } + } if (!cnf) { res = ast_streamfile(chan, "conf-invalid", chan->language); if (!res) @@ -1482,6 +1511,12 @@ if (cnf) { switch((int) (*command)) { + case 67: /* C: Cloak */ + cnf->cloaked = 1; + break; + case 99: /* c: Unclock */ + cnf->cloaked = 0; + break; case 76: /* L: Lock */ cnf->locked = 1; break;