[tracker] Fixed ontology for old Evolution support and detecting folders.db
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] Fixed ontology for old Evolution support and detecting folders.db
- Date: Mon, 25 May 2009 05:10:27 -0400 (EDT)
commit eb97ae309b24229d6ed2a4f476ed9f4de5a4f5fe
Author: Philip Van Hoof <philip codeminded be>
Date: Mon May 25 11:05:16 2009 +0200
Fixed ontology for old Evolution support and detecting folders.db
The file folders.db will be in the account's cache dir when a more
recent version of Evolution has upgraded an old Evolution mail cache. In
that case we want to ignore the summary files, and instead rely on the
push module
---
src/tracker-indexer/modules/evolution-common.h | 15 +++++----
src/tracker-indexer/modules/evolution.c | 36 +++++++++++++++++++++++-
2 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/src/tracker-indexer/modules/evolution-common.h b/src/tracker-indexer/modules/evolution-common.h
index 81aa3eb..f7c62ba 100644
--- a/src/tracker-indexer/modules/evolution-common.h
+++ b/src/tracker-indexer/modules/evolution-common.h
@@ -26,15 +26,16 @@
#include <gmime/gmime.h>
+#include <libtracker-common/tracker-ontology.h>
+
G_BEGIN_DECLS
-#define METADATA_FILE_NAME "File:Name"
-#define METADATA_EMAIL_RECIPIENT "nmo:recipient"
-#define METADATA_EMAIL_DATE "nmo:sentDate"
-#define METADATA_EMAIL_SENDER "nmo:sender"
-#define METADATA_EMAIL_SUBJECT "nmo:messageSubject"
-#define METADATA_EMAIL_SENT_TO "nmo:to"
-#define METADATA_EMAIL_CC "nmo:cc"
+#define METADATA_EMAIL_RECIPIENT TRACKER_NMO_PREFIX "recipient"
+#define METADATA_EMAIL_DATE TRACKER_NMO_PREFIX "sentDate"
+#define METADATA_EMAIL_SENDER TRACKER_NMO_PREFIX "sender"
+#define METADATA_EMAIL_SUBJECT TRACKER_NMO_PREFIX "messageSubject"
+#define METADATA_EMAIL_SENT_TO TRACKER_NMO_PREFIX "to"
+#define METADATA_EMAIL_CC TRACKER_NMO_PREFIX "cc"
enum EvolutionFlags {
EVOLUTION_MESSAGE_ANSWERED = 1 << 0,
diff --git a/src/tracker-indexer/modules/evolution.c b/src/tracker-indexer/modules/evolution.c
index f94a0b1..39b5b5f 100644
--- a/src/tracker-indexer/modules/evolution.c
+++ b/src/tracker-indexer/modules/evolution.c
@@ -63,16 +63,23 @@ static MailStorageType
get_mail_storage_type_from_path (const gchar *path)
{
MailStorageType type = MAIL_STORAGE_NONE;
- gchar *basenam;
+ gchar *basenam, *dup_, *t;
+ const gchar *ac_path;
basenam = g_path_get_basename (path);
+ dup_ = g_strdup (path);
+ t = dup_;
if (g_str_has_prefix (path, local_dir) &&
strchr (basenam, '.') == NULL) {
type = MAIL_STORAGE_LOCAL;
+ dup_ += strlen (local_dir);
+ ac_path = local_dir;
} else if (g_str_has_prefix (path, imap_dir)) {
if (strcmp (basenam, "summary") == 0) {
type = MAIL_STORAGE_IMAP;
+ dup_ += strlen (imap_dir);
+ ac_path = imap_dir;
}
}
@@ -86,7 +93,34 @@ get_mail_storage_type_from_path (const gchar *path)
type = MAIL_STORAGE_NONE;
}
+ if (type != MAIL_STORAGE_NONE) {
+ gchar *ptr = dup_;
+
+ /* If recent Evolution detected, summary files are outdated */
+
+ ptr++;
+ ptr = g_utf8_strchr (ptr, -1, G_DIR_SEPARATOR);
+
+ if (ptr) {
+ GFile *parent_dir,
+ *account_dir,
+ *summary_file;
+
+ *ptr = '\0';
+ parent_dir = g_file_new_for_path (ac_path);
+ account_dir = g_file_get_child (parent_dir, dup_);
+ summary_file = g_file_get_child (account_dir, "folders.db");
+ if (g_file_query_exists (summary_file, NULL)) {
+ type = MAIL_STORAGE_NONE;
+ }
+ g_object_unref (parent_dir);
+ g_object_unref (account_dir);
+ g_object_unref (summary_file);
+ }
+ }
+
g_free (basenam);
+ g_free (t);
return type;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]