aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-01 14:29:48 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-01 14:29:48 +0000
commitc292249e70b1271cc68195b08f0d443be388554a (patch)
treedd519540b6fdd408e948da1f2763e37dea216540
parentf6fb0900e1a8399fb7e9a7234e2e566d66e724f4 (diff)
IMAP storage functioned under the assumption that folders
such as "Work" and "Family" would be subfolders of the INBOX. This is an invalid assumption to make, but it could be desirable to set up folders in this manner, so a new option for voicemail.conf, "imapparentfolder" has been added to allow for this. (closes issue #13142) Reported by: jaroth Patches: parentfolder.patch uploaded by jaroth (license 50) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@135067 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_voicemail.c14
-rw-r--r--configs/voicemail.conf.sample5
2 files changed, 17 insertions, 2 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 8a7b2aaee..17f5e3767 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -125,6 +125,7 @@ static char imapserver[48];
static char imapport[8];
static char imapflags[128];
static char imapfolder[64];
+static char imapparentfolder[64] = "\0";
static char greetingfolder[64];
static char authuser[32];
static char authpassword[42];
@@ -5986,8 +5987,13 @@ static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int
snprintf(spec, len, "%s%s", tmp, use_folder? imapfolder: "INBOX");
else if (box == GREETINGS_FOLDER)
snprintf(spec, len, "%s%s", tmp, greetingfolder);
- else
- snprintf(spec, len, "%s%s%c%s", tmp, imapfolder, delimiter, mbox(box));
+ else /* Other folders such as Friends, Family, etc... */
+ if (!ast_strlen_zero(imapparentfolder)) {
+ /* imapparentfolder would typically be set to INBOX */
+ snprintf(spec, len, "%s%s%c%s", tmp, imapparentfolder, delimiter, mbox(box));
+ } else {
+ snprintf(spec, len, "%s%s", tmp, mbox(box));
+ }
}
static int init_mailstream(struct vm_state *vms, int box)
@@ -9577,6 +9583,7 @@ static int load_config(int reload)
ucfg = ast_config_load("users.conf", config_flags);
}
+ ast_copy_string(imapparentfolder, "\0", sizeof(imapparentfolder));
/* set audio control prompts */
strcpy(listen_control_forward_key,DEFAULT_LISTEN_CONTROL_FORWARD_KEY);
strcpy(listen_control_reverse_key,DEFAULT_LISTEN_CONTROL_REVERSE_KEY);
@@ -9731,6 +9738,9 @@ static int load_config(int reload)
} else {
ast_copy_string(imapfolder,"INBOX", sizeof(imapfolder));
}
+ if ((val = ast_variable_retrieve(cfg, "general", "imapparentfolder"))) {
+ ast_copy_string(imapparentfolder, val, sizeof(imapparentfolder));
+ }
if ((val = ast_variable_retrieve(cfg, "general", "imapgreetings"))) {
imapgreetings = ast_true(val);
} else {
diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample
index d2213c563..67c349d5e 100644
--- a/configs/voicemail.conf.sample
+++ b/configs/voicemail.conf.sample
@@ -156,6 +156,11 @@ emaildateformat=%A, %B %d, %Y at %r
; If imapgreetings=yes, then specify which folder to store your greetings in. If
; you do not specify a folder, then INBOX will be used
;greetingsfolder=INBOX
+; Some IMAP server implementations store folders under INBOX instead of
+; using a top level folder (ex. INBOX/Friends). In this case, user
+; imapparentfolder to set the parent folder. For example, Cyrus IMAP does
+; NOT use INBOX as the parent. Default is to have no parent folder set.
+;imapparentfolder=INBOX
;
; Users may be located in different timezones, or may have different
; message announcements for their introductory message when they enter