Roundcube 1.0.3 released

Why was config/config.inc.php changed from this:
Code:
$config['default_folders'] = array('INBOX', 'INBOX.Drafts', 'INBOX.Sent', 'INBOX.spam', 'INBOX.Trash');

To be this?:
Code:
$config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'INBOX.spam', 'Trash');

It does nok look correct to me. Should it not be INBOX. in front of Drafts, Sent etc like it was before? And why does it only have INBOX. in front of "spam" now?

Please look at the attachment wiht a image of the folders, there is now some duplicate folders in existing email accounts in Roundcube. Drafts, Sent and Trash is duplicated as you can see in the image:

roundcube103.gif
 
Is a new config in CB 2.

In options.conf now you have this line

webapps_inbox_prefix=no

If you wanna keep "old style" folders set it to yes, otherwise, the new style is better compatibile with Desktop Clients (Outlook, Thunderbird, whatever) and Mobile device using IMAP.

Regards
 
Thank you for the information!

But it would have been better to be able to convert existing folders to the new style to avoid getting duplicate folders. Customers is going to be confused and create support tickets about that.

And why is INBOX.spam still in the old style and not in the new style like the other default folders?
 
INBOX.spam is a subfolder of inbox, as it's still your inbox, but for spam messages :) And other folders are not your "INBOX" folders, because you move emails to them manually (for example, you delete a message to put it in Trash folder, or you save the message to put it in Drafts). It's a nice idea for conversion, but that might still confuse customers, as they'd have their folders merged :) Merge would be a simple process, just a simple "mv" command, to move everything from .INBOX.Drafts to .Drafts, from .INBOX.Trash to .Trash and from .INBOX.Sent to .Sent, that's it :)
 
I wrote a script for do that for each user/domain/account but wasnt that easy Martynas ;)

Since many user was live on the system the not INBOX. folders was already created and since they had many custom INBOX. other folders wasnt that easy to move them to new correct path :)

Regards
 
I wrote a script for do that for each user/domain/account but wasnt that easy Martynas ;)

Since many user was live on the system the not INBOX. folders was already created and since they had many custom INBOX. other folders wasnt that easy to move them to new correct path :)

Regards

It would be really nice of you if you would share that script with us all in the forums. :) I hesitate to upgrade my shared hosting servers beacause of the duplicate folders, so if I could automate converting the folders to avoid that, it would be great.
 
Well here it is, keep in mind that is amatorial, use at your own risk.

It did work to me and probably will run for you aswell, let it run, dont stop it.

Save this to a file, give it execution permisions and run it.

Code:
#!/bin/bash

###############################################################################
###############################################################################
#                                                                             #
#                                Crazy Network                                #
#                                                                             #
#                           http://www.CrazyNetwork.it                        #
#                                                                             #
#                              [email protected]                           #
#                                                                             #
###############################################################################
###############################################################################

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")

