Thread: [csmaild-cvs] csmaild/src/Common/MailstoreProviders IMailstoreProvider.cs,1.1,1.2 XmlMailstoreProvid
Brought to you by:
tamc
From: <ta...@us...> - 2003-07-25 03:39:16
|
Update of /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders In directory sc8-pr-cvs1:/tmp/cvs-serv31506/src/Common/MailstoreProviders Modified Files: IMailstoreProvider.cs XmlMailstoreProvider.cs Log Message: Long time, no commit. Upgraded to VS.NET 2003 Lots of code changes, still pre-pre-pre-alpha, so who's keeping track Removed LOGINDISABLED from CAPABILITY response as well, it's not disabled Index: IMailstoreProvider.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/IMailstoreProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IMailstoreProvider.cs 24 Jul 2003 04:32:14 -0000 1.1 --- IMailstoreProvider.cs 25 Jul 2003 03:39:12 -0000 1.2 *************** *** 8,23 **** public interface IMailstoreProvider { /// <summary> ! /// Gets the mailbox with the specified absolute path /// </summary> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> ! Mailbox GetMailbox(string absoluteHiearchicalName); /// <summary> ! /// Gets all the mailboxes that are in the mail store /// </summary> /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> ! Mailbox[] GetMailboxes(); /// <summary> --- 8,35 ---- public interface IMailstoreProvider { + #region User accessors /// <summary> ! /// Gets the user with the login info /// </summary> + /// <param name="username">The username of the user</param> + /// <param name="password">The accessing password for this user</param> + /// <returns>The user with the username and password</returns> + User GetUser(string username, string password); + #endregion + + #region Mailbox accessors + /// <summary> + /// Gets the mailbox with the specified absolute path for a particular user + /// </summary> + /// <param name="user">The user that owns this mailbox</param> /// <param name="absoluteHiearchicalName">The absolute path of the mailbox to retreive</param> /// <returns>The mailbox or null if not found</returns> ! Mailbox GetMailbox(User user, string absoluteHiearchicalName); /// <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> ! Mailbox[] GetMailboxes(User user); /// <summary> *************** *** 27,31 **** --- 39,45 ---- /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Mailbox[] GetMailboxes(Mailbox parent); + #endregion + #region Message accessors /// <summary> /// Gets the message *************** *** 42,45 **** --- 56,60 ---- /// <returns>An array containing the mailboxes (valid array of size 0 if none)</returns> Message[] GetMessages(Mailbox box); + #endregion } } Index: XmlMailstoreProvider.cs =================================================================== RCS file: /cvsroot/csmaild/csmaild/src/Common/MailstoreProviders/XmlMailstoreProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XmlMailstoreProvider.cs 24 Jul 2003 04:32:14 -0000 1.1 --- XmlMailstoreProvider.cs 25 Jul 2003 03:39:12 -0000 1.2 *************** *** 16,20 **** } ! public Mailbox GetMailbox(string absoluteHiearchicalName) { DataSet ds = new DataSet(); --- 16,39 ---- } ! #region User accessors ! 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) ! return null; ! ! DataRow user = users[0]; ! if((user["Password"] as string) == password) ! return new User(this, username, password); ! else ! return null; ! } ! #endregion ! ! #region Mailbox accessors ! public Mailbox GetMailbox(User user, string absoluteHiearchicalName) { DataSet ds = new DataSet(); *************** *** 26,33 **** DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } ! public Mailbox[] GetMailboxes() { DataSet ds = new DataSet(); --- 45,52 ---- DataRow box = boxes[0]; ! return new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } ! public Mailbox[] GetMailboxes(User user) { DataSet ds = new DataSet(); *************** *** 39,43 **** { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string)); } --- 58,62 ---- { DataRow box = ds.Tables[0].Rows[idx]; ! boxes[idx] = new Mailbox(this, box["Name"] as string, box["FullName"] as string, int.Parse(box["NextUniqueId"] as string), int.Parse(box["UniqueIdValidity"] as string), user); } *************** *** 49,53 **** --- 68,74 ---- return null; } + #endregion + #region Message accessors public Message GetMessage(Mailbox box, int uniqueId) { *************** *** 57,62 **** public Message[] GetMessages(Mailbox box) { ! return null; } } } --- 78,96 ---- 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]; ! ! for(int idx = 0; idx < messages.Length; ++idx) ! { ! DataRow message = messages[idx]; ! msgs[idx] = new Message(this, int.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())); ! } ! ! return msgs; } + #endregion } } |