diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-03 14:32:37 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-03 14:32:37 +0000 |
commit | 9942853e7ebe00d51c519e7f08203afbe58c6191 (patch) | |
tree | 8807de142c2b867a84e80a4fdcf5c00145205f45 /apps | |
parent | 64383136ce811820241f2445e8eb485bd7a4a335 (diff) |
Merged revisions 186286 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r186286 | mmichelson | 2009-04-03 09:32:05 -0500 (Fri, 03 Apr 2009) | 20 lines
Fix the ability to retrieve voicemail messages from IMAP.
A recent change made interactive vm_states no longer get
added to the list of vm_states and instead get stored in
thread-local storage.
In trunk and all the 1.6.X branches, the problem is that
when we search for messages in a voicemail box, we would
attempt to update the appropriate vm_state struct by directly
searching in the list of vm_states instead of using the
get_vm_state_by_imap_user function. This meant we could not
find the interactive vm_state that we wanted.
(closes issue #14685)
Reported by: BlargMaN
Patches:
14685.patch uploaded by mmichelson (license 60)
Tested by: BlargMaN, qualleyiv, mmichelson
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@186287 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_voicemail.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index b6e81e59a..6877b43bb 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -141,7 +141,7 @@ static void write_file(char *filename, char *buffer, unsigned long len); static char *get_header_by_tag(char *header, char *tag, char *buf, size_t len); static void vm_imap_delete(int msgnum, struct ast_vm_user *vmu); 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_imapuser(const 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); static void vmstate_insert(struct vm_state *vms); @@ -1872,22 +1872,14 @@ static void write_file(char *filename, char *buffer, unsigned long len) static void update_messages_by_imapuser(const char *user, unsigned long number) { - struct vmstate *vlist = NULL; + struct vm_state *vms = get_vm_state_by_imapuser(user, 1); - AST_LIST_LOCK(&vmstates); - AST_LIST_TRAVERSE(&vmstates, vlist, list) { - if (!vlist->vms) { - ast_debug(3, "error: vms is NULL for %s\n", user); - continue; - } - if (!vlist->vms->imapuser) { - ast_debug(3, "error: imapuser is NULL for %s\n", user); - continue; - } - ast_debug(3, "saving mailbox message number %lu as message %d. Interactive set to %d\n", number, vlist->vms->vmArrayIndex, vlist->vms->interactive); - vlist->vms->msgArray[vlist->vms->vmArrayIndex++] = number; + if (!vms && !(vms = get_vm_state_by_imapuser(user, 0))) { + return; } - AST_LIST_UNLOCK(&vmstates); + + ast_debug(3, "saving mailbox message number %lu as message %d. Interactive set to %d\n", number, vms->vmArrayIndex, vms->interactive); + vms->msgArray[vms->vmArrayIndex++] = number; } void mm_searched(MAILSTREAM *stream, unsigned long number) @@ -2177,7 +2169,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu) return vms_p; } -static struct vm_state *get_vm_state_by_imapuser(char *user, int interactive) +static struct vm_state *get_vm_state_by_imapuser(const char *user, int interactive) { struct vmstate *vlist = NULL; |