Mail Message Renderer Update



'allo.

The attached patch fixes the hackish xw.WriteRaw garbage by passing the
XmlWriter object.  Also, I renamed the MatchComprarer to
MailMessageDateComparer (as per Nat's suggestion).  

So just some minor internal changes.  Nothing fancy yet.

(I'm dreading figuring out this date format issue.  Mono doesn't seem to
like me right now.)

-- 
Kevin Godby <godbyk yahoo com>
--- dashboard-pristine/renderers/MailMessageMatchRenderer.cs	2004-02-20 16:14:27.000000000 -0600
+++ dashboard/renderers/MailMessageMatchRenderer.cs	2004-02-20 17:13:01.000000000 -0600
@@ -42,13 +42,13 @@
 			xw.WriteAttributeString ("width", "100%");
 
 			// Sort results by date (newest first)
-			IComparer matchcomparer = new MatchComparer ();
-			matches.Sort (matchcomparer);
+			IComparer mailmessagedatecomparer = new MailMessageDateComparer ();
+			matches.Sort (mailmessagedatecomparer);
 
 
 			bool color_band = true;
 			foreach (Match m in matches) {
-				xw.WriteRaw (HTMLRenderSingleMailMessage (m, color_band));
+				HTMLRenderSingleMailMessage (m, color_band, xw);
 				color_band = ! color_band;
 			}
 
@@ -61,7 +61,7 @@
 			return sw.ToString ();
 		}
 
-		private string HTMLRenderSingleMailMessage (Match m, bool color_band)
+		private void HTMLRenderSingleMailMessage (Match m, bool color_band, XmlWriter xw)
 		{
 			// Make the date look pretty
 			string maildate = Convert.ToString (m ["SentDate"]);
@@ -70,11 +70,8 @@
 			Message msg = new Message ();
 			msg.Initialize (m);
 
-			Console.WriteLine ("To: {0}\nFrom: {1}\nSubject: {2}\nDate: {3}",
-						msg.Recipient, msg.Sender, msg.Subject, msg.SentDate);
-
-			StringWriter sw = new StringWriter ();
-			XmlWriter xw = new XmlTextWriter (sw);
+			// Console.WriteLine ("To: {0}\nFrom: {1}\nSubject: {2}\nDate: {3}",
+			// 			msg.Recipient, msg.Sender, msg.Subject, msg.SentDate);
 
 			xw.WriteStartElement ("tr");
 
@@ -151,8 +148,6 @@
 
 			xw.WriteEndElement (); // td
 			xw.WriteEndElement (); // tr
-			
-			return sw.ToString ();
 		}
 
 		private string ParseMailDate (string maildate)
@@ -389,7 +384,7 @@
 		Descending
 	}
 
-	public class MatchComparer : IComparer {
+	public class MailMessageDateComparer : IComparer {
 
 		// Reverse-sort -- newest messages first
 		private SortDirection m_direction = SortDirection.Descending;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]