[csmaild-cvs] csmaild/src/Smtp SmtpConnection.cs,NONE,1.1 SmtpServer.cs,NONE,1.1 Smtp.2002.csproj,1.
Brought to you by:
tamc
|
From: <ta...@us...> - 2003-08-08 22:39:30
|
Update of /cvsroot/csmaild/csmaild/src/Smtp In directory sc8-pr-cvs1:/tmp/cvs-serv18360/src/Smtp Modified Files: Smtp.2002.csproj Smtp.csproj Added Files: SmtpConnection.cs SmtpServer.cs Log Message: Updated VS.NET 2002 project files to reflect currect VS.NET 2003 project Moved message flags into a FlagList class (this makes flag extensions easier to support) Modified the TestClient for easier debugging of the server Added BASE64 decoder to common library Moved argument parsing from ImapCommand into the newly created types (representing various arguments parsed from the client) Added support for AUTHENTICATE PLAIN Added TODO document in the docs !!Some stuff surely has been broken with all this code moving around, it'll compile and run, but some functionality hasn't been verified yet!! --- NEW FILE: SmtpConnection.cs --- using Common.NetworkManager; using System; namespace Smtp { /// <summary> /// Represents an SMTP connection /// </summary> public class SmtpConnection { private Connection mConnection; // the underlying network connection private SmtpServer mServer; // what server we belong to public SmtpConnection(SmtpServer svr, Connection con) { mServer = svr; mConnection = con; mConnection.ReceivedLineEvent += new ReceivedLineDelegate(Connection_ReceivedLine); ReadCommand(); } public void SendMessage(string msg) { mConnection.WriteLine(msg); } public void ReadCommand() { mConnection.BeginReadLine(); } private void Connection_ReceivedLine(Connection cnn, string line) { // ParseAndValidate(line); SendMessage("Got it"); ReadCommand(); } } } --- NEW FILE: SmtpServer.cs --- using Common.MailstoreProviders; using Common.NetworkManager; using System; using System.Collections; namespace Smtp { /// <summary> /// Represents the mail servers smtp server /// </summary> public class SmtpServer { private NetworkManager mNetwork = new NetworkManager(); private Hashtable mSmtpConnections = new Hashtable(); private IMailstoreProvider mMailstoreProvider; public SmtpServer(IMailstoreProvider provider) { mMailstoreProvider = provider; } public void Start() { Listener li = mNetwork.StartListener(25); // TODO: global configuration li.AcceptedConnection += new AcceptDelegate(NewConnectionHandler); } private void NewConnectionHandler(Connection con) { con.ConnectionClosedEvent += new ConnectionClosedDelegate(Connection_Closed); SmtpConnection cnn = new SmtpConnection(this, con); cnn.SendMessage("220 domain.tld ESMTP csmaild dev ready"); mSmtpConnections.Add(con, cnn); } private void Connection_Closed(Connection con) { mSmtpConnections.Remove(con); System.Diagnostics.Trace.WriteLine(con + " Closed"); } } } Index: Smtp.2002.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Smtp/Smtp.2002.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Smtp.2002.csproj 1 Aug 2003 22:02:38 -0000 1.1 --- Smtp.2002.csproj 8 Aug 2003 22:39:26 -0000 1.2 *************** *** 70,76 **** <Reference Name = "System.XML" ! AssemblyName = "System.XML" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> </References> </Build> --- 70,81 ---- <Reference Name = "System.XML" ! AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> + <Reference + Name = "Common.2002" + Project = "{19D49838-BF7A-4432-9C84-F50AE399077B}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 79,82 **** --- 84,97 ---- <File RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SmtpConnection.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SmtpServer.cs" SubType = "Code" BuildAction = "Compile" Index: Smtp.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Smtp/Smtp.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Smtp.csproj 1 Aug 2003 22:02:38 -0000 1.1 --- Smtp.csproj 8 Aug 2003 22:39:26 -0000 1.2 *************** *** 77,83 **** <Reference Name = "System.XML" ! AssemblyName = "System.XML" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> </References> </Build> --- 77,88 ---- <Reference Name = "System.XML" ! AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> + <Reference + Name = "Common" + Project = "{19D49838-BF7A-4432-9C84-F50AE399077B}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 86,89 **** --- 91,104 ---- <File RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SmtpConnection.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SmtpServer.cs" SubType = "Code" BuildAction = "Compile" |