[svn-commits] mmichelson: trunk r103833 - /trunk/apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 19 18:49:39 CST 2008


Author: mmichelson
Date: Tue Feb 19 18:49:38 2008
New Revision: 103833

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103833
Log:
When using IMAP storage, if the folder you attempt to save to does not exist,
create it first.

(closes issue #12032)
Reported by: jaroth
Patches:
      createfolder.patch uploaded by jaroth (license 50)
Tested by: jaroth



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=103833&r1=103832&r2=103833
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Tue Feb 19 18:49:38 2008
@@ -3474,11 +3474,20 @@
 	/* simple. huh? */
 	long res;
 	char sequence[10];
+	char mailbox[256];
 
 	/* 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]);
+	/* Create the folder if it don't exist */
+	imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */
+	ast_debug(5, "Checking if folder exists: %s\n",mailbox);
+	if (mail_create(vms->mailstream, mailbox) == NIL) 
+		ast_debug(5, "Folder exists.\n");
+	else
+		ast_log(LOG_NOTICE, "Folder %s created!\n",mbox(box));
+
 	ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(box));
 	res = mail_copy(vms->mailstream, sequence, (char *)mbox(box));
 	if (res == 1) return 0;
@@ -9454,6 +9463,7 @@
 
 void mm_notify(MAILSTREAM * stream, char *string, long errflg)
 {
+	ast_debug(5, "Entering NOTIFY callback, errflag is %ld, string is %s\n", errflg, string);
 	mm_log (string, errflg);
 }
 




More information about the svn-commits mailing list