Beagle Thunderbird Patch



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Here she is, I'll also attach this in the bugzilla, but heres what we
have, and its ready for SVN in my opinion. (Although, don't get too
excited, were gonna have a long week of bugfixing ahead of us, its a
boatload-of-code).

I'm going to be doing some more testing and possibly change some more
stuff this evening, so I might send another e-mail with an updated patch
(but its not super-likely).


- --
Cheers,
Kevin Kubasik
240-838-6616
http://kubasik.net/blog
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iQIVAwUBRLmCaP3xZFNDM330AQjfSQ//dwkfpnrnA4eWD08+VVf7r6R6VtYR720l
oxuuPFeNxyd6G8ILyNSbd+gRSjCQLcL7+BgsHpzA+5VGdPnYl7U7+ckai0vBB3z3
u9n7KbNvNiFrNmeF9DLHpzFuqPCmoryTGj1igRew2axXtEXoDrfuwDmN7CnrDk5l
TvIBOjIxjFZ/XgHJ8EcVHrMDPbCUiw/6om8szCwOha7ToQcmqE9Mx70LcUlkSX6T
ju0AYsl77io0Y/3NXYATfoFXPD6YC3VBYJ4XrV+ikxbLtelHDL3mL6SMEj3XvpGn
yDjsgP4w0TGTVESO4cizQpCK0xncjyxYI4c/jltc9aKlzURCIYsy9owvNuxsaqgR
TIIiHz9gEtlEdRpGNh9r4RErSrXrJpg/Zbd/5dMeFzj2p9/G6jUfAapWu9Hae7hO
UZdwmAxBqsG6fHX5IkUxlEHZ3E85qaMJu3XUVGQ2+AwXEtcfrRJRJWdsmAzxKwTR
PNp7zzf+CdtRdWxQwr2mg5bqO/s0qREhrs8BsusiOEtTzBKJLb6Wcq6AqW3AzMM0
Z7QElnP/E/GnHPfgjwY5eQbfBryXWfW6Tto3c/i6kv9mk7VjGvfHuJIYHUdMmLcC
4rQJq37WRpC9ykWzAjP7WFikM9jDTSVL9ks0Qs3NEtzNT7vecNNfQ6PrPS0Jbm4i
xqvWi0YW+hU=
=f0TT
-----END PGP SIGNATURE-----
Index: search/Tiles/MailAttachment.cs
===================================================================
--- search/Tiles/MailAttachment.cs	(revision 2690)
+++ search/Tiles/MailAttachment.cs	(working copy)
@@ -22,13 +22,13 @@
 			if (! base.Validate (hit))
 				return false;
 
-			string str = hit ["parent:fixme:hasAttachments"];
-
+			string str = hit.GetFirstProperty ("parent:fixme:hasAttachments");
+			//Console.WriteLine (str);
 			if (hit.ParentUri == null || str == null || str == "false")
 				return false;
 
-			str = hit ["fixme:attachment_title"];
-
+			str = hit.GetFirstProperty ("fixme:attachment_title");
+			//Console.WriteLine (str);
 			if (str == null || str == "")
 				return false;
 
@@ -69,25 +69,30 @@
 
 		public override void Open ()
 		{
-			if (GetHitProperty (Hit, "fixme:client") != "evolution") {
+			SafeProcess p = MailMessage.GetClientProcess (GetHitProperty (Hit, "fixme:client"));
+
+			if (p == null) {
 				OpenFromMime (Hit);
 				return;
 			}
 
-			SafeProcess p = new SafeProcess ();
-			p.Arguments = new string [2];
-			p.Arguments [0] = "evolution";
-
 			if (Hit.ParentUriAsString != null)
-				p.Arguments [1] = Hit.ParentUriAsString;
+				p.Arguments [p.Arguments.Length-1] = Hit.ParentUriAsString;
 			else
-				p.Arguments [1] = Hit.UriAsString;
+				p.Arguments [p.Arguments.Length-1] = Hit.UriAsString;
 
 			try {
 				p.Start ();
 			} catch (SafeProcessException e) {
 				Console.WriteLine ("Unable to run {0}: {1}", p.Arguments [0], e.Message);
+				p.Arguments [0] = "mozilla-thunderbird";
+				try {
+					p.Start();
+				} catch (SafeProcessException e2) {
+					Console.WriteLine ("Unable to run {0}: {1}", p.Arguments [0], e2.Message);
+				}
 			}
-		}	
+		}
+		
 	}
 }
