[csmaild-cvs] csmaild/src/Imap/Commands CreateCommand.cs,1.4,1.5
Brought to you by:
tamc
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; } } |