<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
/**
 * Ingo Hooks configuration file.
 *
 * For more information please see the horde/config/hooks.php.dist file.
 *
 * $Id: acf2c96e445f2709239902bda0371992f2f08c11 $
 */

class Ingo_Hooks
{
    /**
     * Returns the username/password needed to connect to the transport
     * backend.
     *
     * @param string $driver  The driver name (array key from backends.php).
     *
     * @return mixed  If non-array, uses Horde authentication credentials
                      (DEFAULT). Otherwise, an array with the following keys
     *                (non-existent keys will use default values):
     *  - euser: (string; SIEVE ONLY) For the sieve driver, the effective
     *           user to use.
     *  - password: (string) Password.
     *  - username: (string) User name.
     */
    public function transport_auth($driver)
    {
        /* HOOK START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
        switch ($driver) {
        case 'timsieved':
            // Dovecot managesieved requires full mail address for authentication
            $full_username = $GLOBALS['registry']->getAuth(null);
            return array(
                'username' => $full_username,
                'euser' => $full_username,
            );
        }

        // DEFAULT: Use hordeauth (identical to not defining hook at all).
        return true;
        /* HOOK END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */
    }
}
