]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 263589 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 17 May 2010 19:37:11 +0000 (19:37 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 17 May 2010 19:37:11 +0000 (19:37 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r263589 | tilghman | 2010-05-17 14:31:15 -0500 (Mon, 17 May 2010) | 9 lines

  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
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.2@263590 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index aab15c5db524b82ce4cb9f3d1ebc0b6063a5c018..993fe88ec2c408eed0178af3974e78cb5a81a9d5 100644 (file)
@@ -1785,34 +1785,34 @@ exit:
 static int folder_int(const char *folder)
 {
        /*assume a NULL folder means INBOX*/
-       if (!folder)
+       if (!folder) {
                return 0;
-#ifdef IMAP_STORAGE
-       if (!strcasecmp(folder, imapfolder))
-#else
-       if (!strcasecmp(folder, "INBOX"))
-#endif
+       }
+       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)
@@ -1863,14 +1863,11 @@ static int __messagecount(const char *context, const char *mailbox, const char *
        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;
-               }
        }
 
        /* add one if not there... */
@@ -1893,7 +1890,7 @@ static int __messagecount(const char *context, const char *mailbox, const char *
                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;
                }
@@ -1905,9 +1902,14 @@ static int __messagecount(const char *context, const char *mailbox, const char *
                        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;