patch to port beagle to gmime-2.4



This is a preliminary patch, GMime-2.4 isn't yet released and the API
isn't written in stone yet; I've written the patch to get feedback from
you guys on the API changes I've made.

Note: GMime 2.4 is parallel-installable with the old GMime 2.2

Jeff

Index: beagle/beagled/EvolutionMailQueryable/EvolutionMailIndexableGenerator.cs
===================================================================
--- beagle/beagled/EvolutionMailQueryable/EvolutionMailIndexableGenerator.cs	(revision 4845)
+++ beagle/beagled/EvolutionMailQueryable/EvolutionMailIndexableGenerator.cs	(working copy)
@@ -334,14 +334,14 @@
 
 			GMime.InternetAddressList addrs;
 
-			addrs = message.GetRecipients (GMime.Message.RecipientType.To);
+			addrs = message.GetRecipients (GMime.RecipientType.To);
 			foreach (GMime.InternetAddress ia in addrs) {
 				if (this.folder_name == "Sent" && ia.AddressType != GMime.InternetAddressType.Group)
 					indexable.AddProperty (Property.NewUnsearched ("fixme:sentTo", ia.Addr));
 			}
 			addrs.Dispose ();
 
-			addrs = message.GetRecipients (GMime.Message.RecipientType.Cc);
+			addrs = message.GetRecipients (GMime.RecipientType.Cc);
 			foreach (GMime.InternetAddress ia in addrs) {
 				if (this.folder_name == "Sent"  && ia.AddressType != GMime.InternetAddressType.Group)
 					indexable.AddProperty (Property.NewUnsearched ("fixme:sentTo", ia.Addr));
Index: beagle/beagled/KMailQueryable/KMailIndexer.cs
===================================================================
--- beagle/beagled/KMailQueryable/KMailIndexer.cs	(revision 4845)
+++ beagle/beagled/KMailQueryable/KMailIndexer.cs	(working copy)
@@ -408,14 +408,14 @@
 
 			GMime.InternetAddressList addrs;
 
-			addrs = message.GetRecipients (GMime.Message.RecipientType.To);
+			addrs = message.GetRecipients (GMime.RecipientType.To);
 			foreach (GMime.InternetAddress ia in addrs) {
 				if (folder_name == Queryable.SentMailFolderName && ia.AddressType != GMime.InternetAddressType.Group)
 					indexable.AddProperty (Property.NewKeyword ("fixme:sentTo", ia.Addr));
 			}
 			addrs.Dispose ();
 
-			addrs = message.GetRecipients (GMime.Message.RecipientType.Cc);
+			addrs = message.GetRecipients (GMime.RecipientType.Cc);
 			foreach (GMime.InternetAddress ia in addrs) {
 				if (folder_name == Queryable.SentMailFolderName && ia.AddressType != GMime.InternetAddressType.Group)
 					indexable.AddProperty (Property.NewKeyword ("fixme:sentTo", ia.Addr));
Index: beagle/beagled/ThunderbirdQueryable/ThunderbirdQueryable.cs
===================================================================
--- beagle/beagled/ThunderbirdQueryable/ThunderbirdQueryable.cs	(revision 4845)
+++ beagle/beagled/ThunderbirdQueryable/ThunderbirdQueryable.cs	(working copy)
@@ -363,8 +363,8 @@
 			message.Subject = Mime.HeaderDecodeText (GetText (document, "Subject"));
 			message.Sender = Mime.HeaderDecodePhrase (GetText (document, "Author"));
 			message.MessageId = GetText (document, "MessageId");
-			message.SetDate (DateTimeUtil.UnixToDateTimeUtc (Convert.ToInt64 (GetText (document, "Date"))), 0);
-			message.AddRecipientsFromString ("To", Mime.HeaderDecodePhrase (GetText (document, "Recipients")));
+			message.Date = DateTimeUtil.UnixToDateTimeUtc (Convert.ToInt64 (GetText (document, "Date")));
+			message.AddRecipientsFromString (GMime.RecipientType.To, Mime.HeaderDecodePhrase (GetText (document, "Recipients")));
 
 			return message;
 		}
@@ -430,7 +430,7 @@
 			
 			// We _know_ that the stream comes from a StreamReader, which uses UTF8 by
 			// default. So we use that here when parsing our string.
-			return (str != null ? Encoding.UTF8.GetString (str, 0, pos) : string.Empty);
+			return (str != null ? System.Text.Encoding.UTF8.GetString (str, 0, pos) : string.Empty);
 		}
 		
 		// This spell "charset="
