Index: apps/app_voicemail.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v retrieving revision 1.52 diff -u -r1.52 app_voicemail.c --- apps/app_voicemail.c 12 Jan 2004 23:21:29 -0000 1.52 +++ apps/app_voicemail.c 12 Jan 2004 23:45:45 -0000 @@ -3051,16 +3051,19 @@ struct dirent *vment; int vmcount = 0; char count[12]; - make_dir(dirname, 255, vmu->context, vmu->mailbox, "INBOX"); - if ((vmdir = opendir(dirname))) { - /* No matter what the format of VM, there will always be a .txt file for each message. */ - while ((vment = readdir(vmdir))) - if (!strncmp(vment->d_name + 7,".txt",4)) - vmcount++; - closedir(vmdir); + + if ((argc == 3) || ((argc == 5) && !strcmp(argv[4],vmu->context))) { + make_dir(dirname, 255, vmu->context, vmu->mailbox, "INBOX"); + if ((vmdir = opendir(dirname))) { + /* No matter what the format of VM, there will always be a .txt file for each message. */ + while ((vment = readdir(vmdir))) + if (!strncmp(vment->d_name + 7,".txt",4)) + vmcount++; + closedir(vmdir); + } + snprintf(count,11,"%d",vmcount); + ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count); } - snprintf(count,11,"%d",vmcount); - ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count); vmu = vmu->next; } } else {