[asterisk-commits] mmichelson: branch mmichelson/imap_consistency_trunk r135035 - /team/mmichels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 31 17:59:38 CDT 2008


Author: mmichelson
Date: Thu Jul 31 17:59:37 2008
New Revision: 135035

URL: http://svn.digium.com/view/asterisk?view=rev&rev=135035
Log:
A batch of fixes


Modified:
    team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c

Modified: team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c?view=diff&rev=135035&r1=135034&r2=135035
==============================================================================
--- team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c Thu Jul 31 17:59:37 2008
@@ -1425,7 +1425,10 @@
 	int res = 0;
 	struct ast_vm_user *vmu;
 
-	vmu = find_user(NULL, mailbox, context); 
+	if (!(vmu = find_user(NULL, context, mailbox))) {
+		ast_log(LOG_WARNING, "Couldn't find user with mailbox %s@%s\n", mailbox, context);
+		return -1;
+	}
 	
 	if (msgnum < 0) {
 		if (imapgreetings) {
@@ -1437,7 +1440,6 @@
 		}
 	}
 
-	vmu = find_user(NULL, mailbox, context); 
 	/* Before anything can happen, we need a vm_state so that we can
 	 * actually access the imap server through the vms->mailstream
 	 */
@@ -3849,6 +3851,8 @@
 		fprintf(p, "X-Asterisk-VM-Duration: %d" ENDL, duration);
 		if (!ast_strlen_zero(category)) {
 			fprintf(p, "X-Asterisk-VM-Category: %s" ENDL, category);
+		} else {
+			fprintf(p, "X-Asterisk-VM-Category: " ENDL);
 		}
 		fprintf(p, "X-Asterisk-VM-Message-Type: %s" ENDL, msgnum > -1 ? "Message" : greeting_attachment);
 		fprintf(p, "X-Asterisk-VM-Orig-date: %s" ENDL, date);
@@ -6269,8 +6273,9 @@
 
 	/* Can't think of how other diffs might be helpful, but I'm sure somebody will think of something. */
 #endif
-	if (the_zone)
+	if (the_zone) {
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, the_zone->msg_format, the_zone->timezone);
+	}
 	else if (!strcasecmp(chan->language,"pl"))       /* POLISH syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Q HM", NULL);
 	else if (!strcasecmp(chan->language,"se"))       /* SWEDISH syntax */
@@ -6289,8 +6294,9 @@
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' Ad 'digits/pt-de' B 'digits/pt-de' Y 'digits/pt-as' HM ", NULL);
 	else if (!strcasecmp(chan->language,"tw"))      /* CHINESE (Taiwan) syntax */
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "qR 'vm-received'", NULL);		
-	else
+	else {
 		res = ast_say_date_with_format(chan, t, AST_DIGIT_ANY, chan->language, "'vm-received' q 'digits/at' IMp", NULL);
+	}
 #if 0
 	pbx_builtin_setvar_helper(chan, "DIFF_DAY", NULL);
 #endif
@@ -6484,18 +6490,17 @@
 		} else {
 			if (!strcasecmp(chan->language, "se")) /* SWEDISH syntax */
 				res = wait_file2(chan, vms, "vm-meddelandet");  /* "message" */
-			else /* DEFAULT syntax */
+			else /* DEFAULT syntax */ {
 				res = wait_file2(chan, vms, "vm-message");
+			}
 			if (vms->curmsg && (vms->curmsg != vms->lastmsg)) {
-				if (!res)
+				if (!res) {
 					res = ast_say_number(chan, vms->curmsg + 1, AST_DIGIT_ANY, chan->language, NULL);
-			}
-		}
-	}
-
-	/* Retrieve info from VM attribute file */
-	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
-	msg_cfg = ast_config_load(filename, config_flags);
+				}
+			}
+		}
+	}
+
 	if (!msg_cfg) {
 		ast_log(AST_LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
 		return 0;
@@ -6515,8 +6520,9 @@
 	context = ast_variable_retrieve(msg_cfg, "message", "context");
 	if (!strncasecmp("macro",context,5)) /* Macro names in contexts are useless for our needs */
 		context = ast_variable_retrieve(msg_cfg, "message","macrocontext");
-	if (!res)
+	if (!res) {
 		res = play_message_category(chan, category);
+	}
 	if ((!res) && (ast_test_flag(vmu, VM_ENVELOPE)))
 		res = play_message_datetime(chan, vmu, origtime, filename);
 	if ((!res) && (ast_test_flag(vmu, VM_SAYCID)))
@@ -6535,10 +6541,11 @@
 		/*IMAP storage stores any prepended message from a forward
 		 * as a separate file from the rest of the message
 		 */
-		if (!ast_strlen_zero(vms->introfn));
-			res = wait_file(chan, vms, vms->introfn);
+		if (!ast_strlen_zero(vms->introfn)) {
+			wait_file(chan, vms, vms->introfn);
+		}
 #endif
-		if (res || (res = wait_file(chan, vms, vms->fn)) < 0) {
+		if ((res = wait_file(chan, vms, vms->fn)) < 0) {
 			ast_log(AST_LOG_WARNING, "Playback of message %s failed\n", vms->fn);
 			res = 0;
 		}
@@ -8627,7 +8634,6 @@
 	/* Set language from config to override channel language */
 	if (!ast_strlen_zero(vmu->language))
 		ast_string_field_set(chan, language, vmu->language);
-	create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
 
 	/* Retrieve urgent, old and new message counts */
 	ast_debug(1, "Before open_mailbox\n");
@@ -9054,7 +9060,7 @@
 			snprintf(vms.fn, sizeof(vms.fn), "vm-%s", mbox(box));
 			if (!cmd) {
 				cmd = ast_play_and_wait(chan, "vm-message");
-				if (!cmd)
+				if (!cmd) 
 					cmd = say_and_wait(chan, vms.curmsg + 1, chan->language);
 				if (!cmd)
 					cmd = ast_play_and_wait(chan, "vm-savedto");




More information about the asterisk-commits mailing list