[svn-commits] mmichelson: branch 1.6.2 r186289 - in /branches/1.6.2: ./ apps/app_voicemail.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Apr 3 09:34:07 CDT 2009


Author: mmichelson
Date: Fri Apr  3 09:34:02 2009
New Revision: 186289

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=186289
Log:
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
........

Modified:
    branches/1.6.2/   (props changed)
    branches/1.6.2/apps/app_voicemail.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.2/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.2/apps/app_voicemail.c?view=diff&rev=186289&r1=186288&r2=186289
==============================================================================
--- branches/1.6.2/apps/app_voicemail.c (original)
+++ branches/1.6.2/apps/app_voicemail.c Fri Apr  3 09:34:02 2009
@@ -325,7 +325,7 @@
 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, const char *context, int interactive);
 static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu);
 static void vmstate_insert(struct vm_state *vms);
@@ -2294,22 +2294,14 @@
 
 static void update_messages_by_imapuser(const char *user, unsigned long number)
 {
-	struct vmstate *vlist = NULL;
-
-	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;
-	}
-	AST_LIST_UNLOCK(&vmstates);
+	struct vm_state *vms = get_vm_state_by_imapuser(user, 1);
+
+	if (!vms && !(vms = get_vm_state_by_imapuser(user, 0))) {
+		return;
+	}
+
+	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)
@@ -2600,7 +2592,7 @@
 	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;
 




More information about the svn-commits mailing list