Index: search/Tiles/MailMessage.cs
===================================================================
--- search/Tiles/MailMessage.cs	(revision 2690)
+++ search/Tiles/MailMessage.cs	(working copy)
@@ -1,5 +1,6 @@
 using System;
 using System.Diagnostics;
+using System.IO;
 using Mono.Unix;
 using Beagle.Util;
 
@@ -93,30 +94,55 @@
 			details.AddLabelPair (label, Utils.NiceLongDate (Timestamp));
 
 			details.AddSnippet ();
+			//Console.WriteLine ( details.snippet_text );
 
 			return details;
 		}
 
+		public static SafeProcess GetClientProcess (string client)
+		{
+			SafeProcess p = null;
+
+			if (client == "evolution") {
+				p = new SafeProcess ();
+				p.Arguments = new string [2];
+				p.Arguments [0] = "evolution";
+			} else if (client == "thunderbird") {
+				
+
+				p = new SafeProcess ();
+				p.Arguments = new string [3];
+				p.Arguments [0] = "thunderbird";
+				p.Arguments [1] = "-mail";
+			}
+
+			return p;
+		}
+
 		public override void Open ()
 		{
-			if (Hit.GetFirstProperty ("fixme:client") != "evolution") {
+			SafeProcess p = GetClientProcess (Hit.GetFirstProperty ("fixme:client"));
+
+			if (p == null) {
 				OpenFromMime (Hit);
 				return;
 			}
 
-			SafeProcess p = new SafeProcess ();
-			p.Arguments = new string [2];
-			p.Arguments [0] = "evolution";
-
 			if (Hit.ParentUriAsString != null)
-				p.Arguments [1] = Hit.ParentUriAsString;
+				p.Arguments [p.Arguments.Length-1] = Hit.ParentUriAsString;
 			else
-				p.Arguments [1] = Hit.UriAsString;
+				p.Arguments [p.Arguments.Length-1] = Hit.UriAsString;
 
 			try {
 				p.Start ();
 			} catch (SafeProcessException e) {
 				Console.WriteLine ("Unable to run {0}: {1}", p.Arguments [0], e.Message);
+				p.Arguments [0] = "mozilla-thunderbird";
+				try {
+					p.Start();
+				} catch (SafeProcessException e2) {
+					Console.WriteLine ("Unable to run {0}: {1}", p.Arguments [0], e2.Message);
+				}
 			}
 		}
 
Index: search/Tiles/Contact.cs
===================================================================
--- search/Tiles/Contact.cs	(revision 2690)
+++ search/Tiles/Contact.cs	(working copy)
@@ -78,10 +78,30 @@
 			return details;
 		}
 
+		public static SafeProcess GetClientProcess (string client)
+		{
+			SafeProcess p = null;
+
+   			if (client == "evolution") {
+				p = new SafeProcess ();
+				p.Arguments = new string [2];
+				p.Arguments [0] = "evolution";
+			} else if (client == "thunderbird") {
+				p = new SafeProcess ();
+				p.Arguments = new string [4];
+				p.Arguments [0] = "beagle-contactviewer";
+				p.Arguments [1] = "--manager";
+				p.Arguments [2] = "Thunderbird";
+			}
+
+			return p;
+                }
+
+
 		public override void Open ()
 		{
-			SafeProcess p = new SafeProcess ();
-			p.Arguments = new string [] { "evolution", Hit.UriAsString };
+			SafeProcess p = GetClientProcess (Hit.GetFirstProperty ("fixme:client"));
+			p.Arguments [p.Arguments.Length-1] = Hit.UriAsString;
 
 			try {
 				p.Start ();
Index: Util/Makefile.am
===================================================================
--- Util/Makefile.am	(revision 2690)
+++ Util/Makefile.am	(working copy)
@@ -114,6 +114,11 @@
 	$(srcdir)/SemWeb/XPathSemWebNavigator.cs	\
 	$(srcdir)/PropertyKeywordAttribute.cs
 
+if ENABLE_THUNDERBIRD
+UTIL_CSFILES +=				\
+	$(srcdir)/Mork.cs		\
+	$(srcdir)/Thunderbird.cs
+endif
 
 if HAS_LIBCHM 
 UTIL_CSFILES +=					\
Index: beagled/Filter.cs
===================================================================
--- beagled/Filter.cs	(revision 2690)
+++ beagled/Filter.cs	(working copy)
@@ -189,7 +189,7 @@
 
 		//////////////////////////
 		
-		private bool snippetMode = false;
+		private bool snippetMode = true;
 		private bool originalIsText = false;
 		private TextWriter snippetWriter = null;
 
@@ -508,13 +508,14 @@
 			}
 
 			try {
+				
 				DoOpen (info);
 
 				if (IsFinished)
 					return true;
 				else if (HasError)
 					return false;
-				
+					
 				DoPullProperties ();
 				
 				if (IsFinished) 
@@ -715,5 +716,6 @@
 		public ArrayList ChildIndexables {
 			get { return this.child_indexables; }
 		}
+		
 	}
 }
