Tracker was not correctly indexing Evolution emails for me (tested on
release 0.6.4, trunk SVN revision 1095).
Symptoms:
* I am using IMAP mailbox with an auth description in the URI.
example: imap://dan;[EMAIL PROTECTED]/;etc
FWIW, this is a MS Exchange server being accessed through IMAP.
* Observed problem: trackerd was translating this URI into an account
name of "dan;[EMAIL PROTECTED]" where the correct account
name (and evolution directory name) is "[EMAIL PROTECTED]". The
attached patch fixes the issue for me, but I do not have access to an
account with a imap URI not including this auth information. Patch is
against trunk HEAD revision.
* Observed behavior when this happened was that all sent messages in the
local folders were being indexed, and the console output of trackerd
looked like it was finding the IMAP accounts properly, but no emails
were indexed.
* The attached patch fixes the algorithm to look up account name by imap
URI for the embedded auth case and refactors it into a static function.
* The lookup function is then called from load_evolution_config() when
checking for Evolution accounts, and from open_summary_file() when
matching the summary file to be indexed to an evolution account.
* All changes are confined to src/trackerd/tracker-email-evolution.c
Hope this helps,
Dan
Index: tracker-email-evolution.c
===================================================================
--- tracker-email-evolution.c (revision 1095)
+++ tracker-email-evolution.c (working copy)
@@ -148,6 +148,7 @@
*/
static gchar * get_account_name_in_imap_path (const gchar *path);
+static gchar * get_account_name_from_imap_uri (const gchar *imap_uri);
typedef gboolean (* LoadSummaryFileMetaHeaderFct) (SummaryFile *summary, SummaryFileHeader *header);
typedef gboolean (* LoadMailMessageFct) (SummaryFile *summary, MailMessage **mail_msg);
@@ -683,6 +684,49 @@
}
+static gchar* get_account_name_from_imap_uri(const gchar* imap_uri)
+{
+ /* Assume url schema is:
+ imap://[EMAIL PROTECTED]/;etc
+
+ also can contain foo;[EMAIL PROTECTED]
+
+ We try to get "[EMAIL PROTECTED]".
+ */
+
+ // check for embedded @ and then look for first colon after that
+
+ const char *start = imap_uri + 7;
+ const char *at = strchr (start, '@');
+ const char *semic = strchr(start, ';');
+
+ gchar* user_name = NULL;
+ gchar* at_host_name = NULL;
+ gchar *account_name = NULL;
+
+
+ if (semic < at) { // then we have a ";[EMAIL PROTECTED]" schema
+ // Set semic to the next semicolon, which ends the hostname.
+ user_name = g_strndup(start, (semic-start));
+ semic = strchr(at,';');
+ } else {
+ user_name = g_strndup(start, (at-start));
+ }
+
+ at_host_name = g_strndup(at, (semic - 1) - at);
+
+ if (user_name && at_host_name) {
+ account_name = g_strconcat(user_name,at_host_name,NULL);
+ g_free(user_name);
+ g_free(at_host_name);
+ return account_name;
+ } else {
+ g_free(user_name);
+ g_free(at_host_name);
+ return NULL;
+ }
+}
+
static gboolean
load_evolution_config (EvolutionConfig **conf)
{
@@ -723,23 +767,9 @@
}
case EVOLUTION_MAIL_PROTOCOL_IMAP: {
- gchar *account_name = NULL;
- /* Assume url schema is:
- imap://[EMAIL PROTECTED]/;etc
+ gchar* account_name = get_account_name_from_imap_uri(evo_acc->source_url);
- also can contain foo;[EMAIL PROTECTED]
-
- We try to get "[EMAIL PROTECTED]".
- */
-
- // check for embedded @ and then look for first colon after that
-
- const char *at = strchr (evo_acc->source_url + 7, '@');
-
- account_name = g_strndup (evo_acc->source_url + 7,
- (strchr (at, ';') - 1) - (evo_acc->source_url + 7));
-
if (account_name) {
tracker_log ("Found imap account %s", account_name);
@@ -1509,12 +1539,17 @@
tracker_debug ("Account name for summary file is %s and path is %s", account_name, (*summary)->path);
- if (strstr (evo_acc->source_url, account_name)) {
+ gchar* source_account_name = get_account_name_from_imap_uri(evo_acc->source_url);
+
+ if (source_account_name != NULL)
+ if (!strcmp(source_account_name, account_name)) {
(*summary)->associated_account = evo_acc;
g_free (account_name);
+ g_free (source_account_name);
goto loop_exit;
}
g_free (account_name);
+ g_free (source_account_name);
break;
}
_______________________________________________
tracker-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/tracker-list