aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 22:50:19 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 22:50:19 +0000
commit7f636e8320f475129a60364d57c89be16fb4d8e4 (patch)
tree66c1557f13b9ebe79ed2d01f244a92c2c0166cc2 /apps
parent1ae6b2be230c3b5cdffe25e7bb44a3eaac768bb0 (diff)
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) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@51167 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c54e51e50..2b55ad840 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -673,6 +673,12 @@ static void apply_options_full(struct ast_vm_user *retval, struct ast_variable *
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 @@ static void status(MAILSTREAM *stream)
}
#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)
@@ -8379,6 +8407,12 @@ void mm_login(NETMBX * mb, char *user, char *pwd, long trial)
break;
}
}
+ if (!vmu) {
+ if ((vmu = find_user_realtime_imapuser(mb->user))) {
+ ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
+ free_user(vmu);
+ }
+ }
}
}