/// <summary> /// 执行命令,如果命令是与登录相关则不执行 /// </summary> /// <returns>如果返回true,则说明命令执行成功</returns> public override bool IssueCommand(RFC1939.POPCommand command, POPClient context) { if (!IsLegalCommand(command)) { return(false); } if (command is RFC1939.QuitCommand) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = DisconnectedState.GetInstane(); return(true); } context.CurrentState = DisconnectedState.GetInstane(); context.LoggCommand(command); } else if (command is RFC1939.RetriveCommand || command is RFC1939.TopCommand) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = ReadingState.GetInstance(); return(true); } context.LoggCommand(command); } else if (command is RFC1939.NoopCommand) { if (command.Execute()) { context.LoggCommand(command); return(true); } else { context.LoggCommand(command); context.Disconnect(); context.CurrentState = DisconnectedState.GetInstane(); } } else { if (command.Execute()) { context.LoggCommand(command); return(true); } context.LoggCommand(command); } return(false); }
public override bool IssueCommand(RFC1939.POPCommand command, POPClient context) { if (IsLegalCommand(command)) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = AuthorizationState.GetInstance(); return(true); } } return(false); }
public override bool IssueCommand(RFC1939.POPCommand command, POPClient context) { if (!IsLegalCommand(command)) { return(false); } if (command is RFC1939.ConnectCommand) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = TransactionState.GetInstance(); return(true); } context.LoggCommand(command); } else if (command is RFC1939.UserCommand) { if (command.Execute()) { context.LoggCommand(command); return(true); } context.LoggCommand(command); } else if (command is RFC1939.PassCommand) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = TransactionState.GetInstance(); return(true); } context.LoggCommand(command); } else if (command is RFC1939.QuitCommand) { if (command.Execute()) { context.LoggCommand(command); context.CurrentState = DisconnectedState.GetInstane(); return(true); } context.LoggCommand(command); } return(false); }
/// <summary> /// 判断是不是合法命令,如果是则执行命令 /// </summary> public abstract bool IssueCommand(RFC1939.POPCommand command, POPClient context);
public override bool IssueCommand(RFC1939.POPCommand command, POPClient context) { return(IsLegalCommand(command)); }