tracker r1592 - in branches/xesam-support: . src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1592 - in branches/xesam-support: . src/libtracker-db src/tracker-indexer src/tracker-indexer/modules src/trackerd
- Date: Fri, 6 Jun 2008 07:31:23 +0000 (UTC)
Author: pvanhoof
Date: Fri Jun 6 07:31:22 2008
New Revision: 1592
URL: http://svn.gnome.org/viewvc/tracker?rev=1592&view=rev
Log:
2008-06-06 Philip Van Hoof <pvanhoof gnome org>
* svn merge -r 1582:1591 ../indexer-split
Added:
branches/xesam-support/src/trackerd/tracker-email-plugin.h
- copied unchanged from r1591, /branches/indexer-split/src/trackerd/tracker-email-plugin.h
Modified:
branches/xesam-support/ChangeLog
branches/xesam-support/src/libtracker-db/tracker-db-action.c
branches/xesam-support/src/libtracker-db/tracker-db-action.h
branches/xesam-support/src/libtracker-db/tracker-db-file-info.c
branches/xesam-support/src/libtracker-db/tracker-db-file-info.h
branches/xesam-support/src/tracker-indexer/modules/files.c
branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
branches/xesam-support/src/trackerd/Makefile.am
branches/xesam-support/src/trackerd/tracker-db.c
branches/xesam-support/src/trackerd/tracker-email-evolution.c
branches/xesam-support/src/trackerd/tracker-email-kmail.c
branches/xesam-support/src/trackerd/tracker-email-modest.c
branches/xesam-support/src/trackerd/tracker-email-thunderbird.c
branches/xesam-support/src/trackerd/tracker-email-utils.c
branches/xesam-support/src/trackerd/tracker-email-utils.h
branches/xesam-support/src/trackerd/tracker-email.c
branches/xesam-support/src/trackerd/tracker-email.h
branches/xesam-support/src/trackerd/tracker-main.c
branches/xesam-support/src/trackerd/tracker-process-files.c
branches/xesam-support/src/trackerd/tracker-process-files.h
branches/xesam-support/src/trackerd/tracker-watcher-inotify.c
Modified: branches/xesam-support/src/libtracker-db/tracker-db-action.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-action.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-action.c Fri Jun 6 07:31:22 2008
@@ -138,3 +138,12 @@
return enum_value->value_nick;
}
+gboolean
+tracker_db_action_is_delete (TrackerDBAction action)
+{
+ return
+ action == TRACKER_DB_ACTION_DELETE ||
+ action == TRACKER_DB_ACTION_DELETE_SELF ||
+ action == TRACKER_DB_ACTION_FILE_DELETED ||
+ action == TRACKER_DB_ACTION_DIRECTORY_DELETED;
+}
Modified: branches/xesam-support/src/libtracker-db/tracker-db-action.h
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-action.h (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-action.h Fri Jun 6 07:31:22 2008
@@ -55,7 +55,9 @@
} TrackerDBAction;
GType tracker_db_action_get_type (void) G_GNUC_CONST;
-const gchar *tracker_db_action_to_string (TrackerDBAction action);
+const gchar *tracker_db_action_to_string (TrackerDBAction action);
+gboolean tracker_db_action_is_delete (TrackerDBAction action);
+
G_END_DECLS
Modified: branches/xesam-support/src/libtracker-db/tracker-db-file-info.c
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-file-info.c (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-file-info.c Fri Jun 6 07:31:22 2008
@@ -326,4 +326,21 @@
return info;
}
+gboolean
+tracker_db_file_info_is_valid (TrackerDBFileInfo *info)
+{
+ g_return_val_if_fail (info != NULL, FALSE);
+ g_return_val_if_fail (info->uri != NULL, FALSE);
+
+ if (!g_utf8_validate (info->uri, -1, NULL)) {
+ g_warning ("Expected UTF-8 validation of TrackerDBFileInfo URI");
+ return FALSE;
+ }
+
+ if (info->action == TRACKER_DB_ACTION_IGNORE) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
Modified: branches/xesam-support/src/libtracker-db/tracker-db-file-info.h
==============================================================================
--- branches/xesam-support/src/libtracker-db/tracker-db-file-info.h (original)
+++ branches/xesam-support/src/libtracker-db/tracker-db-file-info.h Fri Jun 6 07:31:22 2008
@@ -94,13 +94,15 @@
gint ref_count;
};
-TrackerDBFileInfo *tracker_db_file_info_new (const gchar *uri,
- TrackerDBAction action,
- gint counter,
- TrackerDBWatch watch);
-void tracker_db_file_info_free (TrackerDBFileInfo *info);
-TrackerDBFileInfo *tracker_db_file_info_ref (TrackerDBFileInfo *info);
-TrackerDBFileInfo *tracker_db_file_info_unref (TrackerDBFileInfo *info);
-TrackerDBFileInfo *tracker_db_file_info_get (TrackerDBFileInfo *info);
+TrackerDBFileInfo *tracker_db_file_info_new (const gchar *uri,
+ TrackerDBAction action,
+ gint counter,
+ TrackerDBWatch watch);
+void tracker_db_file_info_free (TrackerDBFileInfo *info);
+TrackerDBFileInfo *tracker_db_file_info_ref (TrackerDBFileInfo *info);
+TrackerDBFileInfo *tracker_db_file_info_unref (TrackerDBFileInfo *info);
+TrackerDBFileInfo *tracker_db_file_info_get (TrackerDBFileInfo *info);
+gboolean tracker_db_file_info_is_valid (TrackerDBFileInfo *info);
+
#endif /* __TRACKER_DB_FILE_INFO_H__ */
Modified: branches/xesam-support/src/tracker-indexer/modules/files.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/modules/files.c (original)
+++ branches/xesam-support/src/tracker-indexer/modules/files.c Fri Jun 6 07:31:22 2008
@@ -26,6 +26,7 @@
#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-file-utils.h>
+#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-os-dependant.h>
#include <libtracker-common/tracker-ontology.h>
@@ -186,7 +187,7 @@
".csproj", ".m4", ".rej", ".gmo", ".orig",
".pc", ".omf", ".aux", ".tmp", ".po",
".vmdk",".vmx",".vmxf",".vmsd",".nvram",
- ".part"
+ ".part", ".bak"
};
const gchar const *ignore_prefix[] = {
@@ -280,15 +281,15 @@
g_free (link_path);
}
- tracker_metadata_get_embedded (file, mimetype, metadata);
+ /* FIXME: These should be dealt directly as integer/times/whatever, not strings */
+ g_hash_table_insert (metadata, METADATA_FILE_SIZE,
+ tracker_uint_to_string (st.st_size));
+ g_hash_table_insert (metadata, METADATA_FILE_MODIFIED,
+ tracker_uint_to_string (st.st_mtime));
+ g_hash_table_insert (metadata, METADATA_FILE_ACCESSED,
+ tracker_uint_to_string (st.st_atime));
- /* FIXME, Missing:
- *
- * File:Size
- * File:Modified
- * File:Accessed
- * Call external metadata extractor
- */
+ tracker_metadata_get_embedded (file, mimetype, metadata);
return metadata;
}
@@ -338,7 +339,6 @@
{
gchar *mimetype, *service_type;
gchar *text = NULL;
- GMappedFile *mapped_file;
mimetype = tracker_file_get_mime_type (file);
service_type = tracker_ontology_get_service_type_for_mime (mimetype);
Modified: branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c
==============================================================================
--- branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c (original)
+++ branches/xesam-support/src/tracker-indexer/tracker-indexer-db.c Fri Jun 6 07:31:22 2008
@@ -133,6 +133,7 @@
{
gchar *id_str, *service_type_id_str;
gchar *dirname, *basename;
+ gboolean is_dir, is_symlink, enabled;
if (!service) {
return FALSE;
@@ -144,23 +145,29 @@
dirname = g_path_get_dirname (path);
basename = g_path_get_basename (path);
+ is_dir = g_file_test (path, G_FILE_TEST_IS_DIR);
+ is_symlink = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
+
/* FIXME: do not hardcode arguments */
tracker_db_interface_execute_procedure (iface, NULL, "CreateService",
id_str,
dirname,
basename,
service_type_id_str,
- g_hash_table_lookup (metadata, "File:Mime"),
+ is_dir ? "Folder" : g_hash_table_lookup (metadata, "File:Mime"),
g_hash_table_lookup (metadata, "File:Size"),
- "0", /* is dir */
- "0", /* is link */
+ is_dir ? "1" : "0",
+ is_symlink ? "1" : "0",
"0", /* offset */
g_hash_table_lookup (metadata, "File:Modified"),
"0", /* aux ID */
NULL);
- /* FIXME: make it work for dirs */
- if (!tracker_service_get_show_service_files (service)) {
+ enabled = (is_dir) ?
+ tracker_service_get_show_service_directories (service) :
+ tracker_service_get_show_service_files (service);
+
+ if (!enabled) {
tracker_db_interface_execute_query (iface, NULL,
"Update services set Enabled = 0 where ID = %d",
id);
Modified: branches/xesam-support/src/trackerd/Makefile.am
==============================================================================
--- branches/xesam-support/src/trackerd/Makefile.am (original)
+++ branches/xesam-support/src/trackerd/Makefile.am Fri Jun 6 07:31:22 2008
@@ -86,6 +86,7 @@
tracker-email.h \
tracker-email-utils.c \
tracker-email-utils.h \
+ tracker-email-plugin.h \
tracker-files.c \
tracker-files.h \
tracker-keywords.c \
Modified: branches/xesam-support/src/trackerd/tracker-db.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-db.c (original)
+++ branches/xesam-support/src/trackerd/tracker-db.c Fri Jun 6 07:31:22 2008
@@ -119,7 +119,7 @@
g_return_val_if_fail (db_con != NULL, info);
g_return_val_if_fail (info != NULL, info);
- if (!tracker_process_files_is_file_info_valid (info)) {
+ if (!tracker_db_file_info_is_valid (info)) {
return NULL;
}
Modified: branches/xesam-support/src/trackerd/tracker-email-evolution.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-evolution.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-evolution.c Fri Jun 6 07:31:22 2008
@@ -31,8 +31,7 @@
#include <glib/gstdio.h>
-#include <libtracker-common/tracker-log.h>
-#include <libtracker-common/tracker-config.h>
+
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-utils.h>
@@ -41,6 +40,7 @@
#include "tracker-email-utils.h"
#include "tracker-db-email.h"
+#include "tracker-email-plugin.h"
#include "tracker-dbus.h"
#include "tracker-daemon.h"
#include "tracker-watcher.h"
@@ -236,12 +236,10 @@
*********************************************************************************************/
gboolean
-tracker_email_init (TrackerConfig *config)
+tracker_email_plugin_init (void)
{
EvolutionConfig *conf;
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
-
if (evolution_config) {
return TRUE;
}
@@ -257,7 +255,7 @@
gboolean
-tracker_email_finalize (void)
+tracker_email_plugin_finalize (void)
{
if (!evolution_config) {
return TRUE;
@@ -271,7 +269,7 @@
void
-tracker_email_watch_emails (DBConnection *db_con)
+tracker_email_plugin_watch_emails (DBConnection *db_con)
{
TrackerDBResultSet *result_set;
@@ -318,8 +316,8 @@
}
-static gboolean
-evolution_file_is_interesting (TrackerDBFileInfo *info)
+gboolean
+tracker_email_plugin_file_is_interesting (TrackerDBFileInfo *info)
{
GSList *dir;
@@ -375,14 +373,14 @@
gboolean
-tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
+tracker_email_plugin_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
{
gchar *file_name;
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (info, FALSE);
- if (!evolution_file_is_interesting (info))
+ if (!tracker_email_plugin_file_is_interesting (info))
return FALSE;
file_name = g_path_get_basename (info->uri);
@@ -543,7 +541,7 @@
}
const gchar *
-tracker_email_get_name (void)
+tracker_email_plugin_get_name (void)
{
return "EvolutionEmails";
}
Modified: branches/xesam-support/src/trackerd/tracker-email-kmail.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-kmail.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-kmail.c Fri Jun 6 07:31:22 2008
@@ -25,11 +25,11 @@
#include <glib/gstdio.h>
-#include <libtracker-common/tracker-log.h>
#include <libtracker-common/tracker-utils.h>
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-type-utils.h>
-#include <libtracker-common/tracker-utils.h>
+
+#include "tracker-email-plugin.h"
#include "tracker-email-utils.h"
#include "tracker-db-email.h"
@@ -106,7 +106,7 @@
*********************************************************************************************/
gboolean
-kmail_init_module (void)
+tracker_email_plugin_init (void)
{
KMailConfig *conf;
@@ -125,7 +125,7 @@
gboolean
-tracker_email_finalize (void)
+tracker_email_plugin_finalize (void)
{
if (!kmail_config) {
return TRUE;
@@ -139,7 +139,7 @@
void
-tracker_email_watch_emails (DBConnection *db_con)
+tracker_email_plugin_watch_emails (DBConnection *db_con)
{
g_return_if_fail (kmail_config);
@@ -159,8 +159,8 @@
}
-static gboolean
-kmail_file_is_interesting (TrackerDBFileInfo *info)
+gboolean
+tracker_email_plugin_file_is_interesting (TrackerDBFileInfo *info)
{
const GSList *account;
@@ -186,14 +186,14 @@
gboolean
-tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
+tracker_email_plugin_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
{
KMailMailProtocol mail_protocol;
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (info, FALSE);
- if (!kmail_file_is_interesting (info))
+ if (!tracker_email_plugin_file_is_interesting (info))
return FALSE;
mail_protocol = find_mail_protocol (info->uri);
@@ -270,7 +270,7 @@
}
const gchar *
-tracker_email_get_name (void)
+tracker_email_plugin_get_name (void)
{
return "KMailEmails";
}
Modified: branches/xesam-support/src/trackerd/tracker-email-modest.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-modest.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-modest.c Fri Jun 6 07:31:22 2008
@@ -31,8 +31,6 @@
#include <glib/gstdio.h>
#include <dirent.h>
-#include <libtracker-common/tracker-log.h>
-#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-file-utils.h>
#include <libtracker-common/tracker-utils.h>
@@ -219,12 +217,10 @@
*********************************************************************************************/
gboolean
-tracker_email_init (TrackerConfig *config)
+tracker_email_plugin_init (void)
{
ModestConfig *conf;
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
-
if (modest_config) {
return TRUE;
}
@@ -241,7 +237,7 @@
gboolean
-tracker_email_finalize (void)
+tracker_email_plugin_finalize (void)
{
if (!modest_config) {
return TRUE;
@@ -276,7 +272,7 @@
}
void
-tracker_email_watch_emails (DBConnection *db_con)
+tracker_email_plugin_watch_emails (DBConnection *db_con)
{
TrackerDBResultSet *result_set;
@@ -319,8 +315,8 @@
load_current_dynamic_folders (modest_config);
}
-static gboolean
-modest_file_is_interesting (TrackerDBFileInfo *info)
+gboolean
+tracker_email_plugin_file_is_interesting (TrackerDBFileInfo *info)
{
g_return_val_if_fail (info, FALSE);
g_return_val_if_fail (info->uri, FALSE);
@@ -339,14 +335,14 @@
gboolean
-tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
+tracker_email_plugin_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
{
gchar *file_name;
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (info, FALSE);
- if (!modest_file_is_interesting (info))
+ if (!tracker_email_plugin_file_is_interesting (info))
return FALSE;
file_name = g_path_get_basename (info->uri);
@@ -389,7 +385,7 @@
}
const gchar *
-tracker_email_get_name (void)
+tracker_email_plugin_get_name (void)
{
return "ModestEmails";
}
Modified: branches/xesam-support/src/trackerd/tracker-email-thunderbird.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-thunderbird.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-thunderbird.c Fri Jun 6 07:31:22 2008
@@ -24,8 +24,7 @@
#include <glib/gstdio.h>
-#include <libtracker-common/tracker-log.h>
-#include <libtracker-common/tracker-config.h>
+#include "tracker-email-plugin.h"
#include "tracker-db-email.h"
#include "tracker-watcher.h"
@@ -91,8 +90,8 @@
return thunderbird_mail_dir != NULL;
}
-static gboolean
-thunderbird_file_is_interesting (TrackerDBFileInfo *info)
+gboolean
+tracker_email_plugin_file_is_interesting (TrackerDBFileInfo *info)
{
//Filename should be objectX.tms (Thunderbird Message Summary)
return g_str_has_suffix (info->uri, ".tms") ;
@@ -103,10 +102,8 @@
*********************************************************************************************/
gboolean
-tracker_email_init (TrackerConfig *config)
+tracker_email_plugin_init (void)
{
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
-
if (!thunderbird_mail_dir) {
thunderbird_mail_dir = g_build_filename (g_get_home_dir (), THUNDERBIRD_MAIL_DIR_S, NULL);
}
@@ -116,7 +113,7 @@
gboolean
-tracker_email_finalize (void)
+tracker_email_plugin_finalize (void)
{
if (thunderbird_mail_dir) {
g_free (thunderbird_mail_dir);
@@ -128,7 +125,7 @@
void
-tracker_email_watch_emails (DBConnection *db_con)
+tracker_email_plugin_watch_emails (DBConnection *db_con)
{
if( thunderbird_mail_dir != NULL ) {
g_message ("Thunderbird directory lookup: \"%s\"", thunderbird_mail_dir);
@@ -138,12 +135,12 @@
gboolean
-tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
+tracker_email_plugin_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
{
g_return_val_if_fail (db_con, FALSE);
g_return_val_if_fail (info, FALSE);
- if (!thunderbird_file_is_interesting (info))
+ if (!tracker_email_plugin_file_is_interesting (info))
return FALSE;
g_message ("Thunderbird file being index:'%s'",info->uri);
@@ -155,7 +152,7 @@
}
const gchar *
-tracker_email_get_name (void)
+tracker_email_plugin_get_name (void)
{
return "ThunderbirdEmails";
}
Modified: branches/xesam-support/src/trackerd/tracker-email-utils.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-utils.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email-utils.c Fri Jun 6 07:31:22 2008
@@ -30,8 +30,6 @@
#include <glib/gstdio.h>
-#include <libtracker-common/tracker-log.h>
-#include <libtracker-common/tracker-config.h>
#include <libtracker-common/tracker-type-utils.h>
#include <libtracker-common/tracker-utils.h>
@@ -39,7 +37,6 @@
#include "tracker-dbus.h"
#include "tracker-daemon.h"
#include "tracker-email-utils.h"
-#include "tracker-watcher.h"
extern Tracker *tracker;
Modified: branches/xesam-support/src/trackerd/tracker-email-utils.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email-utils.h (original)
+++ branches/xesam-support/src/trackerd/tracker-email-utils.h Fri Jun 6 07:31:22 2008
@@ -23,7 +23,7 @@
#include <gmime/gmime.h>
-#include "tracker-email.h"
+#include "tracker-db-sqlite.h"
G_BEGIN_DECLS
Modified: branches/xesam-support/src/trackerd/tracker-email.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email.c (original)
+++ branches/xesam-support/src/trackerd/tracker-email.c Fri Jun 6 07:31:22 2008
@@ -19,79 +19,33 @@
*/
#include <glib.h>
-#include <glib/gstdio.h>
#include <gmodule.h>
-#include <libtracker-common/tracker-config.h>
+#include <gmime/gmime.h>
#include "tracker-email.h"
-#include "tracker-email-utils.h"
-#include "tracker-main.h"
-static GModule *module = NULL;
-
-/* Must be called before any work on files containing mails */
-void
-tracker_email_add_service_directories (DBConnection *db_con)
-{
- TrackerMailWatchEmails func;
-
- if (!module)
- return;
-
- if (g_module_symbol (module, "tracker_email_watch_emails", (gpointer *) &func)) {
- (func) (db_con);
- }
-}
-
-void
-tracker_email_end_email_watching (void)
-{
- TrackerMailFinalize func;
-
- if (!module)
- return;
-
- if (g_module_symbol (module, "tracker_email_finalize", (gpointer *) &func)) {
- (func) ();
- }
+typedef gboolean (* TrackerMailInit) (void);
+typedef void (* TrackerMailFinalize) (void);
+typedef void (* TrackerMailWatchEmails) (DBConnection *db_con);
+typedef gboolean (* TrackerMailIndexFile) (DBConnection *db_con,
+ TrackerDBFileInfo *info);
+typedef gboolean (* TrackerMailFileIsInteresting) (TrackerDBFileInfo *info);
+typedef const gchar * (* TrackerMailGetName) (void);
- g_mime_shutdown ();
-}
-
-
-gboolean
-tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
-{
- TrackerMailIndexFile func;
-
- g_return_val_if_fail (db_con, FALSE);
- g_return_val_if_fail (info, FALSE);
-
- if (!module)
- return FALSE;
-
- if (!g_module_symbol (module, "tracker_email_index_file", (gpointer *) &func))
- return FALSE;
+static GModule *module = NULL;
- return (func) (db_con, info);
-}
gboolean
-tracker_email_init (TrackerConfig *config)
+tracker_email_start_email_watching (const gchar *email_client)
{
TrackerMailInit func;
- const gchar *email_client;
gchar *module_name, *module_path;
gboolean result = FALSE;
- g_return_val_if_fail (TRACKER_IS_CONFIG (config), FALSE);
-
if (module)
return result;
- email_client = tracker_config_get_email_client (config);
-
if (!email_client)
return result;
@@ -114,10 +68,10 @@
g_module_make_resident (module);
- if (g_module_symbol (module, "tracker_email_init", (gpointer *) &func)) {
+ if (g_module_symbol (module, "tracker_email_plugin_init", (gpointer *) &func)) {
g_mime_init (0);
- result = (func) (config);
+ result = (func) ();
}
g_free (module_name);
@@ -127,13 +81,72 @@
}
void
-tracker_email_shutdown (void)
+tracker_email_end_email_watching (void)
{
- /* Nothing to do here it seems, this function is here for
- * completeness.
- */
+ TrackerMailFinalize func;
+
+ if (!module)
+ return;
+
+ if (g_module_symbol (module, "tracker_email_plugin_finalize", (gpointer *) &func)) {
+ (func) ();
+ }
+
+ g_mime_shutdown ();
+}
+
+
+/* Must be called before any work on files containing mails */
+void
+tracker_email_add_service_directories (DBConnection *db_con)
+{
+ TrackerMailWatchEmails func;
+
+ if (!module)
+ return;
+
+ if (g_module_symbol (module, "tracker_email_plugin_watch_emails", (gpointer *) &func)) {
+ (func) (db_con);
+ }
+}
+
+gboolean
+tracker_email_file_is_interesting (TrackerDBFileInfo *info)
+{
+ TrackerMailFileIsInteresting func;
+
+ if (!module)
+ return FALSE;
+
+
+ if (g_module_symbol (module, "tracker_email_plugin_file_is_interesting", (gpointer *) &func)) {
+ (func) (info);
+ } else {
+ g_warning ("%s module doesnt implement _file_is_interesting function",
+ tracker_email_get_name ());
+ }
+
+ return TRUE;
+}
+
+gboolean
+tracker_email_index_file (DBConnection *db_con, TrackerDBFileInfo *info)
+{
+ TrackerMailIndexFile func;
+
+ g_return_val_if_fail (db_con, FALSE);
+ g_return_val_if_fail (info, FALSE);
+
+ if (!module)
+ return FALSE;
+
+ if (!g_module_symbol (module, "tracker_email_plugin_index_file", (gpointer *) &func))
+ return FALSE;
+
+ return (func) (db_con, info);
}
+
const gchar *
tracker_email_get_name (void)
{
@@ -142,7 +155,7 @@
if (!module)
return NULL;
- if (!g_module_symbol (module, "tracker_email_get_name", (gpointer *) &func))
+ if (!g_module_symbol (module, "tracker_email_plugin_get_name", (gpointer *) &func))
return NULL;
return (func) ();
Modified: branches/xesam-support/src/trackerd/tracker-email.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-email.h (original)
+++ branches/xesam-support/src/trackerd/tracker-email.h Fri Jun 6 07:31:22 2008
@@ -23,25 +23,16 @@
#include "config.h"
-#include <libtracker-common/tracker-config.h>
#include <libtracker-db/tracker-db-file-info.h>
-#include "tracker-utils.h"
#include "tracker-db-sqlite.h"
G_BEGIN_DECLS
-typedef gboolean (* TrackerMailInit) (TrackerConfig *config);
-typedef void (* TrackerMailFinalize) (void);
-typedef void (* TrackerMailWatchEmails) (DBConnection *db_con);
-typedef gboolean (* TrackerMailIndexFile) (DBConnection *db_con,
- TrackerDBFileInfo *info);
-typedef const gchar * (* TrackerMailGetName) (void);
+gboolean tracker_email_start_email_watching (const gchar *email_client);
+void tracker_email_end_email_watching (void);
-gboolean tracker_email_init (TrackerConfig *config);
-void tracker_email_shutdown (void);
void tracker_email_add_service_directories (DBConnection *db_con);
-void tracker_email_end_email_watching (void);
gboolean tracker_email_file_is_interesting (TrackerDBFileInfo *info);
gboolean tracker_email_index_file (DBConnection *db_con,
TrackerDBFileInfo *info);
Modified: branches/xesam-support/src/trackerd/tracker-main.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-main.c (original)
+++ branches/xesam-support/src/trackerd/tracker-main.c Fri Jun 6 07:31:22 2008
@@ -941,7 +941,7 @@
tracker_db_manager_init (data_dir, user_data_dir, sys_tmp_dir);
tracker_xesam_manager_init ();
tracker_ontology_init ();
- tracker_email_init (tracker->config);
+ tracker_email_start_email_watching (tracker_config_get_email_client (tracker->config));
#ifdef HAVE_HAL
tracker->hal = tracker_hal_new ();
@@ -1041,7 +1041,7 @@
/* Shutdown major subsystems */
tracker_process_files_shutdown ();
- tracker_email_shutdown ();
+ tracker_email_end_email_watching ();
tracker_dbus_shutdown ();
tracker_ontology_shutdown ();
tracker_xesam_manager_shutdown ();
Modified: branches/xesam-support/src/trackerd/tracker-process-files.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-process-files.c (original)
+++ branches/xesam-support/src/trackerd/tracker-process-files.c Fri Jun 6 07:31:22 2008
@@ -366,7 +366,7 @@
/* Info struct may have been deleted in transit here so check
* if still valid and intact.
*/
- g_return_if_fail (tracker_process_files_is_file_info_valid (info));
+ g_return_if_fail (tracker_db_file_info_is_valid (info));
/* If we dont have an entry in the db for the deleted file, we
* ignore it.
@@ -387,7 +387,7 @@
/* Info struct may have been deleted in transit here so check
* if still valid and intact.
*/
- g_return_if_fail (tracker_process_files_is_file_info_valid (info));
+ g_return_if_fail (tracker_db_file_info_is_valid (info));
/* If we dont have an entry in the db for the deleted
* directory, we ignore it.
@@ -1145,24 +1145,6 @@
return process_get_files (dir, FALSE, FALSE, prefix);
}
-gboolean
-tracker_process_files_is_file_info_valid (TrackerDBFileInfo *info)
-{
- g_return_val_if_fail (info != NULL, FALSE);
- g_return_val_if_fail (info->uri != NULL, FALSE);
-
- if (!g_utf8_validate (info->uri, -1, NULL)) {
- g_warning ("Expected UTF-8 validation of TrackerDBFileInfo URI");
- return FALSE;
- }
-
- if (info->action == TRACKER_DB_ACTION_IGNORE) {
- return FALSE;
- }
-
- return TRUE;
-}
-
gint
tracker_process_files_metadata_queue_length (void)
{
Modified: branches/xesam-support/src/trackerd/tracker-process-files.h
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-process-files.h (original)
+++ branches/xesam-support/src/trackerd/tracker-process-files.h Fri Jun 6 07:31:22 2008
@@ -49,7 +49,6 @@
GSList **files);
GSList * tracker_process_files_get_files_with_prefix (const char *dir,
const char *prefix);
-gboolean tracker_process_files_is_file_info_valid (TrackerDBFileInfo *info);
/* Metadata Queue API */
gint tracker_process_files_metadata_queue_length (void);
Modified: branches/xesam-support/src/trackerd/tracker-watcher-inotify.c
==============================================================================
--- branches/xesam-support/src/trackerd/tracker-watcher-inotify.c (original)
+++ branches/xesam-support/src/trackerd/tracker-watcher-inotify.c Fri Jun 6 07:31:22 2008
@@ -40,6 +40,7 @@
#include <libtracker-common/tracker-utils.h>
#include <libtracker-db/tracker-db-action.h>
+#include <libtracker-db/tracker-db-file-info.h>
#include "tracker-watcher.h"
#include "tracker-process-files.h"
@@ -63,16 +64,6 @@
static gint monitor_limit = 8191;
static gboolean
-is_delete_event (TrackerDBAction event_type)
-{
- return
- event_type == TRACKER_DB_ACTION_DELETE ||
- event_type == TRACKER_DB_ACTION_DELETE_SELF ||
- event_type == TRACKER_DB_ACTION_FILE_DELETED ||
- event_type == TRACKER_DB_ACTION_DIRECTORY_DELETED;
-}
-
-static gboolean
process_moved_events (void)
{
GSList *l;
@@ -143,13 +134,13 @@
info = tracker_db_file_info_new (uri, action, 1, TRACKER_DB_WATCH_OTHER);
- if (!tracker_process_files_is_file_info_valid (info)) {
+ if (!tracker_db_file_info_is_valid (info)) {
return;
}
info->is_directory = is_dir;
- if (is_delete_event (action)) {
+ if (tracker_db_action_is_delete (action)) {
gchar *parent;
parent = g_path_get_dirname (info->uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]