Index: beagled/Makefile.am
===================================================================
--- beagled/Makefile.am	(revision 2690)
+++ beagled/Makefile.am	(working copy)
@@ -592,6 +592,41 @@
 $(DAEMON_TARGET): $(DAEMON_CSFILES) $(DAEMON_LOCAL_ASSEMBLIES)
 	$(CSC) -out:$@ $(DAEMON_CSFLAGS) $(DAEMON_CSFILES) $(DAEMON_ASSEMBLIES)
 
+if ENABLE_THUNDERBIRD	
+THUNDERBIRD_DIR = ./ThunderbirdQueryable
+
+THUNDERBIRD_TARGET = $(THUNDERBIRD_DIR)/ThunderbirdBackends.dll
+
+THUNDERBIRD_CSFLAGS = -target:library
+
+
+THUNDERBIRD_CSFILES =						\
+	$(THUNDERBIRD_DIR)/LuceneAccess.cs			\
+	$(THUNDERBIRD_DIR)/ThunderbirdIndexer.cs   		\
+	$(THUNDERBIRD_DIR)/ThunderbirdIndexableGenerator.cs	\
+	$(THUNDERBIRD_DIR)/ThunderbirdQueryable.cs		\
+	$(THUNDERBIRD_DIR)/ThunderbirdInotify.cs		\
+	$(THUNDERBIRD_DIR)/Mail.cs				\
+	$(THUNDERBIRD_DIR)/Contact.cs				\
+	$(THUNDERBIRD_DIR)/RSS.cs				\
+	$(THUNDERBIRD_DIR)/NNTP.cs				\
+	$(THUNDERBIRD_DIR)/MoveMail.cs
+
+THUNDERBIRD_LOCAL_ASSEMBLIES =		\
+	../Util/Util.dll		\
+	../BeagleClient/Beagle.dll	\
+	BeagleDaemonLib.dll
+
+THUNDERBIRD_ASSEMBLIES =				\
+	-r:Mono.Posix				\
+	$(BEAGLED_LIBS)                 	\
+	$(THUNDERBIRD_LOCAL_ASSEMBLIES:%=-r:%)
+
+
+$(THUNDERBIRD_TARGET): $(THUNDERBIRD_CSFILES) $(THUNDERBIRD_LOCAL_ASSEMBLIES)
+	$(CSC) -out:$@ $(THUNDERBIRD_CSFLAGS) $(THUNDERBIRD_CSFILES) $(THUNDERBIRD_ASSEMBLIES)
+endif
+
 ############################################################
 ############################################################
 ############################################################
@@ -976,6 +1011,10 @@
 	$(BUILD_INDEX_TARGET)		\
 	$(BUILD_INDEX_WRAPPER)
 
+if ENABLE_THUNDERBIRD
+ALL_TARGETS += $(THUNDERBIRD_TARGET)
+endif
+
 if ENABLE_WEBSERVICES
 ALL_TARGETS += 				\
 	$(XSP_TARGET)			\
@@ -1051,13 +1090,20 @@
 #	$(INSTALL_DATA) ../Util/Util.dll ../images/Images.dll ../BeagleClient/Beagle.dll ../Tiles/Tiles.dll BeagleDaemonPlugins.dll BeagleDaemonLib.dll $(DESTDIR)$(XSPBIN_DIR)
 
 endif
-
+if ENABLE_THUNDERBIRD
+	$(INSTALL_DATA) $(THUNDERBIRD_TARGET)                 $(DESTDIR)/$(BACKENDDIR)
+	$(INSTALL_DATA) $(THUNDERBIRD_TARGET).mdb             $(DESTDIR)/$(BACKENDDIR)
+endif
 uninstall-local:
 if ENABLE_WEBSERVICES
 	rm -f $(DESTDIR)$(pkglibdir)/$(WEBSERVICES_BACKEND_TARGET)
 	rm -f $(DESTDIR)$(pkglibdir)/$(WEBSERVICES_XSP_TARGET)
 	rm -rf $(DESTDIR)$(XSP_DIR)
 endif
