[csmaild-cvs] csmaild/src/Imap Connection.cs,1.8,1.9 Imap.csproj,1.7,1.8 Server.cs,1.7,1.8
Brought to you by:
tamc
|
From: <ta...@us...> - 2003-08-03 01:08:41
|
Update of /cvsroot/csmaild/csmaild/src/Imap
In directory sc8-pr-cvs1:/tmp/cvs-serv17718/src/Imap
Modified Files:
Connection.cs Imap.csproj Server.cs
Log Message:
Support for UID commands
Working COPY command
Index: Connection.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Connection.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Connection.cs 1 Aug 2003 22:02:37 -0000 1.8
--- Connection.cs 3 Aug 2003 01:08:38 -0000 1.9
***************
*** 32,35 ****
--- 32,36 ----
private string mCurrentTag; // the current tag sent in the most recent command
private ImapCommand mCurrentCommand; // the current command being processed
+ private bool mCurrentCommandUID; // whether the current command started with UID
private string mCurrentArguments; // the un-parsed arguments for the currently processing command
***************
*** 138,142 ****
if(idxTagEnd == -1) // this would mean that there isn't a space, just call it a missing tag
{
! SendUntaggedMessage("BAD"); // missing tag
return false;
}
--- 139,143 ----
if(idxTagEnd == -1) // this would mean that there isn't a space, just call it a missing tag
{
! SendUntaggedMessage("BAD Missing tag"); // missing tag
return false;
}
***************
*** 145,175 ****
if(!CommandPart.ValidateTagCharacters(mCurrentTag)) // uh oh, bad client, bad client, no supper for you
{
! SendTaggedMessage("BAD"); // tag contains invalid characters
return false;
}
// parse and validate command
string cmd;
! int idxCommandEnd = line.IndexOf(' ', idxTagEnd+1);
if(idxCommandEnd == -1) // nothing after the command
{
! cmd = line.Substring(idxTagEnd+1).ToUpper(); // one space past the tag til the end
mCurrentArguments = string.Empty; // no arguments
}
else
{
! cmd = line.Substring(idxTagEnd+1, idxCommandEnd-idxTagEnd-1).ToUpper(); // one space past tag til the next space
mCurrentArguments = line.Substring(idxCommandEnd); // args will include the preceding space
}
! mCurrentCommand = (ImapCommand)Server.Commands[cmd];
if(mCurrentCommand == null)
{
! SendTaggedMessage("BAD"); // command not found
return false;
}
! mCurrentCommand.Initialize(mCurrentArguments, this);
if(!mCurrentCommand.ValidateState())
--- 146,190 ----
if(!CommandPart.ValidateTagCharacters(mCurrentTag)) // uh oh, bad client, bad client, no supper for you
{
! SendTaggedMessage("BAD Tag has invalid characters"); // tag contains invalid characters
return false;
}
+ ++idxTagEnd;
+
+ if(line.Substring(idxTagEnd, 4).ToUpper() == "UID ")
+ {
+ mCurrentCommandUID = true;
+ idxTagEnd+=4;
+ }
+ else
+ mCurrentCommandUID = false;
+
// parse and validate command
string cmd;
! int idxCommandEnd = line.IndexOf(' ', idxTagEnd);
if(idxCommandEnd == -1) // nothing after the command
{
! cmd = line.Substring(idxTagEnd).ToUpper(); // one space past the tag til the end
mCurrentArguments = string.Empty; // no arguments
}
else
{
! cmd = line.Substring(idxTagEnd, idxCommandEnd-idxTagEnd).ToUpper(); // one space past tag til the next space
mCurrentArguments = line.Substring(idxCommandEnd); // args will include the preceding space
}
! if(mCurrentCommandUID)
! mCurrentCommand = (ImapCommand)Server.UidCommands[cmd];
! else
! mCurrentCommand = (ImapCommand)Server.Commands[cmd];
!
if(mCurrentCommand == null)
{
! SendTaggedMessage("BAD Command not found"); // command not found
return false;
}
! mCurrentCommand.Initialize(mCurrentArguments, this, mCurrentCommandUID);
if(!mCurrentCommand.ValidateState())
Index: Imap.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Imap.csproj,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Imap.csproj 29 Jul 2003 00:46:29 -0000 1.7
--- Imap.csproj 3 Aug 2003 01:08:38 -0000 1.8
***************
*** 225,233 ****
/>
<File
- RelPath = "Commands\UidCommand.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
RelPath = "Commands\UnsubscribeCommand.cs"
SubType = "Code"
--- 225,228 ----
Index: Server.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Imap/Server.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Server.cs 27 Jul 2003 17:26:22 -0000 1.7
--- Server.cs 3 Aug 2003 01:08:38 -0000 1.8
***************
*** 17,20 ****
--- 17,21 ----
private Hashtable mImapConnections = new Hashtable();
private Hashtable mImapCommands = new Hashtable();
+ private Hashtable mUidImapCommands = new Hashtable();
private IMailstoreProvider mMailstoreProvider;
***************
*** 22,27 ****
{
mNetwork = new NetworkManager.NetworkManager();
- mImapConnections = new Hashtable();
-
mMailstoreProvider = provider;
--- 23,26 ----
***************
*** 50,55 ****
mImapCommands.Add("STORE", new StoreCommand(this));
mImapCommands.Add("SUBSCRIBE", new SubscribeCommand(this));
- mImapCommands.Add("UID", new UidCommand(this));
mImapCommands.Add("UNSUBSCRIBE", new UnsubscribeCommand(this));
#endregion
}
--- 49,58 ----
mImapCommands.Add("STORE", new StoreCommand(this));
mImapCommands.Add("SUBSCRIBE", new SubscribeCommand(this));
mImapCommands.Add("UNSUBSCRIBE", new UnsubscribeCommand(this));
+
+ mUidImapCommands.Add("COPY", mImapCommands["COPY"]);
+ mUidImapCommands.Add("FETCH", mImapCommands["FETCH"]);
+ mUidImapCommands.Add("STORE", mImapCommands["STORE"]);
+ mUidImapCommands.Add("SEARCH", mImapCommands["SEARCH"]);
#endregion
}
***************
*** 76,79 ****
--- 79,90 ----
{
return mImapCommands;
+ }
+ }
+
+ public Hashtable UidCommands
+ {
+ get
+ {
+ return mUidImapCommands;
}
}
|