Index: apps/app_hasnewvoicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_hasnewvoicemail.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- apps/app_hasnewvoicemail.c 2 Oct 2004 00:58:31 -0000 1.8 +++ apps/app_hasnewvoicemail.c 3 Oct 2004 05:38:27 -0000 1.9 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -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))) {