aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-27 18:03:57 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-27 18:03:57 +0000
commite125088dbafdae6e1e61e3951cd0ffe46b32a47e (patch)
treee3ad15120a1a578887fcb4363ea76c76d41a6ac5
parente65feea0fab3b7c88cee1ffbb96a30cbe448d0f2 (diff)
Use the proper function to get the new message count instead of always using the filesystem. (issue #8421 reported by slimey)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@48053 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index e76669db7..a1b46d318 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5768,22 +5768,13 @@ static int handle_show_voicemail_users(int fd, int argc, char *argv[])
}
}
while (vmu) {
- 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);
+ messagecount(tmp, &newmsgs, &oldmsgs);
+ snprintf(count,sizeof(count),"%d",newmsgs);
ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
}
vmu = vmu->next;