public virtual Pop3Response Logout() { lock (this) { if (this.State != EPop3ClientState.Awaiting) { throw new InvalidOperationException("Pop3Client doesn't allow executing multiple operations simulteneously in a few threads using one object"); } this.State = EPop3ClientState.Busy; } Pop3Response response = new Pop3Response("+OK"); if (this.ConnectionState != EPop3ConnectionState.Disconnected) { QUIT command = new QUIT(); response = this.DoCommand(command); if (this.Quit != null) { this.Quit(this); } this.ConnectionState = EPop3ConnectionState.Disconnected; if (Disconnected != null) { Disconnected(this); } try { this._connection.Close(); } catch (Exception exception) { this.HandleException(exception); throw; } } this.State = EPop3ClientState.Awaiting; return(response); }
public QUITHandler(ISession client, ChatCommandBase cmd) : base(client, cmd) { _cmd = (QUIT)cmd; }