]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Improved a bit of logic regarding comma-separated mailboxes in has_voicemail. Also...
authorMark Michelson <mmichelson@digium.com>
Thu, 9 Aug 2007 23:47:00 +0000 (23:47 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 9 Aug 2007 23:47:00 +0000 (23:47 +0000)
since unbraced if statements scare me in general.

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

apps/app_voicemail.c

index 8650e3173c3e05c1d64a2dd9ad5041cd4dd36b18..403e9b2d1a5b02796ad30100debc56605ddf4203 100644 (file)
@@ -2515,12 +2515,14 @@ static int inboxcount(const char *mailbox_context, int *newmsgs, int *oldmsgs)
                context = "default";
                mailboxnc = (char *)mailbox_context;
        }
-       if (newmsgs)
+       if (newmsgs) {
                if((*newmsgs = messagecount(context, mailboxnc, "INBOX")) < 0)
                        return -1;
-       if (oldmsgs)
+       }
+       if (oldmsgs) {
                if((*oldmsgs = messagecount(context, mailboxnc, "Old")) < 0)
                        return -1;
+       }
        return 0;
 }
        
@@ -2530,9 +2532,13 @@ static int has_voicemail(const char *mailbox, const char *folder)
        char tmp[256], *tmp2, *mbox, *context;
        ast_copy_string(tmp, mailbox, sizeof(tmp));
        tmp2 = tmp;
-       while (strcmp((mbox = strsep(&tmp2, ",")), mailbox)) {
-               if (has_voicemail(mbox, folder))
-                       return 1;
+       if(strchr(tmp2, ',')) {
+               while((mbox = strsep(&tmp2, ","))) {
+                       if(!ast_strlen_zero(mbox)) {
+                               if (has_voicemail(mbox, folder))
+                                       return 1;
+                       }
+               }
        }
        if ((context= strchr(tmp, '@')))
                *context++ = '\0';