[asterisk-commits] mmichelson: branch 1.6.0 r124124 - in /branches/1.6.0: ./ apps/app_voicemail.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 19 15:32:54 CDT 2008


Author: mmichelson
Date: Thu Jun 19 15:32:54 2008
New Revision: 124124

URL: http://svn.digium.com/view/asterisk?view=rev&rev=124124
Log:
Merged revisions 124121 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r124121 | mmichelson | 2008-06-19 15:30:23 -0500 (Thu, 19 Jun 2008) | 16 lines

Merged revisions 124112 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124112 | mmichelson | 2008-06-19 15:28:41 -0500 (Thu, 19 Jun 2008) | 8 lines

Fix IMAP forwarding so that messages are sent to the proper mailbox.

(closes issue #12897)
Reported by: jaroth
Patches:
      destination_forward.patch uploaded by jaroth (license 50)


........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/apps/app_voicemail.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/apps/app_voicemail.c?view=diff&rev=124124&r1=124123&r2=124124
==============================================================================
--- branches/1.6.0/apps/app_voicemail.c (original)
+++ branches/1.6.0/apps/app_voicemail.c Thu Jun 19 15:32:54 2008
@@ -143,6 +143,7 @@
 static char *get_user_by_mailbox(char *mailbox, char *buf, size_t len);
 static struct vm_state *get_vm_state_by_imapuser(char *user, int interactive);
 static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, int interactive);
+static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu, char *mailbox);
 static void vmstate_insert(struct vm_state *vms);
 static void vmstate_delete(struct vm_state *vms);
 static void set_update(MAILSTREAM * stream);
@@ -4494,6 +4495,9 @@
 
 				/* get destination mailbox */
 				dstvms = get_vm_state_by_mailbox(vmtmp->mailbox, 0);
+				if (!dstvms) {
+					dstvms = create_vm_state_from_user(vmtmp, vmtmp->mailbox);
+				}
 				if (dstvms) {
 					init_mailstream(dstvms, 0);
 					if (!dstvms->mailstream) {
@@ -9666,6 +9670,27 @@
 	}
 }
 
+static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu, char *mailbox)
+{
+	struct vm_state *vms_p;
+
+	if (option_debug > 4)
+		ast_log(LOG_DEBUG,"Adding new vmstate for %s\n",vmu->imapuser);
+	if (!(vms_p = ast_calloc(1, sizeof(*vms_p))))
+		return NULL;
+	ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
+	ast_copy_string(vms_p->username, mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
+	vms_p->mailstream = NIL; /* save for access from interactive entry point */
+	if (option_debug > 4)
+		ast_log(LOG_DEBUG,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+	vms_p->updated = 1;
+	/* set mailbox to INBOX! */
+	ast_copy_string(vms_p->curbox, mbox(0), sizeof(vms_p->curbox));
+	init_vm_state(vms_p);
+	vmstate_insert(vms_p);
+	return vms_p;
+}
+
 static struct vm_state *get_vm_state_by_imapuser(char *user, int interactive)
 {
 	struct vmstate *vlist = NULL;




More information about the asterisk-commits mailing list