当前位置: 首页>>代码示例>>C#>>正文


C# IConnection.AbortMessage方法代码示例

本文整理汇总了C#中IConnection.AbortMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IConnection.AbortMessage方法的具体用法?C# IConnection.AbortMessage怎么用?C# IConnection.AbortMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConnection的用法示例。


在下文中一共展示了IConnection.AbortMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessAsync

        public async Task ProcessAsync(IConnection connection, SmtpCommand command)
        {
            if (connection.CurrentMessage != null)
            {
                await connection.WriteResponseAsync(new SmtpResponse(StandardSmtpResponseCode.BadSequenceOfCommands,
                                                                   "You already told me who the message was from"));
                return;
            }

            if (command.ArgumentsText.Length == 0)
            {
                await connection.WriteResponseAsync(
                    new SmtpResponse(StandardSmtpResponseCode.SyntaxErrorInCommandArguments,
                                     "Must specify from address or <>"));
                return;
            }

            ArgumentsParser argumentsParser = new ArgumentsParser(command.ArgumentsText);
            string[] arguments = argumentsParser.Arguments;

            string from = arguments.First();
            if (from.StartsWith("<"))
                from = from.Remove(0, 1);

            if (from.EndsWith(">"))
                from = from.Remove(from.Length - 1, 1);

            connection.Server.Behaviour.OnMessageStart(connection, from);
            connection.NewMessage();
            connection.CurrentMessage.ReceivedDate = _currentDateTimeProvider.GetCurrentDateTime();
            connection.CurrentMessage.From = from;

            try
            {
                await ParameterProcessorMap.ProcessAsync(connection, arguments.Skip(1).ToArray(), true);
                await connection.WriteResponseAsync(new SmtpResponse(StandardSmtpResponseCode.OK, "New message started"));
            }
            catch
            {
                connection.AbortMessage();
                throw;
            }
        }
开发者ID:rnwood,项目名称:smtp4dev,代码行数:43,代码来源:MailFromVerb.cs

示例2: Process

        public void Process(IConnection connection, SmtpCommand command)
        {
            if (connection.CurrentMessage != null)
            {
                connection.WriteResponse(new SmtpResponse(StandardSmtpResponseCode.BadSequenceOfCommands,
                                                                   "You already told me who the message was from"));
                return;
            }

            if (command.ArgumentsText.Length == 0)
            {
                connection.WriteResponse(
                    new SmtpResponse(StandardSmtpResponseCode.SyntaxErrorInCommandArguments,
                                     "Must specify from address or <>"));
                return;
            }

            string from = command.Arguments.First();
            if (from.StartsWith("<"))
                from = from.Remove(0, 1);

            if (from.EndsWith(">"))
                from = from.Remove(from.Length - 1, 1);

            connection.Server.Behaviour.OnMessageStart(connection, from);
            connection.NewMessage();
            connection.CurrentMessage.From = from;


            try
            {
                ParameterProcessorMap.Process(command.Arguments.Skip(1).ToArray(), true);
                connection.WriteResponse(new SmtpResponse(StandardSmtpResponseCode.OK, "Okey dokey"));
            }
            catch
            {
                connection.AbortMessage();
                throw;
            }
        }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:40,代码来源:MailFromVerb.cs

示例3: Process

 public void Process(IConnection connection, SmtpCommand command)
 {
     connection.AbortMessage();
     connection.WriteResponse(new SmtpResponse(StandardSmtpResponseCode.OK, "Rset completed"));
 }
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:5,代码来源:RsetVerb.cs

示例4: ProcessAsync

 public async Task ProcessAsync(IConnection connection, SmtpCommand command)
 {
     connection.AbortMessage();
     await connection.WriteResponseAsync(new SmtpResponse(StandardSmtpResponseCode.OK, "Rset completed"));
 }
开发者ID:rnwood,项目名称:smtp4dev,代码行数:5,代码来源:RsetVerb.cs


注:本文中的IConnection.AbortMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。