[Asterisk-cvs] asterisk/apps app_meetme.c,1.61,1.62

markster at lists.digium.com markster at lists.digium.com
Mon Oct 11 11:39:44 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv24889/apps

Modified Files:
	app_meetme.c 
Log Message:
Add global mute/unmute (bug #2601)


Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- app_meetme.c	2 Oct 2004 00:58:31 -0000	1.61
+++ app_meetme.c	11 Oct 2004 15:40:24 -0000	1.62
@@ -92,6 +92,8 @@
 "      'l' -- Unlock conference\n"
 "      'M' -- Mute conference\n"
 "      'm' -- Unmute conference\n"
+"      'N' -- Mute entire conference (except admin)\n"
+"      'n' -- Unmute entire conference (except admin)\n"
 "";
 
 STANDARD_LOCAL_USER;
@@ -340,12 +342,20 @@
 			return RESULT_SHOWUSAGE;
 		if (strcmp(argv[1], "mute") == 0) {
 			/* Mute */
-			strncat(cmdline, "|M|", sizeof(cmdline) - strlen(cmdline) - 1);	
-			strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
+			if (strcmp(argv[3], "all") == 0) {
+				 strncat(cmdline, "|N", sizeof(cmdline) - strlen(cmdline) - 1);
+			} else {
+				strncat(cmdline, "|M|", sizeof(cmdline) - strlen(cmdline) - 1);	
+				strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
+			}
 		} else {
 			/* Unmute */
-			strncat(cmdline, "|m|", sizeof(cmdline) - strlen(cmdline) - 1);
-			strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
+			if (strcmp(argv[3], "all") == 0) {
+				 strncat(cmdline, "|n", sizeof(cmdline) - strlen(cmdline) - 1);
+			} else {
+				strncat(cmdline, "|m|", sizeof(cmdline) - strlen(cmdline) - 1);
+				strncat(cmdline, argv[3], sizeof(cmdline) - strlen(cmdline) - 1);
+			}
 		}
 	} else if (strcmp(argv[1], "kick") == 0) {
 		if (argc < 4)
@@ -379,7 +389,7 @@
 		/* Show all the users */
 		user = cnf->firstuser;
 		while(user) {
-			ast_cli(fd, "User #: %i  Channel: %s %s %s\n", user->user_no, user->chan->name, (user->userflags & CONFFLAG_ADMIN) ? "(Admin)" : "", (user->userflags & CONFFLAG_MONITOR) ? "(Listen only)" : "" );
+			ast_cli(fd, "User #: %i  Channel: %s %s %s %s\n", user->user_no, user->chan->name, (user->userflags & CONFFLAG_ADMIN) ? "(Admin)" : "", (user->userflags & CONFFLAG_MONITOR) ? "(Listen only)" : "", (user->adminflags & ADMINFLAG_MUTED) ? "(Admn Muted)" : "" );
 			user = user->nextuser;
 		}
 		return RESULT_SUCCESS;
@@ -425,7 +435,7 @@
 	} else if (pos == 3) {
 		/* User Number || Conf Command option*/
 		if (strstr(line, "mute") || strstr(line, "kick")) {
-			if ((state == 0) && (strstr(line, "kick")) && !(strncasecmp(word, "all", strlen(word)))) {
+			if ((state == 0) && (strstr(line, "kick") || strstr(line,"mute")) && !(strncasecmp(word, "all", strlen(word)))) {
 				return strdup("all");
 			}
 			which++;
@@ -1492,6 +1502,18 @@
 						ast_log(LOG_NOTICE, "Specified User not found!");
 					}
 					break;
+				case 78: /* N: Mute all users */
+					user = cnf->firstuser;
+					while(user) {
+						if (user && !(user->userflags & CONFFLAG_ADMIN))
+							user->adminflags |= ADMINFLAG_MUTED;
+						if (user->nextuser) {
+							user = user->nextuser;
+						} else {
+							break;
+						}
+					}
+					break;					
 				case 109: /* m: Unmute */ 
 					if (user && (user->adminflags & ADMINFLAG_MUTED)) {
 						user->adminflags ^= ADMINFLAG_MUTED;
@@ -1499,6 +1521,19 @@
 						ast_log(LOG_NOTICE, "Specified User not found or he muted himself!");
 					}
 					break;
+				case  110: /* n: Unmute all users */
+					user = cnf->firstuser;
+					while(user) {
+						if (user && (user-> adminflags & ADMINFLAG_MUTED)) {
+							user->adminflags ^= ADMINFLAG_MUTED;
+						}
+						if (user->nextuser) {
+							user = user->nextuser;
+						} else {
+							break;
+						}
+					}
+					break;
 				case 107: /* k: Kick user */ 
 					if (user) {
 						user->adminflags |= ADMINFLAG_KICKME;




More information about the svn-commits mailing list