[Csmail-patches] CVS: csmail/src/CSMail ChangeLog,1.65,1.66 ContentDisposition.cs,1.4,1.5 MimeBodyPa
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2003-01-22 13:48:40
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory sc8-pr-cvs1:/tmp/cvs-serv12466 Modified Files: ChangeLog ContentDisposition.cs MimeBodyPart.cs Log Message: 2003-01-03 * MimeBodyPart.cs : Size - Partial implementation. : ContentDisposition - Completed. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- ChangeLog 7 Nov 2002 09:56:35 -0000 1.65 +++ ChangeLog 22 Jan 2003 13:48:36 -0000 1.66 @@ -1,4 +1,9 @@ +2003-01-03 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * MimeBodyPart.cs : Size - Partial implementation. + : ContentDisposition - Completed. + 2002-11-07 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * ContentType.cs : op_== (ContentType, string) Index: ContentDisposition.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentDisposition.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ContentDisposition.cs 31 Oct 2002 06:30:13 -0000 1.4 +++ ContentDisposition.cs 22 Jan 2003 13:48:36 -0000 1.5 @@ -29,11 +29,13 @@ public ContentDisposition(string headerLine) { - if(!headerLine.ToLower().StartsWith("content-disposition")) - throw new ArgumentException("[ContentDisposition] " + - "Value does not start with " + - " \"Content-Disposition:\""); - headerLine = headerLine.Substring(21); + if(headerLine == null || headerLine.Length == 0) + throw new ArgumentException("Illegal argument value" + + " for headerLine"); + if(headerLine.ToLower().StartsWith("content-disposition")) + { + headerLine = headerLine.Substring(21); + } parameters = Parse(headerLine, out type); } Index: MimeBodyPart.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeBodyPart.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- MimeBodyPart.cs 30 Oct 2002 09:54:16 -0000 1.10 +++ MimeBodyPart.cs 22 Jan 2003 13:48:36 -0000 1.11 @@ -27,6 +27,10 @@ /// The content of this part. /// </summary> protected byte[] content; + /// <summary> + /// The stream associated with the content for the part. + /// </summary> + protected StreamReader reader; /// <summary> /// Creates an empty part. @@ -45,6 +49,7 @@ [MailTODO] public MimeBodyPart(StreamReader reader) { + this.reader = reader; throw new NotImplementedException(); } @@ -66,12 +71,15 @@ /// The size of the headers plus the size of body /// (the actual message), in bytes, for this body part. /// </value> - [MailTODO] public override long Size { get { - throw new NotImplementedException(); + if(content != null) + return content.Length; + if(reader != null && reader.BaseStream != null) + return reader.BaseStream.Length; + return -1; } } @@ -159,11 +167,14 @@ { get { - throw new NotImplementedException(); + return new ContentDisposition(Headers["Content-Disposition"]); } set { - throw new NotImplementedException(); + if(value != null) + Headers["Content-Disposition"] = value.ToString(); + else + Headers.Remove(Header.GetHeaderByName("Content-Disposition", true)); } } |