[SM-Commit] GIT changes to master grimoire by Arwed von Merkatz (1d0d115dbce0c622bef451c0ba4a93ea26bfc242)

Arwed von Merkatz scm at sourcemage.org
Sat Jan 24 09:22:50 EST 2009


GIT changes to master grimoire by Arwed von Merkatz <v.merkatz at gmx.net>:

 gnome2-libs/tracker/HISTORY                 |    5 
 gnome2-libs/tracker/PRE_BUILD               |    5 
 gnome2-libs/tracker/inotify-fix.diff        |  141 --------
 gnome2-libs/tracker/tracker-gmime-2.4.patch |  455 ++++++++++++++++++++++++++++
 4 files changed, 463 insertions(+), 143 deletions(-)

New commits:
commit 1d0d115dbce0c622bef451c0ba4a93ea26bfc242
Author: Arwed von Merkatz <v.merkatz at gmx.net>
Commit: Arwed von Merkatz <v.merkatz at gmx.net>

    tracker: fixed compile with current gmime version

diff --git a/gnome2-libs/tracker/HISTORY b/gnome2-libs/tracker/HISTORY
index 529e0ca..d9c8e4c 100644
--- a/gnome2-libs/tracker/HISTORY
+++ b/gnome2-libs/tracker/HISTORY
@@ -1,3 +1,8 @@
+2009-01-24 Arwed v. Merkatz <v.merkatz at gmx.net>
+	* PRE_BUILD, tracker-gmime-2.4.patch: added patch to make it compile
+	  with current gmime version
+	* inotify-fix.diff: removed
+
 2008-12-27 George Sherwood <gsherwood at sourcemage.org>
 	* DETAILS: updated to version 0.6.6
 	  Fixed long description wrap
diff --git a/gnome2-libs/tracker/PRE_BUILD b/gnome2-libs/tracker/PRE_BUILD
index 3f15a98..9cc259b 100755
--- a/gnome2-libs/tracker/PRE_BUILD
+++ b/gnome2-libs/tracker/PRE_BUILD
@@ -2,5 +2,6 @@ default_pre_build                                 &&
 cd ${SOURCE_DIRECTORY}                            &&
 if [[ $TRACKER_SCM == y ]] ; then
 NOCONFIGURE=X ./autogen.sh
