]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 224448 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 19 Oct 2009 00:12:13 +0000 (00:12 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 19 Oct 2009 00:12:13 +0000 (00:12 +0000)
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

index 23303e48bc123e36782cbf3b30fd9f00550295b7..00ba2b91b71dc97d6e3658cb8ef3b912deeecf70 100644 (file)
@@ -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';