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