[asterisk-bugs] [JIRA] (ASTERISK-24927) save_to_folder: creates wrong folder

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Mon Mar 30 17:40:32 CDT 2015


     [ https://issues.asterisk.org/jira/browse/ASTERISK-24927?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard Mudgett updated ASTERISK-24927:
---------------------------------------

    Description: 
If try to move message to Cust1 (number 5) the function save_to_folder tries to create Greeting folder instead of Cust1.

The function save_to_folder calls imap_mailbox_name to get mailbox name by box id:
{code}
        imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1);
{code}
then tries to create IMAP folder:
{code}
        if (mail_create(vms->mailstream, mailbox) == NIL)
{code}

The function imap_mailbox_name set mailbox name based on enum vm_box:
{code}
        if (box == NEW_FOLDER || box == OLD_FOLDER)
                snprintf(spec, len, "%s%s", tmp, use_folder? vms->imapfolder: "INBOX");
        else if (box == GREETINGS_FOLDER)
                snprintf(spec, len, "%s%s", tmp, greetingfolder);
{code}

But GREETINGS_FOLDER value is 5 and imap_mailbox_name set mailbox as Greeting instead of Cust1

To fix it we have to set GREETINGS_FOLDER value other then folders numbers
{code}
enum vm_box {
        NEW_FOLDER = 0,
        OLD_FOLDER = 1,
        WORK_FOLDER = 2,
        FAMILY_FOLDER = 3,
        FRIENDS_FOLDER = 4,
        GREETINGS_FOLDER = -1
};
{code}


  was:
If try to move message to Cust1 (number 5) the function save_to_folder tries to create Greeting folder instead of Cust1.

The function save_to_folder calls imap_mailbox_name to get mailbox name by box id:
        imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1);
then tries to create IMAP folder:
        if (mail_create(vms->mailstream, mailbox) == NIL)

The function imap_mailbox_name set mailbox name based on enum vm_box:
        if (box == NEW_FOLDER || box == OLD_FOLDER)
                snprintf(spec, len, "%s%s", tmp, use_folder? vms->imapfolder: "INBOX");
        else if (box == GREETINGS_FOLDER)
                snprintf(spec, len, "%s%s", tmp, greetingfolder);

But GREETINGS_FOLDER value is 5 and imap_mailbox_name set mailbox as Greeting instead of Cust1

To fix it we have to set GREETINGS_FOLDER value other then folders numbers

enum vm_box {
        NEW_FOLDER = 0,
        OLD_FOLDER = 1,
        WORK_FOLDER = 2,
        FAMILY_FOLDER = 3,
        FRIENDS_FOLDER = 4,
        GREETINGS_FOLDER = -1
};



> save_to_folder: creates wrong folder
> ------------------------------------
>
>                 Key: ASTERISK-24927
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24927
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_voicemail/IMAP
>    Affects Versions: 13.2.0
>            Reporter: Alexei Gradinari
>            Severity: Minor
>
> If try to move message to Cust1 (number 5) the function save_to_folder tries to create Greeting folder instead of Cust1.
> The function save_to_folder calls imap_mailbox_name to get mailbox name by box id:
> {code}
>         imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1);
> {code}
> then tries to create IMAP folder:
> {code}
>         if (mail_create(vms->mailstream, mailbox) == NIL)
> {code}
> The function imap_mailbox_name set mailbox name based on enum vm_box:
> {code}
>         if (box == NEW_FOLDER || box == OLD_FOLDER)
>                 snprintf(spec, len, "%s%s", tmp, use_folder? vms->imapfolder: "INBOX");
>         else if (box == GREETINGS_FOLDER)
>                 snprintf(spec, len, "%s%s", tmp, greetingfolder);
> {code}
> But GREETINGS_FOLDER value is 5 and imap_mailbox_name set mailbox as Greeting instead of Cust1
> To fix it we have to set GREETINGS_FOLDER value other then folders numbers
> {code}
> enum vm_box {
>         NEW_FOLDER = 0,
>         OLD_FOLDER = 1,
>         WORK_FOLDER = 2,
>         FAMILY_FOLDER = 3,
>         FRIENDS_FOLDER = 4,
>         GREETINGS_FOLDER = -1
> };
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list