[asterisk-commits] qwell: branch 10-digiumphones r388815 - in /branches/10-digiumphones: ./ apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 15 09:25:13 CDT 2013


Author: qwell
Date: Wed May 15 09:25:08 2013
New Revision: 388815

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388815
Log:
Fix VM snapshot handling for combined INBOX.

This should make it more clear about what's happening.

Review: https://reviewboard.asterisk.org/r/2539/

Modified:
    branches/10-digiumphones/   (props changed)
    branches/10-digiumphones/apps/app_voicemail.c

Propchange: branches/10-digiumphones/
------------------------------------------------------------------------------
    svn:mergeinfo = /certified/branches/1.8.15:388814

Modified: branches/10-digiumphones/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/10-digiumphones/apps/app_voicemail.c?view=diff&rev=388815&r1=388814&r2=388815
==============================================================================
--- branches/10-digiumphones/apps/app_voicemail.c (original)
+++ branches/10-digiumphones/apps/app_voicemail.c Wed May 15 09:25:08 2013
@@ -14436,17 +14436,20 @@
 	mailbox_snapshot->folders = ARRAY_LEN(mailbox_folders);
 
 	for (i = 0; i < mailbox_snapshot->folders; i++) {
-		int combining_old = 0;
-		if ((i == old_index) && (combine_INBOX_and_OLD)) {
-			combining_old = 1;
-		}
-
-		/* This if statement is confusing looking.  Here is what it means in english.
-		 * - If a folder is given to the function and that folder's index is not the one we are iterating over, skip it...
-		 * - Unless the folder provided is the INBOX folder and the current index is the OLD folder and we are combining OLD and INBOX msgs.
+		int msg_folder_index = i;
+
+		/* We want this message in the snapshot if any of the following:
+		 *   No folder was specified.
+		 *   The specified folder matches the current folder.
+		 *   The specified folder is INBOX AND we were asked to combine messages AND the current folder is either Old or Urgent.
 		 */
-		if ((this_index_only != -1) && (this_index_only != i) && !(combining_old && i == old_index && this_index_only == inbox_index)) {
-			continue;
+		if (!(this_index_only == -1 || this_index_only == i || (this_index_only == inbox_index && combine_INBOX_and_OLD && (i == old_index || i == urgent_index)))) {
+ 			continue;
+ 		}
+
+		/* Make sure that Old or Urgent messages are marked as being in INBOX. */
+		if (combine_INBOX_and_OLD && (i == old_index || i == urgent_index)) {
+			msg_folder_index = inbox_index;
 		}
 
 		memset(&vms, 0, sizeof(vms));
@@ -14463,7 +14466,7 @@
 
 		/* Iterate through each msg, storing off info */
 		if (vms.lastmsg != -1) {
-			if ((vm_msg_snapshot_create(vmu, &vms, mailbox_snapshot, combining_old ? inbox_index : i, i, descending, sort_val))) {
+			if ((vm_msg_snapshot_create(vmu, &vms, mailbox_snapshot, msg_folder_index, i, descending, sort_val))) {
 				ast_log(LOG_WARNING, "Failed to create msg snapshots for %s@%s\n", mailbox, context);
 				goto snapshot_cleanup;
 			}




More information about the asterisk-commits mailing list