/**
  * Login into roundcube server
  *
  * @param $params userdata            
  * @return true if login was succesfull otherwise false
  */
 public static function login($params)
 {
     OCP\App::checkAppEnabled('roundcube');
     try {
         $username = $params['uid'];
         $password = $params['password'];
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->login(): Preparing login of roundcube user "' . $username . '"', OCP\Util::DEBUG);
         $maildir = OCP\Config::getAppValue('roundcube', 'maildir', '');
         $rc_host = self::getServerHost();
         $rc_port = OCP\Config::getAppValue('roundcube', 'rcPort', '');
         $enable_auto_login = OCP\Config::getAppValue('roundcube', 'autoLogin', false);
         if ($enable_auto_login) {
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->login(): Starting auto login', OCP\Util::DEBUG);
             // SSO attempt
             $mail_username = $username;
             $mail_password = $password;
         } else {
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->login(): Starting manual login', OCP\Util::DEBUG);
             $privKey = OC_RoundCube_App::getPrivateKey($username, $password);
             // Fetch credentials from data-base
             $mail_userdata_entries = OC_RoundCube_App::checkLoginData($username);
             // TODO create dropdown list
             $mail_userdata = $mail_userdata_entries[0];
             $mail_username = OC_RoundCube_App::decryptMyEntry($mail_userdata['mail_user'], $privKey);
             OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->login(): Used roundcube user: '******'mail_password'], $privKey);
         }
         // save username for displaying in later usage
         OC_RoundCube_App::setSessionVariable(OC_RoundCube_App::SESSION_ATTR_RCUSER, $mail_username);
         // login
         return OC_RoundCube_App::login($rc_host, $rc_port, $maildir, $mail_username, $mail_password);
     } catch (Exception $e) {
         // We got an exception == table not found
         OCP\Util::writeLog('roundcube', 'OC_RoundCube_AuthHelper.class.php->login(): Login error. ' . $e, OCP\Util::ERROR);
         return false;
     }
 }