[asterisk-commits] tilghman: trunk r263589 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 17 14:31:21 CDT 2010


Author: tilghman
Date: Mon May 17 14:31:15 2010
New Revision: 263589

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=263589
Log:
With IMAP backend, messages in INBOX were counted twice for MWI.

(closes issue #17135)
 Reported by: edhorton
 Patches: 
       20100513__issue17135.diff.txt uploaded by tilghman (license 14)
       17135_2.diff uploaded by ebroad (license 878)
 Tested by: edhorton, ebroad

Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=263589&r1=263588&r2=263589
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Mon May 17 14:31:15 2010
@@ -1924,30 +1924,34 @@
 static int folder_int(const char *folder)
 {
 	/*assume a NULL folder means INBOX*/
-	if (!folder)
+	if (!folder) {
 		return 0;
-	if (!strcasecmp(folder, imapfolder))
+	}
+	if (!strcasecmp(folder, imapfolder)) {
 		return 0;
-	else if (!strcasecmp(folder, "Old"))
+	} else if (!strcasecmp(folder, "Old")) {
 		return 1;
-	else if (!strcasecmp(folder, "Work"))
+	} else if (!strcasecmp(folder, "Work")) {
 		return 2;
-	else if (!strcasecmp(folder, "Family"))
+	} else if (!strcasecmp(folder, "Family")) {
 		return 3;
-	else if (!strcasecmp(folder, "Friends"))
+	} else if (!strcasecmp(folder, "Friends")) {
 		return 4;
-	else if (!strcasecmp(folder, "Cust1"))
+	} else if (!strcasecmp(folder, "Cust1")) {
 		return 5;
-	else if (!strcasecmp(folder, "Cust2"))
+	} else if (!strcasecmp(folder, "Cust2")) {
 		return 6;
-	else if (!strcasecmp(folder, "Cust3"))
+	} else if (!strcasecmp(folder, "Cust3")) {
 		return 7;
-	else if (!strcasecmp(folder, "Cust4"))
+	} else if (!strcasecmp(folder, "Cust4")) {
 		return 8;
-	else if (!strcasecmp(folder, "Cust5"))
+	} else if (!strcasecmp(folder, "Cust5")) {
 		return 9;
-	else /*assume they meant INBOX if folder is not found otherwise*/
+	} else if (!strcasecmp(folder, "Urgent")) {
+		return 11;
+	} else { /*assume they meant INBOX if folder is not found otherwise*/
 		return 0;
+	}
 }
 
 static int __messagecount(const char *context, const char *mailbox, const char *folder)
@@ -1998,13 +2002,10 @@
 	if (vms_p) {
 		ast_debug(3, "Returning before search - user is logged in\n");
 		if (fold == 0) { /* INBOX */
-			return vms_p->newmessages;
+			return urgent ? vms_p->urgentmessages : vms_p->newmessages;
 		}
 		if (fold == 1) { /* Old messages */
 			return vms_p->oldmessages;
-		}
-		if (fold == 11) {/*Urgent messages*/
-		 	return vms_p->urgentmessages;
 		}
 	}
 
@@ -2028,7 +2029,7 @@
 		hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)(!ast_strlen_zero(vmu->imapvmshareid) ? vmu->imapvmshareid : mailbox));
 		hdr->next = mail_newsearchheader("X-Asterisk-VM-Context", (char *) S_OR(context, "default"));
 		pgm->header = hdr;
-		if (fold != 1) {
+		if (fold != OLD_FOLDER) {
 			pgm->unseen = 1;
 			pgm->seen = 0;
 		}
@@ -2040,9 +2041,14 @@
 			pgm->seen = 1;
 		}
 		/* look for urgent messages */
-		if (urgent) {
-			pgm->flagged = 1;
-			pgm->unflagged = 0;
+		if (fold == NEW_FOLDER) {
+			if (urgent) {
+				pgm->flagged = 1;
+				pgm->unflagged = 0;
+			} else {
+				pgm->flagged = 0;
+				pgm->unflagged = 1;
+			}
 		}
 		pgm->undeleted = 1;
 		pgm->deleted = 0;




More information about the asterisk-commits mailing list