diff options
author | Mark Michelson <mmichelson@digium.com> | 2007-08-09 23:49:05 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2007-08-09 23:49:05 +0000 |
commit | 31aa5e02f1f5a09c7f8421995ce932cc39555509 (patch) | |
tree | 723a6597f05728d5b3cc5f6c88b07e62e51a27a6 /apps | |
parent | c0d15cdef1e4533f6589683b371a4d8636e9df4a (diff) |
Merged revisions 78907 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r78907 | mmichelson | 2007-08-09 18:47:00 -0500 (Thu, 09 Aug 2007) | 4 lines
Improved a bit of logic regarding comma-separated mailboxes in has_voicemail. Also added some braces to some compound if statements
since unbraced if statements scare me in general.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78908 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index eedf7c1ce..471fb2d05 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2702,14 +2702,16 @@ 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; - } + } + return 0; +} static int has_voicemail(const char *mailbox, const char *folder) @@ -2717,9 +2719,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'; |