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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 22 12:15:43 CDT 2008


Author: mmichelson
Date: Tue Jul 22 12:15:43 2008
New Revision: 132636

URL: http://svn.digium.com/view/asterisk?view=rev&rev=132636
Log:
Fix logic for saving to a folder when using IMAP.

Preliminary tests show that this works as expected. Only
tested with saving to old and INBOX folders though.


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=132636&r1=132635&r2=132636
==============================================================================
--- team/mmichelson/imap_consistency/apps/app_voicemail.c (original)
+++ team/mmichelson/imap_consistency/apps/app_voicemail.c Tue Jul 22 12:15:43 2008
@@ -3428,18 +3428,20 @@
 #ifdef IMAP_STORAGE
 	/* we must use mbox(x) folder names, and copy the message there */
 	/* simple. huh? */
-	long res;
 	char sequence[10];
-
-	/* if save to Old folder, just leave in INBOX */
-	if (box == 1) return 10;
 	/* get the real IMAP message number for this message */
 	snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]);
 	if (option_debug > 2)
 		ast_log(LOG_DEBUG, "Copying sequence %s to mailbox %s\n",sequence,(char *) mbox(box));
-	res = mail_copy(vms->mailstream,sequence,(char *) mbox(box));
-	if (res == 1) return 0;
-	return 1;
+	if (box == 1) {
+		mail_setflag(vms->mailstream, sequence, "\\Seen");
+	} else if (box == 0) {
+		mail_clearflag(vms->mailstream, sequence, "\\Seen");
+	}
+	if (!strcasecmp(mbox(0), vms->curbox) && (box == 0 || box == 1))
+		return 0;
+	else 
+		return !mail_copy(vms->mailstream,sequence,(char *) mbox(box)); 
 #else
 	char *dir = vms->curdir;
 	char *username = vms->username;
@@ -6861,12 +6863,10 @@
 				if (cmd == ERROR_LOCK_PATH) {
 					res = cmd;
 					goto out;
-#ifdef IMAP_STORAGE
-				} else if (cmd == 10) {
-					goto out;
-#endif
+#ifndef IMAP_STORAGE
 				} else if (!cmd) {
 					vms.deleted[vms.curmsg] = 1;
+#endif
 				} else {
 					vms.deleted[vms.curmsg] = 0;
 					vms.heard[vms.curmsg] = 0;




More information about the asterisk-commits mailing list