@@ -458,7 +458,7 @@
 			// instead of UTF-8 in some cases and that will really mess things up.
 			byte[] buffer = null;
 			int c, header_length = 0, newlines = 0, charset_pos = 0;
-			Encoding enc = Encoding.UTF8;
+			System.Text.Encoding enc = System.Text.Encoding.UTF8;
 			try {
 				do {
 					c = stream.BaseStream.ReadByte ();
@@ -487,7 +487,7 @@
 				stream.BaseStream.Read (buffer, 0, buffer.Length);
 				
 				// We need to use correct encoding
-				enc = Encoding.GetEncoding (encoding_str);
+				enc = System.Text.Encoding.GetEncoding (encoding_str);
 			} catch {
 			} finally {
 				stream.Close ();
Index: beagle/beagled/GoogleBackends/GMailSearchDriver.cs
===================================================================
--- beagle/beagled/GoogleBackends/GMailSearchDriver.cs	(revision 4845)
+++ beagle/beagled/GoogleBackends/GMailSearchDriver.cs	(working copy)
@@ -322,7 +322,7 @@
 			hit.AddProperty (Property.NewDate ("fixme:date", message.Date.ToUniversalTime ()));
 
 			GMime.InternetAddressList addrs;
-			addrs = message.GetRecipients (GMime.Message.RecipientType.To);
+			addrs = message.GetRecipients (GMime.RecipientType.To);
 			foreach (GMime.InternetAddress ia in addrs) {
 				hit.AddProperty (Property.NewUnsearched ("fixme:to", ia.ToString (false)));
 				if (ia.AddressType != GMime.InternetAddressType.Group)
@@ -332,7 +332,7 @@
 			}
 			addrs.Dispose ();
 
-			addrs = message.GetRecipients (GMime.Message.RecipientType.Cc);
+			addrs = message.GetRecipients (GMime.RecipientType.Cc);
 			foreach (GMime.InternetAddress ia in addrs) {
 				hit.AddProperty (Property.NewUnsearched ("fixme:cc", ia.ToString (false)));
 				if (ia.AddressType != GMime.InternetAddressType.Group)
@@ -353,7 +353,7 @@
 			addrs.Dispose ();
 
 			foreach (GMime.References refs in message.References)
-				hit.AddProperty (Property.NewUnsearched ("fixme:reference", refs.Msgid));
+				hit.AddProperty (Property.NewUnsearched ("fixme:reference", refs.MessageId));
 
 			string list_id = message.GetHeader ("List-Id");
 			if (list_id != null)
Index: beagle/configure.in
===================================================================
--- beagle/configure.in	(revision 4845)
+++ beagle/configure.in	(working copy)
@@ -17,7 +17,7 @@
 NDESK_DBUS_REQUIRED=0.5.2
 NDESK_DBUS_GLIB_REQUIRED=0.3.0
 GTK_SHARP_REQUIRED=2.10.0
-GMIME_SHARP_REQUIRED=2.2.0
+GMIME_SHARP_REQUIRED=2.3.5
 EVOLUTION_SHARP_REQUIRED=0.13.3
 GSF_SHARP_REQUIRED=0.6
 GTK_REQUIRED=2.10.0
@@ -225,7 +225,7 @@
 	glade-sharp-2.0 >= $GTK_SHARP_REQUIRED
 	gnome-sharp-2.0 >= $GTK_SHARP_REQUIRED
 	gnome-vfs-sharp-2.0 >= $GTK_SHARP_REQUIRED
-	gmime-sharp >= $GMIME_SHARP_REQUIRED
+	gmime-sharp-2.4 >= $GMIME_SHARP_REQUIRED
 ])
 	AC_SUBST(BEAGLE_UI_LIBS)
 
@@ -272,7 +272,7 @@
                   evolution-sharp >= $EVOLUTION_SHARP_REQUIRED 	\
                   gconf-sharp-2.0 >= $GTK_SHARP_REQUIRED	\
 		  glib-sharp-2.0 >= $GTK_SHARP_REQUIRED
-                  gmime-sharp >= $GMIME_SHARP_REQUIRED,
+                  gmime-sharp-2.4 >= $GMIME_SHARP_REQUIRED,
                   have_evo_dependencies=yes, have_evo_dependencies=no)
 AC_SUBST(EVO_LIBS)
 
