[svn-commits] mmichelson: branch mmichelson/imap_consistency_trunk r136714 - /team/mmichels...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Aug 7 17:20:49 CDT 2008


Author: mmichelson
Date: Thu Aug  7 17:20:48 2008
New Revision: 136714

URL: http://svn.digium.com/view/asterisk?view=rev&rev=136714
Log:
I believe this does it. Now forwarding and prepending
work as expected, and no remnants are left on the file
system.

Next move. Merge to trunk.


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=136714&r1=136713&r2=136714
==============================================================================
--- team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency_trunk/apps/app_voicemail.c Thu Aug  7 17:20:48 2008
@@ -1458,7 +1458,7 @@
 	}
 	
 	make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
-	snprintf(vms->introfn, sizeof(vms->introfn), "%sintro\n", vms->fn);
+	snprintf(vms->introfn, sizeof(vms->introfn), "%sintro", vms->fn);
 
 	/* Don't try to retrieve a message from IMAP if it already is on the file system */
 	if (ast_fileexists(vms->fn, NULL, NULL) > 0) {
@@ -1488,6 +1488,7 @@
 	/* We have the body, now we extract the file name of the first attachment. */
 	if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) {
 		attachedfilefmt = ast_strdupa(body->nested.part->next->body.parameter->value);
+		ast_log(LOG_NOTICE, "%s is the attached file\n", attachedfilefmt);
 	} else {
 		ast_log(LOG_ERROR, "There is no file attached to this IMAP message.\n");
 		res = -1;
@@ -1505,6 +1506,7 @@
 	
 	save_body(body, vms, "2", attachedfilefmt, 0);
 	if (save_body(body, vms, "3", attachedfilefmt, 1)) {
+		ast_log(LOG_NOTICE, "Nulling the introfn cuz ain't nothing in part 3\n");
 		*vms->introfn = '\0';
 	}
 
@@ -2129,6 +2131,7 @@
 static void write_file(char *filename, char *buffer, unsigned long len)
 {
 	FILE *output;
+	ast_log(LOG_NOTICE, "The name of the file I'm writing is %s\n", filename);
 
 	output = fopen (filename, "w");
 	fwrite (buffer, len, 1, output);
@@ -3398,7 +3401,6 @@
 }
 #endif
 
-#endif /* #ifndef IMAP_STORAGE */
 
 /*!
  * \brief Utility function to copy a file.
@@ -3511,6 +3513,7 @@
 	ast_variables_destroy(var);
 }
 
+#endif /* #ifndef IMAP_STORAGE */
 #endif /* #else of #ifdef ODBC_STORAGE */
 #if (!defined(ODBC_STORAGE) && !defined(IMAP_STORAGE))
 /*! 
@@ -6142,17 +6145,10 @@
 	} else {
 		/* Forward VoiceMail */
 		long duration = 0;
-		char origmsgfile[PATH_MAX], msgfile[PATH_MAX];
 		struct vm_state vmstmp;
 		memcpy(&vmstmp, vms, sizeof(vmstmp));
 
-		make_file(origmsgfile, sizeof(origmsgfile), dir, curmsg);
-		create_dirpath(vmstmp.curdir, sizeof(vmstmp.curdir), sender->context, vmstmp.username, "tmp");
-		make_file(msgfile, sizeof(msgfile), vmstmp.curdir, curmsg);
-
  		RETRIEVE(dir, curmsg, sender->mailbox, sender->context);
-
-		copy_plain_file(origmsgfile, msgfile);
 
 		cmd = vm_forwardoptions(chan, sender, vmstmp.curdir, curmsg, vmfmts, S_OR(context, "default"), record_gain, &duration, &vmstmp, urgent_str);
 		if (!cmd) {
@@ -6208,6 +6204,7 @@
 				res = ast_play_and_wait(chan, "vm-msgsaved");
 			}	
 		}
+		DISPOSE(dir, curmsg);
 	}
 
 	/* If anything failed above, we still have this list to free */
@@ -6449,6 +6446,7 @@
 
 	snprintf(filename, sizeof(filename), "%s.txt", vms->fn);
 	RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context);
+	ast_log(LOG_NOTICE, "I just retrieved %s and %s\n", vms->fn, S_OR(vms->introfn, "No intro"));
 	msg_cfg = ast_config_load(filename, config_flags);
 	if (!msg_cfg) {
 		ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename);
@@ -6563,6 +6561,7 @@
 		}
 	}
 	DISPOSE(vms->curdir, vms->curmsg);
+	ast_log(LOG_NOTICE, "I just disposed of %s and %s\n", vms->fn, S_OR(vms->introfn, "No intro"));
 	return res;
 }
 
@@ -6571,16 +6570,19 @@
 {
 	char fn[PATH_MAX];
 	char full_fn[PATH_MAX];
-	char msgnums[80];
+	char intro[PATH_MAX] = {0,};
 	
 	if (msgnum > -1) {
-		snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
 		make_file(fn, sizeof(fn), dir, msgnum);
+		snprintf(intro, sizeof(intro), "%sintro", fn);
 	} else
 		ast_copy_string(fn, dir, sizeof(fn));
 	
 	if ((msgnum < 0 && imapgreetings) || msgnum > -1) {
-		ast_filedelete(fn, NULL);	
+		ast_filedelete(fn, NULL);
+		if (!ast_strlen_zero(intro)) {
+			ast_filedelete(intro, NULL);
+		}
 		snprintf(full_fn, sizeof(full_fn), "%s.txt", fn);
 		unlink(full_fn);
 	}




More information about the svn-commits mailing list