[Asterisk-cvs] asterisk/apps app_hasnewvoicemail.c,1.9,1.10

markster at lists.digium.com markster at lists.digium.com
Sun Oct 3 17:22:12 CDT 2004


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

Modified Files:
	app_hasnewvoicemail.c 
Log Message:
Add app_hasnewvoicemail


Index: app_hasnewvoicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_hasnewvoicemail.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_hasnewvoicemail.c	3 Oct 2004 05:38:27 -0000	1.9
+++ app_hasnewvoicemail.c	3 Oct 2004 21:23:54 -0000	1.10
@@ -59,9 +59,10 @@
 static char *app_hasnewvoicemail = "HasNewVoicemail";
 static char *hasnewvoicemail_synopsis = "Conditionally branches to priority + 101";
 static char *hasnewvoicemail_descrip =
-"HasNewVoicemail(vmbox[@context][|varname])\n"
-"  Branches to priority + 101, if there is voicemail in folder INBOX."
-"  Optionally sets <varname> to the number of messages in that folder.\n";
+"HasNewVoicemail(vmbox[/folder][@context][|varname])\n"
+"  Branches to priority + 101, if there is voicemail in folder 'folder' or INBOX.\n"
+"if folder is not specified. Optionally sets <varname> to the number of messages\n" 
+"in that folder.\n";
 
 STANDARD_LOCAL_USER;
 
@@ -71,7 +72,8 @@
 {
 	int res=0;
 	struct localuser *u;
-	char vmpath[256], *temps, *input, *varname = NULL, *vmbox, *vmfolder = "INBOX", *context = "default";
+	char vmpath[256], *temps, *input, *varname = NULL, *vmbox, *context = "default";
+	char *vmfolder;
 	DIR *vmdir;
 	struct dirent *vment;
 	int vmcount = 0;
@@ -100,7 +102,12 @@
 				context = input;
 		if (!vmbox)
 			vmbox = input;
-
+		vmfolder = strchr(vmbox, '/');
+		if (vmfolder) {
+			*vmfolder = '\0';
+			vmfolder++;
+		} else
+			vmfolder = "INBOX";
 		snprintf(vmpath,sizeof(vmpath), "%s/voicemail/%s/%s/%s", (char *)ast_config_AST_SPOOL_DIR, context, vmbox, vmfolder);
 		if (!(vmdir = opendir(vmpath))) {
 			ast_log(LOG_NOTICE, "Voice mailbox %s at %s does not exist\n", vmbox, vmpath);




More information about the svn-commits mailing list