Set filaneme BEFORE we return from open_mailbox() if we don't have positive message...
authorJosh Roberson <josh@asteriasgi.com>
Fri, 9 Sep 2005 21:13:42 +0000 (21:13 +0000)
committerJosh Roberson <josh@asteriasgi.com>
Fri, 9 Sep 2005 21:13:42 +0000 (21:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6559 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c

index ebed7dd..70b32b5 100755 (executable)
@@ -3780,6 +3780,12 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
        int count_msg, last_msg;
 
        ast_copy_string(vms->curbox, mbox(box), sizeof(vms->curbox));
        int count_msg, last_msg;
 
        ast_copy_string(vms->curbox, mbox(box), sizeof(vms->curbox));
+       
+       /* Rename the member vmbox HERE so that we don't try to return before
+        * we know what's going on.
+        */
+       snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
+       
        make_dir(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
        count_msg = count_messages(vmu, vms->curdir);
        if (count_msg < 0)
        make_dir(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox);
        count_msg = count_messages(vmu, vms->curdir);
        if (count_msg < 0)
@@ -3805,7 +3811,6 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
                        return res;
        }
 
                        return res;
        }
 
-       snprintf(vms->vmbox, sizeof(vms->vmbox), "vm-%s", vms->curbox);
        return 0;
 }
 
        return 0;
 }