csmaild-cvs Mailing List for C# Mail Server (Page 5)
Brought to you by:
tamc
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
(79) |
Aug
(49) |
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <ta...@us...> - 2003-07-26 05:21:16
|
Update of /cvsroot/csmaild/csmaild/src/TestClient In directory sc8-pr-cvs1:/tmp/cvs-serv25259/src/TestClient Removed Files: TestClient.csproj.user Log Message: --- TestClient.csproj.user DELETED --- |
From: <ta...@us...> - 2003-07-26 05:21:06
|
Update of /cvsroot/csmaild/csmaild/src In directory sc8-pr-cvs1:/tmp/cvs-serv25794/src Modified Files: .cvsignore Added Files: csmaild.2002.sln Log Message: Added VS.NET 2002 solution and project files (they have a 2002 in the name) Updated ignore files to be less specific to ignore all user setting files Minor updates to crappy testclient --- NEW FILE: csmaild.2002.sln --- Microsoft Visual Studio Solution File, Format Version 7.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.2002", "common\Common.2002.csproj", "{19D49838-BF7A-4432-9C84-F50AE399077B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine.2002", "Engine\Engine.2002.csproj", "{44D6B051-0CE8-4964-8236-8539431F5212}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imap.2002", "Imap\Imap.2002.csproj", "{B1B51646-3745-489A-B0A8-630013E5E44E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient.2002", "TestClient\TestClient.2002.csproj", "{9B24F657-10EF-4F52-A02B-F0C630ED8037}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution ConfigName.0 = Debug ConfigName.1 = Release EndGlobalSection GlobalSection(ProjectDependencies) = postSolution EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {19D49838-BF7A-4432-9C84-F50AE399077B}.Debug.ActiveCfg = Debug|.NET {19D49838-BF7A-4432-9C84-F50AE399077B}.Debug.Build.0 = Debug|.NET {19D49838-BF7A-4432-9C84-F50AE399077B}.Release.ActiveCfg = Release|.NET {19D49838-BF7A-4432-9C84-F50AE399077B}.Release.Build.0 = Release|.NET {44D6B051-0CE8-4964-8236-8539431F5212}.Debug.ActiveCfg = Debug|.NET {44D6B051-0CE8-4964-8236-8539431F5212}.Debug.Build.0 = Debug|.NET {44D6B051-0CE8-4964-8236-8539431F5212}.Release.ActiveCfg = Release|.NET {44D6B051-0CE8-4964-8236-8539431F5212}.Release.Build.0 = Release|.NET {B1B51646-3745-489A-B0A8-630013E5E44E}.Debug.ActiveCfg = Debug|.NET {B1B51646-3745-489A-B0A8-630013E5E44E}.Debug.Build.0 = Debug|.NET {B1B51646-3745-489A-B0A8-630013E5E44E}.Release.ActiveCfg = Release|.NET {B1B51646-3745-489A-B0A8-630013E5E44E}.Release.Build.0 = Release|.NET {9B24F657-10EF-4F52-A02B-F0C630ED8037}.Debug.ActiveCfg = Debug|.NET {9B24F657-10EF-4F52-A02B-F0C630ED8037}.Debug.Build.0 = Debug|.NET {9B24F657-10EF-4F52-A02B-F0C630ED8037}.Release.ActiveCfg = Release|.NET {9B24F657-10EF-4F52-A02B-F0C630ED8037}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal Index: .cvsignore =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Apr 2003 02:57:01 -0000 1.1 --- .cvsignore 25 Jul 2003 14:50:30 -0000 1.2 *************** *** 1 **** ! csmaild.suo --- 1 ---- ! *.suo |
From: <ta...@us...> - 2003-07-26 05:21:05
|
Update of /cvsroot/csmaild/csmaild/src/Common In directory sc8-pr-cvs1:/tmp/cvs-serv25794/src/Common Modified Files: .cvsignore Added Files: Common.2002.csproj Log Message: Added VS.NET 2002 solution and project files (they have a 2002 in the name) Updated ignore files to be less specific to ignore all user setting files Minor updates to crappy testclient --- NEW FILE: Common.2002.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.0.9466" SchemaVersion = "1.0" ProjectGuid = "{19D49838-BF7A-4432-9C84-F50AE399077B}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "Common" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" RootNamespace = "Common" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "DataItem.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Mailbox.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Message.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "User.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "MailstoreProviders\IMailstoreProvider.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "MailstoreProviders\XmlMailstoreProvider.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> Index: .cvsignore =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Apr 2003 02:57:52 -0000 1.1 --- .cvsignore 25 Jul 2003 14:50:31 -0000 1.2 *************** *** 1,3 **** ! common.csproj.user bin obj --- 1,3 ---- ! *.csproj.user bin obj |
From: <ta...@us...> - 2003-07-26 05:21:05
|
Update of /cvsroot/csmaild/csmaild/src/Engine In directory sc8-pr-cvs1:/tmp/cvs-serv25794/src/Engine Modified Files: .cvsignore Added Files: Engine.2002.csproj Log Message: Added VS.NET 2002 solution and project files (they have a 2002 in the name) Updated ignore files to be less specific to ignore all user setting files Minor updates to crappy testclient --- NEW FILE: Engine.2002.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.0.9466" SchemaVersion = "1.0" ProjectGuid = "{44D6B051-0CE8-4964-8236-8539431F5212}" > <Build> <Settings ApplicationIcon = "App.ico" AssemblyKeyContainerName = "" AssemblyName = "Engine" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Exe" RootNamespace = "Engine" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> <Reference Name = "Imap.2002" Project = "{B1B51646-3745-489A-B0A8-630013E5E44E}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "Common.2002" Project = "{19D49838-BF7A-4432-9C84-F50AE399077B}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> </References> </Build> <Files> <Include> <File RelPath = "App.ico" BuildAction = "Content" /> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Engine.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> Index: .cvsignore =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 8 Apr 2003 02:58:46 -0000 1.1 --- .cvsignore 25 Jul 2003 14:50:31 -0000 1.2 *************** *** 1,3 **** ! Engine.csproj.user bin obj --- 1,3 ---- ! *.csproj.user bin obj |
From: <ta...@us...> - 2003-07-26 05:21:04
|
Update of /cvsroot/csmaild/csmaild/src/TestClient In directory sc8-pr-cvs1:/tmp/cvs-serv25794/src/TestClient Modified Files: .cvsignore Main.cs Main.resx Added Files: TestClient.2002.csproj Log Message: Added VS.NET 2002 solution and project files (they have a 2002 in the name) Updated ignore files to be less specific to ignore all user setting files Minor updates to crappy testclient --- NEW FILE: TestClient.2002.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.0.9466" SchemaVersion = "1.0" ProjectGuid = "{9B24F657-10EF-4F52-A02B-F0C630ED8037}" > <Build> <Settings ApplicationIcon = "App.ico" AssemblyKeyContainerName = "" AssemblyName = "TestClient" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Exe" RootNamespace = "TestClient" StartupObject = "TestClient.MainF" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "true" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> </References> </Build> <Files> <Include> <File RelPath = "App.ico" BuildAction = "Content" /> <File RelPath = "AssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ClientHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Main.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "Main.resx" DependentUpon = "Main.cs" BuildAction = "EmbeddedResource" /> </Include> </Files> </CSHARP> </VisualStudioProject> Index: .cvsignore =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/TestClient/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 24 Jul 2003 04:32:14 -0000 1.1 --- .cvsignore 25 Jul 2003 14:50:31 -0000 1.2 *************** *** 1,3 **** ! common.csproj.user bin obj --- 1,3 ---- ! *.csproj.user bin obj Index: Main.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/TestClient/Main.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Main.cs 24 Jul 2003 04:32:14 -0000 1.1 --- Main.cs 25 Jul 2003 14:50:31 -0000 1.2 *************** *** 75,79 **** this.listBox1.Location = new System.Drawing.Point(8, 40); this.listBox1.Name = "listBox1"; ! this.listBox1.Size = new System.Drawing.Size(352, 308); this.listBox1.TabIndex = 0; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); --- 75,79 ---- this.listBox1.Location = new System.Drawing.Point(8, 40); this.listBox1.Name = "listBox1"; ! this.listBox1.Size = new System.Drawing.Size(352, 340); this.listBox1.TabIndex = 0; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); *************** *** 83,87 **** this.button1.Location = new System.Drawing.Point(16, 8); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(96, 23); this.button1.TabIndex = 1; this.button1.Text = "Test Localhost"; --- 83,86 ---- *************** *** 92,96 **** this.button2.Location = new System.Drawing.Point(632, 8); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(88, 23); this.button2.TabIndex = 2; this.button2.Text = "Test Chegg"; --- 91,94 ---- *************** *** 106,110 **** this.listBox2.Location = new System.Drawing.Point(368, 40); this.listBox2.Name = "listBox2"; ! this.listBox2.Size = new System.Drawing.Size(352, 308); this.listBox2.TabIndex = 3; this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged); --- 104,108 ---- this.listBox2.Location = new System.Drawing.Point(368, 40); this.listBox2.Name = "listBox2"; ! this.listBox2.Size = new System.Drawing.Size(336, 340); this.listBox2.TabIndex = 3; this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged); *************** *** 121,125 **** // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(728, 357); this.Controls.Add(this.button3); this.Controls.Add(this.listBox2); --- 119,123 ---- // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(712, 389); this.Controls.Add(this.button3); this.Controls.Add(this.listBox2); *************** *** 138,141 **** --- 136,141 ---- h.Send(msg + "\r\n"); box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " -> " + msg); + + Application.DoEvents(); } *************** *** 145,148 **** --- 145,150 ---- box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " <- " + line); + Application.DoEvents(); + return line; } *************** *** 150,153 **** --- 152,156 ---- private void button1_Click(object sender, System.EventArgs e) { + listBox1.Items.Clear(); ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); *************** *** 156,159 **** --- 159,163 ---- private void button2_Click(object sender, System.EventArgs e) { + listBox1.Items.Clear(); ClientHelper chegg = new ClientHelper("chegg.com", 143); Go(chegg, listBox2); *************** *** 162,165 **** --- 166,171 ---- private void button3_Click(object sender, System.EventArgs e) { + listBox1.Items.Clear(); + listBox2.Items.Clear(); ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); *************** *** 195,198 **** --- 201,219 ---- while(!a3.StartsWith("a3")) a3 = ReadLine(h, box); + + string a4 = string.Empty; + SendLine("a4 LSUB \"\" \"*\"", h, box); + while(!a4.StartsWith("a4")) + a4 = ReadLine(h, box); + + string a5 = string.Empty; + SendLine("a5 SELECT \"INBOX\"", h, box); + while(!a5.StartsWith("a5")) + a5 = ReadLine(h, box); + + string zz = string.Empty; + SendLine("zz LOGOUT", h, box); + while(!zz.StartsWith("zz")) + zz = ReadLine(h, box); } Index: Main.resx =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/TestClient/Main.resx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Main.resx 24 Jul 2003 04:32:14 -0000 1.1 --- Main.resx 25 Jul 2003 14:50:31 -0000 1.2 *************** *** 146,158 **** <value>False</value> </data> - <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>(Default)</value> - </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> - <data name="$this.Name"> - <value>MainF</value> - </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> --- 146,152 ---- *************** *** 161,166 **** --- 155,166 ---- <value>8, 8</value> </data> + <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>(Default)</value> + </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> + </data> + <data name="$this.Name"> + <value>MainF</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
From: <ta...@us...> - 2003-07-26 03:32:24
|
Update of /cvsroot/csmaild/csmaild/src/TestClient/bin In directory sc8-pr-cvs1:/tmp/cvs-serv22618/bin Log Message: Directory /cvsroot/csmaild/csmaild/src/TestClient/bin added to the repository |
From: <ta...@us...> - 2003-07-26 01:49:55
|
Update of /cvsroot/csmaild/csmaild/docs/rfcs/pop In directory sc8-pr-cvs1:/tmp/cvs-serv1894/pop Log Message: Directory /cvsroot/csmaild/csmaild/docs/rfcs/pop added to the repository |
From: <ta...@us...> - 2003-07-26 01:49:53
|
Update of /cvsroot/csmaild/csmaild/docs/rfcs/pop In directory sc8-pr-cvs1:/tmp/cvs-serv2107/docs/rfcs/pop Added Files: 1939 - Post Office Protocol Version 3.txt Log Message: Need it someday I'm sure. --- NEW FILE: 1939 - Post Office Protocol Version 3.txt --- Network Working Group J. Myers Request for Comments: 1939 Carnegie Mellon STD: 53 M. Rose Obsoletes: 1725 Dover Beach Consulting, Inc. Category: Standards Track May 1996 Post Office Protocol - Version 3 Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for [...1252 lines suppressed...] Myers & Rose Standards Track [Page 23] |
From: <ta...@us...> - 2003-07-26 01:44:11
|
Update of /cvsroot/csmaild/csmaild/src/Common In directory sc8-pr-cvs1:/tmp/cvs-serv906/src/Common Modified Files: Mailbox.cs Message.cs Log Message: UIDs, UIDVALIDITYs, and literal sizes can all be uint.MaxValue big Finished up parenthesized list parser, it should work for all commands that need it except SEARCH for now Quite a bit of fixing yet to do to handle buffer overruns and large transmissions, but for small things (can fit into memory), we should be alright for now Index: Mailbox.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mailbox.cs 25 Jul 2003 03:39:12 -0000 1.3 --- Mailbox.cs 25 Jul 2003 23:35:24 -0000 1.4 *************** *** 13,18 **** private string mName; private string mFullName; ! private int mNextUniqueId; ! private int mUniqueIdValidity; private Mailbox mParent; private Mailbox[] mChildren; // TODO: Make a strongly typed collection --- 13,18 ---- private string mName; private string mFullName; ! private uint mNextUniqueId; ! private uint mUniqueIdValidity; private Mailbox mParent; private Mailbox[] mChildren; // TODO: Make a strongly typed collection *************** *** 39,43 **** /// The id that SHOULD be assigned to the next new message in this mailbox /// </summary> ! public int NextUniqueId { get --- 39,43 ---- /// The id that SHOULD be assigned to the next new message in this mailbox /// </summary> ! public uint NextUniqueId { get *************** *** 50,54 **** /// The UIDVALIDITY of this mailbox /// </summary> ! public int UniqueIdValidity { get --- 50,54 ---- /// The UIDVALIDITY of this mailbox /// </summary> ! public uint UniqueIdValidity { get *************** *** 100,104 **** #endregion ! public Mailbox(IMailstoreProvider provider, string name, string fullName, int nextUniqueId, int uniqueIdValidity, User user) : base(provider) { mNextUniqueId = nextUniqueId; --- 100,104 ---- #endregion ! public Mailbox(IMailstoreProvider provider, string name, string fullName, uint nextUniqueId, uint uniqueIdValidity, User user) : base(provider) { mNextUniqueId = nextUniqueId; Index: Message.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Message.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Message.cs 25 Jul 2003 03:39:12 -0000 1.2 --- Message.cs 25 Jul 2003 23:35:24 -0000 1.3 *************** *** 11,15 **** { #region Variables ! private int mUniqueId; private bool mSeen; private bool mAnswered; --- 11,15 ---- { #region Variables ! private uint mUniqueId; private bool mSeen; private bool mAnswered; *************** *** 25,29 **** /// The UID of this message /// </summary> ! public int UniqueId { get --- 25,29 ---- /// The UID of this message /// </summary> ! public uint UniqueId { get *************** *** 135,139 **** #endregion ! public Message(IMailstoreProvider provider, int uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, int size) : base(provider) { mUniqueId = uid; --- 135,139 ---- #endregion ! public Message(IMailstoreProvider provider, uint uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, int size) : base(provider) { mUniqueId = uid; |
From: <ta...@us...> - 2003-07-26 01:44:10
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders In directory sc8-pr-cvs1:/tmp/cvs-serv906/src/Common/MailstoreProviders Modified Files: XmlMailstoreProvider.cs Log Message: UIDs, UIDVALIDITYs, and literal sizes can all be uint.MaxValue big Finished up parenthesized list parser, it should work for all commands that need it except SEARCH for now Quite a bit of fixing yet to do to handle buffer overruns and large transmissions, but for small things (can fit into memory), we should be alright for now Index: XmlMailstoreProvider.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlMailstoreProvider.cs 25 Jul 2003 03:39:12 -0000 1.2 --- XmlMailstoreProvider.cs 25 Jul 2003 23:35:24 -0000 1.3 *************** *** 45,49 **** DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } --- 45,49 ---- DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user); } *************** *** 58,62 **** { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } --- 58,62 ---- { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user); } *************** *** 87,91 **** { DataRow message = messages[idx]; ! msgs[idx] = new Message(this, int.Parse(message["UniqueIdentifier"].ToString()), bool.Parse(message["Seen"].ToString()), bool.Parse(message["Answered"].ToString()), bool.Parse(message["Flagged"].ToString()), bool.Parse(message["Deleted"].ToString()), bool.Parse(message["Draft"].ToString()), int.Parse(message["Size"].ToString())); } --- 87,91 ---- { DataRow message = messages[idx]; ! msgs[idx] = new Message(this, uint.Parse(message["UniqueIdentifier"].ToString()), bool.Parse(message["Seen"].ToString()), bool.Parse(message["Answered"].ToString()), bool.Parse(message["Flagged"].ToString()), bool.Parse(message["Deleted"].ToString()), bool.Parse(message["Draft"].ToString()), int.Parse(message["Size"].ToString())); } |
From: <ta...@us...> - 2003-07-26 01:44:10
|
Update of /cvsroot/csmaild/csmaild/src/TestClient/bin In directory sc8-pr-cvs1:/tmp/cvs-serv906/src/TestClient/bin Modified Files: Commands.xml Log Message: UIDs, UIDVALIDITYs, and literal sizes can all be uint.MaxValue big Finished up parenthesized list parser, it should work for all commands that need it except SEARCH for now Quite a bit of fixing yet to do to handle buffer overruns and large transmissions, but for small things (can fit into memory), we should be alright for now Index: Commands.xml =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/TestClient/bin/Commands.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Commands.xml 25 Jul 2003 19:30:28 -0000 1.1 --- Commands.xml 25 Jul 2003 23:35:24 -0000 1.2 *************** *** 17,21 **** </Commands> <Commands> ! <Command>LOGOUT</Command> </Commands> </NewDataSet> --- 17,21 ---- </Commands> <Commands> ! <Command>FETCH (item1 item2 (item3 item4))</Command> </Commands> </NewDataSet> |
From: <ta...@us...> - 2003-07-26 01:44:10
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands In directory sc8-pr-cvs1:/tmp/cvs-serv906/src/Imap/Commands Modified Files: ImapCommand.cs Log Message: UIDs, UIDVALIDITYs, and literal sizes can all be uint.MaxValue big Finished up parenthesized list parser, it should work for all commands that need it except SEARCH for now Quite a bit of fixing yet to do to handle buffer overruns and large transmissions, but for small things (can fit into memory), we should be alright for now Index: ImapCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ImapCommand.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImapCommand.cs 25 Jul 2003 18:46:40 -0000 1.4 --- ImapCommand.cs 25 Jul 2003 23:35:24 -0000 1.5 *************** *** 124,127 **** --- 124,129 ---- ListString = 13, // quoted(1) + literal(4) + listchars(8) SequenceSet = 16, + ParenthesizedList = 32, + ParenthesizedListAtom = 34, // paren(32) + atom(2) } *************** *** 161,164 **** --- 163,174 ---- ParseArgumentHandler(false, string.Empty); } + else if(((mArgumentTypes[mCurrentArgument] & ArgumentType.ParenthesizedList) == ArgumentType.ParenthesizedList) && mUnparsedArguments[mUnparsedArgumentIdx] == '(') // paren list + { + ParenthesizedList list; + if(ParseParenthesizedList(out list)) + ParseArgumentHandler(true, list); + else + ParseArgumentHandler(false, string.Empty); + } else if(((mArgumentTypes[mCurrentArgument] & ArgumentType.ListChars) == ArgumentType.ListChars)) { *************** *** 192,201 **** ++mUnparsedArgumentIdx; // move past '{' ! int literalSize; // read digit-nz if(CommandPart.DigitNz.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { ! literalSize = int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); // read the rest of the digits --- 202,211 ---- ++mUnparsedArgumentIdx; // move past '{' ! uint literalSize; // read digit-nz if(CommandPart.DigitNz.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { ! literalSize = uint.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); // read the rest of the digits *************** *** 209,212 **** --- 219,225 ---- else { + // TODO: need to chunk the blocks somehow, as creating a uint.MaxVal buffer throws some pretty errors + // probably should also allow the command to specify how big is too big (for example, somebody typing + // in a 20 thousand character username probably is trying to break stuff mConnection.SendContinueMessage("Ready"); mConnection.Connection.ReadBlock(new byte[literalSize], 0, literalSize, new ReceivedBlockDelegate(ReceivedLiteralString)); *************** *** 216,221 **** else if(CommandPart.Digit.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { literalSize *= 10; ! literalSize += int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); } else // not a valid digit --- 229,238 ---- else if(CommandPart.Digit.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { + // TODO: this will overflow the size , so we'll need to check for that + // we can set a compilation option that will throw exceptions on overflow, + // but I would imagine that this would make things very inefficient + // it won't error as is, just roll around literalSize *= 10; ! literalSize += uint.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); } else // not a valid digit *************** *** 349,354 **** bool isGood = false; // will determine whether we've read a valid quoted string sequenceSet = new SequenceSet(); // will store the sequenceSet string as we "read" it ! int startNumber = 0; ! int sequenceNumber = 0; for(; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) --- 366,371 ---- bool isGood = false; // will determine whether we've read a valid quoted string sequenceSet = new SequenceSet(); // will store the sequenceSet string as we "read" it ! uint startNumber = 0; ! uint sequenceNumber = 0; for(; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) *************** *** 360,364 **** else { ! sequenceNumber = int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); isGood = true; } --- 377,381 ---- else { ! sequenceNumber = uint.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); isGood = true; } *************** *** 385,388 **** --- 402,411 ---- sequenceNumber = 0; } + else if(mUnparsedArguments[mUnparsedArgumentIdx] == '*') // largest possible message + { + if(sequenceNumber != 0) // * can't be part of a number + return false; + sequenceNumber = int.MaxValue; + } else if(mUnparsedArguments[mUnparsedArgumentIdx] == ' ') // a space, done with the argument break; *************** *** 394,398 **** { sequenceNumber *= 10; ! sequenceNumber += int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); } } --- 417,421 ---- { sequenceNumber *= 10; ! sequenceNumber += uint.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); } } *************** *** 411,425 **** } protected class SequenceSet { public class SequenceRange { ! private int mLow; ! private int mHigh; private SequenceRange mPrevious; private SequenceRange mNext; ! public int Low { get --- 434,449 ---- } + #region SequenceSet protected class SequenceSet { public class SequenceRange { ! private uint mLow; ! private uint mHigh; private SequenceRange mPrevious; private SequenceRange mNext; ! public uint Low { get *************** *** 445,449 **** } ! public int High { get --- 469,473 ---- } ! public uint High { get *************** *** 469,473 **** } ! public SequenceRange(int low, int high) { mLow = low; --- 493,497 ---- } ! public SequenceRange(uint low, uint high) { mLow = low; *************** *** 477,481 **** } ! public SequenceRange AddRange(int low, int high) { if(low <= mHigh + 1 && high >= mLow - 1) // they can combine with us --- 501,505 ---- } ! public SequenceRange AddRange(uint low, uint high) { if(low <= mHigh + 1 && high >= mLow - 1) // they can combine with us *************** *** 520,532 **** private SequenceRange mRootNode; ! public void AddRange(int num) { AddRange(num, num); } ! public void AddRange(int start, int end) { ! int low = Math.Min(start, end); ! int high = Math.Max(start, end); if(mRootNode == null) --- 544,556 ---- private SequenceRange mRootNode; ! public void AddRange(uint num) { AddRange(num, num); } ! public void AddRange(uint start, uint end) { ! uint low = Math.Min(start, end); ! uint high = Math.Max(start, end); if(mRootNode == null) *************** *** 536,607 **** } - // private void AddHelper(int lowVal, int highVal) - // { - // for(int idx = 0; idx < mStartRange.Count; ++idx) - // { - // if(lowVal == (int)mStartRange[idx]) // we start on the same value, wee! - // { - // if(highVal > (int)mEndRange[idx]) // we end higher, change some stuff - // AddHelperHelper(idx, highVal); - // break; - // } - // else if(lowVal > (int)mStartRange[idx]) // we start higher then this guy starts - // { - // if(lowVal <= (int)mEndRange[idx]+1) // we start lower or on this guys end+1 - // { - // if(highVal > (int)mEndRange[idx]) // we end higher, change some stuff - // AddHelperHelper(idx, highVal); - // break; - // } - // else if(idx == mStartRange.Count-1) // start higher then end and at the end of ranges, just add - // { - // mStartRange.Insert(idx+1, lowVal); - // mEndRange.Insert(idx+1, highVal); - // } - // } - // else // we start lower then this guy starts - // { - // if(highVal > (int)mStartRange[idx]) // we end higher or on this guys start+1 - // { - // // need to adjust start - // mStartRange[idx] = lowVal; - // - // if(highVal > (int)mEndRange[idx]) // we end higher then this guy ends - // AddHelperHelper(idx, highVal); - // break; - // } - // continue; - // } - // } - // } - // - // private void AddHelperHelper(int idx, int highVal) - // { - // // firstly, adjust the end - // mEndRange[idx] = Math.Max(highVal, (int)mEndRange[idx]); - // - // ++idx; - // - // // while we haven't exhausted the array and we can combine sequences - // while(idx < mStartRange.Count && highVal > (int)mStartRange[idx]) - // { - // // this range can consume the entire next range - // if(highVal >= (int)mEndRange[idx]) - // { - // mStartRange.RemoveAt(idx); - // mEndRange.RemoveAt(idx); - // continue; // still need to see how much more we can eat - // } - // else // we need to combine the ranges - // { - // // make previous range all inclusive - // mEndRange[idx-1] = mEndRange[idx]; - // mStartRange.RemoveAt(idx); - // mEndRange.RemoveAt(idx); - // break; // done - // } - // } - // } - public override string ToString() { --- 560,563 ---- *************** *** 609,612 **** --- 565,695 ---- } } + #endregion + + #endregion + + #region Parenthesized list string + /// <summary> + /// Default implementation does not handle anything but atoms as elements + /// Which means as of IMAP4rev1 it should handle all input except for the SEARCH command + /// </summary> + protected virtual bool ParseParenthesizedList(out ParenthesizedList list) + { + bool isGood = false; // will determine whether we've read a valid parenthesized list + string dataItem = string.Empty; // stores the data item as we're reading it + list = new ParenthesizedList(); + + for(++mUnparsedArgumentIdx; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) + { + if(mUnparsedArguments[mUnparsedArgumentIdx] == ')') + { + isGood = true; + if(dataItem != string.Empty) + list.AddItem(dataItem); + break; + } + else if(mUnparsedArguments[mUnparsedArgumentIdx] == '(') + { + ParenthesizedList nestedList; + if(ParseParenthesizedList(out nestedList)) + list.AddItem(list); + else + return false; + } + else if(mUnparsedArguments[mUnparsedArgumentIdx] == ' ') + { + if(dataItem != string.Empty) + { + list.AddItem(dataItem); + dataItem = string.Empty; + } + else // getting a space after an empty item is not permitted + return false; + } + else + { + if(CommandPart.AtomChar.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) == -1) + return false; + else + dataItem += mUnparsedArguments[mUnparsedArgumentIdx]; + } + } + + ++mUnparsedArgumentIdx; + return isGood; + } + + #region ParenthesizedList + protected class ParenthesizedList + { + #region ParenthesizedListItem + public class ParenthesizedListItem + { + private object mDataItem; + private ParenthesizedList mNestedList; + + public object DataItem + { + get + { + return mDataItem; + } + } + + public ParenthesizedList NestedList + { + get + { + return mNestedList; + } + } + + public ParenthesizedListItem(object data) + { + if(data is ParenthesizedList) + { + mDataItem = null; + mNestedList = data as ParenthesizedList; + } + else + { + mDataItem = data; + mNestedList = null; + } + } + + public override string ToString() + { + if(mDataItem == null) + return mNestedList.ToString(); + else + return mDataItem.ToString(); + } + + } + #endregion + + private ArrayList mItems; + + public ParenthesizedList() + { + mItems = new ArrayList(); + } + + public void AddItem(object data) + { + mItems.Add(new ParenthesizedListItem(data)); + } + + public override string ToString() + { + string rv = "("; + for(int idx = 0; idx < mItems.Count; ++idx) + rv += mItems[idx].ToString() + (idx != mItems.Count-1 ? " " : string.Empty); + return rv + ")"; + } + } + #endregion + #endregion |
From: <ta...@us...> - 2003-07-26 01:44:10
|
Update of /cvsroot/csmaild/csmaild/src/Imap/NetworkManager In directory sc8-pr-cvs1:/tmp/cvs-serv906/src/Imap/NetworkManager Modified Files: Connection.cs Log Message: UIDs, UIDVALIDITYs, and literal sizes can all be uint.MaxValue big Finished up parenthesized list parser, it should work for all commands that need it except SEARCH for now Quite a bit of fixing yet to do to handle buffer overruns and large transmissions, but for small things (can fit into memory), we should be alright for now Index: Connection.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/NetworkManager/Connection.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Connection.cs 25 Jul 2003 03:39:13 -0000 1.5 --- Connection.cs 25 Jul 2003 23:35:24 -0000 1.6 *************** *** 171,177 **** /// <param name="offset">The offset into this buffer</param> /// <param name="size">The number of bytes to read into the buffer</param> ! public void ReadBlock(byte[] block, int offset, int length) { ! ReadBlock(block, offset, length, mReceivedBlockEvent); } --- 171,181 ---- /// <param name="offset">The offset into this buffer</param> /// <param name="size">The number of bytes to read into the buffer</param> ! public void ReadBlock(byte[] block, uint offset, uint length) { ! // TODO: really need to handle bigger values, will need to split this up too, because an presumed 4 gigabyte buffer probably won't slide ! if(length > int.MaxValue) ! ReadBlock(block, offset, int.MaxValue, mReceivedBlockEvent); ! else ! ReadBlock(block, offset, length, mReceivedBlockEvent); } *************** *** 183,191 **** /// <param name="size">The number of bytes to read into the buffer</param> /// <param name="callback">The callback function to call after done reading</param> ! public void ReadBlock(byte[] block, int offset, int length, ReceivedBlockDelegate callback) { ! mReceiveBlockBuffer = block; ! mReceiveBlockOffset = offset; ! mReceiveBlockSize = length; ReadBlock(callback); --- 187,205 ---- /// <param name="size">The number of bytes to read into the buffer</param> /// <param name="callback">The callback function to call after done reading</param> ! public void ReadBlock(byte[] block, uint offset, uint length, ReceivedBlockDelegate callback) { ! // TODO: really need to handle bigger values, will need to split this up too, because an presumed 4 gigabyte buffer probably won't slide ! if(length > int.MaxValue) ! { ! mReceiveBlockBuffer = block; ! mReceiveBlockOffset = (int)offset; ! mReceiveBlockSize = int.MaxValue; ! } ! else ! { ! mReceiveBlockBuffer = block; ! mReceiveBlockOffset = (int)offset; ! mReceiveBlockSize = (int)length; ! } ReadBlock(callback); |
From: <ta...@us...> - 2003-07-25 03:39:16
|
Update of /cvsroot/csmaild/csmaild/src/Imap/NetworkManager In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Imap/NetworkManager Modified Files: Connection.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled Index: Connection.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/NetworkManager/Connection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Connection.cs 24 Jul 2003 04:32:14 -0000 1.4 --- Connection.cs 25 Jul 2003 03:39:13 -0000 1.5 *************** *** 1,6 **** --- 1,8 ---- using System; + using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; + using System.Threading; using System.Text; *************** *** 20,24 **** private Socket mClient; // the communication socket private NetworkStream mSocketStream; // a stream wrapping the communication socket ! private byte[] mReceiveLineBuffer; // a small storage place for receiving bytes for the line private string mLineString; // used to store the line the client sends --- 22,26 ---- private Socket mClient; // the communication socket private NetworkStream mSocketStream; // a stream wrapping the communication socket ! private byte[] mReceiveLineBuffer; // a small storage place for receiving bytes for the line private string mLineString; // used to store the line the client sends *************** *** 28,31 **** --- 30,36 ---- private int mReceiveBlockSize; // the number of bytes left to read into the receive block buffer + private Queue mWriteQueue = Queue.Synchronized(new Queue()); // the queue for writes (so we do them in order) + private bool mCurrentlyWriting; + private Listener mListener; // the listener that created us #endregion *************** *** 109,112 **** --- 114,120 ---- mListener = listener; + mWriteQueue = Queue.Synchronized(new Queue()); // the queue for writes (so we do them in order) + mCurrentlyWriting = false; + mSocketStream = new NetworkStream(mClient, true); mReceiveLineBuffer = new byte[8192]; *************** *** 115,122 **** #region Public methods public void Write(string msg) { ! byte[] b = Encoding.ASCII.GetBytes(msg); ! mSocketStream.BeginWrite(b, 0, b.Length, new AsyncCallback(SendCallback), msg); } --- 123,143 ---- #region Public methods + /// <summary> + /// Writes the message to the socket asynchronously + /// </summary> + /// <param name="msg">The message to write</param> public void Write(string msg) { ! Monitor.Enter(mWriteQueue); ! if(mCurrentlyWriting) ! mWriteQueue.Enqueue(msg); ! else ! { ! byte[] b = Encoding.ASCII.GetBytes(msg); ! if(mClient.Connected) ! mSocketStream.BeginWrite(b, 0, b.Length, new AsyncCallback(SendCallback), msg); ! mCurrentlyWriting = true; ! } ! Monitor.Exit(mWriteQueue); } *************** *** 124,128 **** /// Writes the message to the socket asynchronosously /// </summary> ! /// <param name="msg">The message to write</param> public void WriteLine(string msg) { --- 145,149 ---- /// Writes the message to the socket asynchronosously /// </summary> ! /// <param name="msg">The message to write (it will be suffixed with a CRLF)</param> public void WriteLine(string msg) { *************** *** 140,144 **** public void ReadLine(ReceivedLineDelegate callback) { ! mSocketStream.BeginRead(mReceiveLineBuffer, 0, mReceiveLineBuffer.Length, new AsyncCallback(ReceiveLineCallback), callback); } --- 161,166 ---- public void ReadLine(ReceivedLineDelegate callback) { ! if(mClient.Connected) ! mSocketStream.BeginRead(mReceiveLineBuffer, 0, mReceiveLineBuffer.Length, new AsyncCallback(ReceiveLineCallback), callback); } *************** *** 206,210 **** private void ReadBlock(ReceivedBlockDelegate callback) { ! mSocketStream.BeginRead(mReceiveBlockBuffer, mReceiveBlockOffset, mReceiveBlockSize, new AsyncCallback(ReceiveBlockCallback), callback); } --- 228,233 ---- private void ReadBlock(ReceivedBlockDelegate callback) { ! if(mClient.Connected) ! mSocketStream.BeginRead(mReceiveBlockBuffer, mReceiveBlockOffset, mReceiveBlockSize, new AsyncCallback(ReceiveBlockCallback), callback); } *************** *** 213,218 **** --- 236,253 ---- mSocketStream.EndWrite(result); + Monitor.Enter(mWriteQueue); + mCurrentlyWriting = false; + if(mWriteQueue.Count != 0) + { + string msg = (string)mWriteQueue.Dequeue(); + byte[] b = Encoding.ASCII.GetBytes(msg); + if(mClient.Connected) + mSocketStream.BeginWrite(b, 0, b.Length, new AsyncCallback(SendCallback), msg); + mCurrentlyWriting = true; + } System.Diagnostics.Trace.Write(ToString() + " <- " + (string)result.AsyncState); + Monitor.Exit(mWriteQueue); + // spill event OnSent(); *************** *** 242,246 **** mLineString = mLineString.Substring(idx+2); ! System.Diagnostics.Trace.WriteLine(ToString() + " -> " + (string)line); // spill event --- 277,282 ---- mLineString = mLineString.Substring(idx+2); ! if(line != string.Empty) ! System.Diagnostics.Trace.WriteLine(ToString() + " -> " + (string)line); // spill event *************** *** 271,275 **** --- 307,315 ---- if(mReceiveBlockSize == 0) + { + System.Diagnostics.Trace.WriteLine(ToString() + " -> " + System.Text.Encoding.ASCII.GetString(mReceiveBlockBuffer)); + FireReadBlockDelegate(mReceiveBlockBuffer, (ReceivedBlockDelegate)result.AsyncState); + } else ReadBlock((ReceivedBlockDelegate)result.AsyncState); |
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Imap/Commands Modified Files: AppendCommand.cs AuthenticateCommand.cs CapabilityCommand.cs CheckCommand.cs CloseCommand.cs CommandPart.cs CopyCommand.cs CreateCommand.cs DeleteCommand.cs ExamineCommand.cs ExpungeCommand.cs FetchCommand.cs ImapCommand.cs ListCommand.cs LoginCommand.cs LogoutCommand.cs LsubCommand.cs NoopCommand.cs RenameCommand.cs SearchCommand.cs SelectCommand.cs StarttlsCommand.cs StatusCommand.cs StoreCommand.cs SubscribeCommand.cs UidCommand.cs UnsubscribeCommand.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled Index: AppendCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/AppendCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AppendCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- AppendCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: AuthenticateCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/AuthenticateCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AuthenticateCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- AuthenticateCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: CapabilityCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CapabilityCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CapabilityCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CapabilityCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 13,26 **** } ! override public void Process() { - if(mArguments != string.Empty) - { - InvalidArguments(); - return; - } - StringBuilder sb = new StringBuilder(); ! sb.Append(" * "); for(int idx=0; idx < Server.Capabilities.Length; ++idx) --- 13,20 ---- } ! override protected void InternalProcess() { StringBuilder sb = new StringBuilder(); ! sb.Append("* CAPABILITY "); for(int idx=0; idx < Server.Capabilities.Length; ++idx) Index: CheckCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CheckCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CheckCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CheckCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,24 **** } ! override public void Process() { ! if(mArguments != string.Empty) ! { ! InvalidArguments(); ! return; ! } ! ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: CloseCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CloseCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CloseCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CloseCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,24 **** } ! override public void Process() { ! if(mArguments != string.Empty) ! { ! InvalidArguments(); ! return; ! } ! ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: CommandPart.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CommandPart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CommandPart.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CommandPart.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 36,45 **** // QUOTED-CHAR = <any TEXT-CHAR except quoted specials> / "\" public static string QuotedChar = RemoveChars(TextChar, QuotedSpecials); ! // digit-nz = %x31-39 ; 1-9 public static string DigitNz = "123456789"; // DIGIT ! public static string Digit = "0123456798"; ! protected static string Range(int low, int high) --- 36,51 ---- // QUOTED-CHAR = <any TEXT-CHAR except quoted specials> / "\" public static string QuotedChar = RemoveChars(TextChar, QuotedSpecials); ! // list-char = ATOM-CHAR / list-wildcards / resp-specials ! public static string ListChar = CombineChars(AtomChar, ListWildcards, RespSpecials); // digit-nz = %x31-39 ; 1-9 public static string DigitNz = "123456789"; // DIGIT ! public static string Digit = "0123456789"; ! // seq-number = nz-number / "*" ! public static string SeqNumber = CombineChars(DigitNz, "*"); ! // // seq-range = seq-number ":" seq-number ! public static string SeqRange = CombineChars(SeqNumber, ":"); ! // sequence-set = (seq-number / seq-range) *("," sequence-set) ! public static string SequenceSet = CombineChars(SeqRange, ","); protected static string Range(int low, int high) Index: CopyCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CopyCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CopyCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CopyCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: CreateCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CreateCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CreateCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- CreateCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: DeleteCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/DeleteCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeleteCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- DeleteCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: ExamineCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ExamineCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExamineCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- ExamineCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,36 ---- } ! override protected void InternalProcess() { ! mConnection.Mailbox = Server.MailstoreProvider.GetMailbox(mConnection.User, mParsedArguments[0] as string); ! if(mConnection.Mailbox == null) ! { ! mConnection.State = ImapConnectionState.Authenticated; ! mConnection.SendTaggedMessage("NO"); ! } ! else ! { ! mConnection.State = ImapConnectionState.Selected; ! ! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)"); ! mConnection.SendUntaggedMessage(mConnection.Mailbox.Messages.Length.ToString() + " EXISTS"); ! mConnection.SendUntaggedMessage("0 RECENT"); ! mConnection.SendUntaggedMessage("OK [UNSEEN 0]"); ! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS ()]"); ! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + mConnection.Mailbox.UniqueIdValidity.ToString() + "]"); ! mConnection.SendUntaggedMessage("OK [UIDNEXT " + mConnection.Mailbox.NextUniqueId + "]"); ! mConnection.SendTaggedMessage("OK [READ-ONLY]"); ! } // done Index: ExpungeCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ExpungeCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExpungeCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- ExpungeCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,24 **** } ! override public void Process() { ! if(mArguments != string.Empty) ! { ! InvalidArguments(); ! return; ! } ! ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: FetchCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/FetchCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FetchCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- FetchCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: ImapCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ImapCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImapCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- ImapCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using System; + using System.Collections; namespace Imap.Commands *************** *** 13,27 **** public static ImapConnectionState AuthSelectedState = ImapConnectionState.Authenticated | ImapConnectionState.Selected; - protected event ReadAStringDelegate mReadAStringEvent; - protected delegate void ReadAStringDelegate(bool valid, string str); - private string mCommand; private ImapConnectionState mValidStates; private ImapServer mServer; private bool mReadLiteralSuccess; private string mReadLiteralString; ! protected string mArguments; ! protected int mArgumentIndex; protected ImapConnection mConnection; --- 14,29 ---- public static ImapConnectionState AuthSelectedState = ImapConnectionState.Authenticated | ImapConnectionState.Selected; private string mCommand; private ImapConnectionState mValidStates; private ImapServer mServer; + private ArgumentType[] mArgumentTypes; + private bool mReadLiteralSuccess; private string mReadLiteralString; ! protected string mUnparsedArguments; ! protected object[] mParsedArguments; ! private int mCurrentArgument; ! protected int mUnparsedArgumentIdx; protected ImapConnection mConnection; *************** *** 42,56 **** } ! public ImapCommand(ImapServer svr, string command, Imap.ImapConnectionState validStates) { mServer = svr; mCommand = command; mValidStates = validStates; } public void Initialize(string arguments, ImapConnection con) { ! mArguments = arguments; mConnection = con; } --- 44,79 ---- } ! /// <summary> ! /// Initializes a new ImapCommand ! /// </summary> ! /// <param name="svr">The server we'll be handling commands for</param> ! /// <param name="command">The command that we'll be handling</param> ! /// <param name="validStates">Which connection states are valid for this command</param> ! /// <param name="argTypes">The argument types for this command (use ArgumentType.CustomHandler if you want to do it yourself)</param> ! protected ImapCommand(ImapServer svr, string command, Imap.ImapConnectionState validStates, params ArgumentType[] argTypes) { mServer = svr; mCommand = command; mValidStates = validStates; + + mArgumentTypes = argTypes; + if(mArgumentTypes == null) + mArgumentTypes = new ArgumentType[0]; + + mParsedArguments = new object[mArgumentTypes.Length]; } public void Initialize(string arguments, ImapConnection con) { ! mUnparsedArguments = arguments; mConnection = con; + + // initialize couples as the uninitialize of the previous call + mReadLiteralSuccess = false; + mReadLiteralString = string.Empty; + mUnparsedArgumentIdx = 0; + mCurrentArgument = 0; + for(int idx = 0; idx < mParsedArguments.Length; ++idx) + mParsedArguments[idx] = null; } *************** *** 60,64 **** } ! abstract public void Process(); protected void InvalidArguments() --- 83,109 ---- } ! /// <summary> ! /// Processes the command, may return before the command is actually finished ! /// </summary> ! /// <param name="arguments">The arguments read in for processing</param> ! /// <param name="con">The connection that needs this command handled</param> ! public void Process() ! { ! // no arguments ... ! if(mArgumentTypes.Length == 0) ! { ! // ... and they gave us some ! if(mUnparsedArguments != string.Empty) ! InvalidArguments(); ! else ! InternalProcess(); ! } ! else // we need some arguments ! { ! ParseArgument(); ! } ! } ! ! abstract protected void InternalProcess(); protected void InvalidArguments() *************** *** 68,122 **** } ! protected void ReadAString(ReadAStringDelegate handler, bool includesPrecedingSpace) { ! mReadAStringEvent = null; // hopefully will unsubscribe the last guy ! if(includesPrecedingSpace) ! ++mArgumentIndex; // move past the space at the beginning ! if(mArguments == string.Empty) ! handler(false, string.Empty); ! else if(mArguments[mArgumentIndex] == '{') // literal string ! ReadLiteralString(handler); ! else if(mArguments[mArgumentIndex] == '"') // quoted string { string str; ! if(ReadQuotedString(out str)) ! handler(true, str); else ! handler(false, string.Empty); } ! else // atom { string str; ! if(ReadAtom(out str)) ! handler(true, str); else ! handler(false, string.Empty); } } ! protected void ReadLiteralString(ReadAStringDelegate callback) { ! ++mArgumentIndex; // move past '{' int literalSize; // read digit-nz ! if(CommandPart.DigitNz.IndexOf(mArguments[mArgumentIndex]) != -1) { ! literalSize = int.Parse(mArguments[mArgumentIndex] + string.Empty); // read the rest of the digits ! for(++mArgumentIndex; mArgumentIndex < mArguments.Length; ++mArgumentIndex) { ! if(mArguments[mArgumentIndex] == '}') { ! ++mArgumentIndex; ! if(mArgumentIndex != mArguments.Length) ! callback(false, string.Empty); // literal size line must end after the '}' else { - mReadAStringEvent += callback; mConnection.SendContinueMessage("Ready"); mConnection.Connection.ReadBlock(new byte[literalSize], 0, literalSize, new ReceivedBlockDelegate(ReceivedLiteralString)); --- 113,210 ---- } ! #region Argument parsing stuff ! [Flags()] protected enum ArgumentType { ! CustomHandler = 0, ! QuotedString = 1, ! AtomString = 2, ! LiteralString = 4, ! AString = 7, // quoted(1) + atom(2) + literal(4) ! ListChars = 8, ! ListString = 13, // quoted(1) + literal(4) + listchars(8) ! SequenceSet = 16, ! } ! private void ParseArgumentHandler(bool valid, object parsedArgument) ! { ! if(valid) // yay, we got a good argument ! { ! mParsedArguments[mCurrentArgument++] = parsedArgument; // save and move to next ! if(mCurrentArgument == mArgumentTypes.Length) // if we're done, then send it over to custom processing ! InternalProcess(); ! else // need more arguments ! ParseArgument(); ! } ! else ! { ! mConnection.SendTaggedMessage("BAD"); ! mConnection.ReadCommand(); ! } ! } ! private void ParseArgument() ! { ! ++mUnparsedArgumentIdx; // move past the space at the beginning ! ! if(mUnparsedArguments == string.Empty) ! ParseArgumentHandler(false, string.Empty); ! else if(((mArgumentTypes[mCurrentArgument] & ArgumentType.LiteralString) == ArgumentType.LiteralString) && mUnparsedArguments[mUnparsedArgumentIdx] == '{') // literal string ! ParseLiteralString(); ! else if(((mArgumentTypes[mCurrentArgument] & ArgumentType.QuotedString) == ArgumentType.QuotedString) && mUnparsedArguments[mUnparsedArgumentIdx] == '"') // quoted string { string str; ! if(ParseQuotedString(out str)) ! ParseArgumentHandler(true, str); else ! ParseArgumentHandler(false, string.Empty); } ! else if(((mArgumentTypes[mCurrentArgument] & ArgumentType.ListChars) == ArgumentType.ListChars)) { string str; ! if(ParseListCharString(out str)) ! ParseArgumentHandler(true, str); else ! ParseArgumentHandler(false, string.Empty); ! } ! else if((mArgumentTypes[mCurrentArgument] & ArgumentType.AtomString) == ArgumentType.AtomString) // atom ! { ! string str; ! if(ParseAtom(out str)) ! ParseArgumentHandler(true, str); ! else ! ParseArgumentHandler(false, string.Empty); ! } ! else if((mArgumentTypes[mCurrentArgument] & ArgumentType.SequenceSet) == ArgumentType.SequenceSet) // sequence set ! { ! SequenceSet seq; ! if(ParseSequenceSet(out seq)) ! ParseArgumentHandler(true, seq); ! else ! ParseArgumentHandler(false, string.Empty); } } ! #region Literal string ! private void ParseLiteralString() { ! ++mUnparsedArgumentIdx; // move past '{' int literalSize; // read digit-nz ! if(CommandPart.DigitNz.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { ! literalSize = int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); // read the rest of the digits ! for(++mUnparsedArgumentIdx; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) { ! if(mUnparsedArguments[mUnparsedArgumentIdx] == '}') { ! ++mUnparsedArgumentIdx; ! if(mUnparsedArgumentIdx != mUnparsedArguments.Length) ! ParseArgumentHandler(false, string.Empty); // literal size line must end after the '}' else { mConnection.SendContinueMessage("Ready"); mConnection.Connection.ReadBlock(new byte[literalSize], 0, literalSize, new ReceivedBlockDelegate(ReceivedLiteralString)); *************** *** 124,153 **** } } ! else if(CommandPart.Digit.IndexOf(mArguments[mArgumentIndex]) != -1) { literalSize *= 10; ! literalSize += int.Parse(mArguments[mArgumentIndex] + string.Empty); } else // not a valid digit ! callback(false, string.Empty); } } else // not a valid digit ! callback(false, string.Empty); } ! protected bool ReadAtom(out string atomString) { bool isGood = true; // will determine whether we've read a valid atom atomString = string.Empty; // will store the atom as we "read" it ! for(; mArgumentIndex < mArguments.Length; ++ mArgumentIndex) { ! if(CommandPart.AtomChar.IndexOf(mArguments[mArgumentIndex]) != -1) ! atomString += mArguments[mArgumentIndex]; else // not found, bad char { isGood = false; ! ++mArgumentIndex; break; } --- 212,294 ---- } } ! else if(CommandPart.Digit.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) { literalSize *= 10; ! literalSize += int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); } else // not a valid digit ! ParseArgumentHandler(false, string.Empty); } } else // not a valid digit ! ParseArgumentHandler(false, string.Empty); } ! private void ReceivedLiteralString(Connection con, byte[] block) ! { ! mReadLiteralSuccess = true; ! mReadLiteralString = System.Text.Encoding.ASCII.GetString(block); ! for(int idx = 0; idx < mReadLiteralString.Length; ++idx) ! { ! if(CommandPart.CHAR8.IndexOf(mReadLiteralString[idx]) == -1) ! { ! mReadLiteralSuccess = false; ! break; ! } ! } ! ! mConnection.Connection.ReadLine(new ReceivedLineDelegate(ReceivedLineAfterLiteral)); ! } ! ! private void ReceivedLineAfterLiteral(Connection con, string line) ! { ! mUnparsedArgumentIdx = 0; ! mUnparsedArguments = line; ! ! if(mReadLiteralSuccess) ! ParseArgumentHandler(true, mReadLiteralString); ! else ! ParseArgumentHandler(false, string.Empty); ! } ! #endregion ! ! #region List char string ! private bool ParseListCharString(out string listCharString) ! { ! bool isGood = true; // will determing whether we've read a valid atom ! listCharString = string.Empty; // will store the list char string as we "read" it ! ! for(; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) ! { ! if(CommandPart.ListChar.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) ! listCharString += mUnparsedArguments[mUnparsedArgumentIdx]; ! else // not found, bad char ! { ! isGood = false; ! ++mUnparsedArgumentIdx; ! break; ! } ! } ! ! return isGood; ! } ! #endregion ! ! #region Atom string ! private bool ParseAtom(out string atomString) { bool isGood = true; // will determine whether we've read a valid atom atomString = string.Empty; // will store the atom as we "read" it ! for(; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++ mUnparsedArgumentIdx) { ! if(CommandPart.AtomChar.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) ! atomString += mUnparsedArguments[mUnparsedArgumentIdx]; ! else if(mUnparsedArguments[mUnparsedArgumentIdx] == ' ') // a space, done with this argument ! break; else // not found, bad char { isGood = false; ! ++mUnparsedArgumentIdx; break; } *************** *** 156,161 **** return isGood; } ! protected bool ReadQuotedString(out string quotedString) { bool readEscape = false; // keeps track of whether or not we just read the escape character "\" --- 297,304 ---- return isGood; } + #endregion ! #region Quoted sring ! private bool ParseQuotedString(out string quotedString) { bool readEscape = false; // keeps track of whether or not we just read the escape character "\" *************** *** 163,183 **** quotedString = string.Empty; // will store the quoted string as we "read" it ! for(++mArgumentIndex; mArgumentIndex < mArguments.Length; ++mArgumentIndex) { ! if(mArguments[mArgumentIndex] == '"') { if(readEscape) ! quotedString += mArguments[mArgumentIndex]; else { isGood = true; // only good when we read an unescaped quote ! ++mArgumentIndex; break; // done } } ! else if(mArguments[mArgumentIndex] == '\\') { if(readEscape) ! quotedString += mArguments[mArgumentIndex]; else readEscape = true; --- 306,326 ---- quotedString = string.Empty; // will store the quoted string as we "read" it ! for(++mUnparsedArgumentIdx; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) { ! if(mUnparsedArguments[mUnparsedArgumentIdx] == '"') { if(readEscape) ! quotedString += mUnparsedArguments[mUnparsedArgumentIdx]; else { isGood = true; // only good when we read an unescaped quote ! ++mUnparsedArgumentIdx; break; // done } } ! else if(mUnparsedArguments[mUnparsedArgumentIdx] == '\\') { if(readEscape) ! quotedString += mUnparsedArguments[mUnparsedArgumentIdx]; else readEscape = true; *************** *** 185,193 **** else { ! if(CommandPart.TextChar.IndexOf(mArguments[mArgumentIndex]) != -1) // it's found, good char ! quotedString += mArguments[mArgumentIndex]; else // not found, bad char { ! ++mArgumentIndex; break; } --- 328,336 ---- else { ! if(CommandPart.TextChar.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) != -1) // it's found, good char ! quotedString += mUnparsedArguments[mUnparsedArgumentIdx]; else // not found, bad char { ! ++mUnparsedArgumentIdx; break; } *************** *** 196,227 **** return isGood; ! } ! private void ReceivedLiteralString(Connection con, byte[] block) { ! mReadLiteralSuccess = true; ! mReadLiteralString = System.Text.Encoding.ASCII.GetString(block); ! for(int idx = 0; idx < mReadLiteralString.Length; ++idx) { ! if(CommandPart.CHAR8.IndexOf(mReadLiteralString[idx]) == -1) { ! mReadLiteralSuccess = false; break; } } ! mConnection.Connection.ReadLine(new ReceivedLineDelegate(ReceivedLineAfterLiteral)); } ! private void ReceivedLineAfterLiteral(Connection con, string line) { ! mArgumentIndex = 0; ! mArguments = line; ! if(mReadLiteralSuccess) ! mReadAStringEvent(true, mReadLiteralString); ! else ! mReadAStringEvent(false, string.Empty); } } } --- 339,508 ---- return isGood; ! } ! #endregion ! #region Sequence string ! private bool ParseSequenceSet(out SequenceSet sequenceSet) { ! bool isGood = false; // will determine whether we've read a valid quoted string ! sequenceSet = new SequenceSet(); // will store the sequenceSet string as we "read" it ! int startNumber = 0; ! int sequenceNumber = 0; ! ! for(; mUnparsedArgumentIdx < mUnparsedArguments.Length; ++mUnparsedArgumentIdx) { ! if(sequenceNumber == 0) // haven't started yet, need to read a non-zero digit { ! if(CommandPart.DigitNz.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) == -1) ! return false; ! else ! { ! sequenceNumber = int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); ! isGood = true; ! } ! } ! else if(mUnparsedArguments[mUnparsedArgumentIdx] == ':') // making a range ! { ! isGood = false; ! if(startNumber == 0) // we started a range earlier, can't start another so soon ! return false; ! ! startNumber = sequenceNumber; ! sequenceNumber = 0; ! } ! else if(mUnparsedArguments[mUnparsedArgumentIdx] == ',') // next sequence set ! { ! isGood = false; ! if(startNumber != 0) // we started a range earlier ! { ! sequenceSet.AddRange(startNumber, sequenceNumber); ! startNumber = 0; ! } ! else // make a range of size 1 ! sequenceSet.AddRange(sequenceNumber); ! sequenceNumber = 0; ! } ! else if(mUnparsedArguments[mUnparsedArgumentIdx] == ' ') // a space, done with the argument ! { ! if(startNumber != 0) // we started a range earlier ! { ! sequenceSet.AddRange(startNumber, sequenceNumber); ! startNumber = 0; ! } ! else // make a range of size 1 ! sequenceSet.AddRange(sequenceNumber); break; } + else + { + if(CommandPart.Digit.IndexOf(mUnparsedArguments[mUnparsedArgumentIdx]) == -1) + return false; + else + { + sequenceNumber *= 10; + sequenceNumber += int.Parse(mUnparsedArguments[mUnparsedArgumentIdx] + string.Empty); + } + } } ! return isGood; } ! protected class SequenceSet { ! private ArrayList mStartRange = new ArrayList(); ! private ArrayList mEndRange = new ArrayList(); ! public void AddRange(int num) ! { ! AddRange(num, num); ! } ! ! public void AddRange(int start, int end) ! { ! int low = Math.Min(start, end); ! int high = Math.Max(start, end); ! ! if(mStartRange.Count == 0) ! { ! mStartRange.Add(low); ! mEndRange.Add(high); ! } ! else ! AddHelper(low, high); ! } ! ! private void AddHelper(int lowVal, int highVal) ! { ! for(int idx = 0; idx < mStartRange.Count; ++idx) ! { ! if(lowVal == (int)mStartRange[idx]) // we start on the same value, wee! ! { ! if(highVal > (int)mEndRange[idx]) // we end higher, change some stuff ! AddHelperHelper(idx, highVal); ! break; ! } ! else if(lowVal > (int)mStartRange[idx]) // we start higher then this guy starts ! { ! if(lowVal < (int)mEndRange[idx]) // we start lower than this guy ends ! if(highVal > (int)mEndRange[idx]) // we end higher, change some stuff ! AddHelperHelper(idx, highVal); ! break; // done no matter what ! } ! else // we start lower then this guy starts ! { ! if(highVal > (int)mStartRange[idx]) // we end higher then this guy starts ! { ! // need to adjust start ! mStartRange[idx] = lowVal; ! ! if(highVal > (int)mEndRange[idx]) // we end higher then this guy ends ! AddHelperHelper(idx, highVal); ! break; ! } ! continue; ! } ! } ! } ! ! private void AddHelperHelper(int idx, int highVal) ! { ! // firstly, adjust the end ! mEndRange[idx] = Math.Max(highVal, (int)mEndRange[idx]); ! ! ++idx; ! ! // while we haven't exhausted the array and we can combine sequences ! while(idx < mStartRange.Count && highVal > (int)mStartRange[idx]) ! { ! // this range can consume the entire next range ! if(highVal >= (int)mEndRange[idx]) ! { ! mStartRange.RemoveAt(idx); ! mEndRange.RemoveAt(idx); ! continue; // still need to see how much more we can eat ! } ! else // we need to combine the ranges ! { ! // make previous range all inclusive ! mEndRange[idx-1] = mEndRange[idx]; ! mStartRange.RemoveAt(idx); ! mEndRange.RemoveAt(idx); ! break; // done ! } ! } ! } ! ! public override string ToString() ! { ! string rv = string.Empty; ! for(int idx = 0; idx < mStartRange.Count; ++idx) ! rv += mStartRange[idx].ToString() + ":" + mEndRange[idx].ToString(); ! return rv; ! } } + #endregion + + #endregion } } Index: ListCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ListCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ListCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- ListCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 10,22 **** public class ListCommand : ImapCommand { ! public ListCommand(ImapServer svr) : base(svr, "LIST", ImapCommand.AuthSelectedState) { } ! override public void Process() { // TODO: actually handle the arguments ! foreach(Mailbox box in Server.MailstoreProvider.GetMailboxes()) ! mConnection.SendUntaggedMessage("LIST() \"/\" \"" + box.Name + "\""); mConnection.SendTaggedMessage("OK LIST completed"); --- 10,22 ---- public class ListCommand : ImapCommand { ! public ListCommand(ImapServer svr) : base(svr, "LIST", ImapCommand.AuthSelectedState, ArgumentType.AString, ArgumentType.ListString) { } ! override protected void InternalProcess() { // TODO: actually handle the arguments ! foreach(Mailbox box in mConnection.User.Mailboxes) ! mConnection.SendUntaggedMessage("LIST () \"/\" \"" + box.Name + "\""); mConnection.SendTaggedMessage("OK LIST completed"); Index: LoginCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LoginCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LoginCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- LoginCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 10,44 **** public class LoginCommand : ImapCommand { ! public LoginCommand(ImapServer svr) : base(svr, "LOGIN", ImapConnectionState.NotAuthenticated) { } ! override public void Process() { ! ReadAString(new ReadAStringDelegate(ReceivedUsername), true); ! } ! private void ReceivedUsername(bool valid, string str) ! { ! if(valid) // good so far, now get the password ! ReadAString(new ReadAStringDelegate(ReceivedPassword), true); else { - mConnection.SendTaggedMessage("BAD"); - mConnection.ReadCommand(); - } - } - - private void ReceivedPassword(bool valid, string str) - { - if(valid) // good, yay, go security - { mConnection.State = ImapConnectionState.Authenticated; mConnection.SendTaggedMessage("OK LOGIN completed"); } - else - mConnection.SendTaggedMessage("BAD"); - // done mConnection.ReadCommand(); } --- 10,29 ---- public class LoginCommand : ImapCommand { ! public LoginCommand(ImapServer svr) : base(svr, "LOGIN", ImapConnectionState.NotAuthenticated, ArgumentType.AString, ArgumentType.ListString) { } ! override protected void InternalProcess() { ! mConnection.User = Server.MailstoreProvider.GetUser(mParsedArguments[0] as String, mParsedArguments[1] as String); ! if(mConnection.User == null) ! mConnection.SendTaggedMessage("NO"); else { mConnection.State = ImapConnectionState.Authenticated; mConnection.SendTaggedMessage("OK LOGIN completed"); } mConnection.ReadCommand(); } Index: LogoutCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LogoutCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogoutCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- LogoutCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,27 **** } ! override public void Process() { ! if(mArguments != string.Empty) ! { ! InvalidArguments(); ! return; ! } ! mConnection.SendTaggedMessage("OK"); // done ! mConnection.ReadCommand(); } } --- 12,22 ---- } ! override protected void InternalProcess() { ! mConnection.SendUntaggedMessage("BYE"); mConnection.SendTaggedMessage("OK"); // done ! mConnection.Close(); } } Index: LsubCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LsubCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LsubCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- LsubCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 1,2 **** --- 1,4 ---- + using Common; + using System; *************** *** 8,18 **** public class LsubCommand : ImapCommand { ! public LsubCommand(ImapServer svr) : base(svr, "LSUB", ImapCommand.AuthSelectedState) { } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 10,24 ---- public class LsubCommand : ImapCommand { ! public LsubCommand(ImapServer svr) : base(svr, "LSUB", ImapCommand.AuthSelectedState, ArgumentType.AString, ArgumentType.ListString) { } ! override protected void InternalProcess() { ! // TODO: actually handle the arguments ! foreach(Mailbox box in mConnection.User.Mailboxes) ! mConnection.SendUntaggedMessage("LSUB () \"/\" \"" + box.Name + "\""); ! ! mConnection.SendTaggedMessage("OK LSUB completed"); // done Index: NoopCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/NoopCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NoopCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- NoopCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,23 **** } ! override public void Process() { - if(mArguments != string.Empty) - { - InvalidArguments(); - return; - } - mConnection.SendTaggedMessage("OK"); --- 12,17 ---- } ! override protected void InternalProcess() { mConnection.SendTaggedMessage("OK"); Index: RenameCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/RenameCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RenameCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- RenameCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: SearchCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SearchCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SearchCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- SearchCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: SelectCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SelectCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- SelectCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 8,18 **** public class SelectCommand : ImapCommand { ! public SelectCommand(ImapServer svr) : base(svr, "SELECT", ImapCommand.AuthSelectedState) { } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 8,36 ---- public class SelectCommand : ImapCommand { ! public SelectCommand(ImapServer svr) : base(svr, "SELECT", ImapCommand.AuthSelectedState, ArgumentType.AString) { } ! override protected void InternalProcess() { ! mConnection.Mailbox = Server.MailstoreProvider.GetMailbox(mConnection.User, mParsedArguments[0] as string); ! if(mConnection.Mailbox == null) ! { ! mConnection.State = ImapConnectionState.Authenticated; ! mConnection.SendTaggedMessage("NO"); ! } ! else ! { ! mConnection.State = ImapConnectionState.Selected; ! ! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)"); ! mConnection.SendUntaggedMessage(mConnection.Mailbox.Messages.Length.ToString() + " EXISTS"); ! mConnection.SendUntaggedMessage("0 RECENT"); ! mConnection.SendUntaggedMessage("OK [UNSEEN 0]"); ! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft)]"); ! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + mConnection.Mailbox.UniqueIdValidity.ToString() + "]"); ! mConnection.SendUntaggedMessage("OK [UIDNEXT " + mConnection.Mailbox.NextUniqueId + "]"); ! mConnection.SendTaggedMessage("OK [READ-WRITE]"); ! } // done Index: StarttlsCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StarttlsCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StarttlsCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- StarttlsCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,24 **** } ! override public void Process() { ! if(mArguments != string.Empty) ! { ! InvalidArguments(); ! return; ! } ! ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: StatusCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StatusCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatusCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- StatusCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: StoreCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StoreCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StoreCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- StoreCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: SubscribeCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SubscribeCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SubscribeCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- SubscribeCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: UidCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/UidCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UidCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- UidCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done Index: UnsubscribeCommand.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/UnsubscribeCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UnsubscribeCommand.cs 24 Jul 2003 04:32:14 -0000 1.2 --- UnsubscribeCommand.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 12,18 **** } ! override public void Process() { ! mConnection.SendTaggedMessage("OK"); // done --- 12,18 ---- } ! override protected void InternalProcess() { ! mConnection.SendTaggedMessage("BAD"); // done |
From: <ta...@us...> - 2003-07-25 03:39:16
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Common/MailstoreProviders Modified Files: IMailstoreProvider.cs XmlMailstoreProvider.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled Index: IMailstoreProvider.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/IMailstoreProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IMailstoreProvider.cs 24 Jul 2003 04:32:14 -0000 1.1 --- IMailstoreProvider.cs 25 Jul 2003 03:39:12 -0000 1.2 *************** *** 8,23 **** public interface IMailstoreProvider { /// <summary> ! /// Gets the mailbox with the specified absolute path /// </summary> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> ! Mailbox GetMailbox(string absoluteHiearchicalName); /// <summary> ! /// Gets all the mailboxes that are in the mail store /// </summary> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> ! Mailbox[] GetMailboxes(); /// <summary> --- 8,35 ---- public interface IMailstoreProvider { + #region User accessors /// <summary> ! /// Gets the user with the login info /// </summary> + /// <param name="username">The username of the user</param> + /// <param name="password">The accessing password for this user</param> + /// <returns>The user with the username and password</returns> + User GetUser(string username, string password); + #endregion + + #region Mailbox accessors + /// <summary> + /// Gets the mailbox with the specified absolute path for a particular user + /// </summary> + /// <param name="user">The user that owns this mailbox</param> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> ! Mailbox GetMailbox(User user, string absoluteHiearchicalName); /// <summary> ! /// Gets all the mailboxes that are in the mail store for a particular user /// </summary> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> ! Mailbox[] GetMailboxes(User user); /// <summary> *************** *** 27,31 **** --- 39,45 ---- /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(Mailbox parent); + #endregion + #region Message accessors /// <summary> /// Gets the message *************** *** 42,45 **** --- 56,60 ---- /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Message[] GetMessages(Mailbox box); + #endregion } } Index: XmlMailstoreProvider.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmlMailstoreProvider.cs 24 Jul 2003 04:32:14 -0000 1.1 --- XmlMailstoreProvider.cs 25 Jul 2003 03:39:12 -0000 1.2 *************** *** 16,20 **** } ! public Mailbox GetMailbox(string absoluteHiearchicalName) { DataSet ds = new DataSet(); --- 16,39 ---- } ! #region User accessors ! public User GetUser(string username, string password) ! { ! DataSet ds = new DataSet(); ! ds.ReadXml(mFolderPath + "Users.xml"); ! DataRow[] users = ds.Tables[0].Select("Username = '" + username + "'"); ! ! if(users.Length == 0) ! return null; ! ! DataRow user = users[0]; ! if((user["Password"] as string) == password) ! return new User(this, username, password); ! else ! return null; ! } ! #endregion ! ! #region Mailbox accessors ! public Mailbox GetMailbox(User user, string absoluteHiearchicalName) { DataSet ds = new DataSet(); *************** *** 26,33 **** DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } ! public Mailbox[] GetMailboxes() { DataSet ds = new DataSet(); --- 45,52 ---- DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } ! public Mailbox[] GetMailboxes(User user) { DataSet ds = new DataSet(); *************** *** 39,43 **** { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } --- 58,62 ---- { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } *************** *** 49,53 **** --- 68,74 ---- return null; } + #endregion + #region Message accessors public Message GetMessage(Mailbox box, int uniqueId) { *************** *** 57,62 **** public Message[] GetMessages(Mailbox box) { ! return null; } } } --- 78,96 ---- public Message[] GetMessages(Mailbox box) { ! DataSet ds = new DataSet(); ! ds.ReadXml(mFolderPath + "Messages.xml"); ! ! DataRow[] messages = ds.Tables[0].Select("MailboxIdentifier = '" + box.Name + "'"); ! Message[] msgs = new Message[messages.Length]; ! ! for(int idx = 0; idx < messages.Length; ++idx) ! { ! DataRow message = messages[idx]; ! msgs[idx] = new Message(this, int.Parse(message["UniqueIdentifier"].ToString()), bool.Parse(message["Seen"].ToString()), bool.Parse(message["Answered"].ToString()), bool.Parse(message["Flagged"].ToString()), bool.Parse(message["Deleted"].ToString()), bool.Parse(message["Draft"].ToString()), int.Parse(message["Size"].ToString())); ! } ! ! return msgs; } + #endregion } } |
From: <ta...@us...> - 2003-07-25 03:39:16
|
Update of /cvsroot/csmaild/csmaild/src/Common In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Common Modified Files: Common.csproj Mailbox.cs Message.cs Added Files: User.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled --- NEW FILE: User.cs --- using Common.MailstoreProviders; using System; namespace Common { /// <summary> /// Represents a server user /// </summary> public class User : DataItem { #region Variables private string mUsername; private string mPassword; #endregion #region Properties /// <summary> /// The username of this user /// </summary> public string Username { get { return mUsername; } } /// <summary> /// The password of this user /// </summary> public string Password { get { return mPassword; } } public Mailbox[] Mailboxes { get { return mMailstoreProvider.GetMailboxes(this); } } #endregion public User(IMailstoreProvider provider, string username, string password) : base(provider) { mUsername = username; mPassword = password; } } } Index: Common.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Common.csproj 24 Jul 2003 04:32:13 -0000 1.2 --- Common.csproj 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 105,108 **** --- 105,113 ---- /> <File + RelPath = "User.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "MailstoreProviders\IMailstoreProvider.cs" SubType = "Code" Index: Mailbox.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mailbox.cs 24 Jul 2003 04:32:13 -0000 1.2 --- Mailbox.cs 25 Jul 2003 03:39:12 -0000 1.3 *************** *** 1,6 **** - using System; - using Common.MailstoreProviders; namespace Common { --- 1,6 ---- using Common.MailstoreProviders; + using System; + namespace Common { *************** *** 17,22 **** private Mailbox mParent; private Mailbox[] mChildren; // TODO: Make a strongly typed collection ! ! private Message[] mMessages; // TODO: Make a strongly typed collection #endregion --- 17,21 ---- private Mailbox mParent; private Mailbox[] mChildren; // TODO: Make a strongly typed collection ! private User mUser; // the owner of this mailbox #endregion *************** *** 96,109 **** get { ! return mMessages; ! } ! set ! { ! mMessages = value; } } #endregion ! public Mailbox(IMailstoreProvider provider, string name, string fullName, int nextUniqueId, int uniqueIdValidity) : base(provider) { mNextUniqueId = nextUniqueId; --- 95,104 ---- get { ! return mMailstoreProvider.GetMessages(this); } } #endregion ! public Mailbox(IMailstoreProvider provider, string name, string fullName, int nextUniqueId, int uniqueIdValidity, User user) : base(provider) { mNextUniqueId = nextUniqueId; *************** *** 113,117 **** mParent = null; mChildren = null; ! mMessages = null; } } --- 108,112 ---- mParent = null; mChildren = null; ! mUser = user; } } Index: Message.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Message.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Message.cs 24 Jul 2003 04:32:13 -0000 1.1 --- Message.cs 25 Jul 2003 03:39:12 -0000 1.2 *************** *** 1,2 **** --- 1,4 ---- + using Common.MailstoreProviders; + using System; *************** *** 6,10 **** /// Represents a message /// </summary> ! public class Message { #region Variables --- 8,12 ---- /// Represents a message /// </summary> ! public class Message : DataItem { #region Variables *************** *** 133,137 **** #endregion ! public Message(int uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, bool recent, int size) { mUniqueId = uid; --- 135,139 ---- #endregion ! public Message(IMailstoreProvider provider, int uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, int size) : base(provider) { mUniqueId = uid; *************** *** 141,145 **** mDeleted = deleted; mDraft = draft; ! mRecent = recent; mSize = size; } --- 143,147 ---- mDeleted = deleted; mDraft = draft; ! mRecent = false; mSize = size; } |
From: <ta...@us...> - 2003-07-25 03:39:16
|
Update of /cvsroot/csmaild/csmaild/src/Imap In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Imap Modified Files: Connection.cs Server.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled Index: Connection.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Connection.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Connection.cs 24 Jul 2003 04:32:14 -0000 1.4 --- Connection.cs 25 Jul 2003 03:39:12 -0000 1.5 *************** *** 1,7 **** using System; using System.Net.Sockets; using System.Text; - using Imap.Commands; - using Imap.NetworkManager; namespace Imap --- 1,10 ---- + using Common; + + using Imap.Commands; + using Imap.NetworkManager; + using System; using System.Net.Sockets; using System.Text; namespace Imap *************** *** 31,34 **** --- 34,40 ---- private string mCurrentArguments; // the un-parsed arguments for the currently processing command + private User mUser; // the user logged into this connection, or null if not logged in + private Mailbox mMailbox; // the currently selected mailbox, null if not in selected state + public ImapConnectionState State { *************** *** 56,59 **** --- 62,89 ---- { return mServer; + } + } + + public User User + { + get + { + return mUser; + } + set + { + mUser = value; + } + } + + public Mailbox Mailbox + { + get + { + return mMailbox; + } + set + { + mMailbox = value; } } Index: Server.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Server.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Server.cs 24 Jul 2003 04:32:14 -0000 1.5 --- Server.cs 25 Jul 2003 03:39:12 -0000 1.6 *************** *** 59,63 **** get { ! return new string[]{"IMAP4rev1", "STARTTLS", "LOGINDISABLED", "AUTH=PLAIN"}; } } --- 59,63 ---- get { ! return new string[]{"IMAP4rev1", "STARTTLS", "AUTH=PLAIN"}; } } |
From: <ta...@us...> - 2003-07-24 04:32:27
|
Update of /cvsroot/csmaild/csmaild/src/Imap/NetworkManager In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Imap/NetworkManager Modified Files: Connection.cs Listener.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Index: Connection.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/NetworkManager/Connection.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Connection.cs 12 Apr 2003 18:10:15 -0000 1.3 --- Connection.cs 24 Jul 2003 04:32:14 -0000 1.4 *************** *** 19,29 **** #region Variables private Socket mClient; // the communication socket ! private NetworkStream mSocketStream; // a stream wrapping the com socket ! private byte[] mReceiveBuffer; // a storage place for receive calls ! private MemoryStream mBlockStream; // stores the data when reading a block ! private string mLineString; // stores the data when reading a line ! private bool mReadingLine; // true if we're reading a line ! private int mReadingBlockSize; // the size of the block we are reading (if we're reading a block) private Listener mListener; // the listener that created us --- 19,30 ---- #region Variables private Socket mClient; // the communication socket ! private NetworkStream mSocketStream; // a stream wrapping the communication socket ! ! private byte[] mReceiveLineBuffer; // a small storage place for receiving bytes for the line ! private string mLineString; // used to store the line the client sends ! private byte[] mReceiveBlockBuffer; // used to receive the buffer requested ! private int mReceiveBlockOffset; // the current offset into the receive block buffer ! private int mReceiveBlockSize; // the number of bytes left to read into the receive block buffer private Listener mListener; // the listener that created us *************** *** 31,53 **** #region Events /// <summary> ! /// Fires whenever a line is received from the client /// </summary> ! public event ReceivedLineDelegate ReceivedLineEvent; /// <summary> ! /// Fires whenever the amount of data requested is received /// </summary> ! public event ReceivedBlockDelegate ReceivedBlockEvent; /// <summary> /// Fires when sending is complete /// </summary> ! public event SentDataDelegate SentDataEvent; /// <summary> /// Fires when the connection is closed remotely /// </summary> ! public event ConnectionClosedDelegate ConnectionClosedEvent; #endregion --- 32,99 ---- #region Events + private event ReceivedLineDelegate mReceivedLineEvent; + private event ReceivedBlockDelegate mReceivedBlockEvent; + private event SentDataDelegate mSentDataEvent; + private event ConnectionClosedDelegate mConnectionClosedEvent; + /// <summary> ! /// Fires when the requested line has been received from the client /// </summary> ! public event ReceivedLineDelegate ReceivedLineEvent ! { ! add ! { ! mReceivedLineEvent += value; ! } ! remove ! { ! mReceivedLineEvent -= value; ! } ! } /// <summary> ! /// Fires when the requested block has been received from the client /// </summary> ! public event ReceivedBlockDelegate ReceivedBlockEvent ! { ! add ! { ! mReceivedBlockEvent += value; ! } ! remove ! { ! mReceivedBlockEvent -= value; ! } ! } /// <summary> /// Fires when sending is complete /// </summary> ! public event SentDataDelegate SentDataEvent ! { ! add ! { ! mSentDataEvent += value; ! } ! remove ! { ! mSentDataEvent -= value; ! } ! } /// <summary> /// Fires when the connection is closed remotely /// </summary> ! public event ConnectionClosedDelegate ConnectionClosedEvent ! { ! add ! { ! mConnectionClosedEvent += value; ! } ! remove ! { ! mConnectionClosedEvent -= value; ! } ! } #endregion *************** *** 64,73 **** mSocketStream = new NetworkStream(mClient, true); ! mReceiveBuffer = new byte[4096]; ! mBlockStream = new MemoryStream(); } #endregion #region Public methods /// <summary> /// Writes the message to the socket asynchronosously --- 110,124 ---- mSocketStream = new NetworkStream(mClient, true); ! mReceiveLineBuffer = new byte[8192]; } #endregion #region Public methods + public void Write(string msg) + { + byte[] b = Encoding.ASCII.GetBytes(msg); + mSocketStream.BeginWrite(b, 0, b.Length, new AsyncCallback(SendCallback), msg); + } + /// <summary> /// Writes the message to the socket asynchronosously *************** *** 76,81 **** public void WriteLine(string msg) { ! byte[] b = Encoding.ASCII.GetBytes(msg + "\r\n"); ! mSocketStream.BeginWrite(b, 0, b.Length, new AsyncCallback(SendCallback), msg); } --- 127,131 ---- public void WriteLine(string msg) { ! Write(msg + "\r\n"); } *************** *** 85,134 **** public void ReadLine() { ! mReadingLine = true; ! mSocketStream.BeginRead(mReceiveBuffer, 0, mReceiveBuffer.Length, new AsyncCallback(ReceiveCallback), null); } /// <summary> ! /// Reads a block of data from the socket asynchronously /// </summary> ! /// <param name="size">The size of the block to read</param> ! public void ReadBlock(int size) { ! mReadingLine = false; ! mReadingBlockSize = size; ! // if we have some left over from before ! if(mLineString.Length != 0) ! { ! byte[] old = Encoding.ASCII.GetBytes(mLineString); ! mBlockStream.Write(old, 0, old.Length); ! mLineString = string.Empty; ! } ! // read some more bytes (the lesser of the number we need left or the buffer size) ! mSocketStream.BeginRead(mReceiveBuffer, 0, (int)Math.Min(mReceiveBuffer.Length, mReadingBlockSize-mBlockStream.Position), new AsyncCallback(ReceiveCallback), null); } #endregion #region Protected methods ! /// <summary> ! /// Fires the related event, called when a line has been read ! /// </summary> ! /// <param name="line">The line that was read</param> ! protected virtual void OnReadLine(string line) { ! if(ReceivedLineEvent != null) ! ReceivedLineEvent(this, line); } ! /// <summary> ! /// Fires the related event, called when a block has been read ! /// </summary> ! /// <param name="block">The block that was read</param> ! protected virtual void OnReadBlock(byte[] block) { ! if(ReceivedBlockEvent != null) ! ReceivedBlockEvent(this, block); } --- 135,185 ---- public void ReadLine() { ! ReadLine(mReceivedLineEvent); ! } ! public void ReadLine(ReceivedLineDelegate callback) ! { ! mSocketStream.BeginRead(mReceiveLineBuffer, 0, mReceiveLineBuffer.Length, new AsyncCallback(ReceiveLineCallback), callback); } /// <summary> ! /// Reads a block from the socket asynchronously /// </summary> ! /// <param name="block">The buffer to place the bytes read</param> ! /// <param name="offset">The offset into this buffer</param> ! /// <param name="size">The number of bytes to read into the buffer</param> ! public void ReadBlock(byte[] block, int offset, int length) { ! ReadBlock(block, offset, length, mReceivedBlockEvent); ! } ! /// <summary> ! /// Reads a block from the socket asynchronously calling the passed in delegate instead of the subscribed handler ! /// </summary> ! /// <param name="block">The buffer to place the bytes read</param> ! /// <param name="offset">The offset into this buffer</param> ! /// <param name="size">The number of bytes to read into the buffer</param> ! /// <param name="callback">The callback function to call after done reading</param> ! public void ReadBlock(byte[] block, int offset, int length, ReceivedBlockDelegate callback) ! { ! mReceiveBlockBuffer = block; ! mReceiveBlockOffset = offset; ! mReceiveBlockSize = length; ! ReadBlock(callback); } #endregion #region Protected methods ! private void FireReadLineDelegate(string line, ReceivedLineDelegate func) { ! if(func != null) ! func(this, line); } ! private void FireReadBlockDelegate(byte[] block, ReceivedBlockDelegate func) { ! if(func != null) ! func(this, block); } *************** *** 138,143 **** protected virtual void OnSent() { ! if(SentDataEvent != null) ! SentDataEvent(this); } --- 189,194 ---- protected virtual void OnSent() { ! if(mSentDataEvent != null) ! mSentDataEvent(this); } *************** *** 147,164 **** protected virtual void OnClosed() { ! if(ConnectionClosedEvent != null) ! ConnectionClosedEvent(this); } #endregion #region Private methods private void SendCallback(IAsyncResult result) { mSocketStream.EndWrite(result); // spill event OnSent(); } ! private void ReceiveCallback(IAsyncResult result) { int read = mSocketStream.EndRead(result); --- 198,223 ---- protected virtual void OnClosed() { ! if(mConnectionClosedEvent != null) ! mConnectionClosedEvent(this); } #endregion #region Private methods + private void ReadBlock(ReceivedBlockDelegate callback) + { + mSocketStream.BeginRead(mReceiveBlockBuffer, mReceiveBlockOffset, mReceiveBlockSize, new AsyncCallback(ReceiveBlockCallback), callback); + } + private void SendCallback(IAsyncResult result) { mSocketStream.EndWrite(result); + + System.Diagnostics.Trace.Write(ToString() + " <- " + (string)result.AsyncState); + // spill event OnSent(); } ! private void ReceiveLineCallback(IAsyncResult result) { int read = mSocketStream.EndRead(result); *************** *** 171,220 **** { // if we're reading a line ! if(mReadingLine) { ! mLineString += Encoding.ASCII.GetString(mReceiveBuffer, 0, read); ! // we're reading a line and we found the eof!! ! int idx = mLineString.IndexOf("\r\n"); ! if(idx != -1) ! { ! // we quite possibly got too much data for this line ! // stuff everything before the <CRLF> in this ! string line = mLineString.Substring(0, idx); ! // and everything after back here ! mLineString = mLineString.Substring(idx+2); ! // spill event ! OnReadLine(line); ! } ! else ! { ! // read some more bytes ! ReadLine(); ! } } ! else // or we're reading a block of bytes { ! // add to our current stash of input ! mBlockStream.Write(mReceiveBuffer, 0, read); ! // we're reading a block and got all of our data!! ! if(mBlockStream.Position == mReadingBlockSize) ! { ! byte[] block = mBlockStream.ToArray(); ! ! // reset the stream ! mBlockStream.Close(); ! mBlockStream = new MemoryStream(); ! // spill event ! OnReadBlock(block); ! } ! else ! { ! // read more ! ReadBlock(mReadingBlockSize); ! } ! } } } --- 230,277 ---- { // if we're reading a line ! mLineString += Encoding.ASCII.GetString(mReceiveLineBuffer, 0, read); ! ! // we're reading a line and we found the eof!! ! int idx = mLineString.IndexOf("\r\n"); ! if(idx != -1) { ! // we quite possibly got too much data for this line ! // stuff everything before the <CRLF> in this ! string line = mLineString.Substring(0, idx); ! // and everything after back here ! mLineString = mLineString.Substring(idx+2); ! System.Diagnostics.Trace.WriteLine(ToString() + " -> " + (string)line); ! // spill event ! FireReadLineDelegate(line, (ReceivedLineDelegate)result.AsyncState); } ! else { ! // read some more bytes ! ReadLine(); ! } ! } ! } ! private void ReceiveBlockCallback(IAsyncResult result) ! { ! int read = mSocketStream.EndRead(result); ! if(read == 0) // connection was closed ! { ! // spill event ! OnClosed(); ! } ! else ! { ! // move offset by the amount we read ! mReceiveBlockOffset += read; ! // decrease the amount we have left to read by the amount we read ! mReceiveBlockSize -= read; ! if(mReceiveBlockSize == 0) ! FireReadBlockDelegate(mReceiveBlockBuffer, (ReceivedBlockDelegate)result.AsyncState); ! else ! ReadBlock((ReceivedBlockDelegate)result.AsyncState); } } Index: Listener.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/NetworkManager/Listener.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Listener.cs 11 Apr 2003 01:29:26 -0000 1.2 --- Listener.cs 24 Jul 2003 04:32:14 -0000 1.3 *************** *** 14,18 **** private Socket mListenSocket; ! public event AcceptDelegate AcceptedConnection; public Listener(int port) --- 14,29 ---- private Socket mListenSocket; ! private event AcceptDelegate mAcceptedConnection; ! public event AcceptDelegate AcceptedConnection ! { ! add ! { ! mAcceptedConnection += value; ! } ! remove ! { ! mAcceptedConnection -= value; ! } ! } public Listener(int port) *************** *** 37,42 **** // tell the observers about our new connection ! if(AcceptedConnection != null) ! AcceptedConnection(con); } } --- 48,53 ---- // tell the observers about our new connection ! if(mAcceptedConnection != null) ! mAcceptedConnection(con); } } |
From: <ta...@us...> - 2003-07-24 04:32:27
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Common/MailstoreProviders Added Files: IMailstoreProvider.cs XmlMailstoreProvider.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track --- NEW FILE: IMailstoreProvider.cs --- using System; namespace Common.MailstoreProviders { /// <summary> /// Defines an interface for implementing a mailstore provider /// </summary> public interface IMailstoreProvider { /// <summary> /// Gets the mailbox with the specified absolute path /// </summary> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> Mailbox GetMailbox(string absoluteHiearchicalName); /// <summary> /// Gets all the mailboxes that are in the mail store /// </summary> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(); /// <summary> /// Gets the mailboxes that are immediate children /// </summary> /// <param name="parent">The parent mailbox to gather children for</param> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(Mailbox parent); /// <summary> /// Gets the message /// </summary> /// <param name="box">The mailbox the message is located in</param> /// <param name="uniqueId">The unique identifier of the message</param> /// <returns>The message found, or null if none found</returns> Message GetMessage(Mailbox box, int uniqueId); /// <summary> /// Gets all the messages contained in a mailbox /// </summary> /// <param name="box">The mailbox to gather messages for</param> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Message[] GetMessages(Mailbox box); } } --- NEW FILE: XmlMailstoreProvider.cs --- using System; using System.Data; namespace Common.MailstoreProviders { public class XmlMailstoreProvider : IMailstoreProvider { private string mFolderPath; public XmlMailstoreProvider(string folderPath) { mFolderPath = folderPath; if(!mFolderPath.EndsWith(@"\")) mFolderPath += @"\"; } public Mailbox GetMailbox(string absoluteHiearchicalName) { DataSet ds = new DataSet(); ds.ReadXml(mFolderPath + "Mailboxes.xml"); DataRow[] boxes = ds.Tables[0].Select("FullName = '" + absoluteHiearchicalName + "'"); if(boxes.Length == 0) return null; DataRow box = boxes[0]; return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } public Mailbox[] GetMailboxes() { DataSet ds = new DataSet(); ds.ReadXml(mFolderPath + "Mailboxes.xml"); Mailbox[] boxes = new Mailbox[ds.Tables[0].Rows.Count]; for(int idx = 0; idx < boxes.Length; ++idx) { DataRow box = ds.Tables[0].Rows[idx]; boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } return boxes; } public Mailbox[] GetMailboxes(Mailbox parent) { return null; } public Message GetMessage(Mailbox box, int uniqueId) { return null; } public Message[] GetMessages(Mailbox box) { return null; } } } |
From: <ta...@us...> - 2003-07-24 04:32:25
|
Update of /cvsroot/csmaild/csmaild/src/Common In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Common Modified Files: Common.csproj Mailbox.cs Added Files: DataItem.cs Message.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track --- NEW FILE: DataItem.cs --- using System; using Common.MailstoreProviders; namespace Common { /// <summary> /// Base class for all things data /// </summary> public class DataItem { protected IMailstoreProvider mMailstoreProvider; public DataItem(IMailstoreProvider provider) { mMailstoreProvider = provider; } } } --- NEW FILE: Message.cs --- using System; namespace Common { /// <summary> /// Represents a message /// </summary> public class Message { #region Variables private int mUniqueId; private bool mSeen; private bool mAnswered; private bool mFlagged; private bool mDeleted; private bool mDraft; private bool mRecent; private int mSize; #endregion #region Properties /// <summary> /// The UID of this message /// </summary> public int UniqueId { get { return mUniqueId; } } /// <summary> /// Whether the message has been seen /// </summary> public bool Seen { get { return mSeen; } set { mSeen = value; } } /// <summary> /// Whether the message has been answered /// </summary> public bool Answered { get { return mAnswered; } set { mAnswered = value; } } /// <summary> /// Whether the message has been flagged /// </summary> public bool Flagged { get { return mFlagged; } set { mFlagged = value; } } /// <summary> /// Whether the message has been deleted /// </summary> public bool Deleted { get { return mDeleted; } set { mDeleted = value; } } /// <summary> /// Whether the message is a draft /// </summary> public bool Draft { get { return mDraft; } set { mDraft = value; } } /// <summary> /// Whether the message is recent /// </summary> public bool Recent { get { return mRecent; } set { mRecent = value; } } /// <summary> /// Size of the message (as defined by RFC-2822 /// </summary> public int Size { get { return mSize; } } #endregion public Message(int uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, bool recent, int size) { mUniqueId = uid; mSeen = seen; mAnswered = answered; mFlagged = flagged; mDeleted = deleted; mDraft = draft; mRecent = recent; mSize = size; } } } Index: Common.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Common.csproj 8 Apr 2003 03:02:18 -0000 1.1 --- Common.csproj 24 Jul 2003 04:32:13 -0000 1.2 *************** *** 2,7 **** <CSHARP ProjectType = "Local" ! ProductVersion = "7.0.9466" ! SchemaVersion = "1.0" ProjectGuid = "{19D49838-BF7A-4432-9C84-F50AE399077B}" > --- 2,7 ---- <CSHARP ProjectType = "Local" ! ProductVersion = "7.10.3077" ! SchemaVersion = "2.0" ProjectGuid = "{19D49838-BF7A-4432-9C84-F50AE399077B}" > *************** *** 17,21 **** --- 17,24 ---- DelaySign = "false" OutputType = "Library" + PreBuildEvent = "" + PostBuildEvent = "" RootNamespace = "Common" + RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > *************** *** 31,34 **** --- 34,39 ---- FileAlignment = "4096" IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" *************** *** 49,52 **** --- 54,59 ---- FileAlignment = "4096" IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" *************** *** 83,87 **** --- 90,114 ---- /> <File + RelPath = "DataItem.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Mailbox.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Message.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "MailstoreProviders\IMailstoreProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "MailstoreProviders\XmlMailstoreProvider.cs" SubType = "Code" BuildAction = "Compile" Index: Mailbox.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mailbox.cs 8 Apr 2003 03:02:18 -0000 1.1 --- Mailbox.cs 24 Jul 2003 04:32:13 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- using System; + using Common.MailstoreProviders; + namespace Common { *************** *** 6,20 **** /// Represents a mailbox /// </summary> ! public class Mailbox { ! #region "Variables" private string mName; ! // private int mNextUniqueId; ! // private int mUniqueIdValidity; ! // private Mailbox mParent; ! // private Mailbox[] mChildren; #endregion ! #region "Properties" /// <summary> /// The human readable name of this mailbox --- 8,25 ---- /// Represents a mailbox /// </summary> ! public class Mailbox : DataItem { ! #region Variables private string mName; ! private string mFullName; ! private int mNextUniqueId; ! private int mUniqueIdValidity; ! private Mailbox mParent; ! private Mailbox[] mChildren; // TODO: Make a strongly typed collection ! ! private Message[] mMessages; // TODO: Make a strongly typed collection #endregion ! #region Properties /// <summary> /// The human readable name of this mailbox *************** *** 39,43 **** get { ! return 0;//mNextUniqueId; } } --- 44,48 ---- get { ! return mNextUniqueId;; } } *************** *** 50,60 **** get { ! return 0;//mUniqueIdValidity; } } #endregion ! public Mailbox() { } } --- 55,117 ---- get { ! return mUniqueIdValidity; ! } ! } ! ! /// <summary> ! /// The parent Mailbox for this mailbox (null if none) ! /// </summary> ! public Mailbox Parent ! { ! get ! { ! return mParent; ! } ! set ! { ! mParent = value; ! } ! } ! ! /// <summary> ! /// The child Mailboxes for this mailbox (valid array of size 0 if none) ! /// </summary> ! public Mailbox[] Children ! { ! get ! { ! return mChildren; ! } ! set ! { ! mChildren = value; ! } ! } ! ! /// <summary> ! /// The Messages contained in this mailbox ! /// </summary> ! public Message[] Messages ! { ! get ! { ! return mMessages; ! } ! set ! { ! mMessages = value; } } #endregion ! public Mailbox(IMailstoreProvider provider, string name, string fullName, int nextUniqueId, int uniqueIdValidity) : base(provider) { + mNextUniqueId = nextUniqueId; + mUniqueIdValidity = uniqueIdValidity; + mName = name; + mFullName = fullName; + mParent = null; + mChildren = null; + mMessages = null; } } |
From: <ta...@us...> - 2003-07-24 04:32:25
|
Update of /cvsroot/csmaild/csmaild/src In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src Modified Files: csmaild.sln Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Index: csmaild.sln =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/csmaild.sln,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csmaild.sln 8 Apr 2003 03:02:55 -0000 1.1 --- csmaild.sln 24 Jul 2003 04:32:14 -0000 1.2 *************** *** 1,15 **** ! Microsoft Visual Studio Solution File, Format Version 7.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "common\Common.csproj", "{19D49838-BF7A-4432-9C84-F50AE399077B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine", "Engine\Engine.csproj", "{44D6B051-0CE8-4964-8236-8539431F5212}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imap", "Imap\Imap.csproj", "{B1B51646-3745-489A-B0A8-630013E5E44E}" EndProject Global GlobalSection(SolutionConfiguration) = preSolution ! ConfigName.0 = Debug ! ConfigName.1 = Release ! EndGlobalSection ! GlobalSection(ProjectDependencies) = postSolution EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution --- 1,23 ---- ! Microsoft Visual Studio Solution File, Format Version 8.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "common\Common.csproj", "{19D49838-BF7A-4432-9C84-F50AE399077B}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine", "Engine\Engine.csproj", "{44D6B051-0CE8-4964-8236-8539431F5212}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Imap", "Imap\Imap.csproj", "{B1B51646-3745-489A-B0A8-630013E5E44E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection + EndProject + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\TestClient.csproj", "{EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution ! Debug = Debug ! Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution *************** *** 26,29 **** --- 34,41 ---- {B1B51646-3745-489A-B0A8-630013E5E44E}.Release.ActiveCfg = Release|.NET {B1B51646-3745-489A-B0A8-630013E5E44E}.Release.Build.0 = Release|.NET + {EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Debug.ActiveCfg = Debug|.NET + {EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Debug.Build.0 = Debug|.NET + {EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Release.ActiveCfg = Release|.NET + {EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution |
Update of /cvsroot/csmaild/csmaild/src/TestClient In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/TestClient Added Files: .cvsignore App.ico AssemblyInfo.cs ClientHelper.cs Main.cs Main.resx TestClient.csproj TestClient.csproj.user Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track --- NEW FILE: .cvsignore --- common.csproj.user bin obj --- NEW FILE: App.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: AssemblyInfo.cs --- using System.Reflection; using System.Runtime.CompilerServices; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.*")] // // In order to sign your assembly you must specify a key to use. Refer to the // Microsoft .NET Framework documentation for more information on assembly signing. // // Use the attributes below to control which key is used for signing. // // Notes: // (*) If no key is specified, the assembly is not signed. // (*) KeyName refers to a key that has been installed in the Crypto Service // Provider (CSP) on your machine. KeyFile refers to a file which contains // a key. // (*) If the KeyFile and the KeyName values are both specified, the // following processing occurs: // (1) If the KeyName can be found in the CSP, that key is used. // (2) If the KeyName does not exist and the KeyFile does exist, the key // in the KeyFile is installed into the CSP and used. // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. // When specifying the KeyFile, the location of the KeyFile should be // relative to the project output directory which is // %Project Directory%\obj\<configuration>. For example, if your KeyFile is // located in the project directory, you would specify the AssemblyKeyFile // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework // documentation for more information on this. // [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] --- NEW FILE: ClientHelper.cs --- using System; using System.Net.Sockets; namespace TestClient { /// <summary> /// Summary description for ClientHelper. /// </summary> public class ClientHelper { TcpClient client; NetworkStream stream; Random r = new Random(); public ClientHelper(string host, short port) { client = new TcpClient(host, port); stream = client.GetStream(); } public void Send(string msg) { bool split = (r.Next(1) == 0 ? false : true); int blocks = (split ? r.Next(msg.Length/2)+1 : 1); int blockSize = msg.Length / blocks; int sent = 0; byte[] buf = System.Text.Encoding.ASCII.GetBytes(msg); while(sent < msg.Length) { stream.Write(buf, sent, Math.Min(blockSize, msg.Length-sent)); sent += Math.Min(blockSize, msg.Length-sent); } } public string ReceiveLine() { string retval = string.Empty; bool read13 = false; bool done = false; while(!done) { if(stream.DataAvailable) { int chI = stream.ReadByte(); if(chI != -1) { char ch = Convert.ToChar(chI); if(read13 && ch == '\n') done = true; read13 = (ch == '\r'); retval += ch; } } else System.Threading.Thread.Sleep(10); } return retval.Substring(0, retval.Length-2); } } } --- NEW FILE: Main.cs --- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace TestClient { /// <summary> /// Summary description for Main. /// </summary> public class MainF : System.Windows.Forms.Form { private System.Windows.Forms.ListBox listBox1; int counter = 0; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.ListBox listBox2; private System.Windows.Forms.Button button3; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public MainF() { // // Required for Windows Form Designer support // InitializeComponent(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } [STAThread] static void Main(string[] args) { new MainF().ShowDialog(); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.listBox1 = new System.Windows.Forms.ListBox(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.listBox2 = new System.Windows.Forms.ListBox(); this.button3 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // listBox1 // this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox1.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox1.ItemHeight = 16; this.listBox1.Location = new System.Drawing.Point(8, 40); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(352, 308); this.listBox1.TabIndex = 0; this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // // button1 // this.button1.Location = new System.Drawing.Point(16, 8); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(96, 23); this.button1.TabIndex = 1; this.button1.Text = "Test Localhost"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(632, 8); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(88, 23); this.button2.TabIndex = 2; this.button2.Text = "Test Chegg"; this.button2.Click += new System.EventHandler(this.button2_Click); // // listBox2 // this.listBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listBox2.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.listBox2.ItemHeight = 16; this.listBox2.Location = new System.Drawing.Point(368, 40); this.listBox2.Name = "listBox2"; this.listBox2.Size = new System.Drawing.Size(352, 308); this.listBox2.TabIndex = 3; this.listBox2.SelectedIndexChanged += new System.EventHandler(this.listBox2_SelectedIndexChanged); // // button3 // this.button3.Location = new System.Drawing.Point(328, 8); this.button3.Name = "button3"; this.button3.TabIndex = 4; this.button3.Text = "Test Both"; this.button3.Click += new System.EventHandler(this.button3_Click); // // MainF // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(728, 357); this.Controls.Add(this.button3); this.Controls.Add(this.listBox2); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.listBox1); this.Name = "MainF"; this.Text = "Main"; this.ResumeLayout(false); } #endregion private void SendLine(string msg, ClientHelper h, ListBox box) { h.Send(msg + "\r\n"); box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " -> " + msg); } private string ReadLine(ClientHelper h, ListBox box) { string line = h.ReceiveLine(); box.Items.Add(counter++.ToString().PadLeft(4, ' ') + " <- " + line); return line; } private void button1_Click(object sender, System.EventArgs e) { ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); } private void button2_Click(object sender, System.EventArgs e) { ClientHelper chegg = new ClientHelper("chegg.com", 143); Go(chegg, listBox2); } private void button3_Click(object sender, System.EventArgs e) { ClientHelper localhost = new ClientHelper("localhost", 143); Go(localhost, listBox1); ClientHelper chegg = new ClientHelper("chegg.com", 143); Go(chegg, listBox2); } private void Go(ClientHelper h, ListBox box) { ReadLine(h, box); // read welcome msg string a1 = string.Empty; SendLine("a1 CAPABILITY", h, box); while(!a1.StartsWith("a1")) a1 = ReadLine(h, box); string a2 = string.Empty; SendLine("a2 LOGIN {12}", h, box); a2 = ReadLine(h, box); SendLine("csmaild_test {12}", h, box); a2 = ReadLine(h, box); SendLine("csmaild_test", h, box); while(!a2.StartsWith("a2")) a2 = ReadLine(h, box); /* string a2 = string.Empty; SendLine("a2 LOGIN \"csmaild_test\" \"csmaild_test\""); while(!a2.StartsWith("a2")) a2 = ReadLine();*/ string a3 = string.Empty; SendLine("a3 LIST \"\" \"*\"", h, box); while(!a3.StartsWith("a3")) a3 = ReadLine(h, box); } private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e) { listBox2.SelectedIndex = listBox1.SelectedIndex; } private void listBox2_SelectedIndexChanged(object sender, System.EventArgs e) { listBox1.SelectedIndex = listBox2.SelectedIndex; } } } --- NEW FILE: Main.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="listBox1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="listBox1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox2.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="listBox2.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="listBox2.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button3.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="button3.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="button3.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>(Default)</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Name"> <value>MainF</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>8, 8</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> </root> --- NEW FILE: TestClient.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}" > <Build> <Settings ApplicationIcon = "App.ico" AssemblyKeyContainerName = "" AssemblyName = "TestClient" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "WinExe" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "TestClient" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.Drawing" AssemblyName = "System.Drawing" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll" /> <Reference Name = "System.Windows.Forms" AssemblyName = "System.Windows.Forms" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll" /> <Reference Name = "System.XML" AssemblyName = "System.XML" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> </References> </Build> <Files> <Include> <File RelPath = "App.ico" BuildAction = "Content" /> <File RelPath = "AssemblyInfo.cs" BuildAction = "Compile" /> <File RelPath = "ClientHelper.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Main.cs" SubType = "Form" BuildAction = "Compile" /> <File RelPath = "Main.resx" DependentUpon = "Main.cs" BuildAction = "EmbeddedResource" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: TestClient.csproj.user --- <VisualStudioProject> <CSHARP LastOpenVersion = "7.10.3077" > <Build> <Settings ReferencePath = "" > <Config Name = "Debug" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "false" /> <Config Name = "Release" EnableASPDebugging = "false" EnableASPXDebugging = "false" EnableUnmanagedDebugging = "false" EnableSQLServerDebugging = "false" RemoteDebugEnabled = "false" RemoteDebugMachine = "" StartAction = "Project" StartArguments = "" StartPage = "" StartProgram = "" StartURL = "" StartWorkingDirectory = "" StartWithIE = "true" /> </Settings> </Build> <OtherProjectSettings CopyProjectDestinationFolder = "" CopyProjectUncPath = "" CopyProjectOption = "0" ProjectView = "ProjectFiles" ProjectTrust = "0" /> </CSHARP> </VisualStudioProject> |
From: <ta...@us...> - 2003-07-24 04:32:23
|
Update of /cvsroot/csmaild/csmaild/src/Engine In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Engine Modified Files: Engine.cs Engine.csproj Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Index: Engine.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/Engine.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Engine.cs 11 Apr 2003 01:29:25 -0000 1.3 --- Engine.cs 24 Jul 2003 04:32:13 -0000 1.4 *************** *** 1,5 **** ! using System; using Imap; namespace Engine { --- 1,8 ---- ! using Common.MailstoreProviders; ! using Imap; + using System; + namespace Engine { *************** *** 20,24 **** public void RunStuff() { ! Server svr = new Server(); svr.Start(); --- 23,30 ---- public void RunStuff() { ! System.Diagnostics.TextWriterTraceListener tWriter = new System.Diagnostics.TextWriterTraceListener(System.Console.Out); ! System.Diagnostics.Trace.Listeners.Add(tWriter); ! ! ImapServer svr = new ImapServer(new XmlMailstoreProvider(@"C:\Mailstore")); svr.Start(); Index: Engine.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/Engine.csproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Engine.csproj 8 Apr 2003 03:02:20 -0000 1.1 --- Engine.csproj 24 Jul 2003 04:32:13 -0000 1.2 *************** *** 2,7 **** <CSHARP ProjectType = "Local" ! ProductVersion = "7.0.9466" ! SchemaVersion = "1.0" ProjectGuid = "{44D6B051-0CE8-4964-8236-8539431F5212}" > --- 2,7 ---- <CSHARP ProjectType = "Local" ! ProductVersion = "7.10.3077" ! SchemaVersion = "2.0" ProjectGuid = "{44D6B051-0CE8-4964-8236-8539431F5212}" > *************** *** 17,21 **** --- 17,24 ---- DelaySign = "false" OutputType = "Exe" + PreBuildEvent = "" + PostBuildEvent = "" RootNamespace = "Engine" + RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > *************** *** 31,34 **** --- 34,39 ---- FileAlignment = "4096" IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" *************** *** 49,52 **** --- 54,59 ---- FileAlignment = "4096" IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" *************** *** 76,79 **** --- 83,91 ---- Name = "Imap" Project = "{B1B51646-3745-489A-B0A8-630013E5E44E}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> + <Reference + Name = "Common" + Project = "{19D49838-BF7A-4432-9C84-F50AE399077B}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> |
From: <ta...@us...> - 2003-07-24 04:32:21
|
Update of /cvsroot/csmaild/csmaild/src/Imap In directory sc8-pr-cvs1:/tmp/cvs-serv32149/src/Imap Modified Files: Connection.cs Imap.csproj Server.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Index: Connection.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Connection.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Connection.cs 11 Apr 2003 07:21:41 -0000 1.3 --- Connection.cs 24 Jul 2003 04:32:14 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- using System.Net.Sockets; using System.Text; + using Imap.Commands; using Imap.NetworkManager; *************** *** 9,18 **** /// The various states an ImapConnection can be in /// </summary> public enum ImapConnectionState : byte { ! NotAuthenticated, /// user is not authenticated, generally right after a connect ! Authenticated, /// user is authenticated, but no mailboxes are selected ! Selected, /// user has selected an active mailbox ! Logout /// not much of a state, but eh } --- 10,19 ---- /// The various states an ImapConnection can be in /// </summary> + [Flags()] public enum ImapConnectionState : byte { ! NotAuthenticated = 1, /// user is not authenticated, generally right after a connect ! Authenticated = 2, /// user is authenticated, but no mailboxes are selected ! Selected = 4 /// user has selected an active mailbox } *************** *** 22,27 **** public class ImapConnection { ! private Connection mConnection; ! private ImapConnectionState mState; public ImapConnectionState State --- 23,33 ---- public class ImapConnection { ! private Connection mConnection; // the underlying network connection ! private ImapConnectionState mState; // the state of this connection ! private ImapServer mServer; // what server we belong to ! ! private string mCurrentTag; // the current tag sent in the most recent command ! private ImapCommand mCurrentCommand; // the current command being processed ! private string mCurrentArguments; // the un-parsed arguments for the currently processing command public ImapConnectionState State *************** *** 45,56 **** } /// <summary> /// Creates a new ImapConnection object, starts in NotAuthenticated state /// </summary> /// <param name="client">The network connection for this</param> ! public ImapConnection(Connection con) { mConnection = con; mState = ImapConnectionState.NotAuthenticated; } } --- 51,186 ---- } + public ImapServer Server + { + get + { + return mServer; + } + } + /// <summary> /// Creates a new ImapConnection object, starts in NotAuthenticated state /// </summary> /// <param name="client">The network connection for this</param> ! public ImapConnection(ImapServer svr, Connection con) { + mServer = svr; mConnection = con; mState = ImapConnectionState.NotAuthenticated; + + mConnection.ReceivedLineEvent += new ReceivedLineDelegate(Connection_ReceivedLine); + mConnection.SentDataEvent += new SentDataDelegate(Connection_SentData); + + ReadCommand(); + } + + public void SendTaggedMessage(string msg) + { + SendTaggedMessage(mCurrentTag, msg); + } + public void SendTaggedMessage(string tag, string msg) + { + SendMessage(tag + " " + msg); + } + + public void SendUntaggedMessage(string msg) + { + SendMessage("* " + msg); + } + + public void SendContinueMessage(string msg) + { + SendMessage("+ " + msg); + } + + private void SendMessage(string msg) + { + mConnection.WriteLine(msg); + } + + public void ReadCommand() + { + mCurrentTag = string.Empty; + mCurrentArguments = string.Empty; + mCurrentCommand = null; + + mConnection.ReadLine(); + } + + private bool ParseAndValidate(string line) + { + // parse and validate tag + int idxTagEnd = line.IndexOf(' '); + if(idxTagEnd == -1) // this would mean that there isn't a space, just call it a missing tag + { + SendUntaggedMessage("BAD"); // missing tag + return false; + } + + mCurrentTag = line.Substring(0, idxTagEnd); + if(!CommandPart.ValidateTagCharacters(mCurrentTag)) // uh oh, bad client, bad client, no supper for you + { + SendTaggedMessage("BAD"); // tag contains invalid characters + return false; + } + + // parse and validate command + string cmd; + + int idxCommandEnd = line.IndexOf(' ', idxTagEnd+1); + if(idxCommandEnd == -1) // nothing after the command + { + cmd = line.Substring(idxTagEnd+1).ToUpper(); // one space past the tag til the end + mCurrentArguments = string.Empty; // no arguments + } + else + { + cmd = line.Substring(idxTagEnd+1, idxCommandEnd-idxTagEnd-1).ToUpper(); // one space past tag til the next space + mCurrentArguments = line.Substring(idxCommandEnd); // args will include the preceding space + } + + mCurrentCommand = (ImapCommand)Server.Commands[cmd]; + if(mCurrentCommand == null) + { + SendTaggedMessage("BAD"); // command not found + return false; + } + + mCurrentCommand.Initialize(mCurrentArguments, this); + + if(!mCurrentCommand.ValidateState()) + { + SendTaggedMessage("BAD state"); // cannot run this command in this state + return false; + } + + return true; + } + + private void Connection_ReceivedLine(Connection cnn, string line) + { + // this shouldn't ever be a problem, but what the heck, clock cycles are cheap ;) + if(cnn != mConnection) + throw new Exception("Fucked up, this is just fucked up!"); + + // this command will parse through the incoming line and make sure it's valid + if(ParseAndValidate(line)) + { + // good, leave the rest of the work up to the actual command handler + mCurrentCommand.Process(); + } + else + { + // move on + ReadCommand(); + } + } + + private void Connection_SentData(Connection con) + { + } + + public void Close() + { } } Index: Imap.csproj =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Imap.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Imap.csproj 11 Apr 2003 07:21:42 -0000 1.4 --- Imap.csproj 24 Jul 2003 04:32:14 -0000 1.5 *************** *** 2,7 **** <CSHARP ProjectType = "Local" ! ProductVersion = "7.0.9466" ! SchemaVersion = "1.0" ProjectGuid = "{B1B51646-3745-489A-B0A8-630013E5E44E}" > --- 2,7 ---- <CSHARP ProjectType = "Local" ! ProductVersion = "7.10.3077" ! SchemaVersion = "2.0" ProjectGuid = "{B1B51646-3745-489A-B0A8-630013E5E44E}" > *************** *** 17,21 **** --- 17,24 ---- DelaySign = "false" OutputType = "Library" + PreBuildEvent = "" + PostBuildEvent = "" RootNamespace = "Imap" + RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > *************** *** 31,34 **** --- 34,39 ---- FileAlignment = "4096" IncrementalBuild = "true" + NoStdLib = "false" + NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" *************** *** 49,52 **** --- 54,59 ---- FileAlignment = "4096" IncrementalBuild = "false" + NoStdLib = "false" + NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" *************** *** 72,75 **** --- 79,87 ---- AssemblyName = "System.Xml" HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" + /> + <Reference + Name = "Common" + Project = "{19D49838-BF7A-4432-9C84-F50AE399077B}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> </References> Index: Server.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Imap/Server.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Server.cs 11 Apr 2003 07:21:42 -0000 1.4 --- Server.cs 24 Jul 2003 04:32:14 -0000 1.5 *************** *** 3,107 **** using Imap.NetworkManager; using System.Collections; ! //using System.IO; //using System.Net.Sockets; //using System.Text; namespace Imap { ! public class Server { private NetworkManager.NetworkManager mNetwork; private Hashtable mImapConnections = new Hashtable(); private Hashtable mImapCommands = new Hashtable(); ! public Server() { mNetwork = new NetworkManager.NetworkManager(); mImapConnections = new Hashtable(); #region Register handlers ! mImapCommands.Add("APPEND", new AppendCommand()); ! mImapCommands.Add("AUTHENTICATE", new AuthenticateCommand()); ! mImapCommands.Add("CAPABILITY", new CapabilityCommand()); ! mImapCommands.Add("CHECK", new CheckCommand()); ! mImapCommands.Add("CLOSE", new CloseCommand()); ! mImapCommands.Add("COPY", new CopyCommand()); ! mImapCommands.Add("CREATE", new CreateCommand()); ! mImapCommands.Add("DELETE", new DeleteCommand()); ! mImapCommands.Add("EXAMINE", new ExamineCommand()); ! mImapCommands.Add("EXPUNGE", new ExpungeCommand()); ! mImapCommands.Add("FETCH", new FetchCommand()); ! mImapCommands.Add("LIST", new ListCommand()); ! mImapCommands.Add("LOGIN", new LoginCommand()); ! mImapCommands.Add("LOGOUT", new LogoutCommand()); ! mImapCommands.Add("LSUB", new LsubCommand()); ! mImapCommands.Add("NOOP", new NoopCommand()); ! mImapCommands.Add("RENAME", new RenameCommand()); ! mImapCommands.Add("SEARCH", new SearchCommand()); ! mImapCommands.Add("SELECT", new SelectCommand()); ! mImapCommands.Add("STARTTLS", new StarttlsCommand()); ! mImapCommands.Add("STATUS", new StatusCommand()); ! mImapCommands.Add("STORE", new StoreCommand()); ! mImapCommands.Add("SUBSCRIBE", new SubscribeCommand()); ! mImapCommands.Add("UID", new UidCommand()); ! mImapCommands.Add("UNSUBSCRIBE", new UnsubscribeCommand()); #endregion } ! public void Start() { ! Listener li = mNetwork.StartListener(143); // TODO: global configuration ! li.AcceptedConnection += new AcceptDelegate(NewConnectionHandler); } ! private void SendWelcomeMessage(Connection con) { ! con.WriteLine("* OK domain.tld IMAP4rev1 csmaild dev ready"); ! System.Console.WriteLine(con + " S: * OK domain.tld IMAP4rev1 csmaild.dev ready"); } ! private void NewConnectionHandler(Connection con) { ! mImapConnections.Add(con, new ImapConnection(con)); ! ! con.ConnectionClosedEvent += new ConnectionClosedDelegate(Connection_Closed); ! con.ReceivedLineEvent += new ReceivedLineDelegate(Connection_ReceivedLine); ! con.ReceivedBlockEvent += new ReceivedBlockDelegate(Connection_ReceivedBlock); ! con.SentDataEvent += new SentDataDelegate(Connection_SentData); ! ! SendWelcomeMessage(con); ! ! con.ReadLine(); } ! private void Connection_ReceivedLine(Connection con, string line) { ! System.Console.WriteLine(con + " C: " + line); ! ! line += " "; // to alleviate invalid input parsing ! ! int idxTag = line.IndexOf(' '); ! int idxCommand = line.IndexOf(' ', idxTag+1); ! ! string tag = line.Substring(0, idxTag); ! string cmd = line.Substring(idxTag+1, idxCommand-idxTag-1); ! string args = line.Substring(idxCommand+1); ! ! ImapCommand command = (ImapCommand)mImapCommands[cmd]; ! if(command != null) ! command.Process((ImapConnection)mImapConnections[con], tag); ! else ! ((ImapConnection)mImapConnections[con]).Connection.WriteLine(tag + " BAD"); ! ! con.ReadLine(); } ! private void Connection_ReceivedBlock(Connection con, byte[] block) { ! System.Console.WriteLine(con + " C: " + block); ! } ! private void Connection_SentData(Connection con) ! { } --- 3,97 ---- using Imap.NetworkManager; using System.Collections; ! using System.IO; ! //using System.Net.Sockets; //using System.Text; + using Common.MailstoreProviders; + namespace Imap { ! public class ImapServer { private NetworkManager.NetworkManager mNetwork; private Hashtable mImapConnections = new Hashtable(); private Hashtable mImapCommands = new Hashtable(); + private IMailstoreProvider mMailstoreProvider; ! public ImapServer(IMailstoreProvider provider) { mNetwork = new NetworkManager.NetworkManager(); mImapConnections = new Hashtable(); + mMailstoreProvider = provider; + #region Register handlers ! mImapCommands.Add("APPEND", new AppendCommand(this)); ! mImapCommands.Add("AUTHENTICATE", new AuthenticateCommand(this)); ! mImapCommands.Add("CAPABILITY", new CapabilityCommand(this)); ! mImapCommands.Add("CHECK", new CheckCommand(this)); ! mImapCommands.Add("CLOSE", new CloseCommand(this)); ! mImapCommands.Add("COPY", new CopyCommand(this)); ! mImapCommands.Add("CREATE", new CreateCommand(this)); ! mImapCommands.Add("DELETE", new DeleteCommand(this)); ! mImapCommands.Add("EXAMINE", new ExamineCommand(this)); ! mImapCommands.Add("EXPUNGE", new ExpungeCommand(this)); ! mImapCommands.Add("FETCH", new FetchCommand(this)); ! mImapCommands.Add("LIST", new ListCommand(this)); ! mImapCommands.Add("LOGIN", new LoginCommand(this)); ! mImapCommands.Add("LOGOUT", new LogoutCommand(this)); ! mImapCommands.Add("LSUB", new LsubCommand(this)); ! mImapCommands.Add("NOOP", new NoopCommand(this)); ! mImapCommands.Add("RENAME", new RenameCommand(this)); ! mImapCommands.Add("SEARCH", new SearchCommand(this)); ! mImapCommands.Add("SELECT", new SelectCommand(this)); ! mImapCommands.Add("STARTTLS", new StarttlsCommand(this)); ! mImapCommands.Add("STATUS", new StatusCommand(this)); ! mImapCommands.Add("STORE", new StoreCommand(this)); ! mImapCommands.Add("SUBSCRIBE", new SubscribeCommand(this)); ! mImapCommands.Add("UID", new UidCommand(this)); ! mImapCommands.Add("UNSUBSCRIBE", new UnsubscribeCommand(this)); #endregion } ! public string[] Capabilities { ! get ! { ! return new string[]{"IMAP4rev1", "STARTTLS", "LOGINDISABLED", "AUTH=PLAIN"}; ! } } ! public IMailstoreProvider MailstoreProvider { ! get ! { ! return mMailstoreProvider; ! } } ! public Hashtable Commands { ! get ! { ! return mImapCommands; ! } } ! public void Start() { ! Listener li = mNetwork.StartListener(143); // TODO: global configuration ! li.AcceptedConnection += new AcceptDelegate(NewConnectionHandler); } ! private void NewConnectionHandler(Connection con) { ! con.ConnectionClosedEvent += new ConnectionClosedDelegate(Connection_Closed); ! ImapConnection cnn = new ImapConnection(this, con); ! cnn.SendUntaggedMessage("OK domain.tld IMAP4rev1 csmaild dev ready"); ! ! mImapConnections.Add(con, cnn); ! } *************** *** 109,113 **** { mImapConnections.Remove(con); ! System.Console.WriteLine(con + " Closed"); } --- 99,103 ---- { mImapConnections.Remove(con); ! System.Diagnostics.Trace.WriteLine(con + " Closed"); } |