+if ENABLE_THUNDERBIRD
+	$(INSTALL_DATA) $(THUNDERBIRD_TARGET)                 $(DESTDIR)/$(BACKENDDIR)
+	$(INSTALL_DATA) $(THUNDERBIRD_TARGET).mdb             $(DESTDIR)/$(BACKENDDIR)
+endif
 if ENABLE_EVOLUTION
 	rm -f $(DESTDIR)$(BACKENDDIR)/$(EVO_DLL_TARGET)
 	rm -f $(DESTDIR)$(BACKENDDIR)/$(EVO_DLL_TARGET).mdb
@@ -1186,5 +1232,6 @@
 	$(WEBSERVICES_FRONTEND_TARGET)		\
 	$(WEBSERVICES_FRONTEND_TARGET).mdb	\
 	$(WEBSERVICES_XSP_TARGET)		\
-	$(WEBSERVICES_XSP_TARGET).mdb		
-
+	$(WEBSERVICES_XSP_TARGET).mdb		\
+	$(THUNDERBIRD_TARGET)			\
+	$(THUNDERBIRD_TARGET).mdb
Index: configure.in
===================================================================
--- configure.in	(revision 2690)
+++ configure.in	(working copy)
@@ -168,6 +168,13 @@
 LDFLAGS="$OLD_LDFLAGS"
 LIBS="$OLD_LIBS"
 
+dnl ----------------------------------------------
+AC_ARG_ENABLE([thunderbird],
+	AC_HELP_STRING([--disable-thunderbird], [Disable Thunderbird Mail Backend]),
+	enable_tbird=$enableval,
+	enable_tbird=yes)
+AM_CONDITIONAL(ENABLE_THUNDERBIRD, test "x$enable_tbird" = "xyes")
+
 dnl -------------------------------------------------------
 
 AC_ARG_ENABLE([gui],
@@ -645,6 +652,7 @@
 tools/Makefile
 search/Makefile
 ImLogViewer/Makefile
+ContactViewer/Makefile
 libbeagle/Makefile
 libbeagle/libbeagle-0.0.pc
 libbeagle/beagle/Makefile
@@ -678,6 +686,7 @@
 	galago-sharp?		  ${enable_galago}
 	libchm?			  ${has_libchm} 
 	google backend?		  ${enable_googledriver} (Unsupported)
+	Thunderbird backend? 	  ${enable_tbird}
 
 	Mozilla Extension?	  yes
 	Epiphany Extension?	  ${enable_epiphany_extension}
Index: Filters/FilterMail.cs
===================================================================
--- Filters/FilterMail.cs	(revision 2690)
+++ Filters/FilterMail.cs	(working copy)
@@ -53,7 +53,9 @@
 		{
 			// 1: Make email addresses non-keyword, add sanitized version
 			//    for eaching for parts of an email address.
-			SetVersion (1);
+			// 2: Snippet all mail and attachments
+			SetVersion (2);
+			SnippetMode = true;
 
 			AddSupportedFlavor (FilterFlavor.NewFromMimeType ("message/rfc822"));
 		}
@@ -81,8 +83,11 @@
 			stream.Dispose ();
 			parser.Dispose ();
 
-			if (this.message == null)
+			if (this.message == null){
+				Console.WriteLine ("NO MESSAGE!");
 				Error ();
+				
+			}
 		}
 
 		private bool HasAttachments (GMime.Object mime_part)
@@ -190,7 +195,7 @@
 			}
 
 			string l = handler.Reader.ReadLine ();
-
+			//Console.WriteLine (l);
 			if (l != null)
 				AppendText (l);
 			else
@@ -224,6 +229,7 @@
 			public PartHandler (Beagle.Daemon.Filter filter)
 			{
 				this.filter = filter;
+				this.filter.SnippetMode = true;
 			}
 
 			private bool IsMimeTypeHandled (string mime_type)
@@ -315,7 +321,8 @@
 
 						child.HitType = "MailMessage";
 						child.MimeType = part.ContentType.ToString ();
-						child.CacheContent = false;
+						//child.CacheContent = false;
+					
 
 						child.AddProperty (Property.NewKeyword ("fixme:attachment_title", ((GMime.Part)part).Filename));
 
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 2690)
+++ Makefile.am	(working copy)
@@ -36,6 +36,10 @@
 SUBDIRS += bludgeon
 endif
 
+if ENABLE_THUNDERBIRD
+SUBDIRS += ContactViewer
+endif
+
 # When the chooser work has been fixed up to use libbeagle, we can
 # reenable this directory.
 # SUBDIRS += chooser-fu


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