[Asterisk-cvs] asterisk/apps app_hasnewvoicemail.c,1.7,1.7.2.1

russell at lists.digium.com russell at lists.digium.com
Sun Oct 3 12:41:45 CDT 2004


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

Modified Files:
      Tag: v1-0
	app_hasnewvoicemail.c 
Log Message:
Has(New)VoiceMail does not assume INBOX if no folder specified (bug #2559)


Index: app_hasnewvoicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_hasnewvoicemail.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -d -r1.7 -r1.7.2.1
--- app_hasnewvoicemail.c	14 Jul 2004 07:22:30 -0000	1.7
+++ app_hasnewvoicemail.c	3 Oct 2004 16:43:29 -0000	1.7.2.1
@@ -38,6 +38,7 @@
 #include <asterisk/pbx.h>
 #include <asterisk/module.h>
 #include <asterisk/lock.h>
+#include <asterisk/utils.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
@@ -70,7 +71,7 @@
 {
 	int res=0;
 	struct localuser *u;
-	char vmpath[256], *input, *varname = NULL, *vmbox, *vmfolder = "INBOX", *context = "default";
+	char vmpath[256], *temps, *input, *varname = NULL, *vmbox, *vmfolder = "INBOX", *context = "default";
 	DIR *vmdir;
 	struct dirent *vment;
 	int vmcount = 0;
@@ -83,21 +84,22 @@
 
 	input = ast_strdupa((char *)data);
 	if (input) {
-		if ((vmbox = strsep(&input,":")))
-			if ((vmfolder = strsep(&input,"|")))
+		temps = input;
+		if ((temps = strsep(&input, "|"))) {
+			if (input && !ast_strlen_zero(input))
 				varname = input;
-			else
+			input = temps;
+		}
+		if ((temps = strsep(&input, ":"))) {
+			if (input && !ast_strlen_zero(input))
 				vmfolder = input;
-		else
-			if ((vmbox = strsep(&input,"|")))
-				varname = input;
-			else
-				vmbox = input;
-
-		if (index(vmbox,'@')) {
-			context = vmbox;
-			vmbox = strsep(&context,"@");
+			input = temps;
 		}
+		if ((vmbox = strsep(&input, "@")))
+			if (input && !ast_strlen_zero(input))
+				context = input;
+		if (!vmbox)
+			vmbox = input;
 
 		snprintf(vmpath,sizeof(vmpath), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, vmbox, vmfolder);
 		if (!(vmdir = opendir(vmpath))) {




More information about the svn-commits mailing list