I use roundCube to connect to two imap accounts. Because one is an older UW-imap server the mail folder (imap_root) has to be specified by the client. The other server needs an empty string for the imap_root. So I cannot specify the imap_root parameter globally.
I know it could be done in a convoluted way by using vitual hosts... but I have a very simple patch to specify the imap_root in the server URL:
for example ssl://host-2:993/rootFolder
--- roundcubemail-0.2-alpha/program/include/rcmail.php.org 2008-08-10 15:14:01.000000000 -0700
+++ roundcubemail-0.2-alpha/program/include/rcmail.php 2008-08-10 11:05:09.000000000 -0700
@@ -361,6 +361,8 @@
$host = $a_host['host'];
$imap_ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null;
$imap_port = isset($a_host['port']) ? $a_host['port'] : ($imap_ssl ? 993 : $config['default_port']);
+ $imap_root = isset($a_host['path']) ? $a_host['path'] : $config['imap_root'];
+ $imap_root = ltrim($imap_root, '/ ');
}
else
$imap_port = $config['default_port'];
@@ -425,6 +427,7 @@
$_SESSION['imap_host'] = $host;
$_SESSION['imap_port'] = $imap_port;
$_SESSION['imap_ssl'] = $imap_ssl;
+ $_SESSION['imap_root'] = $imap_root;
$_SESSION['password'] = $this->encrypt_passwd($pass);
$_SESSION['login_time'] = mktime();
@@ -450,10 +453,8 @@
{
$this->imap->set_charset($this->config->get('default_charset', RCMAIL_CHARSET));
- // set root dir from config
- if ($imap_root = $this->config->get('imap_root')) {
- $this->imap->set_rootdir($imap_root);
- }
+ $this->imap->set_rootdir($_SESSION['imap_root']);
+
if ($default_folders = $this->config->get('default_imap_folders')) {
$this->imap->set_default_mailboxes($default_folders);
}
--- roundcubemail-0.2-alpha/config/main.inc.php.dist.org 2008-08-13 19:59:15.000000000 -0700
+++ roundcubemail-0.2-alpha/config/main.inc.php.dist 2008-08-13 20:06:42.000000000 -0700
@@ -35,6 +35,10 @@
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL connection, enter ssl://hostname:993
+// To enable a choice of which imap host to connect to enter
+// array( 'host-1' => 'friendlyName-1', 'ssl://host-2:993/rootFolder' => 'friendlyName-2')
+// the optional 'rootFolder' argument takes precedence over the 'imap_root' parameter below.
+
$rcmail_config['default_host'] = '';