[asterisk-commits] mmichelson: branch mmichelson/imap_consistency r132629 - /team/mmichelson/ima...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 22 10:45:45 CDT 2008


Author: mmichelson
Date: Tue Jul 22 10:45:45 2008
New Revision: 132629

URL: http://svn.digium.com/view/asterisk?view=rev&rev=132629
Log:
Fetching the structure or body of a message causes the message to automatically
be set to "seen." Due to a set of circumstances, every time a message was left,
it would then immediately be retrieved from IMAP. I have set a shortcut in place
which makes sure that if the message is still on the filesystem, don't try
to retrieve the message. This serves both as an optimization and bug fix.


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

Modified: team/mmichelson/imap_consistency/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/imap_consistency/apps/app_voicemail.c?view=diff&rev=132629&r1=132628&r2=132629
==============================================================================
--- team/mmichelson/imap_consistency/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency/apps/app_voicemail.c Tue Jul 22 10:45:45 2008
@@ -1683,6 +1683,13 @@
 		 */
 		ast_log(LOG_ERROR, "Couldn't find a vm_state for mailbox %s!!! Oh no!\n", vmu->mailbox);
 	}
+	
+	make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
+
+	/* 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) {
+		return 0;
+	}
 
 	if (option_debug > 2)
 		ast_log (LOG_DEBUG,"Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]);
@@ -1698,7 +1705,6 @@
 		ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[msgnum]);
 		return -1;
 	}
-	make_file(vms->fn, sizeof(vms->fn), dir, msgnum);
 
 	mail_fetchstructure (vms->mailstream,vms->msgArray[msgnum],&body);
 	




More information about the asterisk-commits mailing list