[svn-commits] qwell: branch 1.4 r51167 - in /branches/1.4: apps/ contrib/scripts/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Jan 16 15:50:20 MST 2007


Author: qwell
Date: Tue Jan 16 16:50:19 2007
New Revision: 51167

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51167
Log:
Fix an issue with IMAP storage and realtime voicemail.

Also update the vmdb sql script for IMAP specific options.

Issue 8819, initial patches by bsmithurst (slightly modified by me)

Modified:
    branches/1.4/apps/app_voicemail.c
    branches/1.4/contrib/scripts/vmdb.sql

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=51167&r1=51166&r2=51167
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Tue Jan 16 16:50:19 2007
@@ -673,6 +673,12 @@
 			ast_copy_string(retval->fullname, tmp->value, sizeof(retval->fullname));
 		} else if (!strcasecmp(tmp->name, "context")) {
 			ast_copy_string(retval->context, tmp->value, sizeof(retval->context));
+#ifdef IMAP_STORAGE
+		} else if (!strcasecmp(tmp->name, "imapuser")) {
+			ast_copy_string(retval->imapuser, tmp->value, sizeof(retval->imapuser));
+		} else if (!strcasecmp(tmp->name, "imappassword")) {
+			ast_copy_string(retval->imappassword, tmp->value, sizeof(retval->imappassword));
+#endif
 		} else
 			apply_option(retval, tmp->name, tmp->value);
 		tmp = tmp->next;
@@ -8244,6 +8250,28 @@
 }
 #endif
 
+static struct ast_vm_user *find_user_realtime_imapuser(const char *imapuser)
+{
+	struct ast_variable *var;
+	struct ast_vm_user *vmu;
+
+	vmu = ast_calloc(1, sizeof *vmu);
+	if (!vmu)
+		return NULL;
+	ast_set_flag(vmu, VM_ALLOCED);
+	populate_defaults(vmu);
+
+	var = ast_load_realtime("voicemail", "imapuser", imapuser, NULL);
+	if (var) {
+		apply_options_full(vmu, var);
+		ast_variables_destroy(var);
+		return vmu;
+	} else {
+		free(vmu);
+		return NULL;
+	}
+}
+
 /* Interfaces to C-client */
 
 void mm_exists(MAILSTREAM * stream, unsigned long number)
@@ -8377,6 +8405,12 @@
 			if(!strcasecmp(mb->user, vmu->imapuser)) {
 				ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
 				break;
+			}
+		}
+		if (!vmu) {
+			if ((vmu = find_user_realtime_imapuser(mb->user))) {
+				ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
+				free_user(vmu);
 			}
 		}
 	}

Modified: branches/1.4/contrib/scripts/vmdb.sql
URL: http://svn.digium.com/view/asterisk/branches/1.4/contrib/scripts/vmdb.sql?view=diff&rev=51167&r1=51166&r2=51167
==============================================================================
--- branches/1.4/contrib/scripts/vmdb.sql (original)
+++ branches/1.4/contrib/scripts/vmdb.sql Tue Jan 16 16:50:19 2007
@@ -7,5 +7,7 @@
 email VARCHAR(80) NOT NULL DEFAULT '',
 pager VARCHAR(80) NOT NULL DEFAULT '',
 options VARCHAR(160) NOT NULL DEFAULT '',
+imapuser VARCHAR(80) DEFAULT NULL,
+imappassword VARCHAR(80) DEFAULT NULL,
 PRIMARY KEY (context, mailbox)
 );



More information about the svn-commits mailing list