Update of /cvsroot/csmaild/csmaild/src/Common
In directory sc8-pr-cvs1:/tmp/cvs-serv29411/src/Common
Modified Files:
Common.csproj User.cs
Added Files:
MailboxCollection.cs
Log Message:
CREATE command should work now
--- NEW FILE: MailboxCollection.cs ---
using Common.MailstoreProviders;
using System;
using System.Collections;
namespace Common
{
/// <summary>
/// Custom class representing a mailbox collection
/// </summary>
public class MailboxCollection : IEnumerable
{
private User mUser;
private ArrayList mIndexedList = new ArrayList();
private Hashtable mNamedList = new Hashtable();
private IMailstoreProvider mProvider;
internal MailboxCollection(IMailstoreProvider provider, User usr)
{
mProvider = provider;
mUser = usr;
}
public Mailbox this[int idx]
{
get
{
return (Mailbox)mIndexedList[idx];
}
}
public Mailbox this[string name]
{
get
{
return (Mailbox)mNamedList[name.ToUpper()];
}
}
internal void Add(Mailbox box)
{
mIndexedList.Add(box);
mNamedList.Add(box.Name.ToUpper(), box);
}
public Mailbox Add(string name)
{
// 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;
}
#region IEnumerable
public IEnumerator GetEnumerator()
{
return mIndexedList.GetEnumerator();
}
#endregion
}
}
Index: Common.csproj
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/Common.csproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Common.csproj 25 Jul 2003 03:39:12 -0000 1.3
--- Common.csproj 27 Jul 2003 19:32:58 -0000 1.4
***************
*** 100,103 ****
--- 100,108 ----
/>
<File
+ RelPath = "MailboxCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "Message.cs"
SubType = "Code"
Index: User.cs
===================================================================
RCS file: /cvsroot/csmaild/csmaild/src/Common/User.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** User.cs 25 Jul 2003 03:39:12 -0000 1.1
--- User.cs 27 Jul 2003 19:32:58 -0000 1.2
***************
*** 13,16 ****
--- 13,17 ----
private string mUsername;
private string mPassword;
+ private MailboxCollection mMailboxes;
#endregion
***************
*** 38,46 ****
}
! public Mailbox[] Mailboxes
{
get
{
! return mMailstoreProvider.GetMailboxes(this);
}
}
--- 39,49 ----
}
! public MailboxCollection Mailboxes
{
get
{
! if(mMailboxes == null)
! mMailboxes = mMailstoreProvider.GetMailboxes(this);
! return mMailboxes;
}
}
|