-fi                                                
-#patch -p0 < ${SCRIPT_DIRECTORY}/inotify-fix.diff
+else
+patch -p1 < $SCRIPT_DIRECTORY/tracker-gmime-2.4.patch
+fi
diff --git a/gnome2-libs/tracker/inotify-fix.diff b/gnome2-libs/tracker/inotify-fix.diff
deleted file mode 100644
index 90cd8a0..0000000
--- a/gnome2-libs/tracker/inotify-fix.diff
+++ /dev/null
@@ -1,141 +0,0 @@
-diff -Nur src/trackerd/inotify.h ../tracker-0.5.4-fixed/src/trackerd/inotify.h
---- src/trackerd/inotify.h	1970-01-01 01:00:00.000000000 +0100
-+++ ../tracker-0.5.4-fixed/src/trackerd/inotify.h	2007-03-03 20:49:56.000000000 +0100
-@@ -0,0 +1,113 @@
-+/*
-+ * Inode based directory notification for Linux
-+ *
-+ * Copyright (C) 2005 John McCutchan
-+ */
-+
-+#ifndef _LINUX_INOTIFY_H
-+#define _LINUX_INOTIFY_H
-+
-+#include <linux/types.h>
-+
-+/*
-+ * struct inotify_event - structure read from the inotify device for each event
-+ *
-+ * When you are watching a directory, you will receive the filename for events
-+ * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
-+ */
-+struct inotify_event {
-+	__s32		wd;		/* watch descriptor */
-+	__u32		mask;		/* watch mask */
-+	__u32		cookie;		/* cookie to synchronize two events */
-+	__u32		len;		/* length (including nulls) of name */
-+	char		name[0];	/* stub for possible name */
-+};
-+
-+/* the following are legal, implemented events that user-space can watch for */
-+#define IN_ACCESS		0x00000001	/* File was accessed */
-+#define IN_MODIFY		0x00000002	/* File was modified */
-+#define IN_ATTRIB		0x00000004	/* Metadata changed */
-+#define IN_CLOSE_WRITE		0x00000008	/* Writtable file was closed */
-+#define IN_CLOSE_NOWRITE	0x00000010	/* Unwrittable file closed */
-+#define IN_OPEN			0x00000020	/* File was opened */
-+#define IN_MOVED_FROM		0x00000040	/* File was moved from X */
-+#define IN_MOVED_TO		0x00000080	/* File was moved to Y */
-+#define IN_CREATE		0x00000100	/* Subfile was created */
-+#define IN_DELETE		0x00000200	/* Subfile was deleted */
-+#define IN_DELETE_SELF		0x00000400	/* Self was deleted */
-+#define IN_MOVE_SELF		0x00000800	/* Self was moved */
-+
-+/* the following are legal events.  they are sent as needed to any watch */
-+#define IN_UNMOUNT		0x00002000	/* Backing fs was unmounted */
-+#define IN_Q_OVERFLOW		0x00004000	/* Event queued overflowed */
-+#define IN_IGNORED		0x00008000	/* File was ignored */
-+
-+/* helper events */
-+#define IN_CLOSE		(IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
-+#define IN_MOVE			(IN_MOVED_FROM | IN_MOVED_TO) /* moves */
-+
-+/* special flags */
-+#define IN_ONLYDIR		0x01000000	/* only watch the path if it is a directory */
-+#define IN_DONT_FOLLOW		0x02000000	/* don't follow a sym link */
-+#define IN_MASK_ADD		0x20000000	/* add to the mask of an already existing watch */
-+#define IN_ISDIR		0x40000000	/* event occurred against dir */
-+#define IN_ONESHOT		0x80000000	/* only send event once */
-+
-+/*
-+ * All of the events - we build the list by hand so that we can add flags in
-+ * the future and not break backward compatibility.  Apps will get only the
-+ * events that they originally wanted.  Be sure to add new events here!
-+ */
-+#define IN_ALL_EVENTS	(IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
-+			 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
-+			 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
-+			 IN_MOVE_SELF)
-+
-+#ifdef __KERNEL__
-+
-+#include <linux/dcache.h>
-+#include <linux/fs.h>
-+#include <linux/config.h>
-+
-+#ifdef CONFIG_INOTIFY
-+
-+extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
-+				      const char *);
-+extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
-+					      const char *);
-+extern void inotify_unmount_inodes(struct list_head *);
-+extern void inotify_inode_is_dead(struct inode *);
-+extern u32 inotify_get_cookie(void);
-+
-+#else
-+
-+static inline void inotify_inode_queue_event(struct inode *inode,
-+					     __u32 mask, __u32 cookie,
-+					     const char *filename)
-+{
-+}
-+
-+static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
-+						     __u32 mask, __u32 cookie,
-+						     const char *filename)
-+{
-+}
-+
-+static inline void inotify_unmount_inodes(struct list_head *list)
-+{
-+}
-+
-+static inline void inotify_inode_is_dead(struct inode *inode)
-+{
-+}
-+
-+static inline u32 inotify_get_cookie(void)
-+{
-+	return 0;
-+}
-+
-+#endif	/* CONFIG_INOTIFY */
-+
-+#endif	/* __KERNEL __ */
-+
-+#endif	/* _LINUX_INOTIFY_H */
-diff -Nur src/trackerd/tracker-inotify.c ../tracker-0.5.4-fixed/src/trackerd/tracker-inotify.c
---- src/trackerd/tracker-inotify.c	2007-01-26 01:15:10.000000000 +0100
-+++ ../tracker-0.5.4-fixed/src/trackerd/tracker-inotify.c	2007-03-03 20:51:02.000000000 +0100
-@@ -21,6 +21,7 @@
- #include <string.h>
- #include <glib.h>
- #include <glib/gstdio.h>
-+#include <unistd.h>
- 
- #include "tracker-inotify.h"
- 
-diff -Nur src/trackerd/tracker-inotify.h ../tracker-0.5.4-fixed/src/trackerd/tracker-inotify.h
---- src/trackerd/tracker-inotify.h	2007-01-26 01:15:10.000000000 +0100
-+++ ../tracker-0.5.4-fixed/src/trackerd/tracker-inotify.h	2007-03-03 20:47:13.000000000 +0100
-@@ -28,7 +28,8 @@
- #   include <linux/inotify.h>
- #   include "linux-inotify-syscalls.h"
- #else
--#   include <sys/inotify.h>
-+#   include "inotify.h"
-+#   include "linux-inotify-syscalls.h"
- #endif
- 
- #include "tracker-db.h"
diff --git a/gnome2-libs/tracker/tracker-gmime-2.4.patch b/gnome2-libs/tracker/tracker-gmime-2.4.patch
new file mode 100644
index 0000000..9cc3158
--- /dev/null
+++ b/gnome2-libs/tracker/tracker-gmime-2.4.patch
@@ -0,0 +1,455 @@
+diff -ur tracker-0.6.6.old/configure tracker-0.6.6/configure
+--- tracker-0.6.6.old/configure	2008-03-03 05:13:57.000000000 +0100
++++ tracker-0.6.6/configure	2009-01-24 15:16:16.000000000 +0100
+@@ -21254,12 +21254,12 @@
+         pkg_cv_GMIME_CFLAGS="$GMIME_CFLAGS"
+     else
+         if test -n "$PKG_CONFIG" && \
+-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \" gmime-2.0 >= \$GMIME_REQUIRED \"") >&5
+-  ($PKG_CONFIG --exists --print-errors " gmime-2.0 >= $GMIME_REQUIRED ") 2>&5
++    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \" gmime-2.4 >= \$GMIME_REQUIRED \"") >&5
++  ($PKG_CONFIG --exists --print-errors " gmime-2.4 >= $GMIME_REQUIRED ") 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+-  pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags " gmime-2.0 >= $GMIME_REQUIRED " 2>/dev/null`
++  pkg_cv_GMIME_CFLAGS=`$PKG_CONFIG --cflags " gmime-2.4 >= $GMIME_REQUIRED " 2>/dev/null`
+ else
+   pkg_failed=yes
+ fi
+@@ -21272,12 +21272,12 @@
+         pkg_cv_GMIME_LIBS="$GMIME_LIBS"
+     else
+         if test -n "$PKG_CONFIG" && \
+-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \" gmime-2.0 >= \$GMIME_REQUIRED \"") >&5
+-  ($PKG_CONFIG --exists --print-errors " gmime-2.0 >= $GMIME_REQUIRED ") 2>&5
++    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \" gmime-2.4 >= \$GMIME_REQUIRED \"") >&5
++  ($PKG_CONFIG --exists --print-errors " gmime-2.4 >= $GMIME_REQUIRED ") 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }; then
+-  pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs " gmime-2.0 >= $GMIME_REQUIRED " 2>/dev/null`
++  pkg_cv_GMIME_LIBS=`$PKG_CONFIG --libs " gmime-2.4 >= $GMIME_REQUIRED " 2>/dev/null`
+ else
+   pkg_failed=yes
+ fi
+@@ -21296,14 +21296,14 @@
+         _pkg_short_errors_supported=no
+ fi
+         if test $_pkg_short_errors_supported = yes; then
+-	        GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors " gmime-2.0 >= $GMIME_REQUIRED "`
++	        GMIME_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors " gmime-2.4 >= $GMIME_REQUIRED "`
+         else
+-	        GMIME_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " gmime-2.0 >= $GMIME_REQUIRED "`
++	        GMIME_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors " gmime-2.4 >= $GMIME_REQUIRED "`
+         fi
+ 	# Put the nasty error message in config.log where it belongs
+ 	echo "$GMIME_PKG_ERRORS" >&5
+ 
+-	{ { echo "$as_me:$LINENO: error: Package requirements ( gmime-2.0 >= $GMIME_REQUIRED ) were not met:
++	{ { echo "$as_me:$LINENO: error: Package requirements ( gmime-2.4 >= $GMIME_REQUIRED ) were not met:
+ 
+ $GMIME_PKG_ERRORS
+ 
+@@ -21314,7 +21314,7 @@
+ and GMIME_LIBS to avoid the need to call pkg-config.
+ See the pkg-config man page for more details.
+ " >&5
+-echo "$as_me: error: Package requirements ( gmime-2.0 >= $GMIME_REQUIRED ) were not met:
++echo "$as_me: error: Package requirements ( gmime-2.4 >= $GMIME_REQUIRED ) were not met:
+ 
+ $GMIME_PKG_ERRORS
+ 
+diff -ur tracker-0.6.6.old/configure.ac tracker-0.6.6/configure.ac
+--- tracker-0.6.6.old/configure.ac	2008-03-03 05:13:34.000000000 +0100
++++ tracker-0.6.6/configure.ac	2009-01-24 15:15:51.000000000 +0100
+@@ -65,7 +65,7 @@
+ AC_SUBST(PANGO_LIBS)
+ 
+ # Check for GMime
+-PKG_CHECK_MODULES(GMIME, [ gmime-2.0 >= $GMIME_REQUIRED ])
++PKG_CHECK_MODULES(GMIME, [ gmime-2.4 >= $GMIME_REQUIRED ])
+ AC_SUBST(GMIME_CFLAGS)
+ AC_SUBST(GMIME_LIBS)
+ 
+diff -ur tracker-0.6.6.old/src/trackerd/tracker-email-evolution.c tracker-0.6.6/src/trackerd/tracker-email-evolution.c
+--- tracker-0.6.6.old/src/trackerd/tracker-email-evolution.c	2008-02-29 00:49:53.000000000 +0100
++++ tracker-0.6.6/src/trackerd/tracker-email-evolution.c	2009-01-24 15:15:51.000000000 +0100
+@@ -1450,7 +1450,7 @@
+ 	g_return_if_fail (g_m_message);
+ 	g_return_if_fail (msg);
+ 
+-	field = g_mime_message_get_header (g_m_message, "X-Evolution");
++	field = g_mime_object_get_header (GMIME_OBJECT (g_m_message), "X-Evolution");
+ 
+ 	g_return_if_fail (field);
+ 
+@@ -2478,27 +2478,28 @@
+ static GSList *
+ add_persons_from_internet_address_list_string_parsing (GSList *list, const gchar *s)
+ {
+-	InternetAddressList *addrs_list, *tmp;
++	InternetAddressList *addrs_list;
++	int i, count;
+ 
+ 	g_return_val_if_fail (s, NULL);
+ 
+-	addrs_list = internet_address_parse_string (s);
++	addrs_list = internet_address_list_parse_string (s);
++	count = internet_address_list_length (addrs_list);
+ 
+-	for (tmp = addrs_list; tmp; tmp = tmp->next) {
++	for (i = 0; i < count; i++) {
+ 		MailPerson *mp;
++		InternetAddress *addr;
+ 
+ 		mp = email_allocate_mail_person ();
++		addr = internet_address_list_get_address (addrs_list, i);
+ 
+-		mp->addr = g_strdup (tmp->address->value.addr);
+-		if(tmp->address->name)
+-                	mp->name = g_strdup (tmp->address->name);
+-		else
+-			mp->name = g_strdup (tmp->address->value.addr);
++		mp->name = g_strdup (internet_address_get_name (addr));
++		mp->addr = internet_address_to_string (addr, FALSE);
+ 
+ 		list = g_slist_prepend (list, mp);
+ 	}
+ 
+-	internet_address_list_destroy (addrs_list);
++	g_object_unref (addrs_list);
+ 
+ 	return list;
+ }
+diff -ur tracker-0.6.6.old/src/trackerd/tracker-email-kmail.c tracker-0.6.6/src/trackerd/tracker-email-kmail.c
+--- tracker-0.6.6.old/src/trackerd/tracker-email-kmail.c	2008-01-15 05:05:03.000000000 +0100
++++ tracker-0.6.6/src/trackerd/tracker-email-kmail.c	2009-01-24 15:15:51.000000000 +0100
+@@ -787,7 +787,7 @@
+            This line is at the beginning of each header but GMIME does not give access to it so we reproduce it.
+         */
+ 
+-        field = g_mime_message_get_header (g_m_message, "From");
++        field = g_mime_object_get_header (g_m_message, "From");
+ 
+         tmp_from = g_strdup (field);
+ 
+@@ -862,10 +862,10 @@
+ 
+         mail_msg->uri = NULL;
+ 
+-        /* Currently, "g_mime_message_get_header(g_m_message, "X-UID")" does not work because GMIME
++        /* Currently, "g_mime_object_get_header(g_m_message, "X-UID")" does not work because GMIME
+            only handles RFC822 headers... So we have to search X-UID header ourself. */
+ 
+-        headers = g_mime_message_get_headers (g_m_message);
++        headers = g_mime_object_get_headers (g_m_message);
+         g_return_if_fail (headers);
+ 
+         pos_uid = strstr (headers, "X-UID");
+diff -ur tracker-0.6.6.old/src/trackerd/tracker-email-thunderbird.c tracker-0.6.6/src/trackerd/tracker-email-thunderbird.c
+--- tracker-0.6.6.old/src/trackerd/tracker-email-thunderbird.c	2008-01-15 05:05:03.000000000 +0100
++++ tracker-0.6.6/src/trackerd/tracker-email-thunderbird.c	2009-01-24 15:15:51.000000000 +0100
+@@ -418,26 +418,27 @@
+ static GSList *
+ add_persons_from_internet_address_list_string_parsing (GSList *list, const gchar *s)
+ {
+-	InternetAddressList *addrs_list, *tmp;
++	InternetAddressList *addrs_list;
++	int i, count;
+ 
+ 	g_return_val_if_fail (s, NULL);
+ 
+-	addrs_list = internet_address_parse_string (s);
++	addrs_list = internet_address_list_parse_string (s);
++	count = internet_address_list_length (addrs_list);
+ 
+-	for (tmp = addrs_list; tmp; tmp = tmp->next) {
++
++	for (i = 0; i < count; i++) {
+ 		MailPerson *mp = email_allocate_mail_person ();
++		InternetAddress *addr;
+ 
+-		mp->addr = g_strdup (tmp->address->value.addr);
+-                if(tmp->address->name) {
+-                        mp->name = g_strdup (tmp->address->name);
+-                } else {
+-                        mp->name = g_strdup (tmp->address->value.addr);
+-                }
++		addr = internet_address_list_get_address (addrs_list, i);
++		mp->name = g_strdup (internet_address_get_name (addr));
++		mp->addr = internet_address_to_string (addr, FALSE);
+ 
+ 		list = g_slist_prepend (list, mp);
+ 	}
+ 
+-	internet_address_list_destroy (addrs_list);
++	g_object_unref (addrs_list);
+ 
+ 	return list;
+ }
+diff -ur tracker-0.6.6.old/src/trackerd/tracker-email-utils.c tracker-0.6.6/src/trackerd/tracker-email-utils.c
+--- tracker-0.6.6.old/src/trackerd/tracker-email-utils.c	2008-02-29 01:32:16.000000000 +0100
++++ tracker-0.6.6/src/trackerd/tracker-email-utils.c	2009-01-24 15:15:51.000000000 +0100
+@@ -46,8 +46,8 @@
+ static GMimeStream *new_gmime_stream_from_file	(const gchar *path, gint flags, off_t start, off_t end);
+ 
+ static GSList *	add_gmime_references		(GSList *list, GMimeMessage *message, const gchar *header);
+-static GSList *	add_recipients			(GSList *list, GMimeMessage *message, const gchar *type);
+-static void	find_attachment			(GMimeObject *obj, gpointer data);
++static GSList *	add_recipients			(GSList *list, GMimeMessage *message, GMimeRecipientType type);
++static void	find_attachment			(GMimeObject *parent, GMimeObject *obj, gpointer data);
+ 
+ 
+ 
+@@ -491,6 +491,124 @@
+ 	g_slice_free (MailMessage, mail_msg);
+ }
+ 
++static GMimeObject *
++handle_multipart_alternative (GMimeMultipart *multipart, gboolean want_plain, gboolean *is_html)
++{
++	GMimeObject *mime_part, *text_part = NULL;
++	GMimeContentType *type;
++	int count, i;
++
++	count = g_mime_multipart_get_count (multipart);
++	for (i = 0; i < count ; i++) {
++		mime_part = g_mime_multipart_get_part (multipart, i);
++
++		type = g_mime_object_get_content_type (GMIME_OBJECT (mime_part));
++		if (g_mime_content_type_is_type (type, "text", "*")) {
++			if (!text_part || !g_ascii_strcasecmp (type->subtype, want_plain ? "plain" : "html")) {
++				*is_html = !g_ascii_strcasecmp (type->subtype, "html");
++				text_part = mime_part;
++			}
++		}
++	}
++
++	return text_part;
++}
++
++static GMimeObject *
++handle_multipart_mixed (GMimeMultipart *multipart, gboolean want_plain, gboolean *is_html)
++{
++	GMimeObject *mime_part, *text_part = NULL;
++	GMimeContentType *type, *first_type = NULL;
++	GList *subpart;
++	int count, i;
++
++	count = g_mime_multipart_get_count (multipart);
++	for (i = 0; i < count ; i++) {
++		mime_part = g_mime_multipart_get_part (multipart, i);
++
++		type = g_mime_object_get_content_type (mime_part);
++		if (GMIME_IS_MULTIPART (mime_part)) {
++			multipart = GMIME_MULTIPART (mime_part);
++			if (g_mime_content_type_is_type (type, "multipart", "alternative")) {
++				mime_part = handle_multipart_alternative (multipart, want_plain, is_html);
++				if (mime_part)
++					return mime_part;
++			} else {
++				mime_part = handle_multipart_mixed (multipart, want_plain, is_html);
++				if (mime_part && !text_part)
++					text_part = mime_part;
++			}
++		} else if (g_mime_content_type_is_type (type, "text", "*")) {
++			if (!g_ascii_strcasecmp (type->subtype, want_plain ? "plain" : "html")) {
++				/* we got what we came for */
++				*is_html = !g_ascii_strcasecmp (type->subtype, "html");
++				return mime_part;
++			}
++
++			/* if we haven't yet found a text part or if it is a type we can
++			   1514 	* understand and it is the first of that type, save it */
++			if (!text_part || (!g_ascii_strcasecmp (type->subtype, "plain") && (first_type &&
++											    g_ascii_strcasecmp (type->subtype, first_type->subtype) != 0))) {
++				*is_html = !g_ascii_strcasecmp (type->subtype, "html");
++				text_part = mime_part;
++				first_type = type;
++			}
++		}
++
++		subpart = subpart->next;
++	}
++
++	return text_part;
++}
++
++static char *
++tracker_mime_message_get_body (const GMimeMessage *message, gboolean want_plain, gboolean *is_html)
++{
++	GMimeObject *mime_part = NULL;
++	GMimeContentType *type;
++	GMimeMultipart *multipart;
++	char *body = NULL;
++
++	g_return_val_if_fail (GMIME_IS_MESSAGE (message), NULL);
++	g_return_val_if_fail (is_html != NULL, NULL);
++
++	type = g_mime_object_get_content_type (message->mime_part);
++	if (GMIME_IS_MULTIPART (message->mime_part)) {
++		/* let's see if we can find a body in the multipart */
++		multipart = GMIME_MULTIPART (message->mime_part);
++		if (g_mime_content_type_is_type (type, "multipart", "alternative"))
++			mime_part = handle_multipart_alternative (multipart, want_plain, is_html);
++		else
++			mime_part = handle_multipart_mixed (multipart, want_plain, is_html);
++	} else if (g_mime_content_type_is_type (type, "text", "*")) {
++		/* this *has* to be the message body */
++		if (g_mime_content_type_is_type (type, "text", "html"))
++			*is_html = TRUE;
++		else
++			*is_html = FALSE;
++
++		mime_part = message->mime_part;
++	}
++
++	if (mime_part != NULL) {
++		GMimeDataWrapper *data_wrapper;
++		GMimeStream *mime_stream;
++		gint64 len;
++
++		data_wrapper = g_mime_part_get_content_object (GMIME_PART (mime_part));
++		
++		mime_stream = g_mime_data_wrapper_get_stream (data_wrapper);
++		len = g_mime_stream_length (mime_stream);
++		body = g_malloc0 (len + 1);
++		g_mime_stream_read (mime_stream, body, len);
++		g_object_unref (mime_stream);
++		g_object_unref (data_wrapper);
++	}
++
++	return body;
++}
++
++
+ 
+ MailMessage *
+ email_mail_file_parse_next (MailFile *mf, ReadMailHelperFct read_mail_helper, gpointer read_mail_user_data)
+@@ -539,7 +657,7 @@
+ 
+ 	mail_msg->subject = g_strdup (g_mime_message_get_subject (g_m_message));
+ 
+-	mail_msg->body = g_mime_message_get_body (g_m_message, TRUE, &is_html);
++	mail_msg->body = tracker_mime_message_get_body (g_m_message, TRUE, &is_html);
+ 	mail_msg->content_type = g_strdup (is_html ? "text/html" : "text/plain");
+ 
+ 	if (read_mail_helper) {
+@@ -549,7 +667,7 @@
+ 	mail_msg->attachments = NULL;
+ 
+ 	/* find then save attachments in sys tmp directory of Tracker and save entries in MailMessage struct */
+-	g_mime_message_foreach_part (g_m_message, find_attachment, mail_msg);
++	g_mime_message_foreach (g_m_message, find_attachment, mail_msg);
+ 
+ 	g_object_unref (g_m_message);
+ 
+@@ -786,23 +904,23 @@
+ 		return FALSE;
+ 	}
+ 
+-	filtered_stream = g_mime_stream_filter_new_with_stream (stream_src);
++	filtered_stream = g_mime_stream_filter_new (stream_src);
+ 
+ 	switch (encoding) {
+ 		case MIME_ENCODING_BASE64:
+-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_BASE64_DEC);
++			filter = g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_BASE64, FALSE);
+ 			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
+ 			g_object_unref (filter);
+ 			break;
+ 
+ 		case MIME_ENCODING_QUOTEDPRINTABLE:
+-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_QP_DEC);
++			filter = g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE, FALSE);
+ 			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
+ 			g_object_unref (filter);
+ 			break;
+ 
+ 		case MIME_ENCODING_UUENCODE:
+-			filter = g_mime_filter_basic_new_type (GMIME_FILTER_BASIC_UU_ENC);
++			filter = g_mime_filter_basic_new (GMIME_CONTENT_ENCODING_UUENCODE, TRUE);
+ 			g_mime_stream_filter_add (GMIME_STREAM_FILTER (filtered_stream), filter);
+ 			g_object_unref (filter);
+ 			break;
+@@ -913,7 +1031,7 @@
+ static GSList *
+ add_gmime_references (GSList *list, GMimeMessage *message, const gchar *header)
+ {
+-	const gchar *tmp = g_mime_message_get_header (message, header);
++	const gchar *tmp = g_mime_object_get_header (GMIME_OBJECT (message), header);
+ 
+ 	if (tmp) {
+ 		GMimeReferences       *refs;
+@@ -937,15 +1055,21 @@
+ 
+ 
+ static GSList *
+-add_recipients (GSList *list, GMimeMessage *message, const gchar *type)
++add_recipients (GSList *list, GMimeMessage *message, GMimeRecipientType type)
+ {
+-	const InternetAddressList *addrs_list;
++	InternetAddressList *addrs_list;
++	int i, count;
+ 
+-	for (addrs_list = g_mime_message_get_recipients (message, type); addrs_list; addrs_list = addrs_list->next) {
++	addrs_list = g_mime_message_get_recipients (message, type);
++	count = internet_address_list_length (addrs_list);
++	for (i = 0; i < count; i++) {
++		InternetAddress *addr;
+ 		MailPerson *mp = email_allocate_mail_person ();
+ 
+-		mp->name = g_strdup (addrs_list->address->name);
+-		mp->addr = g_strdup (addrs_list->address->value.addr);
++		addr = internet_address_list_get_address (addrs_list, i);
++
++		mp->name = g_strdup (internet_address_get_name (addr));
++		mp->addr = g_strdup (internet_address_to_string (addr, FALSE));
+ 
+ 		list = g_slist_prepend (list, mp);
+ 	}
+@@ -955,7 +1079,7 @@
+ 
+ 
+ static void
+-find_attachment (GMimeObject *obj, gpointer data)
++find_attachment (GMimeObject *parent, GMimeObject *obj, gpointer data)
+ {
+ 	GMimePart   *part;
+ 	MailMessage *mail_msg;
+@@ -969,8 +1093,8 @@
+ 		GMimeMessage *g_msg = g_mime_message_part_get_message (GMIME_MESSAGE_PART (obj));
+ 
+ 		if (g_msg) {
+-			g_mime_message_foreach_part (g_msg, find_attachment, data);
+-			g_object_unref (g_msg);
++			g_mime_message_foreach (g_msg, find_attachment, data);
++			g_object_unref (obj);
+ 		}
+ 		return;
+ 
+@@ -987,20 +1111,20 @@
+ 
+ 	mail_msg = data;
+ 
+-	content_disposition = g_mime_part_get_content_disposition (part);
++	content_disposition = g_mime_object_get_disposition (obj);
+ 
+ 	/* test whether it is a mail attachment */
+ 	if (content_disposition &&
+ 	    (strcmp (content_disposition, GMIME_DISPOSITION_ATTACHMENT) == 0 ||
+ 	     strcmp (content_disposition, GMIME_DISPOSITION_INLINE) == 0)) {
+ 
+-		const GMimeContentType *content_type;
++		GMimeContentType       *content_type;
+ 		MailAttachment         *ma;
+ 		const gchar            *filename;
+ 		gchar                  *attachment_uri;
+ 		gint                   fd;
+ 
+-		if (! (content_type = g_mime_part_get_content_type (part)))
++		if (! (content_type = g_mime_object_get_content_type (obj)))
+ 			return;
+ 
+ 		filename = g_mime_part_get_filename (part);



More information about the SM-Commit mailing list