for USER in `ls /usr/local/directadmin/data/users/`


        do
        if [ -d /home/$USER/Maildir/ ]; then

                for FOLDER in `ls -a /home/$USER/Maildir/ | grep '^\.INBOX\.'`

                        do
                        if [ "$FOLDER" != ".INBOX.spam" ]; then

                                NEW_FOLDER=`echo $FOLDER | sed 's/^\.INBOX\.//'`
                                echo "User: $USER Main Account| Folder: $FOLDER | New Folder: .$NEW_FOLDER"

                                if [ -d /home/$USER/Maildir/."$NEW_FOLDER"/ ]; then

                                        \cp -r /home/$USER/Maildir/$FOLDER/* /home/$USER/Maildir/.$NEW_FOLDER/
                                        rm -rf /home/$USER/Maildir/$FOLDER/

                                else

                                        \mv /home/$USER/Maildir/$FOLDER/ /home/$USER/Maildir/.$NEW_FOLDER/

                                fi

                        fi

                done

        fi

        if [ -d /home/$USER/imap/ ]; then

                for DOMAIN in `ls /home/$USER/imap/`

                        do
                        for ACCOUNT in `ls /home/$USER/imap/$DOMAIN/`

                                do
                                for FOLDER in `ls -a /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/ | grep  '^\.INBOX\.'`

                                        do
                                        if [ "$FOLDER" != ".INBOX.spam" ]; then

                                                 NEW_FOLDER=`echo $FOLDER | sed 's/^\.INBOX\.//'`
                                                echo "User: $USER | Domain: $DOMAIN | Account: $ACCOUNT | Folder: $FOLDER | New Folder: .$NEW_FOLDER"

                                                if [ -d /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/."$NEW_FOLDER"/ ]; then

                                                        \cp -r /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/$FOLDER/* /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/.$NEW_FOLDER/
                                                        rm -rf /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/$FOLDER/

                                                else

                                                        \mv /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/$FOLDER/ /home/$USER/imap/$DOMAIN/$ACCOUNT/Maildir/.$NEW_FOLDER/

                                                fi

                                        fi

                                done

                        done

                done

        fi

done

IFS=$SAVEIFS

Hope this help.

Best regards
 
Last edited:
SeLLeRoNe, thanks for sharing the script with community :) I have a few minor suggestions for it.

Change:
Code:
grep ".INBOX."

To:
Code:
grep '^\.INBOX\.'

And execute 'ls' for /usr/local/directadmin/data/users, instead of /home (it's just for efficiency, as you already have a check for /home/$USER/imap/). Nice script :)
 
Thanks Martynas for your hint.

Since NEW_FOLDER is created from FOLDER variable i'd used sed this way: NEW_FOLDER=`echo $FOLDER | sed 's/^.......//'`

But, there is a way better? Since that sed command does a subfolder for each ".", so, 7 "." are 7 subfolder, but, there is a way to do for as many subfolder are present instead prefix a defined numer?

Thanks

PS. I'd edited my post with your edit suggestions

Best regards
 
Thanks Martynas for your hint.

Since NEW_FOLDER is created from FOLDER variable i'd used sed this way: NEW_FOLDER=`echo $FOLDER | sed 's/^.......//'`

But, there is a way better? Since that sed command does a subfolder for each ".", so, 7 "." are 7 subfolder, but, there is a way to do for as many subfolder are present instead prefix a defined numer?

Thanks

PS. I'd edited my post with your edit suggestions

Best regards

The following code is not going inside any directories:
Code:
NEW_FOLDER=`echo $FOLDER | sed 's/^.......//'`

So, it's not a limitation of 7 subfolders :) That sed command says "cut the first 7 characters from the folder names you find" (as you're using "grep" above, they're .INBOX. only). An "unescaped" dot chatacter (.) means "any symbol" in regexes. That line could be simply replaced with:
Code:
NEW_FOLDER=`echo $FOLDER | sed 's/^\.INBOX\.//'`
 
After doing some testing, this script does not seem to work correctly. Firstly, it does not handle system mail accounts. Additionally, I had to restore from backup because the script did not copy the folder contents of .INBOX.Sent to .Sent and other folders. Also, the .Junk folder is created by RoundCube when a user logs in for the first time.
 
Well folders are not divided in subfolders but MAIN.SUB.SUB.SUB and the . as delimiter yes, is delimiting .SUB (well at least did work for me i had many subfolders structures) :)

But i see your point and thanks for this second tip/fix on the script :) Since i made it by myself and im not bash expert, i think is still better fix and make it better wherever possible for not cause issue to other users (maybe with less experience in case they need to fix something) :)

best regards
 
What do you mean by "system account"? Arent them saved in imap folder as all accounts?

The Junk folder as far as i know is not from roundcube (i'm using a custom config.inc.php where all folders are defined so maybe Martynas added it to the standard).

The Sent folder has been copied on my servers for all customers, so, maybe something did not run correctly or you stopped it before that folder.. just the .INBOX.spam folder get skipped since is the only one remained the same...

Regards
 
Back
Top