aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 22:53:13 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-16 22:53:13 +0000
commit106655c486cca176b8cafb1a972f58b63c1d79a1 (patch)
tree1e6bef2fa90749c6ee397a71eb3009d700f88fad
parent6a2132eedcbe2e96118c5d362839c888757c5a1e (diff)
Merged revisions 51167 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r51167 | qwell | 2007-01-16 16:50:19 -0600 (Tue, 16 Jan 2007) | 6 lines 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/trunk@51168 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c34
-rw-r--r--contrib/scripts/vmdb.sql2
2 files changed, 36 insertions, 0 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index f966fbce6..8579f6da0 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -694,6 +694,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;
@@ -8407,6 +8413,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)
@@ -8542,6 +8570,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);
+ }
+ }
}
}
diff --git a/contrib/scripts/vmdb.sql b/contrib/scripts/vmdb.sql
index 59238c659..92553bbc6 100644
--- a/contrib/scripts/vmdb.sql
+++ b/contrib/scripts/vmdb.sql
@@ -7,5 +7,7 @@ fullname VARCHAR(80) NOT NULL DEFAULT '',
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)
);