[Csmail-patches] CVS: csmail/src/CSMail ChangeLog,1.62,1.63 ContentDisposition.cs,1.3,1.4 MimeMessag
Status: Pre-Alpha
Brought to you by:
mastergaurav
From: Gaurav V. <mas...@us...> - 2002-10-31 06:30:16
|
Update of /cvsroot/csmail/csmail/src/CSMail In directory usw-pr-cvs1:/tmp/cvs-serv28383 Modified Files: ChangeLog ContentDisposition.cs MimeMessage.cs ParameterList.cs Log Message: 2002-10-31 * ContentDisposition.cs : FileName - Changed to Filename. * MimeMessage.cs : Disposition { get; set; } - Implemented. * ParameterList.cs : this[string] { set; } - Check for null values. Index: ChangeLog =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ChangeLog,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- ChangeLog 30 Oct 2002 09:54:16 -0000 1.62 +++ ChangeLog 31 Oct 2002 06:30:12 -0000 1.63 @@ -1,4 +1,11 @@ +2002-10-31 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> + + * ContentDisposition.cs : FileName - Changed to Filename. + * MimeMessage.cs : Disposition { get; set; } + - Implemented. + * ParameterList.cs : this[string] { set; } - Check for null values. + 2002-10-30 Gaurav Vaish <mastergaurav AT users DOT sf DOT net> * ContentDisposition.cs : Made a class. Added fancy features. Index: ContentDisposition.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ContentDisposition.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContentDisposition.cs 30 Oct 2002 09:54:16 -0000 1.3 +++ ContentDisposition.cs 31 Oct 2002 06:30:13 -0000 1.4 @@ -58,6 +58,16 @@ return retVal; } + public static ContentDisposition Parse(string headerValue) + { + ContentDispositionType type; + ParameterList pl = Parse(headerValue, out type); + ContentDisposition retVal = new ContentDisposition(); + retVal.DispositionType = type; + retVal.Parameters = pl; + return retVal; + } + public ContentDisposition(ContentDispositionType type, ParameterList parameters) { @@ -75,23 +85,20 @@ { if(!Enum.IsDefined(typeof(ContentDispositionType), value)) throw new ArgumentException("[DispositionType]" + - " Illegal value provided."); + " Given value does not exist."); type = value; } } - public string FileName + public string Filename { get { - return parameters["FileName"]; + return parameters["Filename"]; } set { - if(value == null || value.Length == 0) - parameters.Remove("FileName"); - else - parameters["FileName"] = value; + parameters["Filename"] = value; } } Index: MimeMessage.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/MimeMessage.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- MimeMessage.cs 1 Oct 2002 11:47:41 -0000 1.6 +++ MimeMessage.cs 31 Oct 2002 06:30:13 -0000 1.7 @@ -30,6 +30,8 @@ protected NewsAddressList ngroupList = new NewsAddressList(); protected EMailAddressList replyList = new EMailAddressList(); + protected ContentDisposition disposition = null; + private bool isStrict = false; public MimeMessage(Session session) : base(session) @@ -240,11 +242,19 @@ { get { - throw new NotImplementedException(); + if(disposition == null) + { + string disp = Headers["Content-Disposition"]; + if(disp != null && disp.Length > 0) + { + disposition = ContentDisposition.Parse(disp); + } + } + return disposition; } set { - throw new NotImplementedException(); + disposition = value; } } @@ -252,25 +262,11 @@ { get { - ParameterList list = MimeUtils.GetParametersAsList - (headers["Content-Disposition"], null); - if(list != null) - { - return list["Filename"]; - } - return null; + return Disposition.Filename; } set { - 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(); + disposition.Filename = value; } } Index: ParameterList.cs =================================================================== RCS file: /cvsroot/csmail/csmail/src/CSMail/ParameterList.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ParameterList.cs 9 Oct 2002 07:09:30 -0000 1.4 +++ ParameterList.cs 31 Oct 2002 06:30:13 -0000 1.5 @@ -61,7 +61,10 @@ } set { - parameters[name] = value; + if(value == null || value.Length == 0) + Remove(name); + else + parameters[name] = value; } } |