[Csmail-patches] CVS: csmail/src/CSMail ChangeLog,1.45,1.46 HeaderList.cs,1.5,1.6 MimeBodyPart.cs,1.
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-09-24 08:34:55
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv20226 Modified Files: ChangeLog HeaderList.cs MimeBodyPart.cs MimeMultipart.cs Multipart.cs Log Message: 2002-09-24 * HeaderList.cs : this[string] { get; set; } - Stubbed : ctor(StreamReader) - Stubbed * MimeBodyPart.cs : Change in implementation of some properties. Now make use of Headers, instead of PartState. : Some change in documentation. * MimeMultipart.cs : ctor(StreamReader) - Stubbed : CreateMimeBodyPart(...) - Implemented : CreateHeaders(...) - Implemented. : UpdateHeaders() - Removed * Multipart.cs : UpdateHeaders() - Implemented Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- ChangeLog 24 Sep 2002 06:37:20 -0000 1.45 +++ ChangeLog 24 Sep 2002 08:34:52 -0000 1.46 @@ -1,4 +1,17 @@ +2002-09-24 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * HeaderList.cs : this[string] { get; set; } - Stubbed + : ctor(StreamReader) - Stubbed + * MimeBodyPart.cs : Change in implementation of some properties. + Now make use of Headers, instead of PartState. + : Some change in documentation. + * MimeMultipart.cs : ctor(StreamReader) - Stubbed + : CreateMimeBodyPart(...) - Implemented + : CreateHeaders(...) - Implemented. + : UpdateHeaders() - Removed + * Multipart.cs : UpdateHeaders() - Implemented + 2002-09-17 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * MimeBodyPart.cs : Documented. And raised doubts and questions. Index: HeaderList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/HeaderList.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- HeaderList.cs 19 Sep 2002 08:16:15 -0000 1.5 +++ HeaderList.cs 24 Sep 2002 08:34:52 -0000 1.6 @@ -11,6 +11,7 @@ using System; using System.Collections; using System.Collections.Specialized; +using System.IO; namespace CSMail { @@ -38,6 +39,12 @@ headers.Add(header); } + [MailTODO] + public HeaderList(StreamReader reader) + { + throw new NotImplementedException(); + } + /// <summary> /// Creates a list with a given set of headers. /// </summary> @@ -103,6 +110,32 @@ set { headers[index] = value; + } + } + + /// <summary> + /// Gets or gets the header with given name. + /// </summary> + /// <param name="name">The header name.</param> + /// <value> + /// The string representation of the value, along + /// with parameters, if any. + /// </value> + /// <remarks> + /// If more than one key exist, all will be removed and + /// only one with the provided name and value will be + /// created. + /// </remarks> + [MailTODO] + public string this[string name] + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); } } Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MimeBodyPart.cs 24 Sep 2002 06:37:20 -0000 1.4 +++ MimeBodyPart.cs 24 Sep 2002 08:34:52 -0000 1.5 @@ -62,6 +62,10 @@ /// <summary> /// Returns the size of the part in bytes. /// </summary> + /// <value> + /// The size of the headers plus the size of body + /// (the actual message), in bytes, for this body part. + /// </value> [MailTODO] public override int Size { @@ -129,7 +133,7 @@ } /// <summary> - /// Gets or sets the value of "Description" header. + /// Gets or sets the value of "Content-Description" header. /// </summary> /// <remarks> /// I will changed the implementation to read from or @@ -140,14 +144,11 @@ { get { - object o = PartState["Description"]; - if(o != null) - return (string)o; - return String.Empty; + return Headers["Content-Description"]; } set { - PartState["Description"] = value; + Headers["Content-Description"] = value; } } @@ -180,92 +181,63 @@ /// Gets or sets the value of filename associated with this part, /// if any. /// </summary> - /// <remarks> - /// I will changed the implementation to read from or - /// write to the headers of this part, and not as a part - /// of the PartState. - /// </remarks> public override string Filename { get { - object o = PartState["Filename"]; - if(o != null) - return (string)o; - return String.Empty; + return Headers["Content-Description"]; } set { - PartState["Filename"] = value; + Headers["Content-Description"] = value; } } /// <summary> /// Gets or sets the value of "Content-ID" header. /// </summary> - /// <remarks> - /// I will changed the implementation to read from or - /// write to the headers of this part, and not as a part - /// of the PartState. - /// </remarks> public virtual string ContentID { get { - object o = PartState["ContentID"]; - if(o != null) - return (string)o; - return String.Empty; + return Headers["Content-ID"]; } set { - PartState["ContentID"] = value; + Headers["Content-ID"] = value; } } /// <summary> /// Gets or sets the value of "Content-Language" header. /// </summary> - /// <remarks> - /// I will changed the implementation to read from or - /// write to the headers of this part, and not as a part - /// of the PartState. - /// </remarks> public virtual string ContentLanguage { get { - object o = PartState["ContentLanguage"]; - if(o != null) - return (string)o; - return String.Empty; + return Headers["Content-Language"]; } set { - PartState["ContentLanguage"] = value; + Headers["Content-Language"] = value; } } /// <summary> /// Gets or sets the value of "Content-MD5" header. /// </summary> - /// <remarks> - /// I will changed the implementation to read from or - /// write to the headers of this part, and not as a part - /// of the PartState. - /// </remarks> + /// <value> + /// The value of "Content-MD5" header. + /// </value> public virtual string ContentMD5 { get { - object o = PartState["ContentMD5"]; - if(o != null) - return (string)o; - return String.Empty; + return Headers["Content-MD5"]; } set { - PartState["ContentMD5"] = value; + Headers["Content-MD5"] = value; } } @@ -273,6 +245,9 @@ /// Gets or sets the value of text for a body /// whose "ContentType" is "text/plain". /// </summary> + /// <value> + /// The body of the message (of this body part). + /// </value> public virtual string Text { get @@ -291,6 +266,9 @@ /// <summary> /// Gets or sets the value of "Transfer-Encoding" header. /// </summary> + /// <value> + /// The transfer encoding for the body part. + /// </value> /// <remarks> /// I will changed the implementation to read from or /// write to the headers of this part, and not as a part Index: MimeMultipart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMultipart.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MimeMultipart.cs 24 Sep 2002 06:37:20 -0000 1.6 +++ MimeMultipart.cs 24 Sep 2002 08:34:52 -0000 1.7 @@ -22,11 +22,19 @@ { } + [MailTODO] public MimeMultipart(string subPart) { isParsed = true; CType = new ContentType("multipart", subPart); // Have to set a new Boundary Value; + throw new NotImplementedException(); + } + + [MailTODO] + public MimeMultipart(StreamReader reader) + { + throw new NotImplementedException(); } public string SubType @@ -54,12 +62,12 @@ } /// <summary> - /// See remarks + /// See remarks. /// </summary> /// <remarks> /// <para> /// I have to get raw data (stream) from somewhere. - /// Not this makes me think over the issue of + /// Now this makes me think over the issue of /// a DataSource. Do I need it now? /// </para> /// <para> @@ -73,43 +81,61 @@ [MailTODO] protected override void ParseBodyParts() { - throw new NotImplementedException(); + if(!isParsed) + { + throw new NotImplementedException(); + } } [MailTODO] - protected virtual void UpdateHeaders() - { - throw new NotImplementedException(); - } - - [MailTODO] public override void WriteTo(StreamWriter writer) { throw new NotImplementedException(); } - [MailTODO] + /// <summary> + /// Creates an instance of <see cref="MimeBodyPart"/> + /// from the provided stream. + /// </summary> + /// <param name="reader"> + /// The input stream to be parsed to generate the body part. + /// </param> + /// <returns> + /// <see cref="MimeBodyPart"/> derived from the provided stream. + /// </returns> protected virtual MimeBodyPart CreateMimeBodyPart(StreamReader reader) { - throw new NotImplementedException(); + return new MimeBodyPart(reader); } - [MailTODO] + /// <summary> + /// Creates an instance of <see cref="MimeBodyPart"/> from the + /// provided list of headers and specified content. + /// </summary> + /// <param name="headers">The headers for the part.</param> + /// <param name="content">Content for the part.</param> + /// <returns> + /// <see cref="MimeBodyPart"/> derived out of the provided + /// headers and given content. + /// </returns> protected virtual MimeBodyPart CreateMimeBodyPart(HeaderList headers, byte[] content) { - throw new NotImplementedException(); + return new MimeBodyPart(headers, content); } - [MailTODO] + /// <summary> + /// Creates an instance of <see cref="HeaderList"/> + /// from the provided stream. + /// </summary> + /// <param name="reader"> + /// The input stream to be parsed to generate the header list. + /// </param> + /// <returns> + /// <see cref="HeaderList"/> derived from the provided stream. + /// </returns> protected virtual HeaderList CreateHeaders(StreamReader reader) { - throw new NotImplementedException(); - } - - [MailTODO] - protected virtual void Parse() - { - throw new NotImplementedException(); + return new HeaderList(reader); } } } Index: Multipart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Multipart.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Multipart.cs 13 Sep 2002 06:10:59 -0000 1.5 +++ Multipart.cs 24 Sep 2002 08:34:52 -0000 1.6 @@ -118,5 +118,16 @@ /// But from where and how? /// </remarks> protected abstract void ParseBodyParts(); + + protected virtual void UpdateHeaders() + { + for(int i = 0; i < BodyParts.Count; i++) + { + if(BodyParts[i] is MimeBodyPart) + { + ((MimeBodyPart)BodyParts[i]).UpdateHeaders(); + } + } + } } } |