csmail-patches Mailing List for CS Mail API (Page 2)
Status: Pre-Alpha
Brought to you by:
mastergaurav
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(36) |
Aug
(25) |
Sep
(49) |
Oct
(28) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gaurav V. <mas...@us...> - 2002-10-09 07:09:36
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv13578 Modified Files: ChangeLog ContentType.cs EMailAddress.cs MimeBodyPart.cs ParameterList.cs Provider.cs Log Message: 2002-10-09 * ContentType.cs : ctor(string) - Implemented. : ctor(string, string) - Primary type cannot be null or empty. : SubType - Defaults to "*". : GetHashCode() - New definition. : ParameterList - Made writable. : operators ==, !=, : Equals(object), : Equals(ContentType), : Equals(string), : GetHashCode(), : ToString() - Revamp. * EMailAddress.cs : operators ==, !=, : Equals(IAddress), : Equals(object) - Revamp. : Equals(EMailAddress)- Implemented. * MimeBodyPart.cs : Fixed documentation bug. * ParameterList.cs : operators ==, != - Implemented. : Equals(...) - Implemented. : GetHashCode() - Implemented. : ToString() - Added space between two parameters. : ctor(string) - Stubbed. * Provider.cs : operators ==, !=, : Equals(object) - Revamp. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- ChangeLog 8 Oct 2002 12:30:56 -0000 1.55 +++ ChangeLog 9 Oct 2002 07:09:30 -0000 1.56 @@ -1,4 +1,32 @@ +2002-10-09 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * ContentType.cs : ctor(string) - Implemented. + : ctor(string, string) + - Primary type cannot be null or empty. + : SubType - Defaults to "*". + : GetHashCode() - New definition. + : ParameterList - Made writable. + : operators ==, !=, + : Equals(object), + : Equals(ContentType), + : Equals(string), + : GetHashCode(), + : ToString() - Revamp. + * EMailAddress.cs : operators ==, !=, + : Equals(IAddress), + : Equals(object) - Revamp. + : Equals(EMailAddress)- Implemented. + * MimeBodyPart.cs : Fixed documentation bug. + * ParameterList.cs : operators ==, != - Implemented. + : Equals(...) - Implemented. + : GetHashCode() - Implemented. + : ToString() + - Added space between two parameters. + : ctor(string) - Stubbed. + * Provider.cs : operators ==, !=, + : Equals(object) - Revamp. + 2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * ContentType.cs : Tokens - Removed member. Index: ContentType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ContentType.cs 8 Oct 2002 12:29:09 -0000 1.7 +++ ContentType.cs 9 Oct 2002 07:09:30 -0000 1.8 @@ -32,6 +32,10 @@ /// </summary> public ContentType(string primary, string sub) { + if(primary == null || primary.Length == 0) + { + throw new ArgumentException("[ContentType] Primary type cannot be empty"); + } primaryType = primary; subType = sub; parameters = new ParameterList(); @@ -45,6 +49,10 @@ /// </summary> public ContentType(string primary, string sub, ParameterList parameters) { + if(primary == null || primary.Length == 0) + { + throw new ArgumentException("[ContentType] Primary type cannot be empty"); + } primaryType = primary; subType = sub; if(parameters != null) @@ -56,6 +64,11 @@ } } + /// <summary> + /// Creates an insance with the + /// <paramref name="headerValue"/> as read in + /// "Content-Type" header. + /// </summary> /// <remarks> /// <code> /// <paramref name="headerValue"/> := primarytype '/' subtype [plist] @@ -63,17 +76,47 @@ /// params := key '=' value /// </code> /// </remarks> - [MailTODO] + /// <param name="headerValue">The value of the header + /// "Content-Type". + /// </param> + /// <exception name="ParseException"> + /// <para> + /// When provided with invalid format header value. + /// </para> + /// </exception> public ContentType(string headerValue) { HeaderTokenizer ht = new HeaderTokenizer(headerValue, Constants.MIMEDelimiters); - throw new NotImplementedException(); + HeaderToken token = ht.Next; + if(token.TokenType != HeaderTokenType.Atom) + { + throw new ParseException("[ContentType] Cannot locate primary type"); + } + PrimaryType = token.Value; + + token = ht.Next; + if(token.Value[0] != '/') + { + throw new ParseException("[ContentType] Invalid content type declaration"); + } + + token = ht.Next; + if(token.TokenType != HeaderTokenType.Atom) + { + throw new ParseException("[ContentType] Cannot locate subtype"); + } + SubType = token.Value; + + Parameters = new ParameterList(ht.Remainder); } /// <summary> - /// Gets the primary type of the content. + /// Gets or sets the primary type of the content. /// </summary> + /// <value> + /// The primary-type associated with the content. + /// </value> /// <remarks> /// Returns an empty string, if a <b>null</b> was set /// </remarks> @@ -92,10 +135,14 @@ } /// <summary> - /// Returns the sub-type of the content. + /// Gets or sets the sub-type of the content. /// </summary> + /// <value> + /// The sub-type associated with the content. + /// </value> /// <remarks> - /// Returns an empty string, if a <b>null</b> was set + /// Returns a "*", if a <see langword="null"/> + /// was set. /// </remarks> public string SubType { @@ -103,7 +150,7 @@ { if(subType != null) return subType; - return String.Empty; + return "*"; } set { @@ -112,32 +159,89 @@ } /// <summary> - /// Returns the parameters. + /// Gets or sets the parameters. /// </summary> + /// <value> + /// The extra parameters associated with the + /// "Content-Type" header. + /// </value> public ParameterList Parameters { get { return parameters; } + set + { + parameters = value; + } } + /// <summary> + /// Compares two <see cref="T:CSMail.ContentType"/> + /// objects. + /// </summary> + /// <returns> + /// <see langword="true"/> if they represent the same + /// content type, <see langword="false"/> otherwise. + /// </returns> + /// <remarks> + /// <para> + /// Comparision is made on the basis of + /// primary type and subtype only. + /// </para> + /// <para> + /// It is however important to note that if subtype of + /// any one of them have a subtype "*", it + /// will match any subtype. + /// </para> + /// </remarks> + /// <param name="left">Operand on the left side of + /// the operator.</param> + /// <param name="right">Operand on the right side of + /// the operator.</param> public static bool operator == (ContentType left, ContentType right) { - if(left == null && right == null) + if((object)left == (object)right) return true; - if(left == null || right == null) + if(null == (object)left || null == (object)right) return false; bool retVal = true; retVal &= (String.Compare(left.PrimaryType, right.PrimaryType, false) == 0); - retVal &= (String.Compare(left.SubType, + if(left.SubType[0] == '*' || right.SubType[0] == '*') + return retVal; + + retVal &= (String.Compare(left.SubType, right.SubType, false) == 0); return retVal; } + /// <summary> + /// Compares two <see cref="T:CSMail.ContentType"/> + /// objects. + /// </summary> + /// <returns> + /// <see langword="true"/> if they represent the same + /// content type, <see langword="false"/> otherwise. + /// </returns> + /// <remarks> + /// <para> + /// Comparision is made on the basis of + /// primary type and subtype only. + /// </para> + /// <para> + /// It is however important to note that if subtype of + /// any one of them have a subtype "*", it + /// will match any subtype. + /// </para> + /// </remarks> + /// <param name="left">Operand on the left side of + /// the operator.</param> + /// <param name="right">Operand on the right side of + /// the operator.</param> public static bool operator != (ContentType left, ContentType right) { return !(left == right); @@ -151,12 +255,19 @@ /// <see cref="T:CSMail.ContentType"/> or /// <see cref="T:System.String"/>. /// </remarks> + /// <param name="obj">Object to match with.</param> public override bool Equals(object obj) { + if(null == obj) + { + return false; + } + if(obj is ContentType) { return Equals((ContentType)obj); } + if(obj is string) { return Equals((string)obj); @@ -169,11 +280,12 @@ /// </summary> /// <param name="cType">Content type to check /// against.</param> + /// <param name="cType">Object to match with.</param> public bool Equals(ContentType cType) { - if(cType != null) + if(null != (Object)cType) { - return Equals(cType.ToString()); + return (this == cType); } return false; } @@ -182,9 +294,31 @@ /// Checks for the equality with a string representation /// of the object. /// </summary> + /// <remarks> + /// This method is quite different in behaviour from othe + /// related methods and operators in that it checks also + /// for the equality of parameters. + /// </remarks> + /// <param name="cType">String representation of the + /// content type to matched with. + /// </param> public bool Equals(string cType) { - return (cType.Equals(this.ToString())); + if(cType == null || cType.Length == 0) + return false; + + try + { + ContentType that = new ContentType(cType); + if(this == that) + return false; + if(this.Parameters != that.Parameters) + return false; + } catch(ParseException) + { + return false; + } + return true; } /// <summary> @@ -199,13 +333,12 @@ public override string ToString() { string retVal; - retVal = primaryType; - if(primaryType != "") - retVal += "/"; + retVal = PrimaryType; + retVal += "/"; retVal += SubType; - if(retVal != "" && parameters!=null) + if(parameters!=null) { - retVal += ";"; + retVal += " ; "; retVal += parameters.ToString(); } return retVal; @@ -216,7 +349,7 @@ /// </summary> public override int GetHashCode() { - return (primaryType.GetHashCode() + subType.GetHashCode()); + return ToString().GetHashCode(); } } } Index: EMailAddress.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddress.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EMailAddress.cs 6 Sep 2002 09:30:27 -0000 1.4 +++ EMailAddress.cs 9 Oct 2002 07:09:30 -0000 1.5 @@ -112,16 +112,33 @@ /// </remarks> public bool Equals(IAddress address) { - if(address is EMailAddress) + if(address != null && address is EMailAddress) { EMailAddress that = (EMailAddress)address; - if(this.User == that.User && this.Host == that.Host) - return true; + return (this == that); } return false; } /// <summary> + /// Checks for equality with another address. + /// </summary> + /// <param name="address">Address to be compared with.</param> + /// <returns><c>true</c> if they are same, <c>false</c> + /// otherwise.</returns> + /// <remarks> + /// Two email addresses are equal if they share common + /// <c>user</c> and <c>host</c> parts. Comparision is currently + /// case sensitive, which I think <b>is a bug!</b> But right now, + /// I am too clumsy to correct this... will work on it later. + /// But have submitted the bug in the bug-tracker system! + /// </remarks> + public bool Equals(EMailAddress address) + { + return (this == address); + } + + /// <summary> /// Checks for equality with another object. /// </summary> /// <param name="address">Address to be compared with.</param> @@ -136,11 +153,9 @@ /// </remarks> public override bool Equals(object address) { - if(address is EMailAddress) + if(address != null && address is EMailAddress) { - EMailAddress that = (EMailAddress)address; - if(this.User == that.User && this.Host == that.Host) - return true; + return (this == (EMailAddress)address); } return false; } @@ -157,14 +172,15 @@ /// </returns> public static bool operator == (EMailAddress left, EMailAddress right) { - if(left == null && right == null) - { + if((object)left == (object)right) return true; - } - if(left != null && right != null) - { - return left.Equals(right); - } + + if(null == (object)left || null == (object)right) + return false; + + if(left.User == right.User && left.Host == right.Host) + return true; + return false; } Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MimeBodyPart.cs 1 Oct 2002 10:33:20 -0000 1.8 +++ MimeBodyPart.cs 9 Oct 2002 07:09:30 -0000 1.9 @@ -300,7 +300,7 @@ /// confused as to where and when will it be used. /// </para> /// <para> - /// May be just before <see cref="Write(TextWriter)"/> is + /// May be just before <see cref="Write(StreamWriter)"/> is /// called. /// </para> /// </remarks> Index: ParameterList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ParameterList.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ParameterList.cs 30 Sep 2002 04:01:37 -0000 1.3 +++ ParameterList.cs 9 Oct 2002 07:09:30 -0000 1.4 @@ -8,6 +8,7 @@ * (C) Gaurav Vaish (2002) */ +using System; using System.Collections; namespace CSMail @@ -21,6 +22,11 @@ parameters = new Hashtable(); } + public ParameterList(string value) + { + throw new NotImplementedException(); + } + public ParameterList(Parameter parameter) { parameters = new Hashtable(); @@ -77,6 +83,17 @@ Remove(parameter.Name); } + // FIXME: To checking of key should be case insensitive. + // Should I create my own definition of HashTable? + // But wait, why do I need a HashTable? Should a simple + // ArrayList should do? Now, to search in the ArrayList + // would be a difficult job, unless I have a sorted one. + // So, the class that implements such a list, should + // have something like this: + // Hashtable keys := (key, index) + // ArrayList values := (values) + // Now, when I have to search, I use sorted keys, + // and to return the value, I directly acess values[index] public void Remove(string name) { if(parameters.ContainsKey(name)) @@ -91,14 +108,43 @@ return (IEnumerator)(parameters.Keys); } + public static bool operator == (ParameterList left, + ParameterList right) + { + throw new NotImplementedException(); + //if(left == null && right == null) + // return + } + + public static bool operator != (ParameterList left, + ParameterList right) + { + return !(left == right); + } + + public override bool Equals(object obj) + { + if(obj != null && obj is ParameterList) + { + return (this == (ParameterList)obj); + } + return false; + } + + public override int GetHashCode() + { + return ToString().GetHashCode(); + } + public override string ToString() { - string retVal = ""; + string retVal = String.Empty; foreach(string key in this) { retVal += (key + "=\"" + this[key] + "\";"); + retVal += ' '; } - retVal = retVal.Substring(0, retVal.Length - 1); + retVal = retVal.Substring(0, retVal.Length - 2); return retVal; } } Index: Provider.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Provider.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Provider.cs 6 Sep 2002 11:52:29 -0000 1.7 +++ Provider.cs 9 Oct 2002 07:09:30 -0000 1.8 @@ -157,32 +157,28 @@ { if(obj != null && obj is Provider) { - Provider prov = (Provider)obj; - bool retVal = true; - retVal &= (this.assembly == prov.assembly); - retVal &= (this.className == prov.className); - retVal &= (this.protocol == prov.protocol); - retVal &= (this.type == prov.type); - retVal &= (this.vendor == prov.vendor); - retVal &= (this.version == prov.version); - - return retVal; + return (this == (Provider)obj; } return false; } - public static bool operator == (Provider obj1, Provider obj2) + public static bool operator == (Provider left, Provider right) { - if(obj1 == null && obj2 == null) - { + if((object)left == (object)right) return true; - } - if(obj1 != null && obj2 != null) - { - return obj1.Equals(obj2); - } - return false; + if(null == (object)left || null == (object)right) + return false; + + bool retVal = true; + retVal &= (left.assembly == right.assembly); + retVal &= (left.className == right.className); + retVal &= (left.protocol == right.protocol); + retVal &= (left.type == right.type); + retVal &= (left.vendor == right.vendor); + retVal &= (left.version == right.version); + + return retVal; } public static bool operator != (Provider obj1, Provider obj2) |
From: Gaurav V. <mas...@us...> - 2002-10-08 12:30:58
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv18959 Modified Files: ChangeLog Log Message: 2002-10-08 * ContentType.cs : Tokens - Removed member. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- ChangeLog 4 Oct 2002 11:14:42 -0000 1.54 +++ ChangeLog 8 Oct 2002 12:30:56 -0000 1.55 @@ -1,4 +1,8 @@ +2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * ContentType.cs : Tokens - Removed member. + 2002-10-04 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * Constants.cs : RFC822Tokens, |
From: Gaurav V. <mas...@us...> - 2002-10-08 12:29:12
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv17877 Modified Files: ContentType.cs Log Message: 2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * ContentType.cs : Tokens - Removed member. Index: ContentType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ContentType.cs 4 Oct 2002 11:14:42 -0000 1.6 +++ ContentType.cs 8 Oct 2002 12:29:09 -0000 1.7 @@ -9,6 +9,7 @@ */ using System; +using CSMail.Utils; namespace CSMail { @@ -25,27 +26,6 @@ private string subType; private ParameterList parameters; - // :\\\"\t []/?=" - public static readonly char[] Tokens = new char[]{ - '(', - ')', - '<', - '>', - '@', - ',', - ';', - ':', - '\\', - '"', - '\t', - ' ', - '[', - ']', - '/', - '?', - '=' - }; - /// <summary> /// Create an instance with the primary as the <c>PrimaryType</c> /// and sub as the <c>SubType</c> @@ -86,7 +66,8 @@ [MailTODO] public ContentType(string headerValue) { - + HeaderTokenizer ht = new HeaderTokenizer(headerValue, + Constants.MIMEDelimiters); throw new NotImplementedException(); } |
From: Gaurav V. <mas...@us...> - 2002-10-08 12:26:45
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv16737 Modified Files: ChangeLog HeaderToken.cs HeaderTokenType.cs HeaderTokenizer.cs Log Message: 2002-10-08 * HeaderToken.cs, * HeaderTokenizer.cs, * HeaderTokenType.cs : Documentation. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ChangeLog 8 Oct 2002 04:48:42 -0000 1.19 +++ ChangeLog 8 Oct 2002 12:26:42 -0000 1.20 @@ -1,6 +1,12 @@ 2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderToken.cs, + * HeaderTokenizer.cs, + * HeaderTokenType.cs : Documentation. + +2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenizer.cs : line 184. Fixed typo bug. 2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> Index: HeaderToken.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderToken.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HeaderToken.cs 4 Oct 2002 11:13:20 -0000 1.1 +++ HeaderToken.cs 8 Oct 2002 12:26:42 -0000 1.2 @@ -13,11 +13,23 @@ namespace CSMail.Utils { + /// <summary> + /// The class represents the tokens returned + /// by <see cref="T:CSMail.Utils.HeaderTokenizer"/> + /// </summary> + /// <seealso cref="T:CSMail.Utils.HeaderToken"/> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public class HeaderToken { private HeaderTokenType type; private string value; + /// <summary> + /// Creates an instance of <see href="HeaderToken"/>. + /// </summary> + /// <param name="type">The type of the token.</param> + /// <param name="value">The content of the token.</param> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public HeaderToken(HeaderTokenType type, string value) { if(!Enum.IsDefined(typeof(HeaderTokenType), type)) @@ -26,6 +38,13 @@ this.value = value; } + /// <summary> + /// Returns the token type related to this token. + /// </summary> + /// <value> + /// The value is one of + /// <see cref="T:CSMail.Utils.HeaderTokenType"/>. + /// </value> public HeaderTokenType TokenType { get @@ -34,6 +53,13 @@ } } + /// <summary> + /// Returns the data associated with the token. + /// </summary> + /// <value> + /// Contains the value as parsed by + /// <see cref="T:CSMail.Utils.HeaderTokenizer"/>. + /// </value> public string Value { get Index: HeaderTokenType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HeaderTokenType.cs 8 Oct 2002 04:39:33 -0000 1.3 +++ HeaderTokenType.cs 8 Oct 2002 12:26:42 -0000 1.4 @@ -10,13 +10,41 @@ namespace CSMail.Utils { + /// <summary> + /// Enumeration of the various types of tokens available + /// for a <see cref="T:CSMail.Utils.HeaderToken"/> as returned + /// by parsing header by <see cref="T:CSMail.Utils.HeaderTokenizer"/>. + /// </summary> public enum HeaderTokenType { + /// <summary> + /// The token is an atom. + /// </summary> Atom, + /// <summary> + /// The token is a comment. + /// </summary> Comment, + /// <summary> + /// The token is a delimiter. + /// </summary> Delimiter, + /// <summary> + /// The token is end of file. + /// </summary> EOF, + /// <summary> + /// The token is a quoted-string. + /// </summary> QuotedString, + /// <summary> + /// The token type is undefined. + /// </summary> + /// <remarks> + /// <para> + /// This may happen when an illegal token was encountered. + /// </para> + /// </remarks> Undefined } } Index: HeaderTokenizer.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenizer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- HeaderTokenizer.cs 8 Oct 2002 04:45:29 -0000 1.4 +++ HeaderTokenizer.cs 8 Oct 2002 12:26:42 -0000 1.5 @@ -14,6 +14,19 @@ namespace CSMail.Utils { + /// <summary> + /// It tokenizes the RFC822 and MIME headers into basic + /// symbols specified by RFC822 and MIME. + /// </summary> + /// <remarks> + /// <para> + /// This class handles folded headers, the headers with + /// embedded CRLF SPACE sequences. The folds are removed + /// in the returned tokens. + /// </para> + /// </remarks> + /// <seealso cref="T:CSMail.Utils.HeaderToken"/> + /// <seealso cref="T:CSMail.Utils.HeaderTokenType"/> public class HeaderTokenizer { private string content; @@ -29,6 +42,19 @@ HeaderTokenType.EOF, null); + /// <summary> + /// Creates an instance of the object with the given content, + /// delimiters and option to skip comments. + /// </summary> + /// <param name="content">The content or the value of a + /// header.</param> + /// <param name="delimiters">The characters that may serve + /// as delimiters during parsing. If the value is <c>null</c>, it + /// assumes <see cref="P:CSMail.Utils.Constants.RFC822Delimiters"/>. + /// </param> + /// <param name="skipComments">Whether or not to skip comments, + /// embedded inside braces "()". + /// </param> public HeaderTokenizer(string content, string delimiters, bool skipComments) { @@ -43,11 +69,15 @@ this.maximumPosition = content.Length; } + /// <summary> + /// </summary> public HeaderTokenizer(string content, string delimiters) : this(content, delimiters, true) { } + /// <summary> + /// </summary> public HeaderTokenizer(string content) : this(content, null) { } @@ -175,7 +205,7 @@ throw new ParseException("[HeaderTokenizer] Unbalanced quoted string"); } - if(c < ' ' || c >= (char)0xB1 || delimiters.IndexOf(c) >= 0) + if(c < ' ' || c >= (char)0x7F || delimiters.IndexOf(c) >= 0) { currentPosition ++; char[] rv = new char[1]; @@ -190,7 +220,7 @@ while(currentPosition < maximumPosition) { c = content[currentPosition]; - if(c <= ' ' || c >= (char)0xB1 || c == '(' || c == '"' || delimiters.IndexOf(c) >= 0) + if(c <= ' ' || c >= (char)0x7F || c == '(' || c == '"' || delimiters.IndexOf(c) >= 0) break; currentPosition++; } |
From: Gaurav V. <mas...@us...> - 2002-10-08 04:48:45
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv2794 Modified Files: ChangeLog Log Message: 2002-10-08 * ChangeLog : Corrected today's date. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ChangeLog 8 Oct 2002 04:45:29 -0000 1.18 +++ ChangeLog 8 Oct 2002 04:48:42 -0000 1.19 @@ -1,5 +1,5 @@ -2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> +2002-10-08 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * HeaderTokenizer.cs : line 184. Fixed typo bug. |
From: Gaurav V. <mas...@us...> - 2002-10-08 04:45:32
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv1030 Modified Files: ChangeLog HeaderTokenizer.cs Log Message: 2002-10-07 * HeaderTokenizer.cs : line 184. Fixed typo bug. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ChangeLog 8 Oct 2002 04:39:32 -0000 1.17 +++ ChangeLog 8 Oct 2002 04:45:29 -0000 1.18 @@ -1,6 +1,10 @@ 2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenizer.cs : line 184. Fixed typo bug. + +2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenType.cs : Removed member "NotSet". : Added member "Delimiter". * HeaderTokenizer.cs : GetNextToken() - Implemented. Index: HeaderTokenizer.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenizer.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- HeaderTokenizer.cs 8 Oct 2002 04:39:33 -0000 1.3 +++ HeaderTokenizer.cs 8 Oct 2002 04:45:29 -0000 1.4 @@ -181,7 +181,7 @@ char[] rv = new char[1]; rv[0] = c; HeaderTokenType htType = HeaderTokenType.Undefined; - if(defimiters.IndexOf(c) >= 0) + if(delimiters.IndexOf(c) >= 0) htType = HeaderTokenType.Delimiter; return new HeaderToken(htType, new string(rv)); } |
From: Gaurav V. <mas...@us...> - 2002-10-08 04:39:35
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv30738 Modified Files: ChangeLog HeaderTokenType.cs HeaderTokenizer.cs Log Message: 2002-10-07 * HeaderTokenType.cs : Removed member "NotSet". : Added member "Delimiter". * HeaderTokenizer.cs : GetNextToken() - Implemented. : Peek() - Implemented. : Remainder { get; } - Implemented. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ChangeLog 7 Oct 2002 12:56:01 -0000 1.16 +++ ChangeLog 8 Oct 2002 04:39:32 -0000 1.17 @@ -1,6 +1,14 @@ 2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenType.cs : Removed member "NotSet". + : Added member "Delimiter". + * HeaderTokenizer.cs : GetNextToken() - Implemented. + : Peek() - Implemented. + : Remainder { get; } - Implemented. + +2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * HeaderTokenType.cs : Added member "Undefined". * HeaderTokenizer.cs : SkipWhiteSpace(), : ParseToken(string, int, int) Index: HeaderTokenType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- HeaderTokenType.cs 7 Oct 2002 12:56:01 -0000 1.2 +++ HeaderTokenType.cs 8 Oct 2002 04:39:33 -0000 1.3 @@ -12,9 +12,9 @@ { public enum HeaderTokenType { - NotSet, Atom, Comment, + Delimiter, EOF, QuotedString, Undefined Index: HeaderTokenizer.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenizer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- HeaderTokenizer.cs 7 Oct 2002 12:56:01 -0000 1.2 +++ HeaderTokenizer.cs 8 Oct 2002 04:39:33 -0000 1.3 @@ -54,14 +54,17 @@ public HeaderToken Peek() { - throw new NotImplementedException(); + currentPosition = nextPosition; + HeaderToken retVal = GetNextToken(); + peekPosition = currentPosition; + return retVal; } public string Remainder { get { - throw new NotImplementedException(); + return content.Substring(nextPosition); } } @@ -90,10 +93,11 @@ bool waitNext = false; char c; + int start = 0; for( c = content[currentPosition]; c == '('; c = content[currentPosition]) { currentPosition++; - int start = currentPosition; + start = currentPosition; int braceBalance; for(braceBalance = 1; braceBalance > 0 && currentPosition < maximumPosition; @@ -138,7 +142,7 @@ if(c == '"') { - int start = ++currentPosition; + start = ++currentPosition; while(currentPosition < maximumPosition) { c = content[currentPosition]; @@ -170,14 +174,28 @@ } throw new ParseException("[HeaderTokenizer] Unbalanced quoted string"); } - /* - if(c < ' ' || c >= '\177' || delimiters.IndexOf(c) >= 0) + + if(c < ' ' || c >= (char)0xB1 || delimiters.IndexOf(c) >= 0) { currentPosition ++; - char[] ac = + char[] rv = new char[1]; + rv[0] = c; + HeaderTokenType htType = HeaderTokenType.Undefined; + if(defimiters.IndexOf(c) >= 0) + htType = HeaderTokenType.Delimiter; + return new HeaderToken(htType, new string(rv)); + } + + start = currentPosition; + while(currentPosition < maximumPosition) + { + c = content[currentPosition]; + if(c <= ' ' || c >= (char)0xB1 || c == '(' || c == '"' || delimiters.IndexOf(c) >= 0) + break; + currentPosition++; } - */ - throw new NotImplementedException(); + return new HeaderToken(HeaderTokenType.Atom, + content.Substring(start, currentPosition - start)); } private int SkipWhiteSpace() |
From: Gaurav V. <mas...@us...> - 2002-10-07 12:56:04
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv8242 Modified Files: ChangeLog HeaderTokenType.cs HeaderTokenizer.cs Log Message: 2002-10-07 * HeaderTokenType.cs : Added member "Undefined". * HeaderTokenizer.cs : SkipWhiteSpace(), : ParseToken(string, int, int) - Implemented. : GetNextToken() - Partial implementation. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ChangeLog 4 Oct 2002 11:13:20 -0000 1.15 +++ ChangeLog 7 Oct 2002 12:56:01 -0000 1.16 @@ -1,4 +1,12 @@ +2002-10-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * HeaderTokenType.cs : Added member "Undefined". + * HeaderTokenizer.cs : SkipWhiteSpace(), + : ParseToken(string, int, int) + - Implemented. + : GetNextToken() - Partial implementation. + 2002-10-04 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * HeaderTokenizer.cs : Finally, I had to create this class. Index: HeaderTokenType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HeaderTokenType.cs 4 Oct 2002 11:13:20 -0000 1.1 +++ HeaderTokenType.cs 7 Oct 2002 12:56:01 -0000 1.2 @@ -16,6 +16,7 @@ Atom, Comment, EOF, - QuotedString + QuotedString, + Undefined } } Index: HeaderTokenizer.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/HeaderTokenizer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HeaderTokenizer.cs 4 Oct 2002 11:13:20 -0000 1.1 +++ HeaderTokenizer.cs 7 Oct 2002 12:56:01 -0000 1.2 @@ -9,6 +9,7 @@ */ using System; +using System.Text; using CSMail; namespace CSMail.Utils @@ -22,6 +23,11 @@ private int currentPosition = 0; private int nextPosition = 0; private int peekPosition = 0; + private int maximumPosition = 0; + + private static readonly HeaderToken EOFToken = new HeaderToken( + HeaderTokenType.EOF, + null); public HeaderTokenizer(string content, string delimiters, bool skipComments) @@ -30,10 +36,11 @@ { throw new ArgumentNullException("[HeaderTokenizer] Null value to header"); } - this.content = content; + this.content = (content == null ? String.Empty : content); this.skipComments = skipComments; this.delimiters = (delimiters == null ? Constants.RFC822Delimiters : delimiters); + this.maximumPosition = content.Length; } public HeaderTokenizer(string content, string delimiters) @@ -62,13 +69,165 @@ { get { - return GetNextToken(); + currentPosition = nextPosition; + HeaderToken retVal = GetNextToken(); + nextPosition = currentPosition; + peekPosition = currentPosition; + return retVal; } } private HeaderToken GetNextToken() { + if(currentPosition >= maximumPosition) + { + return EOFToken; + } + if(SkipWhiteSpace() < 0) + { + return EOFToken; + } + + bool waitNext = false; + char c; + for( c = content[currentPosition]; c == '('; c = content[currentPosition]) + { + currentPosition++; + int start = currentPosition; + int braceBalance; + for(braceBalance = 1; + braceBalance > 0 && currentPosition < maximumPosition; + currentPosition++) + { + c = content[currentPosition]; + if(c == '\\') + { + currentPosition++; + waitNext = true; + } else if(c == '\r') + { + waitNext = true; + } else if(c == '(') + { + braceBalance++; + } else if(c == ')') + { + braceBalance--; + } + } + + if(braceBalance != 0) + { + throw new ParseException("[HeaderTokenizer] Unbalanced comments"); + } + if(!skipComments) + { + string data = null; + if(waitNext) + { + data = ParseToken(content, start, + currentPosition - 1); + } else + { + data = content.Substring(start, + currentPosition - start); + } + return new HeaderToken(HeaderTokenType.Comment, data); + } + } + + if(c == '"') + { + int start = ++currentPosition; + while(currentPosition < maximumPosition) + { + c = content[currentPosition]; + if(c == '\\') + { + currentPosition++; + waitNext = true; + } else if(c == '\r') + { + currentPosition++; + waitNext = true; + } else if(c == '"') + { + currentPosition++; + string data = null; + if(waitNext) + { + data = ParseToken(content, start, + currentPosition - 1); + } else + { + data = content.Substring(start, + currentPosition - start); + } + return new HeaderToken(HeaderTokenType.QuotedString, + data); + } + currentPosition++; + } + throw new ParseException("[HeaderTokenizer] Unbalanced quoted string"); + } + /* + if(c < ' ' || c >= '\177' || delimiters.IndexOf(c) >= 0) + { + currentPosition ++; + char[] ac = + } + */ throw new NotImplementedException(); + } + + private int SkipWhiteSpace() + { + char c; + while(currentPosition < maximumPosition) + { + c = content[currentPosition]; + if(c != ' ' && c != '\t' && c != '\r' && c != '\n') + return currentPosition; + currentPosition++; + } + return -1; + } + + private string ParseToken(string data, int start, int stop) + { + StringBuilder sb = new StringBuilder(); + bool escape = false; + bool newline = false; + char c; + for(int i = start; i < stop; i++) + { + c = data[i]; + if(c == '\n' && newline) + { + newline = false; + } else + { + newline = false; + if(!escape) + { + if(c == '\\') + { + escape = true; + } else if(c == '\r') + { + newline = true; + } else + { + sb.Append(c); + } + } else + { + sb.Append(c); + escape = false; + } + } + } + return sb.ToString(); } } } |
From: Gaurav V. <mas...@us...> - 2002-10-04 11:14:45
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv11485 Modified Files: Constants.cs ContentType.cs ChangeLog Added Files: ParseException.cs Log Message: 2002-10-04 * Constants.cs : RFC822Tokens, MIMETokens - Added new fields. * CotentType.cs : ctor(string) - Initial implementation. * ParseException.cs : Added new exception class. --- NEW FILE --- /** * Namespace: CSMail * Class: ParseException * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; namespace CSMail { public class ParseException : Exception { public ParseException() : base() { } public ParseException(string message) : base(message) { } } } Index: Constants.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Constants.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Constants.cs 3 Oct 2002 08:58:48 -0000 1.5 +++ Constants.cs 4 Oct 2002 11:14:42 -0000 1.6 @@ -60,6 +60,9 @@ public const char CR = '\r'; public const char LF = '\n'; + public const string RFC822Delimiters = "()<>@,;:\\\"\t []."; + public const string MIMEDelimiters = "()<>@,;:\\\"\t []/?="; + /// <summary> /// Key that holds class-name for store service provider. /// </summary> Index: ContentType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ContentType.cs 30 Sep 2002 04:01:37 -0000 1.5 +++ ContentType.cs 4 Oct 2002 11:14:42 -0000 1.6 @@ -25,6 +25,27 @@ private string subType; private ParameterList parameters; + // :\\\"\t []/?=" + public static readonly char[] Tokens = new char[]{ + '(', + ')', + '<', + '>', + '@', + ',', + ';', + ':', + '\\', + '"', + '\t', + ' ', + '[', + ']', + '/', + '?', + '=' + }; + /// <summary> /// Create an instance with the primary as the <c>PrimaryType</c> /// and sub as the <c>SubType</c> @@ -65,6 +86,7 @@ [MailTODO] public ContentType(string headerValue) { + throw new NotImplementedException(); } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.53 retrieving revision 1.54 diff -u -r1.53 -r1.54 --- ChangeLog 3 Oct 2002 08:58:48 -0000 1.53 +++ ChangeLog 4 Oct 2002 11:14:42 -0000 1.54 @@ -1,4 +1,11 @@ +2002-10-04 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * Constants.cs : RFC822Tokens, + MIMETokens - Added new fields. + * CotentType.cs : ctor(string) - Initial implementation. + * ParseException.cs : Added new exception class. + 2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * Constants.cs : CR, LF - Added new constants. |
From: Gaurav V. <mas...@us...> - 2002-10-04 11:13:25
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv11174 Modified Files: ChangeLog Added Files: HeaderToken.cs HeaderTokenType.cs HeaderTokenizer.cs Log Message: 2002-10-04 * HeaderTokenizer.cs : Finally, I had to create this class. Will need in things like Content-Type, Header etc. * HeaderToken.cs : Completed. * HeaderTokenType.cs : Added enumeration. --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: HeaderToken * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; using CSMail; namespace CSMail.Utils { public class HeaderToken { private HeaderTokenType type; private string value; public HeaderToken(HeaderTokenType type, string value) { if(!Enum.IsDefined(typeof(HeaderTokenType), type)) throw new ArgumentException("[HeaderToken] type parameter has illegal value"); this.type = type; this.value = value; } public HeaderTokenType TokenType { get { return type; } } public string Value { get { return value; } } } } --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: HeaderTokenType * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ namespace CSMail.Utils { public enum HeaderTokenType { NotSet, Atom, Comment, EOF, QuotedString } } --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: HeaderTokenizer * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; using CSMail; namespace CSMail.Utils { public class HeaderTokenizer { private string content; private string delimiters; private bool skipComments; private int currentPosition = 0; private int nextPosition = 0; private int peekPosition = 0; public HeaderTokenizer(string content, string delimiters, bool skipComments) { if(content == null) { throw new ArgumentNullException("[HeaderTokenizer] Null value to header"); } this.content = content; this.skipComments = skipComments; this.delimiters = (delimiters == null ? Constants.RFC822Delimiters : delimiters); } public HeaderTokenizer(string content, string delimiters) : this(content, delimiters, true) { } public HeaderTokenizer(string content) : this(content, null) { } public HeaderToken Peek() { throw new NotImplementedException(); } public string Remainder { get { throw new NotImplementedException(); } } public HeaderToken Next { get { return GetNextToken(); } } private HeaderToken GetNextToken() { throw new NotImplementedException(); } } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ChangeLog 1 Oct 2002 11:48:20 -0000 1.14 +++ ChangeLog 4 Oct 2002 11:13:20 -0000 1.15 @@ -1,4 +1,12 @@ +2002-10-04 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * HeaderTokenizer.cs : Finally, I had to create this class. + Will need in things like Content-Type, + Header etc. + * HeaderToken.cs : Completed. + * HeaderTokenType.cs : Added enumeration. + 2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * UniqueValueGenerator.cs : GenerateMessgeID(Session) |
From: Gaurav V. <mas...@us...> - 2002-10-03 08:58:51
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv4813 Modified Files: Constants.cs Header.cs HeaderList.cs ChangeLog Log Message: 2002-10-01 * Constants.cs : CR, LF - Added new constants. * HeaderList.cs : GetAsHeader(string) - Implemented. : this[string] - Implemented. : ctor(StreamReader) - Implemented. : ConvertDuplicatesToValues() - Implemented. : Add(HeaderList) - Implemented. * Header.cs : ToString() - Uses Constants.CRLF : Value, Values - Made writable. : ctor(StreamReader) - Stubbed. Index: Constants.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Constants.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Constants.cs 1 Oct 2002 10:33:20 -0000 1.4 +++ Constants.cs 3 Oct 2002 08:58:48 -0000 1.5 @@ -55,7 +55,10 @@ /// <summary> /// The standard CRLF (0x13,0x10) value. /// </summary> - public const string CRLF = "\r\f"; + public const string CRLF = "\r\n"; + + public const char CR = '\r'; + public const char LF = '\n'; /// <summary> /// Key that holds class-name for store service provider. Index: Header.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Header.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Header.cs 6 Sep 2002 09:30:27 -0000 1.3 +++ Header.cs 3 Oct 2002 08:58:48 -0000 1.4 @@ -8,6 +8,9 @@ * (C) Gaurav Vaish (2002) */ +using System; +using System.IO; + namespace CSMail { /// <summary> @@ -57,6 +60,50 @@ } } + public Header(StreamReader reader) + { + if(reader == null) + { + throw new ArgumentNullException("[HeaderList] Null value for reader"); + } + + if((char)reader.Peek() == Constants.CR) + { + throw new ArgumentException("[Header] Empty line"); + } + + string valuePart = String.Empty; + string namePart = null; + char c; + int colon; + string lastLine; + while(true) + { + c = (char)reader.Peek(); + if(c != ' ' || c != '\t' && namePart != null) + { + break; + } + + lastLine = reader.ReadLine(); + colon = lastLine.IndexOf(':'); + if(namePart == null && colon < 0) + { + throw new FormatException("[Header] Illegal data format"); + } + + if(namePart == null) + { + namePart = lastLine.Substring(0, colon).Trim(); + valuePart += lastLine.Substring(colon + 1).TrimStart( + new char[] { ' ', '\t'}); + } else + { + valuePart += (Constants.CRLF + lastLine); + } + } + } + /// <summary> /// Returns the header name. /// </summary> @@ -83,6 +130,11 @@ return values[0]; return null; } + set + { + values = new string[1]; + values[0] = value; + } } /// <summary> @@ -94,6 +146,10 @@ { return values; } + set + { + values = value; + } } /// <summary> @@ -113,7 +169,7 @@ string retVal = ""; foreach(string current in Values) { - retVal += (name + ": " + current + "\r\n"); + retVal += (name + ": " + current + Constants.CRLF); } return retVal; } Index: HeaderList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/HeaderList.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- HeaderList.cs 30 Sep 2002 04:01:37 -0000 1.7 +++ HeaderList.cs 3 Oct 2002 08:58:48 -0000 1.8 @@ -22,6 +22,9 @@ { private ArrayList headers = new ArrayList(); + private readonly object lockObj = new object(); + private bool hasConverted = true; + /// <summary> /// Creates an empty list. /// </summary> @@ -39,12 +42,88 @@ headers.Add(header); } - [MailTODO] public HeaderList(StreamReader reader) { + if(reader == null) + { + throw new ArgumentNullException("[HeaderList] Null value for reader"); + } + + int c; + while((char)(c = reader.Peek()) == Constants.CR) + { + c = reader.Read(); + c = reader.Read(); + if((char)c != Constants.LF) + throw new FormatException("[HeaderList] Illegal data in stream"); + } + + while(true) + { + try + { + Add(new Header(reader)); + } catch(ArgumentException) + { + break; + } + } + hasConverted = false; + ConvertDuplicatesToValues(); + } + + private void ConvertDuplicatesToValues() + { + if(!hasConverted) + { + HeaderList temp = new HeaderList(); + string[] keys = GetNames(); + foreach(string cKey in keys) + { + Header[] toAdd = GetHeadersByName(cKey); + if(toAdd != null) + { + temp.Add(ConvertToSingle(toAdd)); + } + } + Clear(); + Add(temp); + hasConverted = true; + } + } + + private Header ConvertToSingle(Header[] headers) + { throw new NotImplementedException(); } + private string[] GetNames() + { + String names = ""; + String lower = ""; + //foreach(Header current in this) + //{ + //if(!lower.IndexOf(':' + + //} + throw new NotImplementedException(); + } + + private Header[] GetHeadersByName(string name) + { + int count = Count; + for(int i = 0; i < count; i++) + { + if(String.Compare(name, this[i].Name, false) == 0) + throw new NotImplementedException(); + } + return null; + } + + private bool IsSpace(char c) + { + return (c == ' ' || c == '\t'); + } + /// <summary> /// Creates a list with a given set of headers. /// </summary> @@ -105,11 +184,17 @@ { get { - return (Header)(headers[index]); + lock(lockObj) + { + return (Header)(headers[index]); + } } set { - headers[index] = value; + lock(lockObj) + { + headers[index] = value; + } } } @@ -126,23 +211,44 @@ /// only one with the provided name and value will be /// created. /// </remarks> - [MailTODO] public string this[string name] { get { - throw new NotImplementedException(); + Header toSearch = GetHeaderByName(name, false); + if(toSearch != null) + { + return toSearch.Values[0]; + } + return null; } set { - throw new NotImplementedException(); + Header toReplace = GetHeaderByName(name, false); + if(toReplace != null) + { + toReplace.Value = value; + } else + { + Add(new Header(name, value)); + } } } - [MailTODO] public Header[] GetAsHeader(string name) { - throw new NotImplementedException(); + Header toSearch = GetHeaderByName(name, false); + if(toSearch != null && toSearch.Values != null && + toSearch.Values.Length > 0) + { + Header[] retVal = new Header[toSearch.Values.Length]; + for(int i = 0; i < toSearch.Values.Length; i++) + { + retVal[i] = new Header(toSearch.Name, toSearch.Values[i]); + } + return retVal; + } + return null; } /// <summary> @@ -161,7 +267,19 @@ /// after adding the header.</returns> public int Add(Header header) { - return headers.Add(header); + lock(lockObj) + { + return headers.Add(header); + } + } + + public int Add(HeaderList headers) + { + foreach(Header current in headers) + { + Add(current); + } + return Count; } /// <summary> @@ -179,7 +297,7 @@ this.headers.Add(current); } } - return this.headers.Count; + return Count; } /// <summary> Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- ChangeLog 1 Oct 2002 11:47:41 -0000 1.52 +++ ChangeLog 3 Oct 2002 08:58:48 -0000 1.53 @@ -1,6 +1,19 @@ 2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Constants.cs : CR, LF - Added new constants. + * HeaderList.cs : GetAsHeader(string) - Implemented. + : this[string] - Implemented. + : ctor(StreamReader) - Implemented. + : ConvertDuplicatesToValues() + - Implemented. + : Add(HeaderList) - Implemented. + * Header.cs : ToString() - Uses Constants.CRLF + : Value, Values - Made writable. + : ctor(StreamReader) - Stubbed. + +2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeMessage.cs : SaveChanges() - Implemented. : UpdateHeaders() - Initial Implementation. |
From: Gaurav V. <mas...@us...> - 2002-10-01 11:48:23
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv609 Modified Files: ChangeLog UniqueValueGenerator.cs Log Message: 2002-10-01 * UniqueValueGenerator.cs : GenerateMessgeID(Session) - Stubbed. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ChangeLog 1 Oct 2002 10:33:58 -0000 1.13 +++ ChangeLog 1 Oct 2002 11:48:20 -0000 1.14 @@ -1,6 +1,11 @@ 2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * UniqueValueGenerator.cs : GenerateMessgeID(Session) + - Stubbed. + +2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * Properties.cs : GetBool(string, bool) - Implemented. : GetInt(string, int) - Implemented. Index: UniqueValueGenerator.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/UniqueValueGenerator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- UniqueValueGenerator.cs 26 Sep 2002 09:45:40 -0000 1.1 +++ UniqueValueGenerator.cs 1 Oct 2002 11:48:20 -0000 1.2 @@ -17,7 +17,6 @@ { public class UniqueValueGenerator { - [MailTODO] public static string GenerateBoundary() { StringBuilder retVal = new StringBuilder("__CSMail__Next"); @@ -45,6 +44,12 @@ retVal.Append((new Random()).Next()); retVal.Append("__"); return retVal.ToString(); + } + + [MailTODO] + public static string GenerateMessgeID(Session session) + { + throw new NotImplementedException(); } } } |
From: Gaurav V. <mas...@us...> - 2002-10-01 11:47:44
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv367 Modified Files: ChangeLog MimeMessage.cs Log Message: 2002-10-01 * MimeMessage.cs : SaveChanges() - Implemented. : UpdateHeaders() - Initial Implementation. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- ChangeLog 1 Oct 2002 10:33:20 -0000 1.51 +++ ChangeLog 1 Oct 2002 11:47:41 -0000 1.52 @@ -1,6 +1,11 @@ 2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeMessage.cs : SaveChanges() - Implemented. + : UpdateHeaders() - Initial Implementation. + +2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * BodyPart.cs : Write(TextWriter) - Changed parameter type to "StreamWriter". * Constants.cs : Added following constants - Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MimeMessage.cs 1 Oct 2002 10:33:20 -0000 1.5 +++ MimeMessage.cs 1 Oct 2002 11:47:41 -0000 1.6 @@ -468,9 +468,22 @@ public override void SaveChanges() { + isModified = true; + isSaved = true; + UpdateHeaders(); + } + + [MailTODO] + protected virtual void UpdateHeaders() + { + headers["Mime-Version"] = "1.0"; + headers["Message-ID"] = "<" + + UniqueValueGenerator.GenerateMessgeID(session) + + ">"; throw new NotImplementedException(); } + [MailTODO] public override void Write(StreamWriter writer) { throw new NotImplementedException(); |
From: Gaurav V. <mas...@us...> - 2002-10-01 10:34:01
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv13396 Modified Files: ChangeLog Properties.cs Log Message: 2002-10-01 * Properties.cs : GetBool(string, bool) - Implemented. : GetInt(string, int) - Implemented. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ChangeLog 30 Sep 2002 12:28:01 -0000 1.12 +++ ChangeLog 1 Oct 2002 10:33:58 -0000 1.13 @@ -1,4 +1,9 @@ +2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * Properties.cs : GetBool(string, bool) - Implemented. + : GetInt(string, int) - Implemented. + 2002-09-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * StringUtils.cs : Escape(string), Index: Properties.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/Properties.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Properties.cs 9 Sep 2002 06:23:58 -0000 1.6 +++ Properties.cs 1 Oct 2002 10:33:58 -0000 1.7 @@ -125,6 +125,39 @@ } } + public bool GetBool(string key, bool defaultValue) + { + object val = this[key]; + if(val != null && val is string) + { + string value = ((string) val).Trim(); + if(value.Length > 0) + { + if(defaultValue) + return (String.Compare(value, "false", false) != 0); + else + return (String.Compare(value, "true", false) == 0); + } + } + return defaultValue; + } + + public int GetInt(string key, int defaultValue) + { + object val = this[key]; + if(val != null && val is string) + { + string value = ((string)val).Trim(); + try + { + return int.Parse(value); + } catch(Exception) + { + } + } + return defaultValue; + } + internal static void GetKeyValue(string line, out string key, out string value) { |
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv13164 Modified Files: BodyPart.cs ChangeLog Constants.cs IPart.cs Message.cs MimeBodyPart.cs MimeMessage.cs NewsAddressList.cs Session.cs Log Message: 2002-10-01 * BodyPart.cs : Write(TextWriter) - Changed parameter type to "StreamWriter". * Constants.cs : Added following constants - * StoreProcotol * TransportProtocol * StrictCheck * Debug * IPart.cs : Write(TextWriter) - Changed parameter type to "StreamWriter". * Message.cs : CType - Renamed to contentType. : Recipients - Changed type to "EMailAddressList" from "IAddressList". : NewsGroups - Added property. : Write(TextWriter) - Changed parameter type to "StreamWriter". : ReplyTo - Made abstract. * MimeBodyPart.cs : Write(TextWriter) - Changed parameter type to "StreamWriter". * MimeMessage.cs : CType - Renamed to contentType. : ctor(Folder, int), : ctor(Folder, StreamReader, int) : ctor(Folder, HeaderList, byte[], int) - Implemented. : ReadHeaders(TextReader), : ReadContent(TextReader), : CreateContentStream(StreamReader) - Implemented. : Write(TextWriter) - Changed parameter type to "StreamWriter". : ctor(MimeMessage) - Removed. : ReplyTo { get; set; } - Stubbed. * NewsAddressList.cs : Index(NewsAddress) - Fixed bug. Parameter should be of type NewsAddress. : Contains(NewsAddress) - Implemented. : operator +(...) - Implemented. * Session.cs : Now uses the new constants defined. Index: BodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/BodyPart.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- BodyPart.cs 30 Sep 2002 12:27:22 -0000 1.9 +++ BodyPart.cs 1 Oct 2002 10:33:20 -0000 1.10 @@ -123,10 +123,6 @@ /// <summary> /// When implemented by a class, writes the content to the writer. /// </summary> - /// <remarks> - /// I wonder shouldn't a <see cref="T:System.IO.StreamWriter"/> - /// be preferred over a <see cref="T:System.IO.TextWriter"/>? - /// </remarks> - public abstract void Write(TextWriter writer); + public abstract void Write(StreamWriter writer); } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- ChangeLog 30 Sep 2002 12:27:22 -0000 1.50 +++ ChangeLog 1 Oct 2002 10:33:20 -0000 1.51 @@ -1,4 +1,45 @@ +2002-10-01 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * BodyPart.cs : Write(TextWriter) - Changed parameter type + to "StreamWriter". + * Constants.cs : Added following constants - + * StoreProcotol + * TransportProtocol + * StrictCheck + * Debug + * IPart.cs : Write(TextWriter) - Changed parameter type + to "StreamWriter". + * Message.cs : CType - Renamed to contentType. + : Recipients - Changed type to + "EMailAddressList" from "IAddressList". + : NewsGroups - Added property. + : Write(TextWriter) - Changed parameter type + to "StreamWriter". + : ReplyTo - Made abstract. + * MimeBodyPart.cs : Write(TextWriter) - Changed parameter type + to "StreamWriter". + * MimeMessage.cs : CType - Renamed to contentType. + : ctor(Folder, int), + : ctor(Folder, StreamReader, int) + : ctor(Folder, HeaderList, byte[], int) + - Implemented. + : ReadHeaders(TextReader), + : ReadContent(TextReader), + : CreateContentStream(StreamReader) + - Implemented. + : Write(TextWriter) - Changed parameter type + to "StreamWriter". + : ctor(MimeMessage) - Removed. + : ReplyTo { get; set; } + - Stubbed. + * NewsAddressList.cs : Index(NewsAddress) - Fixed bug. Parameter + should be of type NewsAddress. + : Contains(NewsAddress) + - Implemented. + : operator +(...) - Implemented. + * Session.cs : Now uses the new constants defined. + 2002-09-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * EMailAddressList.cs : operator + - Stubbed. Index: Constants.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Constants.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Constants.cs 26 Sep 2002 11:52:00 -0000 1.3 +++ Constants.cs 1 Oct 2002 10:33:20 -0000 1.4 @@ -36,19 +36,19 @@ public const string AddressMapFileDefault = "CSMail.adress.map.default"; /// <summary> - /// The default port number for POP3 protocol + /// The default port number for POP3 protocol. /// </summary> public const int Pop3PortDefault = 110; /// <summary> - /// The default port number for IMAP protocol + /// The default port number for IMAP protocol. /// </summary> public const int ImapPortDefault = 143; /// <summary> - /// The default port number for SMTP protocol + /// The default port number for SMTP protocol. /// </summary> public const int SmtpPortDefault = 25; /// <summary> - /// The default port number for NNTP protocol + /// The default port number for NNTP protocol. /// </summary> public const int NntpPortDefault = 119; @@ -56,5 +56,22 @@ /// The standard CRLF (0x13,0x10) value. /// </summary> public const string CRLF = "\r\f"; + + /// <summary> + /// Key that holds class-name for store service provider. + /// </summary> + public const string StoreProtocol = "CSMail.store.protocol"; + /// <summary> + /// Key that holds class-name for transport service provider. + /// </summary> + public const string TransportProtocol = "CSMail.transport.protocol"; + /// <summary> + /// Key that holds value for strictness during checking addresses. + /// </summary> + public const string StrictCheck = "CSMail.mime.address.strict"; + /// <summary> + /// Key that holds value for debug mode during operations. + /// </summary> + public const string Debug = "CSMail.debug"; } } Index: IPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/IPart.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IPart.cs 30 Sep 2002 12:27:22 -0000 1.4 +++ IPart.cs 1 Oct 2002 10:33:20 -0000 1.5 @@ -60,10 +60,6 @@ /// <summary> /// When implemented, writes the content. /// </summary> - /// <remarks> - /// Should <code>TextWriter</code> be replaced by - /// <code>StreamWriter</code>? - /// </remarks> - void Write(TextWriter writer); + void Write(StreamWriter writer); } } Index: Message.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Message.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Message.cs 30 Sep 2002 12:27:22 -0000 1.10 +++ Message.cs 1 Oct 2002 10:33:20 -0000 1.11 @@ -37,7 +37,7 @@ /// <summary> /// Holds the content type for the message. /// </summary> - protected ContentType CType; + protected ContentType contentType; protected Message() { @@ -59,18 +59,19 @@ { get { - return CType; + return contentType; } set { - CType = value; + contentType = value; } } public abstract MessageFlags Flags { get; set; } public abstract EMailAddressList From { get; set; } public abstract DateTime ReceivedDate { get; } - public abstract IAddressList Recipients { get; } + public abstract EMailAddressList Recipients { get; } + public abstract NewsAddressList NewsGroups { get; } public abstract DateTime SentDate { get; set; } public abstract string Subject { get; set; } @@ -90,10 +91,11 @@ public abstract string Filename { get; set; } public abstract HeaderList Headers { get; set; } public abstract long Size { get; } + public abstract EMailAddressList ReplyTo { get; set; } //public abstract int AddHeader(Header header); //public abstract int AddHeaders(HeaderList headers); - public abstract void Write(TextWriter writer); + public abstract void Write(StreamWriter writer); public virtual Folder Folder { @@ -108,14 +110,6 @@ get { return isExpunged; - } - } - - public virtual IAddressList ReplyTo - { - get - { - return (IAddressList)From; } } Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- MimeBodyPart.cs 30 Sep 2002 12:27:22 -0000 1.7 +++ MimeBodyPart.cs 1 Oct 2002 10:33:20 -0000 1.8 @@ -314,12 +314,8 @@ /// Writes the headers and content to the given /// writer. /// </summary> - /// <remarks> - /// I am thinking of moving from <see cref="TextWriter"/> - /// to <see cref="StreamWriter"/>. - /// </remarks> [MailTODO] - public override void Write(TextWriter writer) + public override void Write(StreamWriter writer) { throw new NotImplementedException(); } Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MimeMessage.cs 30 Sep 2002 12:27:22 -0000 1.4 +++ MimeMessage.cs 1 Oct 2002 10:33:20 -0000 1.5 @@ -22,7 +22,7 @@ protected MessageFlags flags = MessageFlags.None; protected bool isModified = false; protected bool isSaved = false; - protected StreamReader reader = null; + //protected StreamReader reader = null; protected EMailAddressList toList = new EMailAddressList(); protected EMailAddressList ccList = new EMailAddressList(); @@ -35,58 +35,100 @@ public MimeMessage(Session session) : base(session) { Initialize(); - CType = new ContentType("multipart", "mixed"); + contentType = new ContentType("multipart", "mixed"); } public MimeMessage(Session session, StreamReader reader) : base(session) { Initialize(); - this.reader = reader; - ParseMessage(); + //this.reader = reader; + ParseMessage(reader); isSaved = true; } +/* [MailTODO] public MimeMessage(MimeMessage message) : base(message.session) { flags = message.flags; isStrict = message.isStrict; isModified = false; - throw new NotImplementedException(); - //isSaved = true; + ParseMessage(message.contentReader); + isSaved = true; + } +*/ + protected MimeMessage(Folder folder, int index) : base(folder, index) + { + isModified = false; + isSaved = true; + isStrict = true; + Initialize(); + } + + protected MimeMessage(Folder folder, StreamReader reader, + int index) : this(folder, index) + { + Initialize(); + //this.reader = reader; + ParseMessage(reader); + } + + protected MimeMessage(Folder folder, HeaderList headers, + byte[] content, int index) : this(folder, index) + { + this.headers = headers; + this.content = content; + Initialize(); } - [MailTODO] private void Initialize() { if(session != null) { - String strict = (string)session.Properties["CSMail.mime.address.scrict"]; + String strict = (string)session.Properties[Constants.StrictCheck]; isStrict = (strict == null || String.Compare(strict, "false", false) != 0); } - throw new NotImplementedException(); } - [MailTODO] - protected virtual void ParseMessage() + protected virtual void ParseMessage(StreamReader reader) + { + CreateContentStream(reader); + ReadHeaders(reader); + contentType = new ContentType(headers["Content-Type"]); + ReadContent(reader); + } + + private void CreateContentStream(StreamReader reader) + { + Stream baseStream = reader.BaseStream; + contentReader = new StreamReader(baseStream); + } + + private void ReadHeaders(StreamReader reader) { headers = new HeaderList(reader); - CType = new ContentType(headers["Content-Type"]); - ReadContent(); - // Create the "contentStream" - throw new NotImplementedException(); } - private void ReadContent() + private void ReadContent(StreamReader reader) { - string data = reader.ReadToEnd(); - content = new byte[data.Length]; - for(int i = 0; i < content.Length; i++) + try + { + string data = reader.ReadToEnd(); + content = new byte[data.Length]; + for(int i = 0; i < content.Length; i++) + { + content[i] = (byte)data[i]; + } + } catch(OutOfMemoryException oome) + { + throw new MessagingException("Out of memory reading content", oome); + } catch(IOException ioe) { - content[i] = (byte)data[i]; + throw new MessagingException("Error reading content", ioe); } + isModified = false; } [MailTODO] @@ -118,11 +160,19 @@ { get { - return new EMailAddressList(headers["From"]); + string fromHeader = headers["From"]; + if(fromHeader == null) + fromHeader = headers["Sender"]; + if(fromHeader != null) + return new EMailAddressList(fromHeader); + return null; } set { - headers["From"] = value.ToString(); + if(value == null) + headers.RemoveAll("From", true); + else + headers["From"] = value.ToString(); } } @@ -134,15 +184,22 @@ } } - [MailTODO] - public override IAddressList Recipients + public override EMailAddressList Recipients { get { - throw new NotImplementedException(); + return (toList + ccList); } } - + + public override NewsAddressList NewsGroups + { + get + { + return ngroupList; + } + } + public override DateTime SentDate { get @@ -221,9 +278,9 @@ { get { - if(reader != null) + if(contentReader != null) { - Stream baseStream = reader.BaseStream; + Stream baseStream = contentReader.BaseStream; if(baseStream != null) { try @@ -238,6 +295,19 @@ } } + [MailTODO] + public override EMailAddressList ReplyTo + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + public override HeaderList Headers { get @@ -372,7 +442,7 @@ replyList = new EMailAddressList(); if(toAll) { - replyList = toList + ccList + bccList; + replyList = toList + ccList; } else { replyList = toList; @@ -382,7 +452,18 @@ public override IAddressList GetRecipients(RecipientType type) { - throw new NotImplementedException(); + if(!Enum.IsDefined(typeof(RecipientType), type)) + { + throw new ArgumentException("[GetRecipients] Illegal value in parameter"); + } + switch(type) + { + case RecipientType.To : return (IAddressList)toList; + case RecipientType.Cc : return (IAddressList)ccList; + case RecipientType.Bcc : return (IAddressList)bccList; + case RecipientType.NewsGroup : return (IAddressList)ngroupList; + default : throw new ArgumentException("[GetRecipients] Illegal value in parameter"); + } } public override void SaveChanges() @@ -390,7 +471,7 @@ throw new NotImplementedException(); } - public override void Write(TextWriter writer) + public override void Write(StreamWriter writer) { throw new NotImplementedException(); } Index: NewsAddressList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/NewsAddressList.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NewsAddressList.cs 30 Sep 2002 12:27:22 -0000 1.2 +++ NewsAddressList.cs 1 Oct 2002 10:33:20 -0000 1.3 @@ -8,6 +8,7 @@ * (C) Gaurav Vaish (2002) */ +using System; using System.Collections; namespace CSMail @@ -104,11 +105,16 @@ return news.Count; } - public int IndexOf(NewsAddressList address) + public int IndexOf(NewsAddress address) { return news.IndexOf(address); } + public bool Contains(NewsAddress address) + { + return (IndexOf(address) >= 0); + } + public void AddAt(int index, NewsAddressList address) { news.Insert(index, address); @@ -132,6 +138,68 @@ public IEnumerator GetEnumerator() { return news.GetEnumerator(); + } + + public static NewsAddressList operator +(NewsAddressList one, + NewsAddressList two) + { + if(one == null && two == null) + { + return null; + } + + NewsAddressList retVal = null; + if(one == null) + { + retVal = two; + } + + if(two == null) + { + retVal = one; + } + + if(one != null && two != null) + { + retVal = one; + foreach(NewsAddress current in two) + { + if(!retVal.Contains(current)) + retVal.Add(current); + } + } + return retVal; + } + + public static NewsAddressList operator +(NewsAddress address, + NewsAddressList list) + { + return (list + address); + } + + public static NewsAddressList operator +(NewsAddressList list, + NewsAddress address) + { + if(list == null && address == null) + { + return null; + } + + NewsAddressList retVal = new NewsAddressList(); + if(address != null) + { + retVal.Add(address); + } + + if(list != null) + { + foreach(NewsAddress current in list) + { + if(!retVal.Contains(current)) + retVal.Add(current); + } + } + return retVal; } } } Index: Session.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Session.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- Session.cs 10 Sep 2002 10:43:37 -0000 1.16 +++ Session.cs 1 Oct 2002 10:33:20 -0000 1.17 @@ -29,7 +29,7 @@ private static Session defaultSession; - private ArrayList dirsToSearch; + private ArrayList dirsToSearch = null; private bool areDirsSet; private Session() @@ -54,7 +54,7 @@ public Store GetStore() { - return GetStore("mail.store.protocol"); + return GetStore(Constants.StoreProtocol); } public Store GetStore(string protocol) @@ -84,7 +84,7 @@ public Transport GetTransport() { - return GetTransport("mail.transport.protocol"); + return GetTransport(Constants.TransportProtocol); } public Transport GetTransport(string protocol) @@ -141,10 +141,10 @@ addrMap = new Properties(); dirsToSearch = new ArrayList(); - debug = bool.Parse((string)this.properties["CSMail.debug"]); + debug = this.properties.GetBool(Constants.Debug, true); - this.LoadProviders(); - this.LoadAddressMap(); + LoadProviders(); + LoadAddressMap(); } public bool Debug @@ -174,7 +174,11 @@ { if(defaultSession == null) { - defaultSession = new Session(properties, authenticator); + lock(defaultSession) + { + if(defaultSession == null) + defaultSession = new Session(properties, authenticator); + } } else { if(defaultSession.authenticator != authenticator) @@ -201,9 +205,13 @@ private void LoadProviders() { // Load from the file. - if(!areDirsSet) + if(!areDirsSet || dirsToSearch == null) { - SetDirsToSearch(); + lock(dirsToSearch) + { + if(dirsToSearch == null) + SetDirsToSearch(); + } } foreach(string current in dirsToSearch) { @@ -254,8 +262,14 @@ private void LoadAddressMap() { // Load from the file. - if(!areDirsSet) - SetDirsToSearch(); + if(!areDirsSet || dirsToSearch == null) + { + lock(dirsToSearch) + { + if(dirsToSearch == null) + SetDirsToSearch(); + } + } foreach(string current in dirsToSearch) { LoadAddressMap(current); |
From: Gaurav V. <mas...@us...> - 2002-09-30 12:28:04
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv9059 Modified Files: ChangeLog StringUtils.cs Log Message: 2002-09-30 * StringUtils.cs : Escape(string), Unescape(string) - Stubbed. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ChangeLog 30 Sep 2002 04:02:38 -0000 1.11 +++ ChangeLog 30 Sep 2002 12:28:01 -0000 1.12 @@ -1,4 +1,9 @@ +2002-09-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * StringUtils.cs : Escape(string), + Unescape(string) - Stubbed. + 2002-09-27 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * DateUtils.cs : Added new class. Index: StringUtils.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/StringUtils.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StringUtils.cs 29 Aug 2002 10:12:50 -0000 1.1 +++ StringUtils.cs 30 Sep 2002 12:28:01 -0000 1.2 @@ -20,5 +20,17 @@ { return path.Split(new char[] { Path.PathSeparator }); } + + [MailTODO] + public static string Escape(string unescaped) + { + throw new NotImplementedException(); + } + + [MailTODO] + public static string Unescape(string escaped) + { + throw new NotImplementedException(); + } } } |
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv8862 Modified Files: BodyPart.cs ChangeLog EMailAddressList.cs IPart.cs Message.cs MimeBodyPart.cs MimeMessage.cs NewsAddressList.cs Log Message: 2002-09-30 * EMailAddressList.cs : operator + - Stubbed. : operator = - Implemented. * BodyPart.cs : Size - Changed to "long". * IPart.cs : Size - Changed to "long". * Message.cs : Size - Changed to "long". * MimeBodyPart.cs : Size - Changed to "long". * MimeMessage.cs : Filename { set; } - Fixed bug. Now does not lose any other parameters defined. : Size { get; } - Implemented. Changed to "long" : AddRecipient(...) - Implemented. : AddRecipients(...) - Implemented. * NewsAddressList.cs : Add(NewsAddress) - Implemented. Index: BodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/BodyPart.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- BodyPart.cs 26 Sep 2002 09:47:10 -0000 1.8 +++ BodyPart.cs 30 Sep 2002 12:27:22 -0000 1.9 @@ -108,7 +108,7 @@ /// <summary> /// When implemented by a class, gets the siz of content. /// </summary> - public abstract int Size { get; } + public abstract long Size { get; } /** /// <summary> Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- ChangeLog 30 Sep 2002 04:01:37 -0000 1.49 +++ ChangeLog 30 Sep 2002 12:27:22 -0000 1.50 @@ -1,4 +1,20 @@ +2002-09-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * EMailAddressList.cs : operator + - Stubbed. + : operator = - Implemented. + * BodyPart.cs : Size - Changed to "long". + * IPart.cs : Size - Changed to "long". + * Message.cs : Size - Changed to "long". + * MimeBodyPart.cs : Size - Changed to "long". + * MimeMessage.cs : Filename { set; } - Fixed bug. Now does not + lose any other parameters defined. + : Size { get; } - Implemented. + Changed to "long" + : AddRecipient(...) - Implemented. + : AddRecipients(...) - Implemented. + * NewsAddressList.cs : Add(NewsAddress) - Implemented. + 2002-09-27 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * ContentType.cs : operator ==, != - Implemented. Index: EMailAddressList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddressList.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EMailAddressList.cs 30 Sep 2002 04:01:37 -0000 1.3 +++ EMailAddressList.cs 30 Sep 2002 12:27:22 -0000 1.4 @@ -138,6 +138,12 @@ } } + [MailTODO] + public bool Contains(EMailAddress address) + { + throw new NotImplementedException(); + } + /// <summary> /// Clears the list. /// </summary> @@ -272,6 +278,66 @@ public IEnumerator GetEnumerator() { return emails.GetEnumerator(); + } + + public static EMailAddressList operator +(EMailAddressList list, + EMailAddress address) + { + if(list == null && address == null) + { + return null; + } + EMailAddressList retVal = new EMailAddressList(); + if(list != null) + { + foreach(EMailAddress current in list) + { + if(!retVal.Contains(current)) + retVal.Add(current); + } + } + if(address != null && !retVal.Contains(address)) + { + retVal.Add(address); + } + return retVal; + } + + public static EMailAddressList operator +(EMailAddress address, + EMailAddressList list) + { + return (list + address); + } + + public static EMailAddressList operator +(EMailAddressList one, + EMailAddressList two) + { + if(one == null && two == null) + { + return null; + } + + EMailAddressList retVal = null; + if(one == null) + { + retVal = two; + } + + if(two == null) + { + retVal = one; + } + + if(one != null && two != null) + { + retVal = one; + foreach(EMailAddress current in two) + { + if(!retVal.Contains(current)) + retVal.Add(current); + } + } + return retVal; } /// <summary> Index: IPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/IPart.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IPart.cs 9 Sep 2002 09:37:54 -0000 1.3 +++ IPart.cs 30 Sep 2002 12:27:22 -0000 1.4 @@ -45,7 +45,7 @@ /// <summary> /// When implemented, gets the size of the part. /// </summary> - int Size { get; } + long Size { get; } /** /// <summary> Index: Message.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Message.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Message.cs 30 Sep 2002 04:01:37 -0000 1.9 +++ Message.cs 30 Sep 2002 12:27:22 -0000 1.10 @@ -89,7 +89,7 @@ public abstract ContentDisposition Disposition { get; set; } public abstract string Filename { get; set; } public abstract HeaderList Headers { get; set; } - public abstract int Size { get; } + public abstract long Size { get; } //public abstract int AddHeader(Header header); //public abstract int AddHeaders(HeaderList headers); Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MimeBodyPart.cs 30 Sep 2002 04:01:37 -0000 1.6 +++ MimeBodyPart.cs 30 Sep 2002 12:27:22 -0000 1.7 @@ -67,7 +67,7 @@ /// (the actual message), in bytes, for this body part. /// </value> [MailTODO] - public override int Size + public override long Size { get { Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MimeMessage.cs 30 Sep 2002 04:01:37 -0000 1.3 +++ MimeMessage.cs 30 Sep 2002 12:27:22 -0000 1.4 @@ -22,6 +22,13 @@ protected MessageFlags flags = MessageFlags.None; protected bool isModified = false; protected bool isSaved = false; + protected StreamReader reader = null; + + protected EMailAddressList toList = new EMailAddressList(); + protected EMailAddressList ccList = new EMailAddressList(); + protected EMailAddressList bccList = new EMailAddressList(); + protected NewsAddressList ngroupList = new NewsAddressList(); + protected EMailAddressList replyList = new EMailAddressList(); private bool isStrict = false; @@ -35,7 +42,8 @@ : base(session) { Initialize(); - ParseMessage(reader); + this.reader = reader; + ParseMessage(); isSaved = true; } @@ -62,16 +70,16 @@ } [MailTODO] - protected virtual void ParseMessage(StreamReader reader) + protected virtual void ParseMessage() { headers = new HeaderList(reader); CType = new ContentType(headers["Content-Type"]); - ReadContent(reader); + ReadContent(); // Create the "contentStream" throw new NotImplementedException(); } - private void ReadContent(StreamReader reader) + private void ReadContent() { string data = reader.ReadToEnd(); content = new byte[data.Length]; @@ -187,8 +195,8 @@ { get { - ParameterList list = MimeUtils.GetParametersAsList( - headers["Content-Disposition"], null); + ParameterList list = MimeUtils.GetParametersAsList + (headers["Content-Disposition"], null); if(list != null) { return list["Filename"]; @@ -197,16 +205,36 @@ } set { - headers["Content-Disposition"] = "attachment ; filename=" - + "\"" + value + "\""; + ParameterList list = MimeUtils.GetParametersAsList + (headers["Content-Disposition"], null); + if(list == null) + { + list = new ParameterList(); + } + list.Add(new Parameter("filename", + StringUtils.Escape(value))); + headers["Content-Disposition"] = list.ToString(); } } - public override int Size + public override long Size { get { - throw new NotImplementedException(); + if(reader != null) + { + Stream baseStream = reader.BaseStream; + if(baseStream != null) + { + try + { + return baseStream.Length; + } catch(NotSupportedException) + { + } + } + } + return -1; } } @@ -284,30 +312,71 @@ } } + [MailTODO] public override void AddRecipient(RecipientType type, EMailAddress email) { - throw new NotImplementedException(); + bool valid = false; + if((type & RecipientType.To) != 0x00) + { + valid = true; + toList.Add(email); + } + if((type & RecipientType.Cc) != 0x00) + { + valid = true; + ccList.Add(email); + } + if((type & RecipientType.Bcc) != 0x00) + { + valid = true; + bccList.Add(email); + } + if((type & RecipientType.NewsGroup) == 0x00) + { + valid = false; + } + if(!valid) + { + // checking it at the end guarantees that + // the name is added to all other types + // throw an exception + throw new NotImplementedException(); + } } public override void AddRecipients(RecipientType type, EMailAddressList emails) { - throw new NotImplementedException(); + foreach(EMailAddress current in emails) + { + AddRecipient(type, current); + } } public override void AddRecipient(NewsAddress address) { - throw new NotImplementedException(); + ngroupList.Add(address); } - public override void AddRecipients(NewsAddressList address) + public override void AddRecipients(NewsAddressList addresses) { - throw new NotImplementedException(); + foreach(NewsAddress current in addresses) + { + ngroupList.Add(current); + } } public override Message GetReplyMessage(bool toAll) { + replyList = new EMailAddressList(); + if(toAll) + { + replyList = toList + ccList + bccList; + } else + { + replyList = toList; + } throw new NotImplementedException(); } Index: NewsAddressList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/NewsAddressList.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NewsAddressList.cs 20 Jun 2002 10:34:55 -0000 1.1 +++ NewsAddressList.cs 30 Sep 2002 12:27:22 -0000 1.2 @@ -90,6 +90,11 @@ return news.Add(address); } + public int Add(NewsAddress address) + { + return news.Add(address); + } + public int Add(NewsAddressList[] addresses) { foreach(NewsAddressList current in addresses) |
From: Gaurav V. <mas...@us...> - 2002-09-30 04:02:40
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv4281 Modified Files: ChangeLog Added Files: DateUtils.cs MimeUtils.cs Log Message: 2002-09-27 * DateUtils.cs : Added new class. : CreateDateHeader(DateTime), : ParseToLocalTime(Header), : ParseToGMT(Header) - Stubbed. * MimeUtils.cs : Added new class. : GetParameters(string, char[]), : GetParametsrsAsList(string, char[]) - Implemented. --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: DateUtils * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; using CSMail; namespace CSMail.Utils { public class DateUtils { [MailTODO] public static DateTime ParseToLocalTime(Header header) { throw new NotImplementedException(); } [MailTODO] public static DateTime ParseToGMT(Header header) { throw new NotImplementedException(); } [MailTODO] public static string CreateDateHeader(DateTime time) { throw new NotImplementedException(); } } } --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: MimeUtils * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; using CSMail; namespace CSMail.Utils { public class MimeUtils { public static string[] GetParameters(string headerValue, char[] separators) { if(headerValue == null) { return null; } if(separators == null) { separators = new char[] { ';' }; } headerValue = headerValue.Trim(); if(headerValue.Length > 0) { string[] parts = headerValue.Split(separators); if(parts.Length > 1) { string[] retVal = new string[parts.Length - 1]; for(int i = 0; i < retVal.Length; i++) { retVal[i] = parts[i+1]; } } } return null; } public static ParameterList GetParametersAsList(string headerValue, char[] separators) { if(headerValue != null) { headerValue = headerValue.Trim(); if(headerValue.Length > 0) { if(separators == null) { separators = new char[] { ';' }; string[] parts = headerValue.Split(separators); if(parts.Length > 1) { ParameterList retVal = new ParameterList(); char[] kvsep = new char[]{ '=' }; for(int i = 1; i < parts.Length; i++) { string[] keyval = parts[i].Split(kvsep); if(keyval.Length > 1) { retVal.Add(new Parameter(keyval[0], keyval[1])); } } return retVal; } } } } return null; } } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ChangeLog 26 Sep 2002 09:45:40 -0000 1.10 +++ ChangeLog 30 Sep 2002 04:02:38 -0000 1.11 @@ -1,8 +1,20 @@ +2002-09-27 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * DateUtils.cs : Added new class. + : CreateDateHeader(DateTime), + : ParseToLocalTime(Header), + : ParseToGMT(Header) + - Stubbed. + * MimeUtils.cs : Added new class. + : GetParameters(string, char[]), + : GetParametsrsAsList(string, char[]) + - Implemented. + 2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * UniqueValueGenerator.cs : Added new class. - : GenerateBoundary() - Implemented + : GenerateBoundary() - Implemented. 2002-09-13 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> |
From: Gaurav V. <mas...@us...> - 2002-09-30 04:01:40
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv3800 Modified Files: ChangeLog ContentType.cs EMailAddressList.cs HeaderList.cs IMimePart.cs Message.cs MimeBodyPart.cs MimeMessage.cs ParameterList.cs ProviderList.cs TODO Log Message: 2002-09-27 * ContentType.cs : operator ==, != - Implemented. : ctor(string) - Stubbed. * EMailAddressList.cs : ctor(string) - Stubbed. * HeaderList.cs : GetAsHeader(string) - Stubbed. * IMimePart.cs : ContentLanguage - Value is "string[]". : MimeBodyPart.cs : ContentLanguage - Value is "string[]". - To do fresh implementation. * MimeMessage.cs : ContentLanguage - Value is "string[]", - Marked virtual. : ContentMD5 { get; set; }, : ContentID { get; set; }, : Filename { get; set; }, : Subject { get; set; }, : Description { get; set; }, : Flags { get; set; } - Implemented. : ReadContent(StreamReader) - Implemented. : ReceivedDate - Readonly, implemented. : SentDate - Implemented. * Message.cs : ReceivedDate - Readonly. : ContentType - Not abstract. * ProviderList.cs : More stubs. * TODO : Add MimeMessage to the list. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- ChangeLog 26 Sep 2002 11:52:00 -0000 1.48 +++ ChangeLog 30 Sep 2002 04:01:37 -0000 1.49 @@ -1,4 +1,32 @@ +2002-09-27 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * ContentType.cs : operator ==, != - Implemented. + : ctor(string) - Stubbed. + * EMailAddressList.cs : ctor(string) - Stubbed. + * HeaderList.cs : GetAsHeader(string) + - Stubbed. + * IMimePart.cs : ContentLanguage - Value is "string[]". + : MimeBodyPart.cs : ContentLanguage - Value is "string[]". + - To do fresh implementation. + * MimeMessage.cs : ContentLanguage - Value is "string[]", + - Marked virtual. + : ContentMD5 { get; set; }, + : ContentID { get; set; }, + : Filename { get; set; }, + : Subject { get; set; }, + : Description { get; set; }, + : Flags { get; set; } + - Implemented. + : ReadContent(StreamReader) + - Implemented. + : ReceivedDate - Readonly, implemented. + : SentDate - Implemented. + * Message.cs : ReceivedDate - Readonly. + : ContentType - Not abstract. + * ProviderList.cs : More stubs. + * TODO : Add MimeMessage to the list. + 2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * MimeMultipart.cs : ParseBodyParts() - Looks done. Index: ContentType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ContentType.cs 26 Sep 2002 09:47:10 -0000 1.4 +++ ContentType.cs 30 Sep 2002 04:01:37 -0000 1.5 @@ -37,10 +37,10 @@ } /// <summary> - /// Create an instance with the + /// Create an instance with the /// <paramref name="primary"/> as the <see cref="PrimaryType"/> /// and <paramref name="sub"/> as the <see cref="SubType"/>, - /// and a list of associated parameters. + /// and a list of associated <paramref name="parameters"/>. /// </summary> public ContentType(string primary, string sub, ParameterList parameters) { @@ -55,6 +55,19 @@ } } + /// <remarks> + /// <code> + /// <paramref name="headerValue"/> := primarytype '/' subtype [plist] + /// plist := *(; params) + /// params := key '=' value + /// </code> + /// </remarks> + [MailTODO] + public ContentType(string headerValue) + { + throw new NotImplementedException(); + } + /// <summary> /// Gets the primary type of the content. /// </summary> @@ -106,12 +119,34 @@ } } + public static bool operator == (ContentType left, ContentType right) + { + if(left == null && right == null) + return true; + + if(left == null || right == null) + return false; + + bool retVal = true; + retVal &= (String.Compare(left.PrimaryType, + right.PrimaryType, false) == 0); + retVal &= (String.Compare(left.SubType, + right.SubType, false) == 0); + return retVal; + } + + public static bool operator != (ContentType left, ContentType right) + { + return !(left == right); + } + /// <summary> /// Checks for the equality with an object. /// </summary> /// <remarks> - /// <c>obj</c> may be of type <c>ContentType</c> or - /// <c>string</c>. + /// <paramref name="obj"/> may be of type + /// <see cref="T:CSMail.ContentType"/> or + /// <see cref="T:System.String"/>. /// </remarks> public override bool Equals(object obj) { @@ -129,6 +164,8 @@ /// <summary> /// Checks for the equality. /// </summary> + /// <param name="cType">Content type to check + /// against.</param> public bool Equals(ContentType cType) { if(cType != null) Index: EMailAddressList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/EMailAddressList.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- EMailAddressList.cs 6 Sep 2002 09:30:27 -0000 1.2 +++ EMailAddressList.cs 30 Sep 2002 04:01:37 -0000 1.3 @@ -64,6 +64,12 @@ } } + [MailTODO] + public EMailAddressList(string headerValue) + { + throw new NotImplementedException(); + } + /// <summary> /// Gets or sets an address at the specified index. /// </summary> Index: HeaderList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/HeaderList.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- HeaderList.cs 24 Sep 2002 08:34:52 -0000 1.6 +++ HeaderList.cs 30 Sep 2002 04:01:37 -0000 1.7 @@ -139,6 +139,12 @@ } } + [MailTODO] + public Header[] GetAsHeader(string name) + { + throw new NotImplementedException(); + } + /// <summary> /// Returns an enumerator for the list for iteration. /// </summary> Index: IMimePart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/IMimePart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IMimePart.cs 5 Sep 2002 05:17:49 -0000 1.2 +++ IMimePart.cs 30 Sep 2002 04:01:37 -0000 1.3 @@ -22,7 +22,7 @@ /// <summary> /// When implemented, gets or sets the content language associated. /// </summary> - string ContentLanguage { get; set; } + string[] ContentLanguage { get; set; } /// <summary> /// When implemented, gets or sets the content-MD5 associated. /// </summary> Index: Message.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Message.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Message.cs 9 Sep 2002 11:07:22 -0000 1.8 +++ Message.cs 30 Sep 2002 04:01:37 -0000 1.9 @@ -34,6 +34,10 @@ /// Has this been message expunged from the folder? /// </summary> protected bool isExpunged; + /// <summary> + /// Holds the content type for the message. + /// </summary> + protected ContentType CType; protected Message() { @@ -51,9 +55,21 @@ this.session = session; } + public virtual ContentType ContentType + { + get + { + return CType; + } + set + { + CType = value; + } + } + public abstract MessageFlags Flags { get; set; } public abstract EMailAddressList From { get; set; } - public abstract DateTime ReceivedDate { get; set; } + public abstract DateTime ReceivedDate { get; } public abstract IAddressList Recipients { get; } public abstract DateTime SentDate { get; set; } public abstract string Subject { get; set; } @@ -69,7 +85,6 @@ public abstract void SaveChanges(); public abstract Multipart Content { get; set; } - public abstract ContentType ContentType { get; set; } public abstract string Description { get; set; } public abstract ContentDisposition Disposition { get; set; } public abstract string Filename { get; set; } Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MimeBodyPart.cs 24 Sep 2002 08:34:52 -0000 1.5 +++ MimeBodyPart.cs 30 Sep 2002 04:01:37 -0000 1.6 @@ -211,15 +211,16 @@ /// <summary> /// Gets or sets the value of "Content-Language" header. /// </summary> - public virtual string ContentLanguage + /// [MailTODO] + public virtual string[] ContentLanguage { get { - return Headers["Content-Language"]; + throw new NotImplementedException(); } set { - Headers["Content-Language"] = value; + throw new NotImplementedException(); } } Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MimeMessage.cs 26 Sep 2002 11:52:00 -0000 1.2 +++ MimeMessage.cs 30 Sep 2002 04:01:37 -0000 1.3 @@ -8,6 +8,7 @@ * (C) Gaurav Vaish (2002) */ +using CSMail.Utils; using System; using System.IO; @@ -15,47 +16,73 @@ { public class MimeMessage : Message, IMimePart, IPart { - protected byte[] content; - protected StreamReader contentReader; - protected HeaderList headers; - protected MessageFlags flags; - protected bool isModified = false; - protected bool isSaved = false; + protected byte[] content = null; + protected StreamReader contentReader = null; + protected HeaderList headers = new HeaderList(); + protected MessageFlags flags = MessageFlags.None; + protected bool isModified = false; + protected bool isSaved = false; private bool isStrict = false; - [MailTODO] public MimeMessage(Session session) : base(session) { - throw new NotImplementedException(); + Initialize(); + CType = new ContentType("multipart", "mixed"); } - [MailTODO] public MimeMessage(Session session, StreamReader reader) : base(session) { - throw new NotImplementedException(); + Initialize(); + ParseMessage(reader); + isSaved = true; } [MailTODO] - public MimeMessage(MimeMessage message) + public MimeMessage(MimeMessage message) : base(message.session) { + flags = message.flags; + isStrict = message.isStrict; + isModified = false; throw new NotImplementedException(); + //isSaved = true; } - public override Multipart Content + [MailTODO] + private void Initialize() { - get + if(session != null) { - throw new NotImplementedException(); + String strict = (string)session.Properties["CSMail.mime.address.scrict"]; + isStrict = (strict == null || + String.Compare(strict, "false", false) != 0); } - set + throw new NotImplementedException(); + } + + [MailTODO] + protected virtual void ParseMessage(StreamReader reader) + { + headers = new HeaderList(reader); + CType = new ContentType(headers["Content-Type"]); + ReadContent(reader); + // Create the "contentStream" + throw new NotImplementedException(); + } + + private void ReadContent(StreamReader reader) + { + string data = reader.ReadToEnd(); + content = new byte[data.Length]; + for(int i = 0; i < content.Length; i++) { - throw new NotImplementedException(); + content[i] = (byte)data[i]; } } - public override ContentType ContentType + [MailTODO] + public override Multipart Content { get { @@ -71,11 +98,11 @@ { get { - throw new NotImplementedException(); + return flags; } set { - throw new NotImplementedException(); + flags = value; } } @@ -83,11 +110,11 @@ { get { - throw new NotImplementedException(); + return new EMailAddressList(headers["From"]); } set { - throw new NotImplementedException(); + headers["From"] = value.ToString(); } } @@ -95,14 +122,11 @@ { get { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); + return DateUtils.ParseToLocalTime(headers.GetAsHeader("Received")[0]); } } + [MailTODO] public override IAddressList Recipients { get @@ -115,11 +139,11 @@ { get { - throw new NotImplementedException(); + return DateUtils.ParseToLocalTime(headers.GetAsHeader("Date")[0]); } set { - throw new NotImplementedException(); + headers["Date"] = DateUtils.CreateDateHeader(value); } } @@ -127,11 +151,11 @@ { get { - throw new NotImplementedException(); + return headers["Subject"]; } set { - throw new NotImplementedException(); + headers["Subject"] = value; } } @@ -139,11 +163,11 @@ { get { - throw new NotImplementedException(); + return headers["Content-Description"]; } set { - throw new NotImplementedException(); + headers["Content-Description"] = value; } } @@ -163,11 +187,18 @@ { get { - throw new NotImplementedException(); + ParameterList list = MimeUtils.GetParametersAsList( + headers["Content-Disposition"], null); + if(list != null) + { + return list["Filename"]; + } + return null; } set { - throw new NotImplementedException(); + headers["Content-Disposition"] = "attachment ; filename=" + + "\"" + value + "\""; } } @@ -183,27 +214,28 @@ { get { - throw new NotImplementedException(); + return headers; } set { - throw new NotImplementedException(); + headers = value; } } - public string ContentID + public virtual string ContentID { get { - throw new NotImplementedException(); + return headers["Content-ID"]; } set { - throw new NotImplementedException(); + headers["Content-ID"] = value; } } - public string ContentLanguage + [MailTODO] + public virtual string[] ContentLanguage { get { @@ -215,19 +247,20 @@ } } - public string ContentMD5 + public virtual string ContentMD5 { get { - throw new NotImplementedException(); + return headers["Content-MD5"]; } set { - throw new NotImplementedException(); + headers["Content-MD5"] = value; } } - public string Text + [MailTODO] + public virtual string Text { get { @@ -239,7 +272,7 @@ } } - public TransferEncoding TransferEncoding + public virtual TransferEncoding TransferEncoding { get { Index: ParameterList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ParameterList.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ParameterList.cs 26 Sep 2002 09:47:10 -0000 1.2 +++ ParameterList.cs 30 Sep 2002 04:01:37 -0000 1.3 @@ -45,6 +45,8 @@ } } + // FIXME: The matching should be case-insensitive. + // Currently, it's all case sensitive. public string this[string name] { get Index: ProviderList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ProviderList.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ProviderList.cs 30 Aug 2002 10:31:26 -0000 1.4 +++ ProviderList.cs 30 Sep 2002 04:01:37 -0000 1.5 @@ -40,5 +40,23 @@ { return providers.GetEnumerator(); } + + [MailTODO] + public int Add(Provider[] providers) + { + throw new NotImplementedException(); + } + + [MailTODO] + public void Remove(Provider provider) + { + throw new NotImplementedException(); + } + + [MailTODO] + public void RemoveAt(int index) + { + throw new NotImplementedException(); + } } } Index: TODO =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/TODO,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TODO 6 Sep 2002 11:52:29 -0000 1.3 +++ TODO 30 Sep 2002 04:01:37 -0000 1.4 @@ -13,3 +13,4 @@ MimeMessage -- Implements IMimePart * Some other? -- Implements IXXXXPart * MimeMultipart -- Extends Multipart + * MimeMessage -- Extends Message. Complete it. |
From: Gaurav V. <mas...@us...> - 2002-09-26 11:52:03
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv1349 Modified Files: ChangeLog Constants.cs MimeMessage.cs MimeMultipart.cs Log Message: 2002-09-26 * MimeMultipart.cs : ParseBodyParts() - Looks done. : GetBoundary() - Stubbed. : GetToBoundaryEnd - Looks complete. * Constants.cs : Added constant CRLF. * MimeMessage.cs : Stubbed new constructors. : Added several protected values. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- ChangeLog 26 Sep 2002 09:47:10 -0000 1.47 +++ ChangeLog 26 Sep 2002 11:52:00 -0000 1.48 @@ -1,6 +1,15 @@ 2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeMultipart.cs : ParseBodyParts() - Looks done. + : GetBoundary() - Stubbed. + : GetToBoundaryEnd - Looks complete. + * Constants.cs : Added constant CRLF. + * MimeMessage.cs : Stubbed new constructors. + : Added several protected values. + +2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * AddressType.cs, BodyPart.cs, BodyPartList.cs, Folder.cs : Minor documentation changes. * ContentType.cs : Forgot to initialize "parameters" in Index: Constants.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Constants.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Constants.cs 6 Sep 2002 09:30:27 -0000 1.2 +++ Constants.cs 26 Sep 2002 11:52:00 -0000 1.3 @@ -51,5 +51,10 @@ /// The default port number for NNTP protocol /// </summary> public const int NntpPortDefault = 119; + + /// <summary> + /// The standard CRLF (0x13,0x10) value. + /// </summary> + public const string CRLF = "\r\f"; } } Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MimeMessage.cs 9 Sep 2002 11:07:22 -0000 1.1 +++ MimeMessage.cs 26 Sep 2002 11:52:00 -0000 1.2 @@ -15,8 +15,30 @@ { public class MimeMessage : Message, IMimePart, IPart { + protected byte[] content; + protected StreamReader contentReader; + protected HeaderList headers; + protected MessageFlags flags; + protected bool isModified = false; + protected bool isSaved = false; + + private bool isStrict = false; + [MailTODO] - public MimeMessage() + public MimeMessage(Session session) : base(session) + { + throw new NotImplementedException(); + } + + [MailTODO] + public MimeMessage(Session session, StreamReader reader) + : base(session) + { + throw new NotImplementedException(); + } + + [MailTODO] + public MimeMessage(MimeMessage message) { throw new NotImplementedException(); } Index: MimeMultipart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMultipart.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MimeMultipart.cs 26 Sep 2002 09:47:10 -0000 1.8 +++ MimeMultipart.cs 26 Sep 2002 11:52:00 -0000 1.9 @@ -115,8 +115,39 @@ { if(!isParsed) { + Stream readerStream = reader.BaseStream; + string boundary = GetBoundary(readerStream); + string preamble = GetToBoundaryEnd(reader, boundary); + HeaderList headers = CreateHeaders(reader); + + // FIXME: I am confused. Lost. Back to basics. + // Reading the RFCs again. Have I forgotten everything? throw new NotImplementedException(); } + } + + [MailTODO] + protected string GetBoundary(Stream inputStream) + { + throw new NotImplementedException(); + } + + [MailTODO] + protected string GetToBoundaryEnd(StreamReader inputStream, + string boundary) + { + string toSearch = "--" + boundary; + string retVal = ""; + string readLine; + while((readLine = inputStream.ReadLine()) != null) + { + if(readLine.Trim() == boundary) + { + return retVal; + } + retVal += readLine + Constants.CRLF; + } + throw new MessagingException("Missing start boundary"); } [MailTODO] |
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv1982 Modified Files: AddressType.cs BodyPart.cs BodyPartList.cs ChangeLog ContentType.cs Folder.cs MimeMultipart.cs ParameterList.cs Log Message: 2002-09-26 * AddressType.cs, BodyPart.cs, BodyPartList.cs, Folder.cs : Minor documentation changes. * ContentType.cs : Forgot to initialize "parameters" in ctor(string,string) * ParameterList.cs : ctor() - Implemented * MimeMultipart.cs : ctor(StreamReader) - Implemented : ParseBodyParts() - More implementation Index: AddressType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/AddressType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AddressType.cs 4 Sep 2002 09:59:18 -0000 1.2 +++ AddressType.cs 26 Sep 2002 09:47:10 -0000 1.3 @@ -12,13 +12,18 @@ namespace CSMail { /// <summary> - /// Denotes the type of address. + /// Denotes the type of address for the classes + /// implementing <see cref="T:CSMail.IAddress"/>. /// </summary> /// <remarks> /// Useful during resolution of addresses while dispatching messages. /// The messages would be dispatched using protocols as set for the /// respective type. /// </remarks> + /// <seealso cref="T:CSMail.IAddress"/> + /// <seealso cref="T:CSMail.EMailAddress"/> + /// <seealso cref="T:CSMail.InternetAddress"/> + /// <seealso cref="T:CSMail.NewsAddress"/> public enum AddressType { /// <summary> Index: BodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/BodyPart.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- BodyPart.cs 13 Sep 2002 06:10:59 -0000 1.7 +++ BodyPart.cs 26 Sep 2002 09:47:10 -0000 1.8 @@ -14,18 +14,19 @@ namespace CSMail { /// <summary> - /// The abstract class models a <c>Part</c> within - /// a <c>Multipart</c>. + /// The abstract class models a + /// <see cref="T:CSMail.IPart"/> within a + /// <see cref="T:CSMail.Multipart"/>. /// </summary> - /// <seealso cref="Multipart"/> - /// <seealso cref="IPart"/> + /// <seealso cref="T:CSMail.Multipart"/> + /// <seealso cref="T:CSMail.IPart"/> public abstract class BodyPart: IPart { private Multipart parent; private StateBag partState; /// <summary> - /// Constructor to do some initialization + /// Creates an instance of body part with no parent. /// </summary> public BodyPart() { @@ -33,8 +34,8 @@ } /// <summary> - /// Returns the parent <c>Multipart</c> for this - /// part, if any. Returns null otherwise. + /// Returns the parent <see cref="T:CSMail.Multipart"/> + /// for this part, if any. Returns null otherwise. /// </summary> public Multipart Parent { @@ -57,8 +58,8 @@ } /// <summary> - /// Gets or sets the parent <c>Multipart</c> associated. - /// </summary> + /// Gets or sets the parent <see cref="T:CSMail.Multipart"/> + /// associated.</summary> /// <remarks> /// This property is available only to the assembly and the /// children of this class, so that it can be used by them. @@ -123,8 +124,8 @@ /// When implemented by a class, writes the content to the writer. /// </summary> /// <remarks> - /// I wonder shouldn't a <c>StreamWriter</c> be preffer over a - /// <c>TextWriter</c>? + /// I wonder shouldn't a <see cref="T:System.IO.StreamWriter"/> + /// be preferred over a <see cref="T:System.IO.TextWriter"/>? /// </remarks> public abstract void Write(TextWriter writer); } Index: BodyPartList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/BodyPartList.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- BodyPartList.cs 19 Sep 2002 08:16:15 -0000 1.5 +++ BodyPartList.cs 26 Sep 2002 09:47:10 -0000 1.6 @@ -14,7 +14,7 @@ namespace CSMail { /// <summary> - /// Container for a list of body parts. + /// Container for a list of <see cref="T:CSMail.BodyPart"/>. /// </summary> public class BodyPartList : IEnumerable { @@ -39,7 +39,9 @@ /// </summary> /// <param name="parts">The body parts in the initial list.</param> /// <param name="isReadOnly">Determines if the list is - /// readonly.</param> + /// readonly. <see langword="true"/> if it is read only, + /// <see langword="false"/> otherwise. + /// </param> public BodyPartList(BodyPart[] parts, bool isReadOnly) { this.isReadOnly = isReadOnly; @@ -58,7 +60,7 @@ /// </summary> /// <param name="part">Body part in the initial list.</param> /// <remarks> - /// The list is not read-only. + /// The list is not <see cref="P:CSMail.BodyPartList.IsReadOnly"/>. /// </remarks> public BodyPartList(BodyPart part) { @@ -72,7 +74,7 @@ /// </summary> /// <param name="parts">Body parts in the initial list.</param> /// <remarks> - /// The list is not read-only. + /// The list is not <see cref="P:CSMail.BodyPartList.IsReadOnly"/>. /// </remarks> public BodyPartList(BodyPart[] parts) : this(parts, false) { @@ -84,9 +86,14 @@ /// <param name="index">The index (zero based) under /// consideration.</param> /// <exception name="ArgumentOutOfRangeException"> + /// <para> /// <c>index</c> is less than zero, - /// <p>-or-</p> - /// <c>index</c> is euqal to or greater than <see cref="Count"/>. + /// </para> + /// <para>-or-</para> + /// <para> + /// <c>index</c> is euqal to or greater than + /// <see cref="P:CSMail.BodyPartList.Count"/>. + /// </para> /// </exception> /// <exception name="NotSupportedException"> /// When trying to modify a read-only list. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- ChangeLog 24 Sep 2002 08:34:52 -0000 1.46 +++ ChangeLog 26 Sep 2002 09:47:10 -0000 1.47 @@ -1,4 +1,14 @@ +2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * AddressType.cs, BodyPart.cs, BodyPartList.cs, Folder.cs + : Minor documentation changes. + * ContentType.cs : Forgot to initialize "parameters" in + ctor(string,string) + * ParameterList.cs : ctor() - Implemented + * MimeMultipart.cs : ctor(StreamReader) - Implemented + : ParseBodyParts() - More implementation + 2002-09-24 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * HeaderList.cs : this[string] { get; set; } - Stubbed Index: ContentType.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContentType.cs 12 Sep 2002 07:13:25 -0000 1.3 +++ ContentType.cs 26 Sep 2002 09:47:10 -0000 1.4 @@ -33,18 +33,26 @@ { primaryType = primary; subType = sub; + parameters = new ParameterList(); } /// <summary> - /// Create an instance with the primary as the <c>PrimaryType</c> - /// and sub as the <c>SubType</c>, and a list of associated - /// parameters. + /// Create an instance with the + /// <paramref name="primary"/> as the <see cref="PrimaryType"/> + /// and <paramref name="sub"/> as the <see cref="SubType"/>, + /// and a list of associated parameters. /// </summary> public ContentType(string primary, string sub, ParameterList parameters) { primaryType = primary; subType = sub; - this.parameters = parameters; + if(parameters != null) + { + this.parameters = parameters; + } else + { + this.parameters = new ParameterList(); + } } /// <summary> Index: Folder.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/Folder.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Folder.cs 6 Sep 2002 11:52:29 -0000 1.7 +++ Folder.cs 26 Sep 2002 09:47:10 -0000 1.8 @@ -24,7 +24,7 @@ /// This class is an abstract class with implementation furnished /// by the providers. /// <p>Folders can of various types. See - /// <see cref="FolderType"/> for more details. + /// <see cref="T:CSMail.FolderType"/> for more details. /// </p> /// <p> /// What a folder stands for may have totally different meanings Index: MimeMultipart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMultipart.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- MimeMultipart.cs 24 Sep 2002 08:34:52 -0000 1.7 +++ MimeMultipart.cs 26 Sep 2002 09:47:10 -0000 1.8 @@ -17,24 +17,63 @@ public class MimeMultipart : Multipart { protected bool isParsed; + + protected StreamReader reader = null; + /// <summary> + /// Creates an instance of MimeMultipart object, whose + /// content-type is "multipart/mixed". + /// </summary> + /// <remarks> + /// <para> + /// This constructor is useful for the providers and + /// other developers who need to create a new part + /// and then slowly fill it with content. + /// </para> + /// <para> + /// It is important to note that a unique boundary value + /// for this part is automatically generated when the + /// instance is created using this constructor or the other + /// where subpart is provided. + /// </para> + /// </remarks> public MimeMultipart(): this("mixed") { } + /// <summary> + /// Creates an instance of MimeMultipart object, with + /// given <see cref="P:CSMail.MimeMultipart.SubType"/> + /// </summary> + /// <remarks> + /// <para> + /// This constructor is useful for the providers and + /// other developers who need to create a new part + /// and then slowly fill it with content. + /// </para> + /// <para> + /// It is important to note that a unique boundary value + /// for this part is automatically generated when the + /// instance is created using this constructor or the other + /// where subpart is provided. + /// </para> + /// </remarks> + /// <param name="subType">The <see cref="SubType"/> for + /// the <see cref="P:CSMail.Multipart.ContentType"/> + /// </param> [MailTODO] - public MimeMultipart(string subPart) + public MimeMultipart(string subType) { isParsed = true; - CType = new ContentType("multipart", subPart); - // Have to set a new Boundary Value; - throw new NotImplementedException(); + CType = new ContentType("multipart", subType); + CType.Parameters["Boundary"] = "\"--" + UniqueValueGenerator.GenerateBoundary() + "\""; } - [MailTODO] public MimeMultipart(StreamReader reader) { - throw new NotImplementedException(); + isParsed = false; + this.reader = reader; + ParseBodyParts(); } public string SubType @@ -66,16 +105,9 @@ /// </summary> /// <remarks> /// <para> - /// I have to get raw data (stream) from somewhere. - /// Now this makes me think over the issue of - /// a DataSource. Do I need it now? - /// </para> - /// <para> - /// But that will mean looking into the - /// whole of Activation framework and understanding it. - /// Now, how does Java-Mail get the DataSource - /// when <c>default constructor</c> or - /// <c>ctor(string)</c> is called? + /// This method is used only in conjuction with + /// <see cref="M:CSMail.MimeMultipart.#ctor(StreamReader)"/> + /// constructor. /// </para> /// </remarks> [MailTODO] @@ -86,7 +118,7 @@ throw new NotImplementedException(); } } - + [MailTODO] public override void WriteTo(StreamWriter writer) { Index: ParameterList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ParameterList.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ParameterList.cs 20 Jun 2002 02:43:25 -0000 1.1 +++ ParameterList.cs 26 Sep 2002 09:47:10 -0000 1.2 @@ -16,6 +16,11 @@ { private Hashtable parameters; + public ParameterList() + { + parameters = new Hashtable(); + } + public ParameterList(Parameter parameter) { parameters = new Hashtable(); |
From: Gaurav V. <mas...@us...> - 2002-09-26 09:45:43
|
Update of /cvsroot/csmail/csmail/src/CSMail.Utils In directory usw-pr-cvs1:/tmp/cvs-serv1700 Modified Files: ChangeLog Added Files: UniqueValueGenerator.cs Log Message: 2002-09-26 * UniqueValueGenerator.cs : Added new class. : GenerateBoundary() - Implemented --- NEW FILE --- /** * Namespace: CSMail.Utils * Class: UniqueValueGenerator * * Author: Gaurav Vaish * Maintainer: mastergaurav AT users DOT sf DOT net * * (C) Gaurav Vaish (2002) */ using System; using System.Text; using System.Net; using CSMail; namespace CSMail.Utils { public class UniqueValueGenerator { [MailTODO] public static string GenerateBoundary() { StringBuilder retVal = new StringBuilder("__CSMail__Next"); retVal.Append("__"); DateTime now = DateTime.Now; retVal.Append(now.Year); retVal.Append(now.Month); retVal.Append(now.Day); retVal.Append(now.Hour); retVal.Append(now.Minute); retVal.Append(now.Second); retVal.Append(now.Millisecond); try { string hostname = Dns.GetHostByAddress("127.0.0.1").HostName; string[] parts = hostname.Split(new char[] { '.'}); foreach(string current in parts) { retVal.Append(current); } } catch(Exception) { } retVal.Append("__"); retVal.Append((new Random()).Next()); retVal.Append("__"); return retVal.ToString(); } } } Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail.Utils/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ChangeLog 13 Sep 2002 05:54:06 -0000 1.9 +++ ChangeLog 26 Sep 2002 09:45:40 -0000 1.10 @@ -1,4 +1,9 @@ +2002-09-26 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * UniqueValueGenerator.cs : Added new class. + : GenerateBoundary() - Implemented + 2002-09-13 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * StateBag.cs : Added new class. |
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(); + } + } + } } } |
From: Gaurav V. <mas...@us...> - 2002-09-24 06:37:23
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv18400 Modified Files: ChangeLog MimeBodyPart.cs MimeMultipart.cs Log Message: 2002-09-17 * MimeBodyPart.cs : Documented. And raised doubts and questions. * MimeMultipart.cs : UpdateHeaders - Marked virtual : CreateMimeBodyPart(...)- Marked virtual : CreateHeaders(...) - Marked virtual : Parse() - Marked virtual Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- ChangeLog 19 Sep 2002 11:13:35 -0000 1.44 +++ ChangeLog 24 Sep 2002 06:37:20 -0000 1.45 @@ -1,6 +1,14 @@ 2002-09-17 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeBodyPart.cs : Documented. And raised doubts and questions. + * MimeMultipart.cs : UpdateHeaders - Marked virtual + : CreateMimeBodyPart(...)- Marked virtual + : CreateHeaders(...) - Marked virtual + : Parse() - Marked virtual + +2002-09-17 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeBodyPart.cs : TransferEncoding - Marked virtual : Text - Marked virtual : ContentMD5 - Marked virtual Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MimeBodyPart.cs 19 Sep 2002 11:13:35 -0000 1.3 +++ MimeBodyPart.cs 24 Sep 2002 06:37:20 -0000 1.4 @@ -13,28 +13,55 @@ namespace CSMail { + /// <summary> + /// Class that encapsulates a part of a + /// <see cref="MimeMessage"/>. + /// </summary> public class MimeBodyPart : BodyPart, IMimePart { + /// <summary> + /// List of headers for this part. + /// </summary> protected HeaderList headers; + /// <summary> + /// The content of this part. + /// </summary> protected byte[] content; + /// <summary> + /// Creates an empty part. + /// </summary> public MimeBodyPart() { headers = new HeaderList(); } + /// <summary> + /// Tries to create a part from the given + /// input stream. + /// </summary> + /// <param name="reader">Stream from where to + /// read the contents for the part.</param> [MailTODO] public MimeBodyPart(StreamReader reader) { throw new NotImplementedException(); } + /// <summary> + /// Creates a part with given headers and content. + /// </summary> + /// <param name="headers">The headers of this part.</param> + /// <param name="content">Content of this part.</param> public MimeBodyPart(HeaderList headers, byte[] content) { this.headers = headers; this.content = content; } + /// <summary> + /// Returns the size of the part in bytes. + /// </summary> [MailTODO] public override int Size { @@ -44,6 +71,12 @@ } } + /// <summary> + /// Gets or sets the headers for this part. + /// </summary> + /// <value> + /// Contains the headers related to the body part held. + /// </value> public override HeaderList Headers { get @@ -56,6 +89,9 @@ } } + /// <summary> + /// Gets or sets the content for this part. + /// </summary> [MailTODO] public override Multipart Content { @@ -69,6 +105,14 @@ } } + /// <summary> + /// Gets or sets the value of "Content-Type" 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 override ContentType ContentType { get @@ -84,6 +128,14 @@ } } + /// <summary> + /// Gets or sets the value of "Description" 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 override string Description { get @@ -99,6 +151,14 @@ } } + /// <summary> + /// Gets or sets the value of "Content-Disposition" 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 override ContentDisposition Disposition { get @@ -116,6 +176,15 @@ } } + /// <summary> + /// 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 @@ -131,6 +200,14 @@ } } + /// <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 @@ -146,6 +223,14 @@ } } + /// <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 @@ -161,6 +246,14 @@ } } + /// <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> public virtual string ContentMD5 { get @@ -176,6 +269,10 @@ } } + /// <summary> + /// Gets or sets the value of text for a body + /// whose "ContentType" is "text/plain". + /// </summary> public virtual string Text { get @@ -191,6 +288,14 @@ } } + /// <summary> + /// Gets or sets the value of "Transfer-Encoding" 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 TransferEncoding TransferEncoding { get @@ -206,12 +311,34 @@ } } + /// <summary> + /// Updates the headers for this part. + /// </summary> + /// <remarks> + /// <para> + /// Though I have copied this method (signature at least), + /// but I don't think there should be any use. I am still + /// confused as to where and when will it be used. + /// </para> + /// <para> + /// May be just before <see cref="Write(TextWriter)"/> is + /// called. + /// </para> + /// </remarks> [MailTODO] public virtual void UpdateHeaders() { throw new NotImplementedException(); } + /// <summary> + /// Writes the headers and content to the given + /// writer. + /// </summary> + /// <remarks> + /// I am thinking of moving from <see cref="TextWriter"/> + /// to <see cref="StreamWriter"/>. + /// </remarks> [MailTODO] public override void Write(TextWriter writer) { Index: MimeMultipart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMultipart.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- MimeMultipart.cs 19 Sep 2002 08:16:15 -0000 1.5 +++ MimeMultipart.cs 24 Sep 2002 06:37:20 -0000 1.6 @@ -57,14 +57,18 @@ /// See remarks /// </summary> /// <remarks> + /// <para> /// I have to get raw data (stream) from somewhere. /// Not this makes me think over the issue of /// a DataSource. Do I need it now? + /// </para> + /// <para> /// But that will mean looking into the /// whole of Activation framework and understanding it. /// Now, how does Java-Mail get the DataSource /// when <c>default constructor</c> or /// <c>ctor(string)</c> is called? + /// </para> /// </remarks> [MailTODO] protected override void ParseBodyParts() @@ -73,7 +77,7 @@ } [MailTODO] - protected void UpdateHeaders() + protected virtual void UpdateHeaders() { throw new NotImplementedException(); } @@ -85,25 +89,25 @@ } [MailTODO] - protected MimeBodyPart CreateMimeBodyPart(StreamReader reader) + protected virtual MimeBodyPart CreateMimeBodyPart(StreamReader reader) { throw new NotImplementedException(); } [MailTODO] - protected MimeBodyPart CreateMimeBodyPart(HeaderList headers, byte[] content) + protected virtual MimeBodyPart CreateMimeBodyPart(HeaderList headers, byte[] content) { throw new NotImplementedException(); } [MailTODO] - protected MimeBodyPart CreateHeaders(StreamReader reader) + protected virtual HeaderList CreateHeaders(StreamReader reader) { throw new NotImplementedException(); } [MailTODO] - protected void Parse() + protected virtual void Parse() { throw new NotImplementedException(); } |
From: Gaurav V. <mas...@us...> - 2002-09-19 11:13:38
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv18972 Modified Files: ChangeLog MimeBodyPart.cs Log Message: 2002-09-17 * MimeBodyPart.cs : TransferEncoding - Marked virtual : Text - Marked virtual : ContentMD5 - Marked virtual : ContentLanguage - Marked virtual : ContentID - Marked virtual Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- ChangeLog 19 Sep 2002 08:16:15 -0000 1.43 +++ ChangeLog 19 Sep 2002 11:13:35 -0000 1.44 @@ -1,6 +1,14 @@ 2002-09-17 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * MimeBodyPart.cs : TransferEncoding - Marked virtual + : Text - Marked virtual + : ContentMD5 - Marked virtual + : ContentLanguage - Marked virtual + : ContentID - Marked virtual + +2002-09-17 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + * BodyPartList.cs : Added utility methods. Fairly complete. * MimeBodyPart.cs : ?? Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MimeBodyPart.cs 13 Sep 2002 06:10:59 -0000 1.2 +++ MimeBodyPart.cs 19 Sep 2002 11:13:35 -0000 1.3 @@ -44,7 +44,6 @@ } } - [MailTODO] public override HeaderList Headers { get @@ -132,7 +131,7 @@ } } - public string ContentID + public virtual string ContentID { get { @@ -147,7 +146,7 @@ } } - public string ContentLanguage + public virtual string ContentLanguage { get { @@ -162,7 +161,7 @@ } } - public string ContentMD5 + public virtual string ContentMD5 { get { @@ -177,7 +176,7 @@ } } - public string Text + public virtual string Text { get { @@ -192,7 +191,7 @@ } } - public TransferEncoding TransferEncoding + public virtual TransferEncoding TransferEncoding { get { |