[gollem] Selecting server based on IMP server

Michael M Slusarz slusarz at mail.curecanti.org
Thu Oct 13 00:14:48 PDT 2005


Quoting Jacob Elder <jake.horde at trec.us>:

> I want to automatically select the backend hostspec based on which 
> IMAP server
> Imp is using. My organization has 5 backend servers running IMAP and 
> FTP, so I
> was imagining something like this:
>
> $backends['auto'] = array(
>    'name' => 'Automatic',
>    'driver' => 'ftp',
>    'preferred' => '',
>    'hordeauth' => full,
>    'params' => array(
>        'hostspec' => // PHP magic here,
>    ),
>    'root' => '/',
>    'home' => '',
>    'createhome' => 'false',
>    // 'filter' => '^regex$',
>    'attributes' => array('type', 'name', 'download', 'modified', 'size',
> 'permission', 'owner', 'group')
> );
>
>
> It's been a couple of years since I've done anything serious with PHP (more
> comfortable in Perl), so I'm not really sure where to start. Is there any way
> to see the which server the user selected from the Imp login screen?

Yes, by looking in the $_SESSION['imp'] array.  But you are responsible 
for making sure this variable is set (i.e. the user has logged in) 
before you can check it in gollem.

better yet, write an api method for imp that will return the current 
imap server used (see imp/lib/api.php) - then you can use Horde 
Registry:: calls to access the information rather than trying to access 
session variables - this is a much cleaner solution.  If you decide to 
go this route, sharing the api code with us would be great since this 
is definitely something that would be added.

michael

_______________________________________
Michael Slusarz [slusarz at curecanti.org]


More information about the gollem mailing list