Author Topic: 'default_imap_folders' - config  (Read 2586 times)

Offline hrayr

  • Newbie
  • *
  • Posts: 3
'default_imap_folders' - config
« on: January 15, 2016, 05:12:31 PM »
Hello!,

On debian-linux server I have installed the roundcube-0.9.5, and in config file exist
the 'default_imap_folders' option, the value is " array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash', 'Spam', 'SpecialFolder'); "

right after that option exist this one also 'create_default_folders', with the value 'true'.

When new user is created and that user do login the first time, the folders specified in 'default_imap_folders' option, will be automaticaly created.
It works fine.

On another debian linux I have installed the new version of roundcube-1.1.4 .
In the config file of 'roundcube-1.1.4' the option 'create_default_folders' exist, but the 'default_imap_folders' doesn't exist.
I have manually added the 'default_imap_folders', but it seems that it doesn't have any effect.

May be it is some bug? or the option name is changed in new version? or now the same functionalty is achieved by another technics?

Hrayr.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,518
    • http://SKaero.com/
Re: 'default_imap_folders' - config
« Reply #1 on: January 15, 2016, 06:46:26 PM »
Note that the configuration variable changed from $rcmail_config to $config between 0.9.x and 1.0.x

Offline hrayr

  • Newbie
  • *
  • Posts: 3
Re: 'default_imap_folders' - config
« Reply #2 on: January 15, 2016, 07:40:28 PM »
Yes, I know, I wrote in config file:
$config['default_imap_folders']=array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash', 'Spam', 'SpecialFolder');

The strange thing that the command:

cd ./root_folder_of_roundcube_sources_and_files; grep -i default_imap_folders -R *

doesn't return anything, it means that 'default_imap_folders' -string doesn't exist in any file of roundcube sources or configs.


So, if this option is removed, what can be alternative of that functionality (i.e. create some folders automatically, instead of creating or subscribing them manually for each account)


Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,518
    • http://SKaero.com/
Re: 'default_imap_folders' - config
« Reply #3 on: January 16, 2016, 03:10:09 AM »

Offline hrayr

  • Newbie
  • *
  • Posts: 3
Re: 'default_imap_folders' - config
« Reply #4 on: January 16, 2016, 06:22:29 PM »
SKaero thank you for your reply, I have read your posts, the functionality really was removed in 1.1 versions.


As I understood in the "program/lib/Roundcube/rcube_storage.php" the class "rcube_storage" has
variable "public static $folder_types = array('drafts', 'sent', 'junk', 'trash');" which is later foreached and the default folders are created.
So, if we will define additional folders (f.x. public static $folder_types = array('drafts', 'sent', 'junk', 'trash','folder2','folder2'); ),
and also in config file we will define that folders in such format "$config['folder1_mbox']='folder1'; $config['folder2_mbox']='folder2'; ", the problem should be solved.


But adding something in main functions (f.x. in 'program/lib/Roundcube/rcube_storage.php' ), are not good practice.
Taking into account that roundcube config file is not only config file, but also PHP parseable file,
it will be nice to add something only in config file, and don't touch the "program/lib/Roundcube/rcube_storage.php".


So, this one is more desirable solution, without touching any main function, and writing something only in config file:
add in config file these 4 lines:

// these lines will just append the existing array, when the config file will be parsed.
rcube_storage::$folder_types[]='folder1';
rcube_storage::$folder_types[]='folder2';

// these lines will work, because the final "$folder_types" variable already will contain the new defined folders
$config['folder1_mbox'] = 'folder1';
$config['folder2_mbox'] = 'folder2';

The example works on my server.


Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,260
Re: 'default_imap_folders' - config
« Reply #5 on: January 17, 2016, 04:02:11 AM »
Plugins can add folder types. There is a plugin called "archive" which is shipped with Roundcube which has an example of this.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