本文整理汇总了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;
}
}
示例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;
}
}
示例3: Process
public void Process(IConnection connection, SmtpCommand command)
{
connection.AbortMessage();
connection.WriteResponse(new SmtpResponse(StandardSmtpResponseCode.OK, "Rset completed"));
}
示例4: ProcessAsync
public async Task ProcessAsync(IConnection connection, SmtpCommand command)
{
connection.AbortMessage();
await connection.WriteResponseAsync(new SmtpResponse(StandardSmtpResponseCode.OK, "Rset completed"));
}