Here's a small patch that allows roundcube to run a query to fill a new user's identities.
In config/main.inc.php I use the following line for my setup:
$rcmail_config['virtuser_query'] = 'SELECT address FROM mail.virtual WHERE alias REGEXP '(^|,)%u(,|$)' AND NOT (address LIKE '@%')';
This ensures that new users get at least one valid email address in their identities, since on my system not everybody has an address $username@$config['mail_domain'].
Maybe it would be even nicer if the query was used not only with a new user, but every time on login. Somehow.
Robin
diff -uNr --exclude CVS --exclude main.inc.php roundcubemail.orig/config/main.inc.php.dist roundcubemail/config/main.inc.php.dist --- roundcubemail.orig/config/main.inc.php.dist Sun Feb 5 18:54:25 2006 +++ roundcubemail/config/main.inc.php.dist Thu Feb 9 10:04:05 2006 @@ -47,6 +47,10 @@ // Path to a virtuser table file to resolve user names and e-mail addresses $rcmail_config['virtuser_file'] = '';
+// Query to resolve user names and e-mail addresses from the database +// %u will be replaced with the current username for login +$rcmail_config['virtuser_query'] = '';
// use this host for sending mails. // to use SSL connection, set ssl://smtp.host.com // if left blank, the PHP mail() function is used diff -uNr --exclude CVS --exclude main.inc.php roundcubemail.orig/program/include/main.inc roundcubemail/program/include/main.inc --- roundcubemail.orig/program/include/main.inc Sun Feb 5 17:34:48 2006 +++ roundcubemail/program/include/main.inc Thu Feb 9 10:32:25 2006 @@ -448,13 +448,29 @@
$user_name = $user!=$user_email ? $user : '';
(user_id, del, standard, name, email)
VALUES (?, 0, 1, ?, ?)",
$user_id,
$user_name,
$user_email);
// also create new identity records
if (empty($CONFIG['virtuser_query']))
{
$DB->query("INSERT INTO ".get_table_name('identities')."
(user_id, del, standard, name, email)
VALUES (?, 0, 1, ?, ?)",
$user_id,
$user_name,
$user_email);
}
else
{
$sql_result = $DB->query(preg_replace('/%u/', $user, $CONFIG['virtuser_query']));
while ($sql_arr = $DB->fetch_assoc($sql_result))
{
$DB->query("INSERT INTO ".get_table_name('identities')."
(user_id, del, standard, name, email)
VALUES (?, 0, 1, ?, ?)",
$user_id,
$user_name,
$sql_arr['address']);
}
}
// get existing mailboxes $a_mailboxes = $IMAP->list_mailboxes();