[svn-commits] file: branch 1.2 r48053 - /branches/1.2/apps/app_voicemail.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Nov 27 11:03:58 MST 2006


Author: file
Date: Mon Nov 27 12:03:57 2006
New Revision: 48053

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48053
Log:
Use the proper function to get the new message count instead of always using the filesystem. (issue #8421 reported by slimey)

Modified:
    branches/1.2/apps/app_voicemail.c

Modified: branches/1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_voicemail.c?view=diff&rev=48053&r1=48052&r2=48053
==============================================================================
--- branches/1.2/apps/app_voicemail.c (original)
+++ branches/1.2/apps/app_voicemail.c Mon Nov 27 12:03:57 2006
@@ -5768,22 +5768,13 @@
 			}
 		}
 		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;



More information about the svn-commits mailing list