[asterisk-commits] mmichelson: trunk r123867 - /trunk/apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 19 10:55:11 CDT 2008


Author: mmichelson
Date: Thu Jun 19 10:55:10 2008
New Revision: 123867

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123867
Log:
Forwarding non-urgent IMAP messages could inadvertently cause the messages
to be marked urgent. This fixes that issue.

(closes issue #12895)
Reported by: jaroth
Patches:
      urgent_forwarding.patch uploaded by jaroth (license 50)


Modified:
    trunk/apps/app_voicemail.c

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=123867&r1=123866&r2=123867
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Thu Jun 19 10:55:10 2008
@@ -4816,7 +4816,7 @@
  * \return zero on success, -1 on error.
  */
 static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfmts,
-			char *context, signed char record_gain, long *duration, struct vm_state *vms, char *introfile)
+			char *context, signed char record_gain, long *duration, struct vm_state *vms, char *introfile, char *flag)
 {
 #ifdef IMAP_STORAGE
 	int res;
@@ -4855,7 +4855,7 @@
 			/* Record new intro file */
 			res = ast_play_and_wait(chan, INTRO);
 			res = ast_play_and_wait(chan, "beep");
-			res = play_record_review(chan, NULL, introfile, vmu->maxsecs, vmfmts, 1, vmu, (int *)duration, NULL, record_gain, vms, NULL);
+			res = play_record_review(chan, NULL, introfile, vmu->maxsecs, vmfmts, 1, vmu, (int *)duration, NULL, record_gain, vms, flag);
 			cmd = 't';
 #else
 
@@ -5102,13 +5102,13 @@
 	int valid_extensions = 0;
 	char *dir;
 	int curmsg;
-	const char *urgent_str = urgent ? "Urgent" : "";
+	char *urgent_str = urgent ? "Urgent" : "";
 	char tmptxtfile[PATH_MAX];
 
 	if (vms == NULL) return -1;
 	dir = vms->curdir;
 	curmsg = vms->curmsg;
-	
+
 	while (!res && !valid_extensions) {
 		int use_directory = 0;
 		if (ast_test_flag((&globalflags), VM_DIRECFORWARD)) {
@@ -5267,7 +5267,7 @@
 		create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
 		make_file(msgfile, sizeof(msgfile), vmstmp.curdir, curmsg);
 
-		cmd = vm_forwardoptions(chan, sender, vmstmp.curdir, curmsg, vmfmts, S_OR(context, "default"), record_gain, &duration, &vmstmp, tmptxtfile);
+		cmd = vm_forwardoptions(chan, sender, vmstmp.curdir, curmsg, vmfmts, S_OR(context, "default"), record_gain, &duration, &vmstmp, tmptxtfile, urgent_str);
 		if (!cmd) {
 			AST_LIST_TRAVERSE_SAFE_BEGIN(&extensions, vmtmp, list) {
 #ifdef IMAP_STORAGE
@@ -8135,6 +8135,7 @@
 
 		/* If there are no new messages, inform the user and hangup */
 		if (vms.lastmsg == -1) {
+			in_urgent = 0;
 			cmd = vm_browse_messages(chan, &vms, vmu);
 			res = 0;
 			goto out;
@@ -8143,6 +8144,7 @@
 		if (!vms.newmessages && !vms.urgentmessages && vms.oldmessages) {
 			/* If we only have old messages start here */
 			res = open_mailbox(&vms, vmu, OLD_FOLDER); /* Count all messages, even Urgent */
+			in_urgent = 0;
 			play_folder = 1;
 			if (res == ERROR_LOCK_PATH)
 				goto out;
@@ -8215,6 +8217,8 @@
 				res = close_mailbox(&vms, vmu);
 				if (res == ERROR_LOCK_PATH)
 					goto out;
+				/* If folder is not urgent, set in_urgent to zero! */
+				if (cmd != 11) in_urgent = 0;
 				res = open_mailbox(&vms, vmu, cmd);
 				if (res == ERROR_LOCK_PATH)
 					goto out;




More information about the asterisk-commits mailing list