@@ -377,14 +377,14 @@
 PKG_CHECK_MODULES(BEAGLED,
 [
 	shared-mime-info
-	gmime-sharp >= $GMIME_SHARP_REQUIRED
+	gmime-sharp-2.4 >= $GMIME_SHARP_REQUIRED
 	glib-sharp-2.0 >= $GTK_SHARP_REQUIRED
 ])
 BEAGLED_LIBS="$BEAGLED_LIBS $GSF_SHARP_LIBS"
 AC_SUBST(BEAGLED_LIBS)
 
 GSF_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gsf-sharp`
-GMIME_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gmime-sharp`
+GMIME_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gmime-sharp-2.4`
 
 dnl ----------------------------------------------
 dnl Epiphany Extension
Index: beagle/Filters/FilterMail.cs
===================================================================
--- beagle/Filters/FilterMail.cs	(revision 4845)
+++ beagle/Filters/FilterMail.cs	(working copy)
@@ -126,7 +126,7 @@
 
 			// Messages that are multipart/alternative shouldn't be considered as having
 			// attachments.  Unless of course they do.
-			if (mime_part is GMime.Multipart && mime_part.ContentType.Subtype.ToLower () != "alternative")
+			if (mime_part is GMime.Multipart && mime_part.ContentType.MediaSubtype.ToLower () != "alternative")
 				return true;
 
 			return false;
@@ -140,7 +140,7 @@
 			AddProperty (Property.NewDate ("fixme:date", message.Date.ToUniversalTime ()));
 
 			GMime.InternetAddressList addrs;
-			addrs = this.message.GetRecipients (GMime.Message.RecipientType.To);
+			addrs = this.message.GetRecipients (GMime.RecipientType.To);
 			foreach (GMime.InternetAddress ia in addrs) {
 				AddProperty (Property.NewUnsearched ("fixme:to", ia.ToString (false)));
 				if (ia.AddressType != GMime.InternetAddressType.Group)
@@ -151,7 +151,7 @@
 			}
 			addrs.Dispose ();
 
-			addrs = this.message.GetRecipients (GMime.Message.RecipientType.Cc);
+			addrs = this.message.GetRecipients (GMime.RecipientType.Cc);
 			foreach (GMime.InternetAddress ia in addrs) {
 				AddProperty (Property.NewUnsearched ("fixme:cc", ia.ToString (false)));
 				if (ia.AddressType != GMime.InternetAddressType.Group)
@@ -184,7 +184,7 @@
 				AddProperty (Property.NewUnsearched ("fixme:msgid", GMime.Utils.DecodeMessageId (msgid)));
 
 			foreach (GMime.References refs in this.message.References)
-				AddProperty (Property.NewUnsearched ("fixme:reference", refs.Msgid));
+				AddProperty (Property.NewUnsearched ("fixme:reference", refs.MessageId));
 
 			string list_id = this.message.GetHeader ("List-Id");
 			if (list_id != null)
@@ -350,7 +350,7 @@
 
 					// If the mimetype is multipart/alternative, we only want to index
 					// one part -- the richest one we can filter.
-					if (mime_part.ContentType.Subtype.ToLower () == "alternative") {
+					if (mime_part.ContentType.MediaSubtype.ToLower () == "alternative") {
 						// The richest formats are at the end, so work from there
 						// backward.
 						for (int i = num_parts - 1; i >= 0; i--) {
@@ -400,7 +400,7 @@
 						} else if (mime_type == "text/html") {
 							no_child_needed = true;
 							html_part = true;
-							string enc = part.GetContentTypeParameter ("charset"); 
+							string enc = part.ContentType.GetParameter ("charset"); 
 							// DataWrapper.Stream is a very limited stream
 							// and does not allow Seek or Tell
 							// HtmlFilter requires Stream.Position=0.
@@ -473,7 +473,7 @@
 							if (length != -1)
 								child.AddProperty (Property.NewUnsearched ("fixme:filesize", length));
 
-							if (part.ContentType.Type.ToLower () == "text")
+							if (part.ContentType.MediaType.ToLower () == "text")
 								child.SetTextReader (new StreamReader (stream));
 							else
 								child.SetBinaryStream (stream);


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