[asterisk-commits] mmichelson: trunk r72670 - /trunk/apps/app_voicemail.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 29 15:02:01 CDT 2007
Author: mmichelson
Date: Fri Jun 29 15:02:00 2007
New Revision: 72670
URL: http://svn.digium.com/view/asterisk?view=rev&rev=72670
Log:
Found a grievous logical error in get_vm_state_by_imapuser.
The imapuser being passed in was never getting compared to imapusers of any of the vm_states
in the vmstates list.
I also found some places in the code where I used my typical brace style and changed it to match
the typical Asterisk brace style.
Modified:
trunk/apps/app_voicemail.c
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?view=diff&rev=72670&r1=72669&r2=72670
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Fri Jun 29 15:02:00 2007
@@ -2647,7 +2647,7 @@
ast_debug(3,"Mailbox is set to %s\n",mailbox);
/* If no mailbox, return immediately */
- if (ast_strlen_zero(mailbox))
+ if (ast_strlen_zero(mailbox))
return 0;
if (strchr(mailbox, ',')) {
@@ -2694,7 +2694,7 @@
free_user(vmu);
return -1;
}
-
+
/* check if someone is accessing this box right now... */
if ((vms_p = get_vm_state_by_imapuser(vmu->imapuser, 1)) || (vms_p = get_vm_state_by_mailbox(mailboxnc, 1))) {
ast_debug(3,"Returning before search - user is logged in\n");
@@ -2703,7 +2703,7 @@
free_user(vmu);
return 0;
}
-
+
/* add one if not there... */
if (!(vms_p = get_vm_state_by_imapuser(vmu->imapuser, 0)) && !(vms_p = get_vm_state_by_mailbox(mailboxnc, 0))) {
ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
@@ -3187,8 +3187,9 @@
ast_log(LOG_NOTICE,"Can not leave voicemail, unable to count messages\n");
return -1;
}
- if((vms = get_vm_state_by_mailbox(ext,0)))
+ if((vms = get_vm_state_by_mailbox(ext,0)))
vms->newmessages++; /*still need to increment new message count*/
+
/* here is a big difference! We add one to it later */
msgnum = newmsgs + oldmsgs;
ast_debug(3, "Messagecount set to %d\n",msgnum);
@@ -5031,8 +5032,7 @@
return -1;
}
- for (i = 0; i < vms_p->mailstream->nmsgs; i++)
- {
+ for (i = 0; i < vms_p->mailstream->nmsgs; i++) {
mail_fetchstructure(vms_p->mailstream, i + 1, &body);
/* We have the body, now we extract the file name of the first attachment. */
if (body->nested.part->next && body->nested.part->next->body.parameter->value) {
@@ -5042,8 +5042,7 @@
return -1;
}
filename = strsep(&attachment, ".");
- if (!strcmp(filename, file))
- {
+ if (!strcmp(filename, file)) {
ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));
vms_p->msgArray[vms_p->curmsg] = i + 1;
save_body(body, vms_p, "2", attachment);
@@ -5083,8 +5082,7 @@
return -1;
}
filename = strsep(&attachment, ".");
- if (!strcmp(filename, file))
- {
+ if (!strcmp(filename, file)) {
sprintf (arg,"%d", i+1);
mail_setflag (vms->mailstream,arg,"\\DELETED");
}
@@ -9495,7 +9493,7 @@
continue;
}
- if (interactive == 2 || vlist->vms->interactive == interactive) {
+ if (!strcmp(vlist->vms->imapuser, user) && (interactive == 2 || vlist->vms->interactive == interactive)) {
AST_LIST_UNLOCK(&vmstates);
return vlist->vms;
}
More information about the asterisk-commits
mailing list