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.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72670 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Michelson
2007-06-29 20:02:00 +00:00
parent 4df1a79314
commit 7415c3ee1e

View File

@@ -3189,6 +3189,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
} }
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*/ vms->newmessages++; /*still need to increment new message count*/
/* here is a big difference! We add one to it later */ /* here is a big difference! We add one to it later */
msgnum = newmsgs + oldmsgs; msgnum = newmsgs + oldmsgs;
ast_debug(3, "Messagecount set to %d\n",msgnum); ast_debug(3, "Messagecount set to %d\n",msgnum);
@@ -5031,8 +5032,7 @@ static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *conte
return -1; 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); mail_fetchstructure(vms_p->mailstream, i + 1, &body);
/* We have the body, now we extract the file name of the first attachment. */ /* 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) { if (body->nested.part->next && body->nested.part->next->body.parameter->value) {
@@ -5042,8 +5042,7 @@ static int imap_retrieve_file (char *dir, int msgnum, char *mailbox, char *conte
return -1; return -1;
} }
filename = strsep(&attachment, "."); filename = strsep(&attachment, ".");
if (!strcmp(filename, file)) if (!strcmp(filename, file)) {
{
ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn)); ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));
vms_p->msgArray[vms_p->curmsg] = i + 1; vms_p->msgArray[vms_p->curmsg] = i + 1;
save_body(body, vms_p, "2", attachment); save_body(body, vms_p, "2", attachment);
@@ -5083,8 +5082,7 @@ static int imap_delete_old_greeting (char *dir, struct vm_state *vms)
return -1; return -1;
} }
filename = strsep(&attachment, "."); filename = strsep(&attachment, ".");
if (!strcmp(filename, file)) if (!strcmp(filename, file)) {
{
sprintf (arg,"%d", i+1); sprintf (arg,"%d", i+1);
mail_setflag (vms->mailstream,arg,"\\DELETED"); mail_setflag (vms->mailstream,arg,"\\DELETED");
} }
@@ -9495,7 +9493,7 @@ static struct vm_state *get_vm_state_by_imapuser(char *user, int interactive)
continue; continue;
} }
if (interactive == 2 || vlist->vms->interactive == interactive) { if (!strcmp(vlist->vms->imapuser, user) && (interactive == 2 || vlist->vms->interactive == interactive)) {
AST_LIST_UNLOCK(&vmstates); AST_LIST_UNLOCK(&vmstates);
return vlist->vms; return vlist->vms;
} }