[imp] Using hook to copy Squirrelmail to Turba on first login?

Josh Trutwin josh at trutwins.homeip.net
Tue Apr 19 05:42:40 PDT 2005


I have some MySQL code that copies a user's SquirrelMail addressbook
into the Turba tables (both are using a MySQL backend).  I'm working
on a migration plan from SquirrelMail to Horde3/Imp4 and what I'd like
to do is use the _horde_hook_postauthenticate hook to run this code on
the user's first login to Imp.  The only thing I'm not sure of is how
to tell whether or not it's the user's first login.  It must be
possible since it shows the Last Login each time anyone logs in.  Any
thoughts?  Here's what I'm attempting to do with the hook:


if (!function_exists('_horde_hook_postauthenticate')) {
    function _horde_hook_postauthenticate($userID, $credential,
$realm)
    {
       // test to check if first login - how???
       if ($first_login) {
          // run code here to copy SM addressbook to Turba 
       } 

       return true;
    }
}

Thanks,

Josh


More information about the imp mailing list