/// <summary> /// Checks for extra response codes when an authentication has failed and throws /// the correct exception. /// If no such response codes is found, nothing happens. /// </summary> /// <param name="serverErrorResponse">The server response string</param> /// <param name="e">The exception thrown because the server responded with -ERR</param> /// <exception cref="PopServerLockedException">If the account is locked or in use</exception> /// <exception cref="LoginDelayException">If the server rejects the login because of too recent logins</exception> private static void CheckFailedLoginServerResponse(string serverErrorResponse, PopServerException e) { string upper = serverErrorResponse.ToUpperInvariant(); // Bracketed strings are extra response codes addded // in RFC http://tools.ietf.org/html/rfc2449 // together with the CAPA command. // Specifies the account is in use if (upper.Contains("[IN-USE]") || upper.Contains("LOCK")) { DefaultLogger.Log.LogError("Authentication: maildrop is locked or in-use"); throw new PopServerLockedException(e); } // Specifies that there must go some time between logins if (upper.Contains("[LOGIN-DELAY]")) { throw new LoginDelayException(e); } }
///<summary> /// Creates a LoginDelayException with the given inner exception ///</summary> ///<param name="innerException">The exception that is the cause of this exception</param> public LoginDelayException(PopServerException innerException) : base("Login denied because of recent connection to this maildrop. Increase time between connections.", innerException) { }
///<summary> /// Creates a PopServerLockedException with the given inner exception ///</summary> ///<param name="innerException">The exception that is the cause of this exception</param> public PopServerLockedException(PopServerException innerException) : base("The account is locked or in use", innerException) { }