I've managed to resolve this with a plugin but simpler ideas (or code corrections) are welcome!
I decided not to hook into user_create as I would prefer to keep the "user@domain.tld" format in the UI.
class percent_authentication extends rcube_plugin
{
public $task = 'login|mail';
private $rc;
function init()
{
$this->rc = rcube::get_instance();
$this->add_hook('authenticate', array($this, 'authentication'));
$this->add_hook('smtp_connect', array($this, 'smtp_connection'));
}
function authentication($args)
{
return array('user' => str_replace('@', '%', $args['user']));
}
function smtp_connection($args)
{
return array('smtp_user' => str_replace('@', '%', $this->rc->user->get_username()));
}
}