Re: Imap support in util/evolution/camel.cs



On Fri, 2004-03-05 at 06:12, Nat Friedman wrote:
> On Thu, 2004-03-04 at 06:04, Erik Bågfors wrote:
> 
> > What about the following very ugly patches? It just checks if the path
> > ends in "/summary", then assumes it's a imap-summary, otherwise it
> > thinks it's a mbox-summary??
> 
> I think this is fine.  Your patch needs to obey the coding guidelines,
> though.  Spaces before open parens in method invocations.

Alright, attached.

/Erik
Index: EvolutionMailBackend.cs
===================================================================
RCS file: /cvs/gnome/dashboard/backends/EvolutionMailBackend.cs,v
retrieving revision 1.21
diff -u -r1.21 EvolutionMailBackend.cs
--- EvolutionMailBackend.cs	4 Mar 2004 07:59:33 -0000	1.21
+++ EvolutionMailBackend.cs	4 Mar 2004 11:01:09 -0000
@@ -33,7 +33,7 @@
 				return false;
 
 			try {
-				summary = new Camel.MBoxSummary (summary_path);
+				summary = Camel.Summary.load (summary_path);
 			} catch (Exception e) {
 				Console.WriteLine ("Could not load camel summary: " + summary_path + e);
 				return false;
Index: camel.cs
===================================================================
RCS file: /cvs/gnome/dashboard/util/evolution/camel.cs,v
retrieving revision 1.2
diff -u -r1.2 camel.cs
--- camel.cs	3 Mar 2004 07:00:54 -0000	1.2
+++ camel.cs	4 Mar 2004 22:32:46 -0000
@@ -16,6 +16,17 @@
         public class Summary { 
 	    public SummaryHeader header;
 	    public MessageInfo [] messages;
+
+	    public static Summary load (string file) 
+	    {
+		Summary s;
+		if (file.EndsWith ("/summary")) { 
+		    s = new ImapSummary (file);
+		} else {
+		    s = new MBoxSummary (file);
+		}
+		return s;
+	    }
 	}
 
 	public class MBoxSummary: Summary {
@@ -317,13 +328,11 @@
 			string file;
 			
 			if (args.Length == 0)
-			//	file = "mbox.ev-summary";
-				file = "summary";
+				file = "./summary";
 			else
 				file = args [0];
 			
-			//Summary s = new MBoxSummary("mbox.ev-summary");
-			Summary s = new ImapSummary(file);
+			Summary s = Summary.load (file);
 			for (int i = 0; i < s.header.count; i++) {
 			    Console.WriteLine(s.messages [i]);
 			}


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