[imp] Cyrus "realms" vs IMP "realms"

Marc G. Fournier scrappy@hub.org
Mon, 2 Sep 2002 13:37:45 -0300 (ADT)


On Mon, 2 Sep 2002, Edwin Culp wrote:

>  | But when I try to login, it only gets the @$vdomain part:
>  |
>  | ...mail.pluto.hub.org:143[imap] as @pluto.hub.org ...
>  |
>  | So, what value should I be setting in there?
>
> I use the following script that will hopefully help as it is a bit different,
> has the vdomain type and has worked for months.  As they say if it works
> don't fix it.
>
>
> $conf['hooks']['vinfo'] = 'imp_get_vinfo';
>
> if (!function_exists('imp_get_vinfo')) {
>      function imp_get_vinfo ($type = 'username') {
>         global $conf, $imp;
>
>         $vdomain = strtolower(preg_replace('|^mail\.|i', '',
> $_SERVER['HTTP_HOST']));
>
>          if ($type == 'username') {
>              return $_SESSION['imp']['user'] . '@' . $vdomain;
>         } elseif ($type == "vdomain") {
>             return $vdomain;
>         } else {
>             return new PEAR_Error('invalid type: ' . $type);
>         }
>     }
> }
>
> Hope this helps,

Nope, had thought to tried using the $_SESSION stuff, but then I get an
error of:

Notice: Undefined index: imp in /usr/local/www/pluto.hub.org/horde/imp/config/conf.php on line 312

if (!function_exists('imp_get_vinfo')) {
    function imp_get_vinfo ($type) {
        global $conf, $imp;

        $vdomain = getenv('HTTP_HOST');
        $vdomain = preg_replace('|^webmail\.|i', '', $vdomain);
        $vdomain = strtolower($vdomain);

        return $_SESSION['imp']['user'] . '@' . $vdomain;
    }
}