summaryrefslogtreecommitdiff
path: root/apps/app_voicemail.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-02-20 00:49:38 +0000
committerMark Michelson <mmichelson@digium.com>2008-02-20 00:49:38 +0000
commitca2cfc8e476b2c3c525ec3c030b47008c1bd6fb4 (patch)
treec7b00f00af840b5c3ee2f574d8b3a9d83d9e03d9 /apps/app_voicemail.c
parent63ab8ad66c9d28f6135c1c825952905cb61b1cd5 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103833 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_voicemail.c')
-rw-r--r--apps/app_voicemail.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 987d66675..ddf2431b0 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -3474,11 +3474,20 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg
/* 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_flags(MAILSTREAM * stream, unsigned long number)
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);
}