summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-03-07 19:14:46 +0000
committerMatthew Jordan <mjordan@digium.com>2013-03-07 19:14:46 +0000
commitb0fc2032ffb4ac7b5f2f67ee1ae495edd50a9dba (patch)
tree84104f671872a4a7d1873a711a651a6d9db80841
parentdd867daac9a564a02c7d5f30afff55d5941af53f (diff)
Let vm_mailbox_snapshot combine "Urgent" when no folder is specified
r381835 fixed a bug in vm_mailbox_snapshot where combining INBOX and Old forgot that Urgent also "counts" as new messages. This fixed the problem when any of the three folders was specified and the combine option was used. It missed the case where the folder isn't specified and we build a snapshot of all folders. This patch corrects that. ........ Merged revisions 382617 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_voicemail.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 857c78d6e..d0a8a7820 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -15059,8 +15059,9 @@ static struct ast_vm_mailbox_snapshot *vm_mailbox_snapshot_create(const char *ma
int i;
int this_index_only = -1;
int open = 0;
- int inbox_index = 0;
- int old_index = 1;
+ int inbox_index = get_folder_by_name("INBOX");
+ int old_index = get_folder_by_name("Old");
+ int urgent_index = get_folder_by_name("Urgent");
if (ast_strlen_zero(mailbox)) {
ast_log(LOG_WARNING, "Cannot create a mailbox snapshot since no mailbox was specified\n");
@@ -15102,7 +15103,14 @@ static struct ast_vm_mailbox_snapshot *vm_mailbox_snapshot_create(const char *ma
for (i = 0; i < mailbox_snapshot->folders; i++) {
int combining_old = 0;
- if ((i == old_index) && (combine_INBOX_and_OLD)) {
+ /* Assume we are combining folders if:
+ * - The current index is the old folder index OR
+ * - The current index is urgent and we were looking for INBOX or all folders OR
+ * - The current index is INBOX and we were looking for Urgent or all folders
+ */
+ if ((i == old_index ||
+ (i == urgent_index && (this_index_only == inbox_index || this_index_only == -1)) ||
+ (i == inbox_index && (this_index_only == urgent_index || this_index_only == -1))) && (combine_INBOX_and_OLD)) {
combining_old = 1;
}