From 8017bc6e6f0ef07edac7ee76037b473a791733e7 Mon Sep 17 00:00:00 2001 From: Joshua Colp <jcolp@digium.com> Date: Mon, 27 Nov 2006 18:10:59 +0000 Subject: [PATCH] Merged revisions 48054 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r48054 | file | 2006-11-27 13:06:50 -0500 (Mon, 27 Nov 2006) | 10 lines Merged revisions 48053 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r48053 | file | 2006-11-27 13:03:57 -0500 (Mon, 27 Nov 2006) | 2 lines Use the proper function to get the new message count instead of always using the filesystem. (issue #8421 reported by slimey) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48056 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index da34569b36..57eed5fd84 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6970,22 +6970,13 @@ static int handle_voicemail_show_users(int fd, int argc, char *argv[]) } } AST_LIST_TRAVERSE(&users, vmu, list) { - char dirname[256]; - DIR *vmdir; - struct dirent *vment; - int vmcount = 0; - char count[12]; + int newmsgs = 0, oldmsgs = 0; + char count[12], tmp[256] = ""; 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 (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7,".txt",4)) - vmcount++; - closedir(vmdir); - } - snprintf(count,sizeof(count),"%d",vmcount); + snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context); + inboxcount(tmp, &newmsgs, &oldmsgs); + snprintf(count,sizeof(count),"%d",newmsgs); ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count); } } -- GitLab