[imp] Help on a custom hook

Otto Stolz Otto.Stolz at uni-konstanz.de
Fri Feb 9 03:01:32 PST 2007


Hello Errol Neal,

you have been asking about _imp_hook_vinfo:
> where should I call my dinky little function in the IMP code?

This will be called
- when you login via the IMP (not Horde) login page,
- if you have enabled this, as described in horde/config/hooks.php.dist.

_imp_hook_vinfo will be called several times during Imp login.
If it is called as _imp_hook_vinfo('vdomain'),
    it must yield a domain name which will be displaed in the
    login mask, next to the Username field. (I do not know,
    where else that info may be used.)
If it is called as _imp_hook_vinfo().
    it must deliver the user id for the IMAP login.

Note that IMP::getCurrentServer(), IMP::serverString(). $_SESSION['imp']
and so forth do not yet work when _imp_hook_vinfo is invoked;
so it must pull its input data from the login form. Note also
that this form uses both POST, and GET, data transfer, depending
on the previous events, so you should use
     $Imp_user    = Util::getFormData('imapuser');
     $IMAP_Server = Util::getFormData('server');
to get at those data.

Note also that Imp, and Turba, will need a unique name to index the
user preferencies, and personal addressbooks, respectively. I do not
quite remember whether the user input ($Imp_user, in my code snippet,
above) is used, or the result from _imp_hook_vinfo(). If you wish
to preserve user preferences, or addressbooks, from a previous horde
installation, you may need to provide _username_hook_frombackend, and
_username_hook_tobackend, functions to generate suitable user-ids for
Imp, and Turba, storage.

You have mentioned a user data base. If this contains the personal
names of your users, you may wish to provide a _prefs_hook_fullname
function to retrieve that name, mainly for the From field in outgoing
messages. Likewise, you can provide the sender's address for those
 From fields via _prefs_hook_from_addr, if necessary.

Best wishes,
   Otto Stolz



More information about the imp mailing list