[Nmailserver-commits] SF.net SVN: nmailserver: [222] NMail/trunk/NMail
Brought to you by:
dframpton-oss,
tmyroadctfig
|
From: <tmy...@us...> - 2007-06-16 14:58:16
|
Revision: 222
http://svn.sourceforge.net/nmailserver/?rev=222&view=rev
Author: tmyroadctfig
Date: 2007-06-16 07:58:16 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Fixed some silly spelling mistakes. Added some constants header values to MessageHeaders.
Modified Paths:
--------------
NMail/trunk/NMail/DataTypes/Message/Envelope.cs
NMail/trunk/NMail/DataTypes/Message/Message.cs
NMail/trunk/NMail/DataTypes/Message/MessageHeaders.cs
NMail/trunk/NMail/DataTypes/Message/SimpleMessageBody.cs
NMail/trunk/NMail/DataTypes/Service/IService.cs
NMail/trunk/NMail/DataTypes/SmtpMessage.cs
NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs
NMail/trunk/NMail.Sendmail/Sendmail.cs
NMail/trunk/NMail.SmtpService/Command/DataCommand.cs
NMail/trunk/NMail.SmtpService/Command/RecipientCommand.cs
NMail/trunk/NMail.SmtpService/Command/SenderCommand.cs
NMail/trunk/NMail.SmtpService/Configuration/SmtpServiceConfiguration.cs
NMail/trunk/NMail.SmtpService/NMail.SmtpService.csproj
NMail/trunk/NMail.SmtpService/SmtpServiceConnection.cs
NMail/trunk/NMail.UnitTests/DataTypes/MessageHeaderTests.cs
Added Paths:
-----------
NMail/trunk/NMail.SmtpService/State/RecipientReceivedState.cs
NMail/trunk/NMail.SmtpService/State/SenderReceivedState.cs
Removed Paths:
-------------
NMail/trunk/NMail.SmtpService/State/RecipientRecievedState.cs
NMail/trunk/NMail.SmtpService/State/SenderRecievedState.cs
Modified: NMail/trunk/NMail/DataTypes/Message/Envelope.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Message/Envelope.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/Message/Envelope.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -37,37 +37,37 @@
/// <param name="messageHeaders">The headers containing the envelope information.</param>
public Envelope(MessageHeaders messageHeaders) {
// These fields should never be null
- this.from = messageHeaders["From"];
- this.date = messageHeaders["Date"];
- this.subject = messageHeaders["Subject"];
+ this.from = messageHeaders[MessageHeaders.FromHeader];
+ this.date = messageHeaders[MessageHeaders.DateHeader];
+ this.subject = messageHeaders[MessageHeaders.SubjectHeader];
- this.sender = messageHeaders["Sender"];
+ this.sender = messageHeaders[MessageHeaders.SenderHeader];
if (this.sender == null || this.sender.Trim() == string.Empty) {
this.sender = this.from;
}
- this.replyTo = messageHeaders["Rely-To"];
+ this.replyTo = messageHeaders[MessageHeaders.ReplyToHeader];
if (this.replyTo == null || this.replyTo.Trim() == string.Empty) {
this.replyTo = this.from;
}
// These fields can be null
- this.messageId = messageHeaders["Message-Id"];
+ this.messageId = messageHeaders[MessageHeaders.MessageIdHeader];
if (this.messageId != null && this.messageId.Trim() == string.Empty) {
this.messageId = null;
}
- this.to = messageHeaders["To"];
+ this.to = messageHeaders[MessageHeaders.ToHeader];
if (this.to != null && this.to.Trim() == string.Empty) {
this.to = null;
}
- this.inReplyTo = messageHeaders["In-Reply-To"];
+ this.inReplyTo = messageHeaders[MessageHeaders.InReplyToHeader];
if (this.inReplyTo != null && this.inReplyTo.Trim() == string.Empty) {
this.inReplyTo = null;
}
- this.bcc = messageHeaders["Bcc"];
+ this.bcc = messageHeaders[MessageHeaders.BccHeader];
if (this.bcc != null && this.inReplyTo.Trim() == string.Empty) {
this.bcc = null;
}
- this.cc = messageHeaders["Cc"];
+ this.cc = messageHeaders[MessageHeaders.CcHeader];
if (this.cc != null && this.cc.Trim() == string.Empty) {
this.cc = null;
}
Modified: NMail/trunk/NMail/DataTypes/Message/Message.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Message/Message.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/Message/Message.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -108,6 +108,40 @@
set { body = value; }
}
+ /// <summary>
+ /// The subject for this message.
+ /// </summary>
+ public string Subject {
+ get { return this.body.Headers[MessageHeaders.SubjectHeader]; }
+ set { this.body.Headers[MessageHeaders.SubjectHeader] = value; }
+ }
+
+ /// <summary>
+ /// The from address for this message.
+ /// </summary>
+ public string From {
+ get { return this.body.Headers[MessageHeaders.FromHeader]; }
+ set { this.body.Headers[MessageHeaders.FromHeader] = value; }
+ }
+
+ /// <summary>
+ /// The date for this message.
+ /// </summary>
+ public string Date {
+ get { return this.body.Headers[MessageHeaders.DateHeader]; }
+ set { this.body.Headers[MessageHeaders.DateHeader] = value; }
+ }
+
+ /// <summary>
+ /// Sets the body of this message to a simple string.
+ /// </summary>
+ /// <param name="bodyData">The string to use for the message body.</param>
+ public void SetSimpleBody(string bodyData) {
+ SimpleMessageBody newBody = new SimpleMessageBody(bodyData);
+ newBody.Headers = this.Headers;
+ this.body = newBody;
+ }
+
#region IMessageBodyPart
/// <summary>
/// Gets or sets the headers associated with this body part.
Modified: NMail/trunk/NMail/DataTypes/Message/MessageHeaders.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Message/MessageHeaders.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/Message/MessageHeaders.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -228,5 +228,60 @@
this.AppendEnd(name, value);
}
}
+
+ /// <summary>
+ /// The Subject header.
+ /// </summary>
+ public const string SubjectHeader = "Subject";
+
+ /// <summary>
+ /// The Date header.
+ /// </summary>
+ public const string DateHeader = "Date";
+
+ /// <summary>
+ /// The From header.
+ /// </summary>
+ public const string FromHeader = "From";
+
+ /// <summary>
+ /// The Received header.
+ /// </summary>
+ public const string ReceivedHeader = "Received";
+
+ /// <summary>
+ /// The To header.
+ /// </summary>
+ public const string ToHeader = "To";
+
+ /// <summary>
+ /// The Cc header.
+ /// </summary>
+ public const string CcHeader = "Cc";
+
+ /// <summary>
+ /// The Bcc header.
+ /// </summary>
+ public const string BccHeader = "Bcc";
+
+ /// <summary>
+ /// The In-reply-to header.
+ /// </summary>
+ public const string InReplyToHeader = "In-Reply-To";
+
+ /// <summary>
+ /// The Reply-to header.
+ /// </summary>
+ public const string ReplyToHeader = "Reply-To";
+
+ /// <summary>
+ /// The Sender header.
+ /// </summary>
+ public const string SenderHeader = "Sender";
+
+ /// <summary>
+ /// The Message-Id header.
+ /// </summary>
+ public const string MessageIdHeader = "Message-Id";
}
}
Modified: NMail/trunk/NMail/DataTypes/Message/SimpleMessageBody.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Message/SimpleMessageBody.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/Message/SimpleMessageBody.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -46,6 +46,12 @@
/// <summary>
/// Creates a message body part from the given lines.
/// </summary>
+ /// <param name="data">The lines to create the data from.</param>
+ public SimpleMessageBody(string data) : this(null, new ByteString(data, Encoding.ASCII)) { }
+
+ /// <summary>
+ /// Creates a message body part from the given lines.
+ /// </summary>
/// <param name="headers">The headers associated with this body part.</param>
/// <param name="data">The lines to create the data from.</param>
public SimpleMessageBody(MessageHeaders headers, ByteString data) : base(data) {
Modified: NMail/trunk/NMail/DataTypes/Service/IService.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/Service/IService.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/Service/IService.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -106,7 +106,7 @@
/// The event triggered when the service has been started.
/// </summary>
/// <remarks>
- /// Running should return true when this event is recieved.
+ /// Running should return true when this event is received.
/// </remarks>
event EventHandler Started;
@@ -114,7 +114,7 @@
/// The event triggered when the sevice has been stopped.
/// </summary>
/// <remarks>
- /// Running should return false when this event is recieved.
+ /// Running should return false when this event is received.
/// </remarks>
event EventHandler Stopped;
}
Modified: NMail/trunk/NMail/DataTypes/SmtpMessage.cs
===================================================================
--- NMail/trunk/NMail/DataTypes/SmtpMessage.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail/DataTypes/SmtpMessage.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -153,7 +153,7 @@
private IPAddress sourceAddress;
/// <summary>
- /// Gets or sets the address from which this message was recieved.
+ /// Gets or sets the address from which this message was received.
/// </summary>
public IPAddress SourceAddress {
get{
Modified: NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs
===================================================================
--- NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.ImapService/State/AuthenticatedState.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -365,19 +365,18 @@
// Parse the message headers
Message message = new Message(new ByteString(messageData, Encoding.ASCII));
- MessageHeaders headers = message.Headers;
// Prepare details for the headers
string currentTime = DateTime.Now.ToString("r", DateTimeFormatInfo.InvariantInfo);
- // TODO: is a Recieved header needed here?
+ // TODO: is a Received header needed here?
// All message must have a from address and a date.
- if (headers["From"] == null) {
- headers["From"] = Session.AuthenticationToken.Username;
+ if (message.From == null) {
+ message.From = Session.AuthenticationToken.Username;
}
- if (headers["Date"] == null) {
- headers["Date"] = currentTime;
+ if (message.Date == null) {
+ message.Date = currentTime;
}
// Attempt to spool the message
Modified: NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs
===================================================================
--- NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.LocalStore/DeliveryActions/ManageWhiteList.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -146,7 +146,7 @@
public bool IsCommandMessage(Message message, EmailAddress sender, EmailAddress recipient) {
if (sender == recipient) {
- if (message.Headers["Subject"].Trim().ToLower() == ListCommand) {
+ if (message.Headers[MessageHeaders.SubjectHeader].Trim().ToLower() == ListCommand) {
return true;
}
}
@@ -155,7 +155,7 @@
}
public WhiteListCommandType GetCommand(Message message) {
- if (message.Headers["Subject"].Trim().ToLower() == ListCommand) {
+ if (message.Headers[MessageHeaders.SubjectHeader].Trim().ToLower() == ListCommand) {
return WhiteListCommandType.List;
}
Modified: NMail/trunk/NMail.Sendmail/Sendmail.cs
===================================================================
--- NMail/trunk/NMail.Sendmail/Sendmail.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.Sendmail/Sendmail.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -74,7 +74,7 @@
// Get the recipients
if (options.ExtractRecipients) {
- string[] recipients = message.Headers["To"].Split(';');
+ string[] recipients = message.Headers[MessageHeaders.ToHeader].Split(';');
foreach (string recipient in recipients) {
string address = null;
Modified: NMail/trunk/NMail.SmtpService/Command/DataCommand.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/Command/DataCommand.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/Command/DataCommand.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -95,12 +95,13 @@
}
// Parse the message headers
- session.Message.Message = new Message(messageData.ToByteString());
- MessageHeaders headers = session.Message.Message.Headers;
+ Message message = new Message(messageData.ToByteString());
+ MessageHeaders headers = message.Headers;
+ session.Message.Message = message;
// Check the headers for signs of an endless SMTP loop
- if (headers.GetHeaders("Recieved") == null
- || headers.GetHeaders("Recieved").Length < SmtpServiceConfiguration.Current.MaximumRecievedCount) {
+ if (headers.GetHeaders(MessageHeaders.ReceivedHeader) == null
+ || headers.GetHeaders(MessageHeaders.ReceivedHeader).Length < SmtpServiceConfiguration.Current.MaximumReceivedCount) {
// Prepare details for the headers
string currentTime = DateTime.Now.ToString("r", DateTimeFormatInfo.InvariantInfo);
@@ -108,16 +109,21 @@
string transport = (session.Esmtp) ? "ESMTP" : "SMTP";
// Add the received header
- string recievedHeader = string.Format(RecievedHeader, session.ReportedHost,
- clientHost, session.ClientAddress, SmtpServiceConfiguration.Current.VisibleHost, transport, currentTime);
- headers.AppendStart("Recieved", recievedHeader);
+ string receivedHeader = string.Format(ReceivedHeaderFormat,
+ session.ReportedHost,
+ clientHost,
+ session.ClientAddress,
+ SmtpServiceConfiguration.Current.VisibleHost,
+ transport,
+ currentTime);
+ headers.AppendStart(MessageHeaders.ReceivedHeader, receivedHeader);
// All message must have a from address and a date.
- if (headers["From"] == null) {
- headers["From"] = session.Message.Sender.ToString(true);
+ if (message.From == null) {
+ message.From = session.Message.Sender.ToString(true);
}
- if (headers["Date"] == null) {
- headers["Date"] = currentTime;
+ if (message.Date == null) {
+ message.Date = currentTime;
}
try {
@@ -129,8 +135,8 @@
session.Connection.TemporaryBadResponse(ex.Message);
}
} else {
- // Too many "Recieved" headers - message rejected
- session.Log.Warn("Rejected message with too many \"Recieved\" headers.");
+ // Too many "Received" headers - message rejected
+ session.Log.Warn("Rejected message with too many \"Received\" headers.");
session.Connection.ErrorPossibleSmtpLoop();
}
@@ -141,7 +147,7 @@
/// <summary>
/// The format of the "Received:" header line that must be added to the message.
/// </summary>
- public const string RecievedHeader = "from {0} ({1} [{2}])\r\n\tby NMail ({3}) with {4} {5}";
+ public const string ReceivedHeaderFormat = "from {0} ({1} [{2}])\r\n\tby NMail ({3}) with {4} {5}";
#endregion
}
Modified: NMail/trunk/NMail.SmtpService/Command/RecipientCommand.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/Command/RecipientCommand.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/Command/RecipientCommand.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -72,7 +72,7 @@
if (session.Message.Recipients.Count <= SmtpServiceConfiguration.Current.RecipientLimit) {
session.Message.AddRecipient(recipient.Address);
session.Connection.OkRecipient(recipient.Address);
- session.CurrentState = new RecipientRecievedState(session);
+ session.CurrentState = new RecipientReceivedState(session);
} else {
session.Connection.TemporaryBadRecipient(recipient.Address);
}
Modified: NMail/trunk/NMail.SmtpService/Command/SenderCommand.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/Command/SenderCommand.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/Command/SenderCommand.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -91,7 +91,7 @@
session.SizeEstimate = sizeEstimate;
session.MessageEncoding = encoding;
session.Connection.Ok();
- session.CurrentState = new SenderRecievedState(session);
+ session.CurrentState = new SenderReceivedState(session);
}
}
Modified: NMail/trunk/NMail.SmtpService/Configuration/SmtpServiceConfiguration.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/Configuration/SmtpServiceConfiguration.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/Configuration/SmtpServiceConfiguration.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -123,17 +123,17 @@
}
/// <summary>
- /// The maximum number of "Recieved" header entries before a message is rejected
+ /// The maximum number of "Received" header entries before a message is rejected
/// being in an endless loop. Should be at least 100 RFC 2821 6.2
/// </summary>
- [ConfigurationProperty("MaxRecievedCount", DefaultValue = 100)]
+ [ConfigurationProperty("MaxReceivedCount", DefaultValue = 100)]
[IntegerValidator(MinValue = 10, MaxValue = Int32.MaxValue)]
- public int MaximumRecievedCount {
+ public int MaximumReceivedCount {
get {
- return (int) this["MaxRecievedCount"];
+ return (int) this["MaxReceivedCount"];
}
set {
- this["MaxRecievedCount"] = value;
+ this["MaxReceivedCount"] = value;
}
}
Modified: NMail/trunk/NMail.SmtpService/NMail.SmtpService.csproj
===================================================================
--- NMail/trunk/NMail.SmtpService/NMail.SmtpService.csproj 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/NMail.SmtpService.csproj 2007-06-16 14:58:16 UTC (rev 222)
@@ -134,12 +134,8 @@
<Compile Include="State\NegotiatedState.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="State\RecipientRecievedState.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="State\SenderRecievedState.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="State\RecipientReceivedState.cs" />
+ <Compile Include="State\SenderReceivedState.cs" />
<Content Include="NMail.SmtpService.build" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Modified: NMail/trunk/NMail.SmtpService/SmtpServiceConnection.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/SmtpServiceConnection.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/SmtpServiceConnection.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -165,7 +165,7 @@
}
/// <summary>
- /// Sends an error message reporting that too many "Recieved" headers have been
+ /// Sends an error message reporting that too many "Received" headers have been
/// detected.
/// </summary>
public void ErrorPossibleSmtpLoop() {
@@ -252,7 +252,7 @@
/// <summary>
/// The error response when a SMTP loop is detected.
/// </summary>
- private const string ErrorSmtpLoopDetected = "554 Error: Too many \"Recieved\" headers; possible SMTP loop.";
+ private const string ErrorSmtpLoopDetected = "554 Error: Too many \"Received\" headers; possible SMTP loop.";
#endregion
}
}
Copied: NMail/trunk/NMail.SmtpService/State/RecipientReceivedState.cs (from rev 192, NMail/trunk/NMail.SmtpService/State/RecipientRecievedState.cs)
===================================================================
--- NMail/trunk/NMail.SmtpService/State/RecipientReceivedState.cs (rev 0)
+++ NMail/trunk/NMail.SmtpService/State/RecipientReceivedState.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2006 Luke Quinane, Daniel Frampton and Jared Hodges.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+
+using NMail.DataTypes;
+using NMail.SmtpService.Command;
+
+namespace NMail.SmtpService.State {
+ /// <summary>
+ /// Defines command behaviour in the recipient received state.
+ /// </summary>
+ public class RecipientReceivedState : AbstractSmtpState {
+ /// <summary>
+ /// Creates a new instance of the state.
+ /// </summary>
+ /// <param name="session">The session the owns this state.</param>
+ public RecipientReceivedState(SmtpSession session) : base(session) {
+ this.Commands["rcpt"] = new RecipientCommand();
+ this.Commands["data"] = new DataCommand();
+ this.Commands["rset"] = new ResetCommand(true);
+ }
+ }
+}
Deleted: NMail/trunk/NMail.SmtpService/State/RecipientRecievedState.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/State/RecipientRecievedState.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/State/RecipientRecievedState.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -1,38 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane, Daniel Frampton and Jared Hodges.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-
-using NMail.DataTypes;
-using NMail.SmtpService.Command;
-
-namespace NMail.SmtpService.State {
- /// <summary>
- /// Defines command behaviour in the recipient recieved state.
- /// </summary>
- public class RecipientRecievedState : AbstractSmtpState {
- /// <summary>
- /// Creates a new instance of the state.
- /// </summary>
- /// <param name="session">The session the owns this state.</param>
- public RecipientRecievedState(SmtpSession session) : base(session) {
- this.Commands["rcpt"] = new RecipientCommand();
- this.Commands["data"] = new DataCommand();
- this.Commands["rset"] = new ResetCommand(true);
- }
- }
-}
Copied: NMail/trunk/NMail.SmtpService/State/SenderReceivedState.cs (from rev 192, NMail/trunk/NMail.SmtpService/State/SenderRecievedState.cs)
===================================================================
--- NMail/trunk/NMail.SmtpService/State/SenderReceivedState.cs (rev 0)
+++ NMail/trunk/NMail.SmtpService/State/SenderReceivedState.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2006 Luke Quinane, Daniel Frampton and Jared Hodges.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+
+using NMail;
+using NMail.Configuration;
+using NMail.DataTypes;
+using NMail.SmtpService.Command;
+
+namespace NMail.SmtpService.State {
+ /// <summary>
+ /// Defines command behaviour in the sender received state.
+ /// </summary>
+ public class SenderReceivedState : AbstractSmtpState {
+ /// <summary>
+ /// Creates a new instance of the state.
+ /// </summary>
+ /// <param name="session">The session the owns this state.</param>
+ public SenderReceivedState(SmtpSession session) : base(session) {
+ this.Commands["rcpt"] = new RecipientCommand();
+ this.Commands["rset"] = new ResetCommand(true);
+ }
+ }
+}
Deleted: NMail/trunk/NMail.SmtpService/State/SenderRecievedState.cs
===================================================================
--- NMail/trunk/NMail.SmtpService/State/SenderRecievedState.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.SmtpService/State/SenderRecievedState.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -1,39 +0,0 @@
-/*
- * Copyright 2004-2006 Luke Quinane, Daniel Frampton and Jared Hodges.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using System;
-
-using NMail;
-using NMail.Configuration;
-using NMail.DataTypes;
-using NMail.SmtpService.Command;
-
-namespace NMail.SmtpService.State {
- /// <summary>
- /// Defines command behaviour in the sender recieved state.
- /// </summary>
- public class SenderRecievedState : AbstractSmtpState {
- /// <summary>
- /// Creates a new instance of the state.
- /// </summary>
- /// <param name="session">The session the owns this state.</param>
- public SenderRecievedState(SmtpSession session) : base(session) {
- this.Commands["rcpt"] = new RecipientCommand();
- this.Commands["rset"] = new ResetCommand(true);
- }
- }
-}
Modified: NMail/trunk/NMail.UnitTests/DataTypes/MessageHeaderTests.cs
===================================================================
--- NMail/trunk/NMail.UnitTests/DataTypes/MessageHeaderTests.cs 2007-06-16 14:54:29 UTC (rev 221)
+++ NMail/trunk/NMail.UnitTests/DataTypes/MessageHeaderTests.cs 2007-06-16 14:58:16 UTC (rev 222)
@@ -20,7 +20,7 @@
public const string BasicParsing2 = "From: \"Sample Person\" <sp...@sa...>\r\nTo: \"newuser\"\r\nSubject: Testing 123\r\nDate: Mon, 10 Jan 2020 18:00:00 +1030";
- public const string BasicParsing3 = "Recieved: from niknak3 (3.3.3.3 [3.3.3.3])\r\n by NMail (localhost) with SMTP Tue, 28 Nov 2006 08:21:04 GMT\r\nRecieved: from niknak2 (2.2.2.2 [2.2.2.2])\r\n by NMail (localhost) with SMTP Tue, 27 Nov 2006 08:21:04 GMT\r\nRecieved: from niknak1 (1.1.1.1 [1.1.1.1])\r\n by NMail (localhost) with SMTP Tue, 26 Nov 2006 08:21:04 GMT\r\nMessage-ID: <001a01c7126e$22ecdf40$01d1a8c0@niknak>\r\nFrom: \"Luke\" <luke@localhost>";
+ public const string BasicParsing3 = "Received: from niknak3 (3.3.3.3 [3.3.3.3])\r\n by NMail (localhost) with SMTP Tue, 28 Nov 2006 08:21:04 GMT\r\nReceived: from niknak2 (2.2.2.2 [2.2.2.2])\r\n by NMail (localhost) with SMTP Tue, 27 Nov 2006 08:21:04 GMT\r\nReceived: from niknak1 (1.1.1.1 [1.1.1.1])\r\n by NMail (localhost) with SMTP Tue, 26 Nov 2006 08:21:04 GMT\r\nMessage-ID: <001a01c7126e$22ecdf40$01d1a8c0@niknak>\r\nFrom: \"Luke\" <luke@localhost>";
[Test]
public void BasicParsing() {
@@ -32,16 +32,16 @@
Assert.AreEqual("image/jpeg;\r\n name=\"image001.jpg\"", headers["Content-Type"], "BasicParsing1");
headers = new MessageHeaders(new ByteString(BasicParsing2, Encoding.ASCII));
- Assert.IsNotNull(headers["From"], "BasicParsing2: from not null");
- Assert.IsNotNull(headers["Subject"], "BasicParsing2: subject not null");
- Assert.IsTrue(headers.GetHeaders("From").Length == 1, "BasicParsing2: from length == 1");
- Assert.IsTrue(headers.GetHeaders("Subject").Length == 1, "BasicParsing2: subject length == 1");
- Assert.AreEqual("Testing 123", headers["Subject"], "BasicParsing2: subject");
+ Assert.IsNotNull(headers[MessageHeaders.FromHeader], "BasicParsing2: from not null");
+ Assert.IsNotNull(headers[MessageHeaders.SubjectHeader], "BasicParsing2: subject not null");
+ Assert.IsTrue(headers.GetHeaders(MessageHeaders.FromHeader).Length == 1, "BasicParsing2: from length == 1");
+ Assert.IsTrue(headers.GetHeaders(MessageHeaders.SubjectHeader).Length == 1, "BasicParsing2: subject length == 1");
+ Assert.AreEqual("Testing 123", headers[MessageHeaders.SubjectHeader], "BasicParsing2: subject");
headers = new MessageHeaders(new ByteString(BasicParsing3, Encoding.ASCII));
- Assert.IsNotNull(headers["Recieved"], "BasicParsing3: not null");
- Assert.IsTrue(headers.GetHeaders("Recieved").Length == 3, "BasicParsing3: length == 3");
- Assert.AreEqual("from niknak3 (3.3.3.3 [3.3.3.3])\r\n by NMail (localhost) with SMTP Tue, 28 Nov 2006 08:21:04 GMT", headers["Recieved"], "BasicParsing3");
+ Assert.IsNotNull(headers[MessageHeaders.ReceivedHeader], "BasicParsing3: not null");
+ Assert.IsTrue(headers.GetHeaders(MessageHeaders.ReceivedHeader).Length == 3, "BasicParsing3: length == 3");
+ Assert.AreEqual("from niknak3 (3.3.3.3 [3.3.3.3])\r\n by NMail (localhost) with SMTP Tue, 28 Nov 2006 08:21:04 GMT", headers[MessageHeaders.ReceivedHeader], "BasicParsing3");
}
#endregion
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|