[RCD] prefs hostname revisited

Cor Bosman cor at xs4all.nl
Fri Aug 15 11:33:03 CEST 2014

Hey all, every so often we have this discussion about the hostname in the preferences db. It is quite a hassle for us to have the imap hostname be part of the preferences. For instance, we allow some customer service people to impersonate customers, and only 1 specific imap server allows impersonation, which is only accessible through internal networks. But then we cant have these customer service people actually interact with settings..

I went into the code a bit, and maybe this is a workable solution. There seems to be only 2 times when the hostname is used to interact with the db. One in rcube_user::query(), and one in rcube_user::create().

Interestingly, create() has a plugin hook, which allows you to modify the hostname. But query() does not.

The code that calls query() is in rcmail.php.

>         $host     = rcube_utils::idn_to_ascii($host);
>         $username = rcube_utils::idn_to_ascii($username);
>         // user already registered -> overwrite username
>         if ($user = rcube_user::query($username, $host)) {
>             $username = $user->data['username'];
>         }

What if we add a plugin hook there (or actually in query()), so you can modify the created hostname during login? That way, this can all be done using plugins and people that want to can set a static hostname for preferences.


More information about the dev mailing list