csmaild-cvs Mailing List for C# Mail Server (Page 3)
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-30 22:45:52
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv17862/src/Imap/Commands
Modified Files:
StatusCommand.cs
Log Message:
STATUS command should be completed now
Index: StatusCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StatusCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** StatusCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
--- StatusCommand.cs 30 Jul 2003 22:45:50 -0000 1.6
***************
*** 1,3 ****
--- 1,6 ----
+ using Common;
+
using System;
+ using System.Text;
namespace Imap.Commands
***************
*** 8,18 ****
public class StatusCommand : ImapCommand
{
! public StatusCommand(ImapServer svr) : base(svr, "STATUS", ImapCommand.AuthSelectedState)
{
}
override protected void InternalProcess()
{
! //return false;
}
}
--- 11,68 ----
public class StatusCommand : ImapCommand
{
! public StatusCommand(ImapServer svr) : base(svr, "STATUS", ImapCommand.AuthSelectedState, ArgumentType.AString, ArgumentType.ParenthesizedList)
{
}
+ //status-att = "MESSAGES" / "RECENT" / "UIDNEXT" / "UIDVALIDITY" / "UNSEEN"
+
override protected void InternalProcess()
{
! string boxName = mParsedArguments[0] as String;
! ParenthesizedList list = mParsedArguments[1] as ParenthesizedList;
!
! Mailbox box = mConnection.User.Mailboxes.FindMailbox(boxName);
! if(box == null)
! mConnection.SendTaggedMessage("NO Does not exist");
! else
! {
! ParenthesizedList output = new ParenthesizedList();
!
! int idx = 0;
! for(; idx < list.Count; ++idx)
! {
! ParenthesizedList.ParenthesizedListItem item = list[idx];
! if(item.IsNestedList)
! {
! mConnection.SendTaggedMessage("BAD Invalid request");
! return;
! }
! output.AddItem(item.DataItem);
! switch((item.DataItem as string).ToUpper())
! {
! case "MESSAGES":
! output.AddItem(box.MessageCount);
! break;
! case "RECENT":
! output.AddItem(box.MessageRecentCount);
! break;
! case "UIDNEXT":
! output.AddItem(box.NextUniqueId);
! break;
! case "UIDVALIDITY":
! output.AddItem(box.UniqueIdValidity);
! break;
! case "UNSEEN":
! output.AddItem(box.MessageUnseenCount);
! break;
! default:
! mConnection.SendTaggedMessage("BAD Invalid request");
! return;
! }
! }
!
! mConnection.SendUntaggedMessage(string.Format("STATUS {0} {1}", box.FullName, output.ToString()));
! mConnection.SendTaggedMessage("OK");
! }
}
}
|
|
From: <ta...@us...> - 2003-07-30 22:44:46
|
Update of /cvsroot/csmaild/csmaild/src/Common/NetworkManager In directory sc8-pr-cvs1:/tmp/cvs-serv17123/src/Common/NetworkManager Added Files: Connection.cs Listener.cs NetworkManager.cs Log Message: Never actually moved these, I deleted them from Imap, but never cvs added them to Common, oops --- NEW FILE: Connection.cs --- using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; using System.Text; namespace Imap.NetworkManager { public delegate void ReceivedLineDelegate(Connection con, string line); public delegate void ConnectionClosedDelegate(Connection con); /// <summary> /// Represents a single client connection /// </summary> public class Connection { #region Variables private Socket mClient; // the communication socket private NetworkStream mSocketStream; // a stream wrapping the communication socket private byte[] mReceiveBuffer; // a small storage place for receiving bytes for the line private StringBuilder mReceivedString; // used to store the line that we have received private Listener mListener; // the listener that created us #endregion #region Events private event ReceivedLineDelegate mReceivedLineEvent; private event ConnectionClosedDelegate mConnectionClosedEvent; /// <summary> /// Fires when the asynchronously requested line has been received from the client /// </summary> public event ReceivedLineDelegate ReceivedLineEvent { add { mReceivedLineEvent += value; } remove { mReceivedLineEvent -= value; } } /// <summary> /// Fires when the connection is closed remotely /// </summary> public event ConnectionClosedDelegate ConnectionClosedEvent { add { mConnectionClosedEvent += value; } remove { mConnectionClosedEvent -= value; } } #endregion #region Constructor /// <summary> /// Creates a new Connection object /// </summary> /// <param name="client">The Socket for this Connection</param> /// <param name="listener">The Listener that created us</param> internal Connection(Socket client, Listener listener) { mClient = client; mListener = listener; mSocketStream = new NetworkStream(mClient, true); mReceiveBuffer = new byte[8192]; mReceivedString = new StringBuilder(1024); // so the initial few growings don't have to happen } #endregion #region Public methods /// <summary> /// Writes the message to the socket /// </summary> /// <param name="msg">The message to write</param> public void Write(string msg) { if(mClient.Connected) { byte[] b = Encoding.ASCII.GetBytes(msg); mSocketStream.Write(b, 0, b.Length); } } /// <summary> /// Writes the message to the socket /// </summary> /// <param name="msg">The message to write (it will be suffixed with a CRLF)</param> public void WriteLine(string msg) { System.Diagnostics.Trace.WriteLine(ToString() + " <- " + msg); Write(msg + "\r\n"); } /// <summary> /// Reads a line from the socket asynchronously /// </summary> public void BeginReadLine() { if(mClient.Connected) mSocketStream.BeginRead(mReceiveBuffer, 0, mReceiveBuffer.Length, new AsyncCallback(ReceiveLineCallback), null); } public string ReadLine() { while(true) { // we may have enough information for a line from the last read string currentData = mReceivedString.ToString(); // TODO: this happening everytime could be a performance hit int idx = currentData.IndexOf("\r\n"); // yay, found the line if(idx != -1) { // we quite possibly got too much data for this line // get the line, leave the rest in the string builder string line = currentData.Substring(0, idx); mReceivedString.Remove(0, idx+2); // remove the line and the \r\n return line; } else // read more { int read = mSocketStream.Read(mReceiveBuffer, 0, mReceiveBuffer.Length); if(read == 0) // connection was closed { OnClosed(); return null; } else { string incoming = Encoding.ASCII.GetString(mReceiveBuffer, 0, read); mReceivedString.Append(incoming); } } } } /// <summary> /// Reads a block from the socket /// </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) { int read = 0; if(mReceivedString.Length > 0) { // TODO: this could probably be made slightly more efficient byte[] currentData = System.Text.Encoding.ASCII.GetBytes(mReceivedString.ToString()); int toCopy = Math.Min(length, currentData.Length); // get the number of bytes we'll need mReceivedString.Remove(0, toCopy); Array.Copy(currentData, 0, block, offset, toCopy); read += toCopy; } while(read != length) { int readThisTime = mSocketStream.Read(block, offset+read, length-read); if(readThisTime == 0) // connection was closed { OnClosed(); return; } else read += readThisTime; } } #endregion #region Protected methods protected void OnReadLine(string line) { if(mReceivedLineEvent != null) mReceivedLineEvent(this, line); } /// <summary> /// Fires when the socket is closed /// </summary> protected virtual void OnClosed() { mClient.Close(); mSocketStream.Close(); if(mConnectionClosedEvent != null) mConnectionClosedEvent(this); } #endregion #region Private methods private void ReceiveLineCallback(IAsyncResult result) { int read = mSocketStream.EndRead(result); if(read == 0) // connection was closed { // spill event OnClosed(); } else { // if we're reading a line string incoming = Encoding.ASCII.GetString(mReceiveBuffer, 0, read); mReceivedString.Append(incoming); // we're reading a line and we found the end of the line!! string currentData = mReceivedString.ToString(); // TODO: this happening everytime could be a performance hit int idx = currentData.IndexOf("\r\n"); if(idx != -1) { // we quite possibly got too much data for this line // get the line, leave the rest in the string builder string line = currentData.Substring(0, idx); mReceivedString.Remove(0, idx+2); // remove the line and the \r\n if(line != string.Empty) System.Diagnostics.Trace.WriteLine(ToString() + " -> " + (string)line); // spill event OnReadLine(line); } else // read more BeginReadLine(); } } #endregion #region Overridden methods public override string ToString() { return mClient.RemoteEndPoint.ToString(); } #endregion } } --- NEW FILE: Listener.cs --- using System; using System.Net; using System.Net.Sockets; namespace Imap.NetworkManager { public delegate void AcceptDelegate(Connection con); /// <summary> /// Simple event based listener class /// </summary> public class Listener { private Socket mListenSocket; private event AcceptDelegate mAcceptedConnection; public event AcceptDelegate AcceptedConnection { add { mAcceptedConnection += value; } remove { mAcceptedConnection -= value; } } public Listener(int port) { // create a TCP socket on the specified port mListenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); mListenSocket.Bind(new IPEndPoint(IPAddress.Any, port)); // start listening for connections, handle this asynchronously mListenSocket.Listen(10); // TODO: configurable/global backlog mListenSocket.BeginAccept(new AsyncCallback(AcceptCallback), null); } private void AcceptCallback(IAsyncResult result) { if(mListenSocket == null) return; // do the final accpet and wait for another Connection con = new Connection(mListenSocket.EndAccept(result), this); mListenSocket.BeginAccept(new AsyncCallback(AcceptCallback), null); // tell the observers about our new connection if(mAcceptedConnection != null) mAcceptedConnection(con); } } } --- NEW FILE: NetworkManager.cs --- using System; using System.Collections; using System.Net; using System.Text; namespace Imap.NetworkManager { /// <summary> /// A facade for network management related tasks /// </summary> public class NetworkManager { private ArrayList mConnections; private ArrayList mListeners; public NetworkManager() { mConnections = new ArrayList(); mListeners = new ArrayList(); } /// <summary> /// Starts a listening socket on the specified port /// </summary> /// <param name="port">The port to listen on</param> /// <returns>The created listener</returns> public Listener StartListener(int port) { Listener li = new Listener(port); li.AcceptedConnection += new AcceptDelegate(Listener_AcceptedConnection); mListeners.Add(li); return li; } public Connection StartConnection(IPAddress address, int port) { // TODO: implement if the need to start connections arises throw new NotImplementedException("Not yet buD!!!"); } public void Listener_AcceptedConnection(Connection con) { con.ConnectionClosedEvent += new ConnectionClosedDelegate(Connection_Closed); mConnections.Add(con); } public void Connection_Closed(Connection con) { mConnections.Remove(con); } } } |
|
From: <ta...@us...> - 2003-07-30 22:37:59
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv15750/src/Imap/Commands
Modified Files:
ImapCommand.cs
Log Message:
Fixed an issue when the client doesn't send enough data in the argument, returns a BAD now instead of throwing an exception ;)
Index: ImapCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ImapCommand.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ImapCommand.cs 29 Jul 2003 00:46:28 -0000 1.9
--- ImapCommand.cs 30 Jul 2003 22:37:56 -0000 1.10
***************
*** 130,134 ****
for(int idx = 0; idx < mArgumentTypes.Length; ++idx)
{
! if(mUnparsedArguments[mUnparsedArgumentIdx++] != ' ')
return false;
object arg = ParseArgument(mArgumentTypes[idx]);
--- 130,136 ----
for(int idx = 0; idx < mArgumentTypes.Length; ++idx)
{
! if(mUnparsedArgumentIdx >= mUnparsedArguments.Length)
! return false;
! else if(mUnparsedArguments[mUnparsedArgumentIdx++] != ' ')
return false;
object arg = ParseArgument(mArgumentTypes[idx]);
|
|
From: <ta...@us...> - 2003-07-30 22:37:15
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv15627/src/Imap/Commands
Modified Files:
ListCommand.cs
Log Message:
Actually uses the arguments, *should* be completed
Index: ListCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ListCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ListCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
--- ListCommand.cs 30 Jul 2003 22:37:12 -0000 1.6
***************
*** 3,6 ****
--- 3,7 ----
using System;
using System.Text;
+ using System.Text.RegularExpressions;
namespace Imap.Commands
***************
*** 11,14 ****
--- 12,18 ----
public class ListCommand : ImapCommand
{
+ private string mReferenceName;
+ private string mMailboxSearchPattern;
+
public ListCommand(ImapServer svr) : base(svr, "LIST", ImapCommand.AuthSelectedState, ArgumentType.AString, ArgumentType.ListString)
{
***************
*** 17,21 ****
override protected void InternalProcess()
{
! ListBoxes(mConnection.User.Mailboxes);
mConnection.SendTaggedMessage("OK LIST completed");
--- 21,36 ----
override protected void InternalProcess()
{
! mReferenceName = mParsedArguments[0] as string;
! mMailboxSearchPattern = ListSearchToRegex(mReferenceName, mParsedArguments[1] as string);
!
! // if we have a reference name, navigate to it and perform the list from that level
! if(mReferenceName != string.Empty)
! {
! Mailbox box = mConnection.User.Mailboxes.FindMailbox(mReferenceName);
! if(box != null)
! ListBoxes(box.Children);
! }
! else
! ListBoxes(mConnection.User.Mailboxes);
mConnection.SendTaggedMessage("OK LIST completed");
***************
*** 24,35 ****
private void ListBoxes(MailboxCollection boxes)
{
- // TODO: actually handle the arguments
foreach(Mailbox box in boxes)
{
! mConnection.SendUntaggedMessage("LIST " + BuildFlagList(box) + " \"/\" \"" + box.FullName + "\"");
if(box.HasChildren)
ListBoxes(box.Children);
}
}
--- 39,84 ----
private void ListBoxes(MailboxCollection boxes)
{
foreach(Mailbox box in boxes)
{
! if(Regex.IsMatch(box.FullName, mMailboxSearchPattern))
! mConnection.SendUntaggedMessage("LIST " + BuildFlagList(box) + " \"/\" \"" + box.FullName + "\"");
if(box.HasChildren)
ListBoxes(box.Children);
}
+ }
+
+ private string ListSearchToRegex(string reference, string listSearch)
+ {
+ string rv = "^" + mReferenceName;
+ char[] wildCards = CommandPart.ListWildcards.ToCharArray();
+ int lastIdx = 0;
+ while(true)
+ {
+ int idx = listSearch.IndexOfAny(wildCards, lastIdx);
+
+ if(idx == -1)
+ {
+ if(lastIdx < listSearch.Length)
+ rv += Regex.Escape(listSearch.Substring(lastIdx));
+ break;
+ }
+ else
+ {
+ if(idx != lastIdx)
+ rv += Regex.Escape(listSearch.Substring(lastIdx, idx-lastIdx));
+ switch(listSearch[idx])
+ {
+ case '%':
+ rv += "[^/]*";
+ break;
+ case '*':
+ rv += ".*";
+ break;
+ }
+ lastIdx = idx+1;
+ }
+ }
+ return rv + "$";
}
|
|
From: <ta...@us...> - 2003-07-30 22:36:45
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv15527/src/Imap/Commands
Modified Files:
RenameCommand.cs SelectExamineCommand.cs
Log Message:
Modified to use new FindMailbox for a little bit cleaner code
Index: RenameCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/RenameCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RenameCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
--- RenameCommand.cs 30 Jul 2003 22:36:42 -0000 1.6
***************
*** 19,24 ****
string dstName = mParsedArguments[1] as string;
! MailboxCollection srcBoxes = mConnection.User.Mailboxes.FindContainer(srcName, false);
! Mailbox srcBox = srcBoxes[Mailbox.ExtractName(srcName)];
if(srcBox == null)
mConnection.SendTaggedMessage("NO Source does not exist");
--- 19,23 ----
string dstName = mParsedArguments[1] as string;
! Mailbox srcBox = mConnection.User.Mailboxes.FindMailbox(srcName);
if(srcBox == null)
mConnection.SendTaggedMessage("NO Source does not exist");
Index: SelectExamineCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SelectExamineCommand.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SelectExamineCommand.cs 29 Jul 2003 00:46:28 -0000 1.3
--- SelectExamineCommand.cs 30 Jul 2003 22:36:42 -0000 1.4
***************
*** 21,58 ****
string boxFullName = mParsedArguments[0] as string;
! MailboxCollection boxes = mConnection.User.Mailboxes.FindContainer(boxFullName, false);
! if(boxes == null)
mConnection.SendTaggedMessage("NO Does not exist");
else
{
! mConnection.Mailbox = boxes[Mailbox.ExtractName(boxFullName)];
! if(mConnection.Mailbox == null)
! {
! mConnection.State = ImapConnectionState.Authenticated;
! mConnection.SendTaggedMessage("NO Does not exist");
! }
! else
! {
! mConnection.State = ImapConnectionState.Selected;
! Mailbox box = mConnection.Mailbox;
! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)");
! mConnection.SendUntaggedMessage(box.MessageCount.ToString() + " EXISTS");
! mConnection.SendUntaggedMessage(box.MessageRecentCount.ToString() + " RECENT");
! if(box.FirstUnseenMessageSeqNum != 0)
! mConnection.SendUntaggedMessage("OK [UNSEEN " + box.FirstUnseenMessageSeqNum + "]");
! if(mIsSelect)
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft)]");
! else
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS ()]");
! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + box.UniqueIdValidity.ToString() + "]");
! mConnection.SendUntaggedMessage("OK [UIDNEXT " + box.NextUniqueId + "]");
! mConnection.SendTaggedMessage(mIsSelect ? "OK [READ-WRITE]" : "OK [READ-ONLY]");
! }
}
}
--- 21,52 ----
string boxFullName = mParsedArguments[0] as string;
! mConnection.Mailbox = mConnection.User.Mailboxes.FindMailbox(boxFullName);
! if(mConnection.Mailbox == null)
! {
! mConnection.State = ImapConnectionState.Authenticated;
mConnection.SendTaggedMessage("NO Does not exist");
+ }
else
{
! mConnection.State = ImapConnectionState.Selected;
! Mailbox box = mConnection.Mailbox;
! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)");
! mConnection.SendUntaggedMessage(box.MessageCount.ToString() + " EXISTS");
! mConnection.SendUntaggedMessage(box.MessageRecentCount.ToString() + " RECENT");
! if(box.FirstUnseenMessageSeqNum != 0)
! mConnection.SendUntaggedMessage("OK [UNSEEN " + box.FirstUnseenMessageSeqNum + "]");
! if(mIsSelect)
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft)]");
! else
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS ()]");
! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + box.UniqueIdValidity.ToString() + "]");
! mConnection.SendUntaggedMessage("OK [UIDNEXT " + box.NextUniqueId + "]");
! mConnection.SendTaggedMessage(mIsSelect ? "OK [READ-WRITE]" : "OK [READ-ONLY]");
}
}
|
|
From: <ta...@us...> - 2003-07-30 22:33:23
|
Update of /cvsroot/csmaild/csmaild/src/Common
In directory sc8-pr-cvs1:/tmp/cvs-serv14777/src/Common
Modified Files:
MailboxCollection.cs
Log Message:
Added a FindMailbox method
Fixed FindContainer when a mailbox has an ending /
Index: MailboxCollection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailboxCollection.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MailboxCollection.cs 29 Jul 2003 00:46:28 -0000 1.3
--- MailboxCollection.cs 30 Jul 2003 22:33:20 -0000 1.4
***************
*** 68,71 ****
--- 68,85 ----
/// <summary>
+ /// Finds the Mailbox specified by a full hierarchical name
+ /// </summary>
+ /// <param name="fullName">The full name of the Mailbox</param>
+ /// <returns>The Mailbox if found in this hierarchy, null if not</returns>
+ public Mailbox FindMailbox(string fullName)
+ {
+ MailboxCollection boxes = FindContainer(fullName, false);
+ if(boxes == null)
+ return null;
+
+ return boxes[Mailbox.ExtractName(fullName)];
+ }
+
+ /// <summary>
/// Finds the containing MailboxCollection that a specified mailbox would reside in (regardless of it existing)
/// </summary>
***************
*** 92,96 ****
}
string childName = fullName.Substring(idx+1);
! if(childName == "/")
return this;
else
--- 106,110 ----
}
string childName = fullName.Substring(idx+1);
! if(childName == string.Empty)
return this;
else
|
|
From: <ta...@us...> - 2003-07-30 22:32:37
|
Update of /cvsroot/csmaild/csmaild/src/Common
In directory sc8-pr-cvs1:/tmp/cvs-serv14606/src/Common
Modified Files:
Mailbox.cs
Log Message:
Added Unseen count property
Fixed ExtractName to exclude '/' as a last character
Index: Mailbox.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Mailbox.cs 29 Jul 2003 00:46:28 -0000 1.7
--- Mailbox.cs 30 Jul 2003 22:32:34 -0000 1.8
***************
*** 143,146 ****
--- 143,159 ----
}
+ public int MessageUnseenCount
+ {
+ get
+ {
+ // TODO: make this more efficient then having to load all the messages
+ int rv = 0;
+ foreach(Message msg in Messages)
+ if(!msg.Seen)
+ ++rv;
+ return rv;
+ }
+ }
+
public uint FirstUnseenMessageSeqNum
{
***************
*** 231,234 ****
--- 244,249 ----
if(idx == -1)
return fullName;
+ else if(idx == fullName.Length-1)
+ return ExtractName(fullName.Substring(0, fullName.Length-1));
else
return fullName.Substring(idx+1);
|
|
From: <ta...@us...> - 2003-07-29 01:09:31
|
Update of /cvsroot/csmaild/csmaild/src/Pop/Commands In directory sc8-pr-cvs1:/tmp/cvs-serv7519/Commands Log Message: Directory /cvsroot/csmaild/csmaild/src/Pop/Commands added to the repository |
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src
Modified Files:
csmaild.2002.sln csmaild.sln
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: csmaild.2002.sln
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/csmaild.2002.sln,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** csmaild.2002.sln 25 Jul 2003 14:50:30 -0000 1.1
--- csmaild.2002.sln 29 Jul 2003 00:46:29 -0000 1.2
***************
*** 8,11 ****
--- 8,13 ----
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient.2002", "TestClient\TestClient.2002.csproj", "{9B24F657-10EF-4F52-A02B-F0C630ED8037}"
EndProject
+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pop.2002", "Pop\Pop.2002.csproj", "{C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}"
+ EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
***************
*** 32,35 ****
--- 34,41 ----
{9B24F657-10EF-4F52-A02B-F0C630ED8037}.Release.ActiveCfg = Release|.NET
{9B24F657-10EF-4F52-A02B-F0C630ED8037}.Release.Build.0 = Release|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Debug.ActiveCfg = Debug|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Debug.Build.0 = Debug|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Release.ActiveCfg = Release|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Index: csmaild.sln
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/csmaild.sln,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** csmaild.sln 24 Jul 2003 04:32:14 -0000 1.2
--- csmaild.sln 29 Jul 2003 00:46:29 -0000 1.3
***************
*** 16,19 ****
--- 16,23 ----
EndProjectSection
EndProject
+ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pop", "Pop\Pop.csproj", "{C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+ EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
***************
*** 38,41 ****
--- 42,49 ----
{EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Release.ActiveCfg = Release|.NET
{EDAA8235-6FC7-4B9F-AD38-A96A3AF99AFA}.Release.Build.0 = Release|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Debug.ActiveCfg = Debug|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Debug.Build.0 = Debug|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Release.ActiveCfg = Release|.NET
+ {C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src/Pop
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Pop
Added Files:
.cvsignore AssemblyInfo.cs Pop.2002.csproj Pop.csproj
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
--- NEW FILE: .cvsignore ---
*.csproj.user
bin
obj
--- 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: Pop.2002.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.0.9466"
SchemaVersion = "1.0"
ProjectGuid = "{C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Pop"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
RootNamespace = "Pop"
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"
/>
<Folder RelPath = "Commands\" />
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
--- NEW FILE: Pop.csproj ---
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{C33A99C2-62F0-4165-9C9E-DA97B10AB3B3}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Pop"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Pop"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "true"
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.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"
/>
<Folder RelPath = "Commands\" />
</Include>
</Files>
</CSHARP>
</VisualStudioProject>
|
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src/Imap/NetworkManager In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Imap/NetworkManager Removed Files: Connection.cs Listener.cs NetworkManager.cs Log Message: Updated 2002 project files for people using legacy IDE's ;) Added initial POP project, no code, just a project Changes to the mail store to support DELETE, RENAME, CREATE commands Nearly finished with said commands, more testing needed Moved NetworkManager to common, so POP can use it --- Connection.cs DELETED --- --- Listener.cs DELETED --- --- NetworkManager.cs DELETED --- |
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src/Imap
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Imap
Modified Files:
Imap.2002.csproj Imap.csproj
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: Imap.2002.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Imap.2002.csproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Imap.2002.csproj 25 Jul 2003 14:50:31 -0000 1.1
--- Imap.2002.csproj 29 Jul 2003 00:46:29 -0000 1.2
***************
*** 143,151 ****
/>
<File
- RelPath = "Commands\ExamineCommand.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
RelPath = "Commands\ExpungeCommand.cs"
SubType = "Code"
--- 143,146 ----
***************
*** 198,202 ****
/>
<File
! RelPath = "Commands\SelectCommand.cs"
SubType = "Code"
BuildAction = "Compile"
--- 193,197 ----
/>
<File
! RelPath = "Commands\SelectExamineCommand.cs"
SubType = "Code"
BuildAction = "Compile"
***************
*** 229,247 ****
<File
RelPath = "Commands\UnsubscribeCommand.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NetworkManager\Connection.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NetworkManager\Listener.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NetworkManager\NetworkManager.cs"
SubType = "Code"
BuildAction = "Compile"
--- 224,227 ----
Index: Imap.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Imap.csproj,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Imap.csproj 27 Jul 2003 17:26:22 -0000 1.6
--- Imap.csproj 29 Jul 2003 00:46:29 -0000 1.7
***************
*** 234,252 ****
BuildAction = "Compile"
/>
- <File
- RelPath = "NetworkManager\Connection.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NetworkManager\Listener.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
- RelPath = "NetworkManager\NetworkManager.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
</Include>
</Files>
--- 234,237 ----
|
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src/TestClient
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/TestClient
Modified Files:
Main.cs Main.resx
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: Main.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/TestClient/Main.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Main.cs 26 Jul 2003 23:09:25 -0000 1.4
--- Main.cs 29 Jul 2003 00:46:29 -0000 1.5
***************
*** 16,19 ****
--- 16,20 ----
ClientHelper mHelper;
int mCounter = 0;
+ ArrayList mResponseCounts = new ArrayList();
private System.Windows.Forms.Button cmdLocalhost;
***************
*** 111,114 ****
--- 112,116 ----
this.lstCommunicationLog.Location = new System.Drawing.Point(8, 40);
this.lstCommunicationLog.Name = "lstCommunicationLog";
+ this.lstCommunicationLog.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.lstCommunicationLog.Size = new System.Drawing.Size(600, 432);
this.lstCommunicationLog.TabIndex = 3;
***************
*** 194,198 ****
//
this.lstCommandsToProcess.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.lstCommandsToProcess.CheckOnClick = true;
this.lstCommandsToProcess.Font = new System.Drawing.Font("Verdana", 8.25F);
this.lstCommandsToProcess.Location = new System.Drawing.Point(616, 40);
--- 196,199 ----
***************
*** 208,211 ****
--- 209,213 ----
this.Controls.Add(this.lstCommandsToProcess);
this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtAddCommands);
this.Controls.Add(this.numPause);
this.Controls.Add(this.cmdDelete);
***************
*** 213,217 ****
this.Controls.Add(this.cmdMoveUp);
this.Controls.Add(this.cmdAdd);
- this.Controls.Add(this.txtAddCommands);
this.Controls.Add(this.lstCommunicationLog);
this.Controls.Add(this.cmdChegg);
--- 215,218 ----
***************
*** 232,235 ****
--- 233,238 ----
lstCommunicationLog.SelectedIndex = lstCommunicationLog.Items.Count-1;
+ mResponseCounts[mResponseCounts.Count-1] = (int)mResponseCounts[mResponseCounts.Count-1]+1;
+
Application.DoEvents();
}
***************
*** 242,245 ****
--- 245,249 ----
lstCommunicationLog.Items.Add(mCounter++.ToString().PadLeft(4, ' ') + " <- " + line);
lstCommunicationLog.SelectedIndex = lstCommunicationLog.Items.Count-1;
+ mResponseCounts[mResponseCounts.Count-1] = (int)mResponseCounts[mResponseCounts.Count-1]+1;
}
Application.DoEvents();
***************
*** 277,280 ****
--- 281,287 ----
lstCommunicationLog.Items.Clear();
+ mResponseCounts.Clear();
+ mResponseCounts.Add(0);
+
cmdAdd.Enabled = false;
cmdDelete.Enabled = false;
***************
*** 287,298 ****
ReadLine(); // read welcome msg
! for(int idx = 0; idx < lstCommandsToProcess.Items.Count; ++idx)
{
! if(lstCommandsToProcess.CheckedIndices.IndexOf(idx) != -1)
! {
! lstCommandsToProcess.SelectedIndex = idx;
! SendReceiveCommand(lstCommandsToProcess.SelectedItem as string);
! System.Threading.Thread.Sleep((int)numPause.Value * 100);
! }
}
--- 294,303 ----
ReadLine(); // read welcome msg
! for(int idx = 0; idx < lstCommandsToProcess.CheckedIndices.Count; ++idx)
{
! mResponseCounts.Add(0);
! lstCommandsToProcess.SelectedIndex = lstCommandsToProcess.CheckedIndices[idx];
! SendReceiveCommand(lstCommandsToProcess.SelectedItem as string);
! System.Threading.Thread.Sleep((int)numPause.Value * 100);
}
***************
*** 350,353 ****
--- 355,370 ----
else
{
+ lstCommunicationLog.SelectedIndex = -1;
+ int idx = lstCommandsToProcess.CheckedIndices.IndexOf(lstCommandsToProcess.SelectedIndex);
+ if(mResponseCounts.Count >= idx+2)
+ {
+ int pos = 0;
+ for(int iidx = idx; iidx >= 0; --iidx)
+ pos += (int)mResponseCounts[iidx];
+ int cnt = (int)mResponseCounts[idx+1]-1;
+ for(; cnt >= 0; --cnt)
+ if(pos+cnt < lstCommunicationLog.Items.Count)
+ lstCommunicationLog.SetSelected(pos+cnt, true);
+ }
cmdMoveUp.Enabled = (lstCommandsToProcess.SelectedIndex != 0);
cmdMoveDown.Enabled = (lstCommandsToProcess.SelectedIndex != lstCommandsToProcess.Items.Count-1);
Index: Main.resx
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/TestClient/Main.resx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Main.resx 26 Jul 2003 23:09:25 -0000 1.4
--- Main.resx 29 Jul 2003 00:46:29 -0000 1.5
***************
*** 215,218 ****
--- 215,221 ----
<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">
<value>80</value>
***************
*** 220,226 ****
<data name="$this.SnapToGrid" 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.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
--- 223,226 ----
|
|
From: <ta...@us...> - 2003-07-29 00:46:33
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Common/MailstoreProviders
Modified Files:
IMailstoreProvider.cs XmlMailstoreProvider.cs
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: IMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/IMailstoreProvider.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** IMailstoreProvider.cs 28 Jul 2003 00:15:17 -0000 1.5
--- IMailstoreProvider.cs 29 Jul 2003 00:46:28 -0000 1.6
***************
*** 20,24 ****
#region Mailbox stuff
! #region Mailbox accessors
/// <summary>
/// Gets the mailbox with the specified absolute path for a particular user
--- 20,24 ----
#region Mailbox stuff
! #region Mailbox functions
/// <summary>
/// Gets the mailbox with the specified absolute path for a particular user
***************
*** 30,51 ****
/// <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>
MailboxCollection GetMailboxes(User user);
/// <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);
! #endregion
! #region Mailbox insert
! bool InsertMailbox(User user, Mailbox mbx);
! #endregion
- #region Mailbox delete
/// <summary>
/// Permanently deletes the mailbox
--- 30,59 ----
/// <summary>
! /// Gets all the mailboxes that are in the mail store for a particular user at the root
/// </summary>
! /// <returns>A collection of mailboxes</returns>
MailboxCollection GetMailboxes(User user);
/// <summary>
! /// Gets the mailboxes that are immediate children of a mailbox
/// </summary>
/// <param name="parent">The parent mailbox to gather children for</param>
! /// <returns>A collection of mailboxes</returns>
! MailboxCollection GetMailboxes(Mailbox parent);
! /// <summary>
! /// Saves the mailbox to the data store
! /// </summary>
! /// <param name="box">The mailbox to save</param>
! void SaveMailbox(Mailbox box);
!
! /// <summary>
! /// Inserts a mailbox for a particular user
! /// </summary>
! /// <param name="user"></param>
! /// <param name="box"></param>
! /// <returns></returns>
! bool InsertMailbox(User user, Mailbox box);
/// <summary>
/// Permanently deletes the mailbox
***************
*** 73,77 ****
/// <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);
#endregion
--- 81,85 ----
/// <param name="box">The mailbox to gather messages for</param>
/// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns>
! MessageCollection GetMessages(Mailbox box);
#endregion
Index: XmlMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** XmlMailstoreProvider.cs 28 Jul 2003 00:15:17 -0000 1.6
--- XmlMailstoreProvider.cs 29 Jul 2003 00:46:28 -0000 1.7
***************
*** 15,18 ****
--- 15,22 ----
private DataTable mUsers;
+ private uint mNextMessageId;
+ private uint mNextMailboxId;
+ private uint mNextUserId;
+
public XmlMailstoreProvider(string folderPath)
{
***************
*** 25,28 ****
--- 29,36 ----
mMessages = mMessageSet.Tables[0];
+ mNextMessageId = (uint)DateTime.Now.Ticks;
+ mNextMailboxId = (uint)DateTime.Now.Ticks;
+ mNextUserId = (uint)DateTime.Now.Ticks;
+
mMailboxSet.ReadXml(mFolderPath + "Mailboxes.xml");
mMailboxes = mMailboxSet.Tables[0];
***************
*** 42,46 ****
DataRow user = users[0];
if((user["Password"] as string) == password)
! return new User(this, username, password);
else
return null;
--- 50,54 ----
DataRow user = users[0];
if((user["Password"] as string) == password)
! return new User(this, user["Id"], user["Username"] as string, user["Password"] as string);
else
return null;
***************
*** 59,97 ****
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);
}
public MailboxCollection GetMailboxes(User user)
{
! DataRow[] rows = mMailboxes.Select("UserIdentifier = '" + user.Username + "'");
! MailboxCollection mbxCollection = new MailboxCollection(this, user);
for(int idx = 0; idx < rows.Length; ++idx)
{
DataRow box = rows[idx];
! mbxCollection.Add(new Mailbox(this, box["Name"] as string, box["FullName"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user));
}
! return mbxCollection;
}
! public Mailbox[] GetMailboxes(Mailbox parent)
{
! return null;
}
#endregion
#region Mailbox insert
! public bool InsertMailbox(User user, Mailbox mbx)
{
! DataRow newMbx = mMailboxes.NewRow();
! newMbx["UserIdentifier"] = user.Username;
! newMbx["Name"] = mbx.Name;
! newMbx["FullName"] = mbx.Name;
! newMbx["NextUniqueId"] = mbx.NextUniqueId;
! newMbx["UniqueIdValidity"] = mbx.UniqueIdValidity;
! mMailboxes.Rows.Add(newMbx);
Save(false, true, false);
--- 67,148 ----
DataRow box = boxes[0];
! return new Mailbox(this, box["Id"], box["Name"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user, bool.Parse(box["NoSelect"] as string), bool.Parse(box["NoInferiors"] as string), bool.Parse(box["Marked"] as string), bool.Parse(box["Unmarked"] as string));
}
public MailboxCollection GetMailboxes(User user)
{
! return GetMailboxes(user, null);
! }
!
! public MailboxCollection GetMailboxes(Mailbox parent)
! {
! return GetMailboxes(parent.User, parent);
! }
!
! private MailboxCollection GetMailboxes(User user, Mailbox parent)
! {
! DataRow[] rows = mMailboxes.Select("ParentId = '" + (parent == null ? "0" : parent.ProvidersIdentifier) + "' AND UserId = '" + user.ProvidersIdentifier + "'");
! MailboxCollection boxes = new MailboxCollection(this, user, parent);
for(int idx = 0; idx < rows.Length; ++idx)
{
DataRow box = rows[idx];
! boxes.Add(new Mailbox(this, box["Id"], box["Name"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user, bool.Parse(box["NoSelect"] as string), bool.Parse(box["NoInferiors"] as string), bool.Parse(box["Marked"] as string), bool.Parse(box["Unmarked"] as string)));
}
! return boxes;
}
+ #endregion
! #region Mailbox update
! public void SaveMailbox(Mailbox box)
{
! DataRow[] rows = mMailboxes.Select("Id = '" + box.ProvidersIdentifier + "' AND UserId = '" + box.User.ProvidersIdentifier + "'");
!
! if(rows.Length == 1)
! {
! DataRow row = rows[0];
! if(box.Parent != null)
! row["ParentId"] = box.Parent.ProvidersIdentifier;
! else
! row["ParentId"] = "0";
!
! row["Name"] = box.Name;
! row["NextUniqueId"] = box.NextUniqueId;
! row["UniqueIdValidity"] = box.UniqueIdValidity;
! row["NoSelect"] = box.NoSelect;
! row["NoInferiors"] = box.NoInferiors;
! row["Marked"] = box.Marked;
! row["Unmarked"] = box.Unmarked;
! }
}
#endregion
#region Mailbox insert
! public bool InsertMailbox(User user, Mailbox box)
{
! DataRow newBox = mMailboxes.NewRow();
! box.ProvidersIdentifier = mNextMailboxId++;
! // set provider specific unique id
! newBox["Id"] = box.ProvidersIdentifier;
!
! newBox["UserId"] = box.User.ProvidersIdentifier;
!
! if(box.Parent != null)
! newBox["ParentId"] = box.Parent.ProvidersIdentifier;
! else
! newBox["ParentId"] = "0";
!
! newBox["Name"] = box.Name;
! newBox["NextUniqueId"] = box.NextUniqueId;
! newBox["UniqueIdValidity"] = box.UniqueIdValidity;
! newBox["NoSelect"] = box.NoSelect;
! newBox["NoInferiors"] = box.NoInferiors;
! newBox["Marked"] = box.Marked;
! newBox["Unmarked"] = box.Unmarked;
!
! mMailboxes.Rows.Add(newBox);
Save(false, true, false);
***************
*** 103,109 ****
public void DeleteMailbox(Mailbox box)
{
! DataRow[] boxes = mMailboxes.Select("FullName = '" + box.Name + "' AND UserIdentifier = '" + box.User.Username + "'");
! boxes[0].Delete();
! Save(false, true, false);
}
#endregion
--- 154,163 ----
public void DeleteMailbox(Mailbox box)
{
! DataRow[] boxes = mMailboxes.Select("Id = '" + box.ProvidersIdentifier + "' AND UserId = '" + box.User.ProvidersIdentifier + "'");
! if(boxes.Length == 1)
! {
! boxes[0].Delete();
! Save(false, true, false);
! }
}
#endregion
***************
*** 119,131 ****
}
! public Message[] GetMessages(Mailbox box)
{
! DataRow[] messages = mMessages.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, 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()));
}
--- 173,185 ----
}
! public MessageCollection GetMessages(Mailbox box)
{
! DataRow[] messages = mMessages.Select("MailboxId = '" + box.ProvidersIdentifier + "'");
! MessageCollection msgs = new MessageCollection(this, box);
for(int idx = 0; idx < messages.Length; ++idx)
{
DataRow message = messages[idx];
! msgs.Add(new Message(this, message["Id"], 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())));
}
***************
*** 137,141 ****
public void DeleteMessages(Mailbox box)
{
! DataRow[] messages = mMessages.Select("MailboxIdentifier = '" + box.Name + "'");
foreach(DataRow msg in messages)
msg.Delete();
--- 191,195 ----
public void DeleteMessages(Mailbox box)
{
! DataRow[] messages = mMessages.Select("Id = '" + box.ProvidersIdentifier + "'");
foreach(DataRow msg in messages)
msg.Delete();
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Imap/Commands
Modified Files:
AppendCommand.cs AuthenticateCommand.cs CapabilityCommand.cs
CheckCommand.cs CloseCommand.cs CopyCommand.cs
CreateCommand.cs DeleteCommand.cs ExpungeCommand.cs
FetchCommand.cs ImapCommand.cs ListCommand.cs LoginCommand.cs
LogoutCommand.cs LsubCommand.cs NoopCommand.cs
RenameCommand.cs SearchCommand.cs SelectExamineCommand.cs
StarttlsCommand.cs StatusCommand.cs StoreCommand.cs
SubscribeCommand.cs UidCommand.cs UnsubscribeCommand.cs
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: AppendCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/AppendCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AppendCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- AppendCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: AuthenticateCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/AuthenticateCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AuthenticateCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- AuthenticateCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: CapabilityCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CapabilityCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CapabilityCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- CapabilityCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 13,17 ****
}
! override protected bool InternalProcess()
{
StringBuilder sb = new StringBuilder();
--- 13,17 ----
}
! override protected void InternalProcess()
{
StringBuilder sb = new StringBuilder();
***************
*** 28,33 ****
mConnection.SendTaggedMessage("OK CAPABILITY completed");
-
- return true;
}
}
--- 28,31 ----
Index: CheckCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CheckCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CheckCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- CheckCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: CloseCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CloseCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CloseCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- CloseCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: CopyCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CopyCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CopyCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- CopyCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: CreateCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CreateCommand.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CreateCommand.cs 28 Jul 2003 00:15:17 -0000 1.6
--- CreateCommand.cs 29 Jul 2003 00:46:28 -0000 1.7
***************
*** 14,56 ****
}
! override protected bool InternalProcess()
{
! string mbxName = mParsedArguments[0] as string;
! if(mbxName.ToUpper() == "INBOX")
! {
mConnection.SendTaggedMessage("NO Cannot create INBOX");
! return true;
! }
!
! MailboxCollection boxes = mConnection.User.Mailboxes;
!
! if(boxes[mbxName] != null)
! {
! mConnection.SendTaggedMessage("NO Cannot create duplicate");
! return true;
! }
!
! string soFar = string.Empty;
! string[] parts = mbxName.Split('/');
!
! for(int idx = 0; idx < parts.Length; ++idx)
{
! soFar += (idx == 0 ? string.Empty : "/") + parts[idx];
! if(idx == parts.Length-1)
!
! boxes.Add(soFar);
else
{
! Mailbox box = boxes[soFar];
! if(box == null)
! boxes.Add(soFar);
else
! soFar = box.Name;
}
}
-
- mConnection.SendTaggedMessage("OK Created");
- return true;
}
}
--- 14,40 ----
}
! override protected void InternalProcess()
{
! string boxFullName = mParsedArguments[0] as string;
! if(boxFullName.ToUpper() == "INBOX")
mConnection.SendTaggedMessage("NO Cannot create INBOX");
! else
{
! MailboxCollection boxes = mConnection.User.Mailboxes.FindContainer(boxFullName, true);
! if(boxes == null)
! mConnection.SendTaggedMessage("NO Cannot create");
else
{
! string boxName = Mailbox.ExtractName(boxFullName);
! if(boxes[boxName] != null)
! mConnection.SendTaggedMessage("NO Cannot create duplicate");
else
! {
! boxes.Add(boxName);
! mConnection.SendTaggedMessage("OK Created");
! }
}
}
}
}
Index: DeleteCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/DeleteCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DeleteCommand.cs 28 Jul 2003 00:15:17 -0000 1.5
--- DeleteCommand.cs 29 Jul 2003 00:46:28 -0000 1.6
***************
*** 14,59 ****
}
! override protected bool InternalProcess()
{
! string mbxName = mParsedArguments[0] as string;
! if(mbxName.ToUpper() == "INBOX")
! {
mConnection.SendTaggedMessage("NO Cannot delete INBOX");
! return true;
! }
!
! Mailbox box = mConnection.User.Mailboxes[mbxName];
!
! if(box == null)
{
! mConnection.SendTaggedMessage("NO Does not exist");
! return true;
! }
! /*
! It is permitted to delete a name that has inferior hierarchical
! names and does not have the \Noselect mailbox name attribute. In
! this case, all messages in that mailbox are removed, and the name
! will acquire the \Noselect mailbox name attribute.
! The value of the highest-used unique identifier of the deleted
! mailbox MUST be preserved so that a new mailbox created with the
! same name will not reuse the identifiers of the former
! incarnation, UNLESS the new incarnation has a different unique
! identifier validity value. See the description of the UID command
! for more detail.
! */
! if(box.HasChildren && box.NoSelect)
! {
! mConnection.SendTaggedMessage("NO Cannot delete");
! return true;
}
-
- box.Messages.Clear();
- box.Delete();
-
- mConnection.SendTaggedMessage("OK Deleted");
- return true;
}
}
--- 14,51 ----
}
! override protected void InternalProcess()
{
! string boxFullName = mParsedArguments[0] as string;
! if(boxFullName.ToUpper() == "INBOX")
mConnection.SendTaggedMessage("NO Cannot delete INBOX");
! else
{
! MailboxCollection boxes = mConnection.User.Mailboxes.FindContainer(boxFullName, true);
! if(boxes == null)
! mConnection.SendTaggedMessage("NO Does not exist");
! else
! {
! Mailbox box = boxes[Mailbox.ExtractName(boxFullName)];
! if(box == null)
! mConnection.SendTaggedMessage("NO Does not exist");
! else
! {
! if(box.HasChildren && box.NoSelect)
! mConnection.SendTaggedMessage("NO Cannot delete");
! else if(box.HasChildren)
! {
! box.NoSelect = true;
! box.Save();
! }
! else
! boxes.Remove(box);
! box.Messages.Clear(); // get rid of messages
! mConnection.SendTaggedMessage("OK Deleted");
! }
! }
}
}
}
Index: ExpungeCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ExpungeCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ExpungeCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- ExpungeCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: FetchCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/FetchCommand.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** FetchCommand.cs 28 Jul 2003 00:15:17 -0000 1.6
--- FetchCommand.cs 29 Jul 2003 00:46:28 -0000 1.7
***************
*** 17,21 ****
}
! override protected bool InternalProcess()
{
mConnection.SendUntaggedMessage(mParsedArguments[0].ToString());
--- 17,21 ----
}
! override protected void InternalProcess()
{
mConnection.SendUntaggedMessage(mParsedArguments[0].ToString());
***************
*** 38,44 ****
else
mConnection.SendTaggedMessage("BAD Invalid request list");
-
- // done
- return true;
}
--- 38,41 ----
Index: ImapCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ImapCommand.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ImapCommand.cs 27 Jul 2003 17:07:05 -0000 1.8
--- ImapCommand.cs 29 Jul 2003 00:46:28 -0000 1.9
***************
*** 97,109 ****
else if(mUnparsedArgumentIdx < mUnparsedArguments.Length)
mConnection.SendTaggedMessage("BAD Too many arguments");
- else if(!InternalProcess())
- mConnection.SendTaggedMessage("BAD Processing problems");
else
return true;
!
return false;
}
! abstract protected bool InternalProcess();
#endregion
--- 97,109 ----
else if(mUnparsedArgumentIdx < mUnparsedArguments.Length)
mConnection.SendTaggedMessage("BAD Too many arguments");
else
+ {
+ InternalProcess();
return true;
! }
return false;
}
! abstract protected void InternalProcess();
#endregion
Index: ListCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/ListCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ListCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- ListCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
using System;
+ using System.Text;
namespace Imap.Commands
***************
*** 14,26 ****
}
! override protected bool InternalProcess()
{
! // TODO: actually handle the arguments
! foreach(Mailbox box in mConnection.User.Mailboxes)
! mConnection.SendUntaggedMessage("LIST () \"/\" \"" + box.Name + "\"");
mConnection.SendTaggedMessage("OK LIST completed");
! return true;
}
}
--- 15,76 ----
}
! override protected void InternalProcess()
{
! ListBoxes(mConnection.User.Mailboxes);
mConnection.SendTaggedMessage("OK LIST completed");
+ }
! private void ListBoxes(MailboxCollection boxes)
! {
! // TODO: actually handle the arguments
! foreach(Mailbox box in boxes)
! {
! mConnection.SendUntaggedMessage("LIST " + BuildFlagList(box) + " \"/\" \"" + box.FullName + "\"");
!
! if(box.HasChildren)
! ListBoxes(box.Children);
! }
! }
!
! private string BuildFlagList(Mailbox box)
! {
! StringBuilder str = new StringBuilder();
! bool first = true;
! str.Append("(");
!
! if(box.NoSelect)
! {
! first = false;
! str.Append("NoSelect");
! }
!
! if(box.NoInferiors)
! {
! if(!first)
! str.Append(" ");
! first = false;
! str.Append("NoInferiors");
! }
!
! if(box.Marked)
! {
! if(!first)
! str.Append(" ");
! first = false;
! str.Append("NoInferiors");
! }
!
! if(box.Unmarked)
! {
! if(!first)
! str.Append(" ");
! first = false;
! str.Append("NoInferiors");
! }
!
! str.Append(")");
!
! return str.ToString();
}
}
Index: LoginCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LoginCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LoginCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- LoginCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 14,18 ****
}
! override protected bool InternalProcess()
{
mConnection.User = Server.MailstoreProvider.GetUser(mParsedArguments[0] as String, mParsedArguments[1] as String);
--- 14,18 ----
}
! override protected void InternalProcess()
{
mConnection.User = Server.MailstoreProvider.GetUser(mParsedArguments[0] as String, mParsedArguments[1] as String);
***************
*** 25,30 ****
mConnection.SendTaggedMessage("OK LOGIN completed");
}
-
- return true;
}
}
--- 25,28 ----
Index: LogoutCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LogoutCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LogoutCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- LogoutCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,21 ****
}
! override protected bool InternalProcess()
{
mConnection.SendUntaggedMessage("BYE");
mConnection.SendTaggedMessage("OK");
-
- return true;
}
}
--- 12,19 ----
}
! override protected void InternalProcess()
{
mConnection.SendUntaggedMessage("BYE");
mConnection.SendTaggedMessage("OK");
}
}
Index: LsubCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/LsubCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** LsubCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- LsubCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 14,18 ****
}
! override protected bool InternalProcess()
{
// TODO: actually handle the arguments
--- 14,18 ----
}
! override protected void InternalProcess()
{
// TODO: actually handle the arguments
***************
*** 21,26 ****
mConnection.SendTaggedMessage("OK LSUB completed");
-
- return true;
}
}
--- 21,24 ----
Index: NoopCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/NoopCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** NoopCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- NoopCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: RenameCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/RenameCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RenameCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- RenameCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 1,2 ****
--- 1,4 ----
+ using Common;
+
using System;
***************
*** 8,18 ****
public class RenameCommand : ImapCommand
{
! public RenameCommand(ImapServer svr) : base(svr, "RENAME", ImapCommand.AuthSelectedState)
{
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 10,51 ----
public class RenameCommand : ImapCommand
{
! public RenameCommand(ImapServer svr) : base(svr, "RENAME", ImapCommand.AuthSelectedState, ArgumentType.AString, ArgumentType.AString)
{
}
! override protected void InternalProcess()
{
! string srcName = mParsedArguments[0] as string;
! string dstName = mParsedArguments[1] as string;
!
! MailboxCollection srcBoxes = mConnection.User.Mailboxes.FindContainer(srcName, false);
! Mailbox srcBox = srcBoxes[Mailbox.ExtractName(srcName)];
! if(srcBox == null)
! mConnection.SendTaggedMessage("NO Source does not exist");
! else
! {
! MailboxCollection dstBoxes = mConnection.User.Mailboxes.FindContainer(dstName, true);
! dstName = Mailbox.ExtractName(dstName);
! if(dstBoxes[dstName] != null)
! mConnection.SendTaggedMessage("NO Destination already exists");
! else
! {
! // special case, doesn't actually rename the inbox
! // it makes a new folder and moves all messages to it
! if(srcName.ToUpper() == "INBOX")
! {
! // create the destination folder
! Mailbox dstBox = dstBoxes.Add(dstName);
!
! // move the messages
! srcBox.MoveMessages(dstBox);
! }
! else
! {
! srcBox.Name = dstName;
! // TODO: save the renamed folder
! }
! }
! }
}
}
Index: SearchCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SearchCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SearchCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- SearchCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: SelectExamineCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SelectExamineCommand.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SelectExamineCommand.cs 27 Jul 2003 17:27:17 -0000 1.2
--- SelectExamineCommand.cs 29 Jul 2003 00:46:28 -0000 1.3
***************
*** 17,53 ****
}
! override protected bool 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;
! Mailbox mbx = mConnection.Mailbox;
! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)");
! mConnection.SendUntaggedMessage(mbx.MessageCount.ToString() + " EXISTS");
! mConnection.SendUntaggedMessage(mbx.MessageRecentCount.ToString() + " RECENT");
! if(mbx.FirstUnseenMessageSeqNum != 0)
! mConnection.SendUntaggedMessage("OK [UNSEEN " + mbx.FirstUnseenMessageSeqNum + "]");
! if(mIsSelect)
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft)]");
! else
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS ()]");
! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + mbx.UniqueIdValidity.ToString() + "]");
! mConnection.SendUntaggedMessage("OK [UIDNEXT " + mbx.NextUniqueId + "]");
! mConnection.SendTaggedMessage(mIsSelect ? "OK [READ-WRITE]" : "OK [READ-ONLY]");
}
-
- return true;
}
}
--- 17,59 ----
}
! override protected void InternalProcess()
{
! string boxFullName = mParsedArguments[0] as string;
!
! MailboxCollection boxes = mConnection.User.Mailboxes.FindContainer(boxFullName, false);
! if(boxes == null)
! mConnection.SendTaggedMessage("NO Does not exist");
else
{
! mConnection.Mailbox = boxes[Mailbox.ExtractName(boxFullName)];
! if(mConnection.Mailbox == null)
! {
! mConnection.State = ImapConnectionState.Authenticated;
! mConnection.SendTaggedMessage("NO Does not exist");
! }
! else
! {
! mConnection.State = ImapConnectionState.Selected;
! Mailbox box = mConnection.Mailbox;
! mConnection.SendUntaggedMessage("FLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft \\Recent)");
! mConnection.SendUntaggedMessage(box.MessageCount.ToString() + " EXISTS");
! mConnection.SendUntaggedMessage(box.MessageRecentCount.ToString() + " RECENT");
! if(box.FirstUnseenMessageSeqNum != 0)
! mConnection.SendUntaggedMessage("OK [UNSEEN " + box.FirstUnseenMessageSeqNum + "]");
! if(mIsSelect)
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS (\\Seen \\Answered \\Flagged \\Deleted \\Draft)]");
! else
! mConnection.SendUntaggedMessage("OK [PERMANENTFLAGS ()]");
! mConnection.SendUntaggedMessage("OK [UIDVALIDITY " + box.UniqueIdValidity.ToString() + "]");
! mConnection.SendUntaggedMessage("OK [UIDNEXT " + box.NextUniqueId + "]");
! mConnection.SendTaggedMessage(mIsSelect ? "OK [READ-WRITE]" : "OK [READ-ONLY]");
! }
}
}
}
Index: StarttlsCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StarttlsCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StarttlsCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- StarttlsCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: StatusCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StatusCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StatusCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- StatusCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: StoreCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/StoreCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** StoreCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- StoreCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: SubscribeCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/SubscribeCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SubscribeCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- SubscribeCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: UidCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/UidCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** UidCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- UidCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
Index: UnsubscribeCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/UnsubscribeCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** UnsubscribeCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- UnsubscribeCommand.cs 29 Jul 2003 00:46:28 -0000 1.5
***************
*** 12,18 ****
}
! override protected bool InternalProcess()
{
! return false;
}
}
--- 12,18 ----
}
! override protected void InternalProcess()
{
! //return false;
}
}
|
|
From: <ta...@us...> - 2003-07-29 00:46:32
|
Update of /cvsroot/csmaild/csmaild/src/Engine/bin/SampleXmlMailstore In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Engine/bin/SampleXmlMailstore Modified Files: Mailboxes.xml Messages.xml Users.xml Log Message: Updated 2002 project files for people using legacy IDE's ;) Added initial POP project, no code, just a project Changes to the mail store to support DELETE, RENAME, CREATE commands Nearly finished with said commands, more testing needed Moved NetworkManager to common, so POP can use it Index: Mailboxes.xml =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/bin/SampleXmlMailstore/Mailboxes.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mailboxes.xml 27 Jul 2003 16:50:47 -0000 1.1 --- Mailboxes.xml 29 Jul 2003 00:46:28 -0000 1.2 *************** *** 1,24 **** ! <?xml version="1.0" standalone="yes" ?> ! <Mailstore> ! <Mailboxes> ! <UserIdentifier>csmaild_test</UserIdentifier> ! <Name>INBOX</Name> ! <FullName>INBOX</FullName> ! <NextUniqueId>1</NextUniqueId> ! <UniqueIdValidity>1</UniqueIdValidity> ! </Mailboxes> ! <Mailboxes> ! <Username>csmaild_test</Username> ! <Name>Drafts</Name> ! <FullName>Drafts</FullName> ! <NextUniqueId>1</NextUniqueId> ! <UniqueIdValidity>1</UniqueIdValidity> ! </Mailboxes> ! <Mailboxes> ! <UserIdentifier>csmaild_test</UserIdentifier> ! <Name>Sent Items</Name> ! <FullName>Sent Items</FullName> ! <NextUniqueId>1</NextUniqueId> ! <UniqueIdValidity>1</UniqueIdValidity> ! </Mailboxes> </Mailstore> --- 1,27 ---- ! <?xml version="1.0" standalone="yes"?> ! <Mailstore xmlns="http://tempuri.org/Mailboxes.xsd"> ! <Mailboxes> ! <Id>1</Id> ! <UserId>1</UserId> ! <ParentId>0</ParentId> ! <Name>INBOX</Name> ! <NextUniqueId>1</NextUniqueId> ! <UniqueIdValidity>1</UniqueIdValidity> ! <NoSelect>false</NoSelect> ! <NoInferiors>false</NoInferiors> ! <Marked>false</Marked> ! <Unmarked>false</Unmarked> ! </Mailboxes> ! <Mailboxes> ! <Id>2430903176</Id> ! <UserId>1</UserId> ! <ParentId>0</ParentId> ! <Name>Custom</Name> ! <NextUniqueId>1</NextUniqueId> ! <UniqueIdValidity>1</UniqueIdValidity> ! <NoSelect>false</NoSelect> ! <NoInferiors>false</NoInferiors> ! <Marked>false</Marked> ! <Unmarked>false</Unmarked> ! </Mailboxes> </Mailstore> Index: Messages.xml =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/bin/SampleXmlMailstore/Messages.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Messages.xml 27 Jul 2003 16:50:47 -0000 1.1 --- Messages.xml 29 Jul 2003 00:46:28 -0000 1.2 *************** *** 1,13 **** ! <?xml version="1.0" standalone="yes" ?> ! <Mailstore> ! <Messages> ! <MailboxIdentifier>INBOX</MailboxIdentifier> ! <UniqueIdentifier>1</UniqueIdentifier> ! <Seen>True</Seen> ! <Answered>False</Answered> ! <Flagged>False</Flagged> ! <Deleted>False</Deleted> ! <Draft>False</Draft> ! <Size>0</Size> ! </Messages> </Mailstore> --- 1,14 ---- ! <?xml version="1.0" standalone="yes"?> ! <Mailstore xmlns="http://tempuri.org/Messages.xsd"> ! <Messages> ! <Id>1</Id> ! <MailboxId>1</MailboxId> ! <UniqueIdentifier>1</UniqueIdentifier> ! <Seen>true</Seen> ! <Answered>true</Answered> ! <Flagged>true</Flagged> ! <Deleted>true</Deleted> ! <Draft>true</Draft> ! <Size>0</Size> ! </Messages> </Mailstore> Index: Users.xml =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Engine/bin/SampleXmlMailstore/Users.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Users.xml 27 Jul 2003 16:50:47 -0000 1.1 --- Users.xml 29 Jul 2003 00:46:28 -0000 1.2 *************** *** 1,7 **** ! <?xml version="1.0" standalone="yes" ?> ! <Mailstore> ! <Users> ! <Username>csmaild_test</Username> ! <Password>csmaild_test</Password> ! </Users> </Mailstore> --- 1,8 ---- ! <?xml version="1.0" standalone="yes"?> ! <Mailstore xmlns="http://tempuri.org/Users.xsd"> ! <Users> ! <Id>1</Id> ! <Username>csmaild_test</Username> ! <Password>csmaild_test</Password> ! </Users> </Mailstore> |
Update of /cvsroot/csmaild/csmaild/src/Common
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Common
Modified Files:
Common.2002.csproj Common.csproj DataItem.cs Mailbox.cs
MailboxCollection.cs Message.cs MessageCollection.cs User.cs
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: Common.2002.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.2002.csproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Common.2002.csproj 25 Jul 2003 14:50:31 -0000 1.1
--- Common.2002.csproj 29 Jul 2003 00:46:28 -0000 1.2
***************
*** 93,96 ****
--- 93,101 ----
/>
<File
+ RelPath = "MailboxCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "Message.cs"
SubType = "Code"
***************
*** 98,101 ****
--- 103,111 ----
/>
<File
+ RelPath = "MessageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "User.cs"
SubType = "Code"
***************
*** 109,112 ****
--- 119,137 ----
<File
RelPath = "MailstoreProviders\XmlMailstoreProvider.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NetworkManager\Connection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NetworkManager\Listener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NetworkManager\NetworkManager.cs"
SubType = "Code"
BuildAction = "Compile"
Index: Common.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.csproj,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Common.csproj 28 Jul 2003 00:15:16 -0000 1.5
--- Common.csproj 29 Jul 2003 00:46:28 -0000 1.6
***************
*** 129,132 ****
--- 129,147 ----
BuildAction = "Compile"
/>
+ <File
+ RelPath = "NetworkManager\Connection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NetworkManager\Listener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NetworkManager\NetworkManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
</Include>
</Files>
Index: DataItem.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/DataItem.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DataItem.cs 24 Jul 2003 04:32:13 -0000 1.1
--- DataItem.cs 29 Jul 2003 00:46:28 -0000 1.2
***************
*** 1,6 ****
- using System;
-
using Common.MailstoreProviders;
namespace Common
{
--- 1,7 ----
using Common.MailstoreProviders;
+ using System;
+ using System.Collections;
+
namespace Common
{
***************
*** 8,19 ****
/// Base class for all things data
/// </summary>
! public class DataItem
{
protected IMailstoreProvider mMailstoreProvider;
! public DataItem(IMailstoreProvider provider)
{
mMailstoreProvider = provider;
}
}
}
--- 9,49 ----
/// Base class for all things data
/// </summary>
! public abstract class DataItem
{
protected IMailstoreProvider mMailstoreProvider;
+ protected object mProvidersIdentifier;
! internal object ProvidersIdentifier
! {
! get
! {
! return mProvidersIdentifier;
! }
! set
! {
! mProvidersIdentifier = value;
! }
! }
!
! internal DataItem(IMailstoreProvider provider, object id)
{
mMailstoreProvider = provider;
+ mProvidersIdentifier = id;
}
+ }
+
+ /// <summary>
+ /// Base class for all collections of DataItems
+ /// </summary>
+ public abstract class DataItemCollection : IEnumerable
+ {
+ protected IMailstoreProvider mMailstoreProvider;
+
+ internal DataItemCollection(IMailstoreProvider provider)
+ {
+ mMailstoreProvider = provider;
+ }
+
+ public abstract IEnumerator GetEnumerator();
}
}
Index: Mailbox.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Mailbox.cs 28 Jul 2003 00:15:16 -0000 1.6
--- Mailbox.cs 29 Jul 2003 00:46:28 -0000 1.7
***************
*** 12,29 ****
#region Variables
private string mName;
- private string mFullName;
private uint mNextUniqueId;
private uint mUniqueIdValidity;
- private Mailbox mParent;
- private MailboxCollection mChildren;
- private MessageCollection mMessages;
private User mUser; // the owner of this mailbox
private bool mNoInferiors; /// Does NOT and MUST NOT have children
private bool mNoSelect; /// MUST NOT be selected
private bool mMarked; /// Marked "interesting": probably contains new messages since last select
private bool mUnmarked; /// Not marked "interesting"
-
- private IMailstoreProvider mProvider;
#endregion
--- 12,26 ----
#region Variables
private string mName;
private uint mNextUniqueId;
private uint mUniqueIdValidity;
private User mUser; // the owner of this mailbox
+ internal Mailbox mParent;
+ internal MailboxCollection mContainer; // the set of mailboxes that we are a part of
+
private bool mNoInferiors; /// Does NOT and MUST NOT have children
private bool mNoSelect; /// MUST NOT be selected
private bool mMarked; /// Marked "interesting": probably contains new messages since last select
private bool mUnmarked; /// Not marked "interesting"
#endregion
***************
*** 44,47 ****
--- 41,55 ----
}
+ public string FullName
+ {
+ get
+ {
+ if(mParent == null)
+ return mName;
+ else
+ return mParent.FullName + "/" + mName;
+ }
+ }
+
/// <summary>
/// The id that SHOULD be assigned to the next new message in this mailbox
***************
*** 92,96 ****
get
{
! return mChildren;
}
}
--- 100,104 ----
get
{
! return mMailstoreProvider.GetMailboxes(this);
}
}
***************
*** 103,107 ****
get
{
! return mMessages;
}
}
--- 111,115 ----
get
{
! return mMailstoreProvider.GetMessages(this);
}
}
***************
*** 128,132 ****
// TODO: make this more efficient then having to load all the messages
int rv = 0;
! foreach(Message msg in mMessages)
if(msg.Recent)
++rv;
--- 136,140 ----
// TODO: make this more efficient then having to load all the messages
int rv = 0;
! foreach(Message msg in Messages)
if(msg.Recent)
++rv;
***************
*** 169,172 ****
--- 177,184 ----
return mNoSelect;
}
+ set
+ {
+ mNoSelect = value;
+ }
}
***************
*** 186,215 ****
}
}
-
#endregion
! public Mailbox(IMailstoreProvider provider, string name, string fullName, uint nextUniqueId, uint uniqueIdValidity, User user) : base(provider)
{
- mProvider = provider;
-
mNextUniqueId = nextUniqueId;
mUniqueIdValidity = uniqueIdValidity;
mName = name;
- mFullName = fullName;
mParent = null;
mUser = user;
! mChildren = new MailboxCollection(mProvider, mUser);
! mMessages = new MessageCollection(mProvider, this);
! mNoInferiors = false;
! mNoSelect = false;
! mMarked = false;
! mUnmarked = false;
}
! public void Delete()
{
! mMailstoreProvider.DeleteMailbox(this);
}
}
--- 198,236 ----
}
}
#endregion
! public Mailbox(IMailstoreProvider provider, object providersId, string name, uint nextUniqueId, uint uniqueIdValidity, User user, bool noSelect, bool noInferiors, bool marked, bool unmarked) : base(provider, providersId)
{
mNextUniqueId = nextUniqueId;
mUniqueIdValidity = uniqueIdValidity;
mName = name;
mParent = null;
+ mContainer = null;
mUser = user;
! mNoSelect = noSelect;
! mNoInferiors = noInferiors;
! mMarked = marked;
! mUnmarked = unmarked;
! }
! public void MoveMessages(Mailbox destination)
! {
! destination.Messages.Add(Messages);
! Messages.Clear();
}
! public void Save()
{
! mMailstoreProvider.SaveMailbox(this);
! }
!
! public static string ExtractName(string fullName)
! {
! int idx = fullName.LastIndexOf('/');
! if(idx == -1)
! return fullName;
! else
! return fullName.Substring(idx+1);
}
}
Index: MailboxCollection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailboxCollection.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MailboxCollection.cs 28 Jul 2003 00:15:16 -0000 1.2
--- MailboxCollection.cs 29 Jul 2003 00:46:28 -0000 1.3
***************
*** 9,25 ****
/// Custom class representing a mailbox collection
/// </summary>
! public class MailboxCollection : IEnumerable
{
private User mUser;
private ArrayList mIndexedList = new ArrayList();
private SortedList mNamedList = new SortedList();
! private IMailstoreProvider mProvider;
!
! internal MailboxCollection(IMailstoreProvider provider, User usr)
{
! mProvider = provider;
! mUser = usr;
}
--- 9,24 ----
/// Custom class representing a mailbox collection
/// </summary>
! public class MailboxCollection : DataItemCollection
{
private User mUser;
+ private Mailbox mContainer;
private ArrayList mIndexedList = new ArrayList();
private SortedList mNamedList = new SortedList();
! internal MailboxCollection(IMailstoreProvider provider, User user, Mailbox container) : base(provider)
{
! mContainer = container;
! mUser = user;
}
***************
*** 40,45 ****
--- 39,54 ----
}
+ public int Count
+ {
+ get
+ {
+ return mIndexedList.Count;
+ }
+ }
+
internal void Add(Mailbox box)
{
+ box.mParent = mContainer;
+ box.mContainer = this;
mIndexedList.Add(box);
mNamedList.Add(box.Name.ToUpper(), box);
***************
*** 49,73 ****
{
// TODO: gather the uidvalidity to be unique for this name (suggested in the rfc to have 32-bit representation of day/time)
! Mailbox mbx = new Mailbox(mProvider, name, name, 1, 1, mUser);
! if(mProvider.InsertMailbox(mUser, mbx))
! {
! Add(mbx);
! return mbx;
! }
else
return null;
}
! public int Count
{
! get
{
! return mIndexedList.Count;
}
}
#region IEnumerable
! public IEnumerator GetEnumerator()
{
return mIndexedList.GetEnumerator();
--- 58,111 ----
{
// TODO: gather the uidvalidity to be unique for this name (suggested in the rfc to have 32-bit representation of day/time)
! Mailbox box = new Mailbox(mMailstoreProvider, null, name, 1, 1, mUser, false, false, false, false);
! Add(box);
! if(mMailstoreProvider.InsertMailbox(mUser, box))
! return box;
else
return null;
}
! /// <summary>
! /// Finds the containing MailboxCollection that a specified mailbox would reside in (regardless of it existing)
! /// </summary>
! /// <param name="fullName">The fullname of the mailbox</param>
! /// <param name="createToFind">Should the method create the mailboxes in order to "find" the container</param>
! /// <returns>The container found, null if not found or unable to create parent containers (if createToFind = true)</returns>
! public MailboxCollection FindContainer(string fullName, bool createToFind)
{
! int idx = fullName.IndexOf('/');
! if(idx == -1) // no hierarchy seperators, must go in this container
! return this;
! else if(idx == 0) // if it starts with a slash, get rid of it
! return FindContainer(fullName.Substring(1), createToFind);
! else
{
! string boxName = fullName.Substring(0, idx);
! Mailbox box = this[boxName];
! if(box == null)
! {
! if(createToFind)
! box = Add(boxName);
! else
! return null;
! }
! string childName = fullName.Substring(idx+1);
! if(childName == "/")
! return this;
! else
! return box.Children.FindContainer(childName, createToFind);
}
}
+ public void Remove(Mailbox box)
+ {
+ mMailstoreProvider.DeleteMailbox(box);
+ mIndexedList.Remove(box);
+ mNamedList.Remove(box.Name.ToUpper());
+ }
+
#region IEnumerable
! public override IEnumerator GetEnumerator()
{
return mIndexedList.GetEnumerator();
Index: Message.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Message.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Message.cs 25 Jul 2003 23:35:24 -0000 1.3
--- Message.cs 29 Jul 2003 00:46:28 -0000 1.4
***************
*** 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;
--- 135,139 ----
#endregion
! public Message(IMailstoreProvider provider, object providersId, uint uid, bool seen, bool answered, bool flagged, bool deleted, bool draft, int size) : base(provider, providersId)
{
mUniqueId = uid;
Index: MessageCollection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MessageCollection.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MessageCollection.cs 28 Jul 2003 00:15:16 -0000 1.1
--- MessageCollection.cs 29 Jul 2003 00:46:28 -0000 1.2
***************
*** 9,13 ****
/// Custom class representing a message collection
/// </summary>
! public class MessageCollection : IEnumerable
{
private Mailbox mMailbox;
--- 9,13 ----
/// Custom class representing a message collection
/// </summary>
! public class MessageCollection : DataItemCollection
{
private Mailbox mMailbox;
***************
*** 16,24 ****
private SortedList mUidList = new SortedList();
! private IMailstoreProvider mProvider;
!
! internal MessageCollection(IMailstoreProvider provider, Mailbox box)
{
- mProvider = provider;
mMailbox = box;
}
--- 16,21 ----
private SortedList mUidList = new SortedList();
! internal MessageCollection(IMailstoreProvider provider, Mailbox box) : base(provider)
{
mMailbox = box;
}
***************
*** 44,52 ****
public void Clear()
{
! mProvider.DeleteMessages(mMailbox);
}
#region IEnumerable
! public IEnumerator GetEnumerator()
{
return mSequenceList.GetEnumerator();
--- 41,57 ----
public void Clear()
{
! mMailstoreProvider.DeleteMessages(mMailbox);
! }
!
! public void Add(Message msg)
! {
! }
!
! public void Add(MessageCollection msgs)
! {
}
#region IEnumerable
! public override IEnumerator GetEnumerator()
{
return mSequenceList.GetEnumerator();
Index: User.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/User.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** User.cs 28 Jul 2003 00:15:16 -0000 1.3
--- User.cs 29 Jul 2003 00:46:28 -0000 1.4
***************
*** 13,18 ****
private string mUsername;
private string mPassword;
- private MailboxCollection mMailboxes;
- private IMailstoreProvider mProvider;
#endregion
--- 13,16 ----
***************
*** 44,58 ****
get
{
! if(mMailboxes == null)
! mMailboxes = mMailstoreProvider.GetMailboxes(this);
! return mMailboxes;
}
}
#endregion
! public User(IMailstoreProvider provider, string username, string password) : base(provider)
{
- mProvider = provider;
-
mUsername = username;
mPassword = password;
--- 42,52 ----
get
{
! return mMailstoreProvider.GetMailboxes(this);
}
}
#endregion
! public User(IMailstoreProvider provider, object providersId, string username, string password) : base(provider, providersId)
{
mUsername = username;
mPassword = password;
|
|
From: <ta...@us...> - 2003-07-29 00:46:31
|
Update of /cvsroot/csmaild/csmaild/src/Engine
In directory sc8-pr-cvs1:/tmp/cvs-serv8950/src/Engine
Modified Files:
Engine.csproj
Log Message:
Updated 2002 project files for people using legacy IDE's ;)
Added initial POP project, no code, just a project
Changes to the mail store to support DELETE, RENAME, CREATE commands
Nearly finished with said commands, more testing needed
Moved NetworkManager to common, so POP can use it
Index: Engine.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Engine/Engine.csproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Engine.csproj 24 Jul 2003 04:32:13 -0000 1.2
--- Engine.csproj 29 Jul 2003 00:46:28 -0000 1.3
***************
*** 108,111 ****
--- 108,138 ----
BuildAction = "Compile"
/>
+ <File
+ RelPath = "bin\SampleXmlMailstore\Mailboxes.xsd"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "bin\SampleXmlMailstore\Mailboxes.xsx"
+ DependentUpon = "Mailboxes.xsd"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "bin\SampleXmlMailstore\Messages.xsd"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "bin\SampleXmlMailstore\Messages.xsx"
+ DependentUpon = "Messages.xsd"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "bin\SampleXmlMailstore\Users.xsd"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "bin\SampleXmlMailstore\Users.xsx"
+ DependentUpon = "Users.xsd"
+ BuildAction = "None"
+ />
</Include>
</Files>
|
|
From: <ta...@us...> - 2003-07-29 00:38:11
|
Update of /cvsroot/csmaild/csmaild/src/Pop In directory sc8-pr-cvs1:/tmp/cvs-serv7469/Pop Log Message: Directory /cvsroot/csmaild/csmaild/src/Pop added to the repository |
|
From: <ta...@us...> - 2003-07-28 00:15:29
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders
In directory sc8-pr-cvs1:/tmp/cvs-serv22151/src/Common/MailstoreProviders
Modified Files:
IMailstoreProvider.cs XmlMailstoreProvider.cs
Log Message:
Added MessageCollection to store the collection of messages in a mailbox
DELETE should work now, had to modify the mail store to support deleting of messages and mailboxes
Index: IMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/IMailstoreProvider.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IMailstoreProvider.cs 27 Jul 2003 19:32:59 -0000 1.4
--- IMailstoreProvider.cs 28 Jul 2003 00:15:17 -0000 1.5
***************
*** 43,52 ****
#endregion
! #region Mailbox modifieres
bool InsertMailbox(User user, Mailbox mbx);
#endregion
#endregion
#region Message accessors
/// <summary>
--- 43,62 ----
#endregion
! #region Mailbox insert
bool InsertMailbox(User user, Mailbox mbx);
#endregion
+ #region Mailbox delete
+ /// <summary>
+ /// Permanently deletes the mailbox
+ /// </summary>
+ /// <param name="box">The box to delete</param>
+ void DeleteMailbox(Mailbox box);
#endregion
+ #endregion
+
+ #region Message stuff
+
#region Message accessors
/// <summary>
***************
*** 64,67 ****
--- 74,87 ----
/// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns>
Message[] GetMessages(Mailbox box);
+ #endregion
+
+ #region Message delete
+ /// <summary>
+ /// Deletes all the messages in a mailbox
+ /// </summary>
+ /// <param name="box">The mailbox to clear out</param>
+ void DeleteMessages(Mailbox box);
+ #endregion
+
#endregion
}
Index: XmlMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** XmlMailstoreProvider.cs 27 Jul 2003 19:33:00 -0000 1.5
--- XmlMailstoreProvider.cs 28 Jul 2003 00:15:17 -0000 1.6
***************
*** 8,11 ****
--- 8,18 ----
private string mFolderPath;
+ private DataSet mMessageSet = new DataSet();
+ private DataSet mMailboxSet = new DataSet();
+ private DataSet mUserSet = new DataSet();
+ private DataTable mMessages;
+ private DataTable mMailboxes;
+ private DataTable mUsers;
+
public XmlMailstoreProvider(string folderPath)
{
***************
*** 14,17 ****
--- 21,33 ----
if(!mFolderPath.EndsWith(@"\"))
mFolderPath += @"\";
+
+ mMessageSet.ReadXml(mFolderPath + "Messages.xml");
+ mMessages = mMessageSet.Tables[0];
+
+ mMailboxSet.ReadXml(mFolderPath + "Mailboxes.xml");
+ mMailboxes = mMailboxSet.Tables[0];
+
+ mUserSet.ReadXml(mFolderPath + "Users.xml");
+ mUsers = mUserSet.Tables[0];
}
***************
*** 19,25 ****
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)
--- 35,39 ----
public User GetUser(string username, string password)
{
! DataRow[] users = mUsers.Select("Username = '" + username + "'");
if(users.Length == 0)
***************
*** 39,45 ****
public Mailbox GetMailbox(User user, string absoluteHiearchicalName)
{
! DataSet ds = new DataSet();
! ds.ReadXml(mFolderPath + "Mailboxes.xml");
! DataRow[] boxes = ds.Tables[0].Select("FullName = '" + absoluteHiearchicalName + "' AND UserIdentifier = '" + user.Username + "'");
if(boxes.Length == 0)
--- 53,57 ----
public Mailbox GetMailbox(User user, string absoluteHiearchicalName)
{
! DataRow[] boxes = mMailboxes.Select("FullName = '" + absoluteHiearchicalName + "' AND UserIdentifier = '" + user.Username + "'");
if(boxes.Length == 0)
***************
*** 52,59 ****
public MailboxCollection GetMailboxes(User user)
{
! DataSet ds = new DataSet();
! ds.ReadXml(mFolderPath + "Mailboxes.xml");
!
! DataRow[] rows = ds.Tables[0].Select("UserIdentifier = '" + user.Username + "'");
MailboxCollection mbxCollection = new MailboxCollection(this, user);
--- 64,68 ----
public MailboxCollection GetMailboxes(User user)
{
! DataRow[] rows = mMailboxes.Select("UserIdentifier = '" + user.Username + "'");
MailboxCollection mbxCollection = new MailboxCollection(this, user);
***************
*** 73,83 ****
#endregion
! #region Mailbox modifieres
public bool InsertMailbox(User user, Mailbox mbx)
{
! DataSet ds = new DataSet();
! ds.ReadXml(mFolderPath + "Mailboxes.xml");
!
! DataRow newMbx = ds.Tables[0].NewRow();
newMbx["UserIdentifier"] = user.Username;
--- 82,89 ----
#endregion
! #region Mailbox insert
public bool InsertMailbox(User user, Mailbox mbx)
{
! DataRow newMbx = mMailboxes.NewRow();
newMbx["UserIdentifier"] = user.Username;
***************
*** 87,92 ****
newMbx["UniqueIdValidity"] = mbx.UniqueIdValidity;
! ds.Tables[0].Rows.Add(newMbx);
! ds.WriteXml(mFolderPath + "Mailboxes.xml");
return true;
--- 93,98 ----
newMbx["UniqueIdValidity"] = mbx.UniqueIdValidity;
! mMailboxes.Rows.Add(newMbx);
! Save(false, true, false);
return true;
***************
*** 94,99 ****
--- 100,116 ----
#endregion
+ #region Mailbox delete
+ public void DeleteMailbox(Mailbox box)
+ {
+ DataRow[] boxes = mMailboxes.Select("FullName = '" + box.Name + "' AND UserIdentifier = '" + box.User.Username + "'");
+ boxes[0].Delete();
+ Save(false, true, false);
+ }
+ #endregion
+
#endregion
+ #region Message stuff
+
#region Message accessors
public Message GetMessage(Mailbox box, int uniqueId)
***************
*** 104,111 ****
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];
--- 121,125 ----
public Message[] GetMessages(Mailbox box)
{
! DataRow[] messages = mMessages.Select("MailboxIdentifier = '" + box.Name + "'");
Message[] msgs = new Message[messages.Length];
***************
*** 119,122 ****
--- 133,160 ----
}
#endregion
+
+ #region Message deletes
+ public void DeleteMessages(Mailbox box)
+ {
+ DataRow[] messages = mMessages.Select("MailboxIdentifier = '" + box.Name + "'");
+ foreach(DataRow msg in messages)
+ msg.Delete();
+ Save(false, false, true);
+ }
+ #endregion
+
+ #endregion
+
+ private void Save(bool saveUsers, bool saveMailboxes, bool saveMessages)
+ {
+ if(saveUsers)
+ mUserSet.WriteXml(mFolderPath + "Users.xml");
+
+ if(saveMailboxes)
+ mMailboxSet.WriteXml(mFolderPath + "Mailboxes.xml");
+
+ if(saveMessages)
+ mMessageSet.WriteXml(mFolderPath + "Messages.xml");
+ }
}
}
|
|
From: <ta...@us...> - 2003-07-28 00:15:24
|
Update of /cvsroot/csmaild/csmaild/src/Common
In directory sc8-pr-cvs1:/tmp/cvs-serv22151/src/Common
Modified Files:
Common.csproj Mailbox.cs MailboxCollection.cs User.cs
Added Files:
MessageCollection.cs
Log Message:
Added MessageCollection to store the collection of messages in a mailbox
DELETE should work now, had to modify the mail store to support deleting of messages and mailboxes
--- NEW FILE: MessageCollection.cs ---
using Common.MailstoreProviders;
using System;
using System.Collections;
namespace Common
{
/// <summary>
/// Custom class representing a message collection
/// </summary>
public class MessageCollection : IEnumerable
{
private Mailbox mMailbox;
private SortedList mSequenceList = new SortedList();
private SortedList mUidList = new SortedList();
private IMailstoreProvider mProvider;
internal MessageCollection(IMailstoreProvider provider, Mailbox box)
{
mProvider = provider;
mMailbox = box;
}
public Message BySeq(uint sequenceNumber)
{
return (Message)mSequenceList[sequenceNumber];
}
public Message ByUID(uint uid)
{
return (Message)mUidList[uid];
}
public int Count
{
get
{
return mSequenceList.Count;
}
}
public void Clear()
{
mProvider.DeleteMessages(mMailbox);
}
#region IEnumerable
public IEnumerator GetEnumerator()
{
return mSequenceList.GetEnumerator();
}
#endregion
}
}
Index: Common.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.csproj,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Common.csproj 27 Jul 2003 19:32:58 -0000 1.4
--- Common.csproj 28 Jul 2003 00:15:16 -0000 1.5
***************
*** 110,113 ****
--- 110,118 ----
/>
<File
+ RelPath = "MessageCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "User.cs"
SubType = "Code"
Index: Mailbox.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Mailbox.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Mailbox.cs 27 Jul 2003 16:52:19 -0000 1.5
--- Mailbox.cs 28 Jul 2003 00:15:16 -0000 1.6
***************
*** 16,21 ****
private uint mUniqueIdValidity;
private Mailbox mParent;
! private Mailbox[] mChildren; // TODO: Make a strongly typed collection
private User mUser; // the owner of this mailbox
#endregion
--- 16,29 ----
private uint mUniqueIdValidity;
private Mailbox mParent;
! private MailboxCollection mChildren;
! private MessageCollection mMessages;
private User mUser; // the owner of this mailbox
+
+ private bool mNoInferiors; /// Does NOT and MUST NOT have children
+ private bool mNoSelect; /// MUST NOT be selected
+ private bool mMarked; /// Marked "interesting": probably contains new messages since last select
+ private bool mUnmarked; /// Not marked "interesting"
+
+ private IMailstoreProvider mProvider;
#endregion
***************
*** 69,76 ****
}
/// <summary>
/// The child Mailboxes for this mailbox (valid array of size 0 if none)
/// </summary>
! public Mailbox[] Children
{
get
--- 77,92 ----
}
+ public bool HasChildren
+ {
+ get
+ {
+ return (Children.Count > 0);
+ }
+ }
+
/// <summary>
/// The child Mailboxes for this mailbox (valid array of size 0 if none)
/// </summary>
! public MailboxCollection Children
{
get
***************
*** 83,91 ****
/// The Messages contained in this mailbox
/// </summary>
! public Message[] Messages
{
get
{
! return mMailstoreProvider.GetMessages(this);
}
}
--- 99,107 ----
/// The Messages contained in this mailbox
/// </summary>
! public MessageCollection Messages
{
get
{
! return mMessages;
}
}
***************
*** 99,103 ****
{
// TODO: make this more efficient then having to load all the messages
! return Messages.Length;
}
}
--- 115,119 ----
{
// TODO: make this more efficient then having to load all the messages
! return Messages.Count;
}
}
***************
*** 111,117 ****
{
// TODO: make this more efficient then having to load all the messages
- Message[] msgs = Messages;
int rv = 0;
! foreach(Message msg in msgs)
if(msg.Recent)
++rv;
--- 127,132 ----
{
// TODO: make this more efficient then having to load all the messages
int rv = 0;
! foreach(Message msg in mMessages)
if(msg.Recent)
++rv;
***************
*** 120,139 ****
}
! public int FirstUnseenMessageSeqNum
{
get
{
// TODO: make this more efficient then having to load all the messages
! Message[] msgs = Messages;
! for(int idx = 0; idx < msgs.Length; ++idx)
! if(!msgs[idx].Seen)
return idx;
return 0;
}
}
#endregion
public Mailbox(IMailstoreProvider provider, string name, string fullName, uint nextUniqueId, uint uniqueIdValidity, User user) : base(provider)
{
mNextUniqueId = nextUniqueId;
mUniqueIdValidity = uniqueIdValidity;
--- 135,196 ----
}
! public uint FirstUnseenMessageSeqNum
{
get
{
// TODO: make this more efficient then having to load all the messages
! for(uint idx = 0; idx < Messages.Count; ++idx)
! if(!Messages.BySeq(idx).Seen)
return idx;
return 0;
}
}
+
+ public User User
+ {
+ get
+ {
+ return mUser;
+ }
+ }
+
+ public bool NoInferiors
+ {
+ get
+ {
+ return mNoInferiors;
+ }
+ }
+
+ public bool NoSelect
+ {
+ get
+ {
+ return mNoSelect;
+ }
+ }
+
+ public bool Marked
+ {
+ get
+ {
+ return mMarked;
+ }
+ }
+
+ public bool Unmarked
+ {
+ get
+ {
+ return mUnmarked;
+ }
+ }
+
#endregion
public Mailbox(IMailstoreProvider provider, string name, string fullName, uint nextUniqueId, uint uniqueIdValidity, User user) : base(provider)
{
+ mProvider = provider;
+
mNextUniqueId = nextUniqueId;
mUniqueIdValidity = uniqueIdValidity;
***************
*** 141,146 ****
mFullName = fullName;
mParent = null;
- mChildren = null;
mUser = user;
}
}
--- 198,215 ----
mFullName = fullName;
mParent = null;
mUser = user;
+
+ mChildren = new MailboxCollection(mProvider, mUser);
+ mMessages = new MessageCollection(mProvider, this);
+
+ mNoInferiors = false;
+ mNoSelect = false;
+ mMarked = false;
+ mUnmarked = false;
+ }
+
+ public void Delete()
+ {
+ mMailstoreProvider.DeleteMailbox(this);
}
}
Index: MailboxCollection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailboxCollection.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MailboxCollection.cs 27 Jul 2003 19:32:58 -0000 1.1
--- MailboxCollection.cs 28 Jul 2003 00:15:16 -0000 1.2
***************
*** 14,18 ****
private ArrayList mIndexedList = new ArrayList();
! private Hashtable mNamedList = new Hashtable();
private IMailstoreProvider mProvider;
--- 14,18 ----
private ArrayList mIndexedList = new ArrayList();
! private SortedList mNamedList = new SortedList();
private IMailstoreProvider mProvider;
***************
*** 58,61 ****
--- 58,69 ----
else
return null;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return mIndexedList.Count;
+ }
}
Index: User.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/User.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** User.cs 27 Jul 2003 19:32:58 -0000 1.2
--- User.cs 28 Jul 2003 00:15:16 -0000 1.3
***************
*** 14,17 ****
--- 14,18 ----
private string mPassword;
private MailboxCollection mMailboxes;
+ private IMailstoreProvider mProvider;
#endregion
***************
*** 52,59 ****
public User(IMailstoreProvider provider, string username, string password) : base(provider)
{
mUsername = username;
mPassword = password;
}
}
-
}
--- 53,61 ----
public User(IMailstoreProvider provider, string username, string password) : base(provider)
{
+ mProvider = provider;
+
mUsername = username;
mPassword = password;
}
}
}
|
|
From: <ta...@us...> - 2003-07-28 00:15:24
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv22151/src/Imap/Commands
Modified Files:
CreateCommand.cs DeleteCommand.cs FetchCommand.cs
Log Message:
Added MessageCollection to store the collection of messages in a mailbox
DELETE should work now, had to modify the mail store to support deleting of messages and mailboxes
Index: CreateCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CreateCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CreateCommand.cs 27 Jul 2003 19:33:00 -0000 1.5
--- CreateCommand.cs 28 Jul 2003 00:15:17 -0000 1.6
***************
*** 39,42 ****
--- 39,43 ----
soFar += (idx == 0 ? string.Empty : "/") + parts[idx];
if(idx == parts.Length-1)
+
boxes.Add(soFar);
else
Index: DeleteCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/DeleteCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DeleteCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- DeleteCommand.cs 28 Jul 2003 00:15:17 -0000 1.5
***************
*** 1,2 ****
--- 1,4 ----
+ using Common;
+
using System;
***************
*** 8,12 ****
public class DeleteCommand : ImapCommand
{
! public DeleteCommand(ImapServer svr) : base(svr, "DELETE", ImapCommand.AuthSelectedState)
{
}
--- 10,14 ----
public class DeleteCommand : ImapCommand
{
! public DeleteCommand(ImapServer svr) : base(svr, "DELETE", ImapCommand.AuthSelectedState, ArgumentType.AString)
{
}
***************
*** 14,18 ****
override protected bool InternalProcess()
{
! return false;
}
}
--- 16,59 ----
override protected bool InternalProcess()
{
! string mbxName = mParsedArguments[0] as string;
!
! if(mbxName.ToUpper() == "INBOX")
! {
! mConnection.SendTaggedMessage("NO Cannot delete INBOX");
! return true;
! }
!
! Mailbox box = mConnection.User.Mailboxes[mbxName];
!
! if(box == null)
! {
! mConnection.SendTaggedMessage("NO Does not exist");
! return true;
! }
! /*
! It is permitted to delete a name that has inferior hierarchical
! names and does not have the \Noselect mailbox name attribute. In
! this case, all messages in that mailbox are removed, and the name
! will acquire the \Noselect mailbox name attribute.
!
! The value of the highest-used unique identifier of the deleted
! mailbox MUST be preserved so that a new mailbox created with the
! same name will not reuse the identifiers of the former
! incarnation, UNLESS the new incarnation has a different unique
! identifier validity value. See the description of the UID command
! for more detail.
! */
!
! if(box.HasChildren && box.NoSelect)
! {
! mConnection.SendTaggedMessage("NO Cannot delete");
! return true;
! }
!
! box.Messages.Clear();
! box.Delete();
!
! mConnection.SendTaggedMessage("OK Deleted");
! return true;
}
}
Index: FetchCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/FetchCommand.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FetchCommand.cs 26 Jul 2003 23:55:47 -0000 1.5
--- FetchCommand.cs 28 Jul 2003 00:15:17 -0000 1.6
***************
*** 37,41 ****
}
else
! mConnection.SendTaggedMessage("BAD");
// done
--- 37,41 ----
}
else
! mConnection.SendTaggedMessage("BAD Invalid request list");
// done
***************
*** 246,250 ****
}
- // ["<" number "." nz-number ">"]
if(idx < section.Length)
{
--- 246,249 ----
|
|
From: <ta...@us...> - 2003-07-28 00:15:24
|
Update of /cvsroot/csmaild/csmaild/src/Imap
In directory sc8-pr-cvs1:/tmp/cvs-serv22151/src/Imap
Modified Files:
Connection.cs
Log Message:
Added MessageCollection to store the collection of messages in a mailbox
DELETE should work now, had to modify the mail store to support deleting of messages and mailboxes
Index: Connection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Connection.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Connection.cs 26 Jul 2003 23:09:25 -0000 1.6
--- Connection.cs 28 Jul 2003 00:15:17 -0000 1.7
***************
*** 190,194 ****
// this command will parse through the incoming line and make sure it's valid
if(ParseAndValidate(line) && mCurrentCommand.Process())
! ;// good processing
ReadCommand();
}
--- 190,195 ----
// this command will parse through the incoming line and make sure it's valid
if(ParseAndValidate(line) && mCurrentCommand.Process())
! {
! }
ReadCommand();
}
|
|
From: <ta...@us...> - 2003-07-27 19:33:03
|
Update of /cvsroot/csmaild/csmaild/src/Imap/Commands
In directory sc8-pr-cvs1:/tmp/cvs-serv29411/src/Imap/Commands
Modified Files:
CreateCommand.cs
Log Message:
CREATE command should work now
Index: CreateCommand.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Commands/CreateCommand.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CreateCommand.cs 26 Jul 2003 23:09:25 -0000 1.4
--- CreateCommand.cs 27 Jul 2003 19:33:00 -0000 1.5
***************
*** 1,2 ****
--- 1,4 ----
+ using Common;
+
using System;
***************
*** 8,12 ****
public class CreateCommand : ImapCommand
{
! public CreateCommand(ImapServer svr) : base(svr, "CREATE", ImapCommand.AuthSelectedState)
{
}
--- 10,14 ----
public class CreateCommand : ImapCommand
{
! public CreateCommand(ImapServer svr) : base(svr, "CREATE", ImapCommand.AuthSelectedState, ArgumentType.AString)
{
}
***************
*** 14,18 ****
override protected bool InternalProcess()
{
! return false;
}
}
--- 16,55 ----
override protected bool InternalProcess()
{
! string mbxName = mParsedArguments[0] as string;
!
! if(mbxName.ToUpper() == "INBOX")
! {
! mConnection.SendTaggedMessage("NO Cannot create INBOX");
! return true;
! }
!
! MailboxCollection boxes = mConnection.User.Mailboxes;
!
! if(boxes[mbxName] != null)
! {
! mConnection.SendTaggedMessage("NO Cannot create duplicate");
! return true;
! }
!
! string soFar = string.Empty;
! string[] parts = mbxName.Split('/');
!
! for(int idx = 0; idx < parts.Length; ++idx)
! {
! soFar += (idx == 0 ? string.Empty : "/") + parts[idx];
! if(idx == parts.Length-1)
! boxes.Add(soFar);
! else
! {
! Mailbox box = boxes[soFar];
! if(box == null)
! boxes.Add(soFar);
! else
! soFar = box.Name;
! }
! }
!
! mConnection.SendTaggedMessage("OK Created");
! return true;
}
}
|
|
From: <ta...@us...> - 2003-07-27 19:33:02
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders
In directory sc8-pr-cvs1:/tmp/cvs-serv29411/src/Common/MailstoreProviders
Modified Files:
IMailstoreProvider.cs XmlMailstoreProvider.cs
Log Message:
CREATE command should work now
Index: IMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/IMailstoreProvider.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** IMailstoreProvider.cs 27 Jul 2003 16:52:19 -0000 1.3
--- IMailstoreProvider.cs 27 Jul 2003 19:32:59 -0000 1.4
***************
*** 33,37 ****
/// </summary>
/// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns>
! Mailbox[] GetMailboxes(User user);
/// <summary>
--- 33,37 ----
/// </summary>
/// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns>
! MailboxCollection GetMailboxes(User user);
/// <summary>
***************
*** 44,48 ****
#region Mailbox modifieres
! bool InsertMailbox(Mailbox mbx);
#endregion
--- 44,48 ----
#region Mailbox modifieres
! bool InsertMailbox(User user, Mailbox mbx);
#endregion
Index: XmlMailstoreProvider.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** XmlMailstoreProvider.cs 27 Jul 2003 16:52:19 -0000 1.4
--- XmlMailstoreProvider.cs 27 Jul 2003 19:33:00 -0000 1.5
***************
*** 50,54 ****
}
! public Mailbox[] GetMailboxes(User user)
{
DataSet ds = new DataSet();
--- 50,54 ----
}
! public MailboxCollection GetMailboxes(User user)
{
DataSet ds = new DataSet();
***************
*** 56,68 ****
DataRow[] rows = ds.Tables[0].Select("UserIdentifier = '" + user.Username + "'");
! Mailbox[] boxes = new Mailbox[rows.Length];
for(int idx = 0; idx < rows.Length; ++idx)
{
DataRow box = 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);
}
! return boxes;
}
--- 56,68 ----
DataRow[] rows = ds.Tables[0].Select("UserIdentifier = '" + user.Username + "'");
! MailboxCollection mbxCollection = new MailboxCollection(this, user);
for(int idx = 0; idx < rows.Length; ++idx)
{
DataRow box = rows[idx];
! mbxCollection.Add(new Mailbox(this, box["Name"] as string, box["FullName"] as string, uint.Parse(box["NextUniqueId"] as string), uint.Parse(box["UniqueIdValidity"] as string), user));
}
! return mbxCollection;
}
***************
*** 74,78 ****
#region Mailbox modifieres
! public bool InsertMailbox(Mailbox mbx)
{
DataSet ds = new DataSet();
--- 74,78 ----
#region Mailbox modifieres
! public bool InsertMailbox(User user, Mailbox mbx)
{
DataSet ds = new DataSet();
***************
*** 81,84 ****
--- 81,85 ----
DataRow newMbx = ds.Tables[0].NewRow();
+ newMbx["UserIdentifier"] = user.Username;
newMbx["Name"] = mbx.Name;
newMbx["FullName"] = mbx.Name;
|