aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-19 00:12:13 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-19 00:12:13 +0000
commit28859cc259516c9a848d2c5e499fc66e0eb488fd (patch)
tree889016de0ebc0d03955fb4acde2213d41af4e704 /apps/app_voicemail.c
parent405edd5f3301793af980e6199b6167acc4cbade0 (diff)
Merged revisions 224448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r224448 | tilghman | 2009-10-18 19:05:56 -0500 (Sun, 18 Oct 2009) | 3 lines Allow ODBC storage to be queried with multiple mailboxes. This corrects an issue reported on the -users list. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@224449 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 23303e48b..00ba2b91b 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3976,7 +3976,6 @@ static void free_zone(struct vm_zone *z)
}
#ifdef ODBC_STORAGE
-/*! XXX \todo Fix this function to support multiple mailboxes in the intput string */
static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
{
int x = -1;
@@ -3999,7 +3998,24 @@ static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
return 0;
ast_copy_string(tmp, mailbox, sizeof(tmp));
-
+
+ if (strchr(mailbox, ',') || strchr(mailbox, ' ')) {
+ char *next, *remaining = tmp;
+ int n, o;
+ while ((next = strsep(&remaining, " ,"))) {
+ if (inboxcount(next, &n, &o)) {
+ return -1;
+ }
+ if (newmsgs) {
+ *newmsgs += n;
+ }
+ if (oldmsgs) {
+ *oldmsgs += o;
+ }
+ }
+ return 0;
+ }
+
context = strchr(tmp, '@');
if (context) {
*context = '\0';