aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-09 23:47:00 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-09 23:47:00 +0000
commitb15f499bd7c7d4167cff98ff4eca057ce371e083 (patch)
tree71a818a7dfd5032d3e0e4923135e1178de190ec9 /apps/app_voicemail.c
parent2c9e652ec8c44b3da342ffaaa1b11c7c1eefffce (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@78907 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 8650e3173..403e9b2d1 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -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';