[imp] disallow Dynamic View

Brendan Oakley gentux2 at gmail.com
Thu Jan 17 02:23:29 UTC 2013


On Wed, Jan 16, 2013 at 5:04 PM, Brendan Oakley <gentux2 at gmail.com> wrote:
>
> I tried changing the mode in
> preauth and postauth hooks, since the mode selection seems to get
> sucked into the authenticate() method, but the problem there is I
> don't see how to get at it where I can change it.

The preauth hook actually works perfectly if you do it right. The
examples in hooks.php.dist do not include one which returns the
credentials array, so I was doing it wrong. The example in the wiki at
the bottom of http://wiki.horde.org/ImapSelect shows how to do this
correctly. So now I have this preauth hook:

class Horde_Hooks {
    public function preauthenticate($userID, $credentials) {
        if ($credentials['mode'] == 'dynamic') {
            $credentials['mode'] = 'basic';
            return array('credentials' => $credentials);
        }
        return true;
    }
}

Now if dynamic view is selected, you get basic view, but if you select
mobile view, you still get mobile view.

With the current code, this would seem to be the best way to go about
it. No need to hack the source.

Thanks
Brendan


More information about the imp mailing list