From db344967da8627b39986d64f59a9f15846b4a5f2 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Mon, 19 Oct 2009 00:12:13 +0000 Subject: [PATCH] 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: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@224449 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_voicemail.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 23303e48bc..00ba2b91b7 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'; -- 2.47.2