Exemplo n.º 1
0
        public async Task NoopSendsMessage()
        {
            var channel = new MockSmtpChannel();
            var noop    = new NoopCommand(channel);

            noop.Initialize("");
            await noop.ExecuteAsync(CancellationToken.None);

            SmtpTestHelper.AssertResponse(channel, SmtpReplyCode.Okay);
        }
Exemplo n.º 2
0
        public override void ProcessNoopCommand(NoopCommand cmd)
        {
            using (var ctx = new MSGorillaMailEntities())
            {
                MailBox box = this.store.GetMailbox(_mailbox.MailboxID, ctx);
                if (box.Exist != _mailbox.Exist)
                {
                    _mailbox = box;
                    this.Enter();
                }
                else
                {
                    _mailbox = box;
                }
            }

            base.ProcessNoopCommand(cmd);
        }
 /// <summary>
 /// Visit an NOOP command.
 /// </summary>
 /// <param name="command">The command that is being visited.</param>
 protected override void Visit(NoopCommand command)
 {
     _output.WriteLine("NOOP");
 }
Exemplo n.º 4
0
        protected async Task <CommandBase> GetCommandAsync(String line, List <Type> possibleCommands)
        {
            if (String.IsNullOrEmpty(line))
            {
                return(null);
            }

            CommandBase cmd     = null;
            String      payload = null;

            if ((payload = this.GetPayloadByCommand(line, HeloCommand.Command)) != null)
            {
                cmd = new HeloCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, EhloCommand.Command)) != null)
            {
                cmd = new EhloCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, StartTlsCommand.Command)) != null)
            {
                cmd = new StartTlsCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, MailCommand.Command)) != null)
            {
                cmd = new MailCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, RcptCommand.Command)) != null)
            {
                cmd = new RcptCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, DataCommand.Command)) != null)
            {
                cmd = new DataCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, QuitCommand.Command)) != null)
            {
                cmd = new QuitCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, RstCommand.Command)) != null)
            {
                cmd = new RstCommand(payload);
            }
            else if ((payload = this.GetPayloadByCommand(line, NoopCommand.Command)) != null)
            {
                cmd = new NoopCommand(payload);
            }

            if (cmd != null)
            {
                if (possibleCommands.Contains(cmd.GetType()))
                {
                    var error = cmd.ParseParameter();
                    if (error == null)
                    {
                        error = await cmd.ParseParameterAsync(this.Connection);
                    }

                    if (error != null)
                    {
                        await this.Connection.WriteLineAsync(error);

                        cmd = null;
                    }
                }
                else
                {
                    cmd = new InvalidCommand(payload);
                }
            }
            else
            {
                await this.Connection.WriteLineAsync("500 Unrecognized command");
            }

            return(cmd);
        }
 public virtual void Visit(NoopCommand command) => Default(command);
Exemplo n.º 6
0
 public virtual void ProcessNoopCommand(NoopCommand cmd)
 {
     this.Session.AppendResponse(new ServerStatusResponse(cmd.Tag, ServerStatusResponseType.OK, "NOOP completed"));
 }