CamelFolderSearch: Hack to deal with "message-location".
authorMatthew Barnes <mbarnes@redhat.com>
Fri, 6 May 2011 17:07:16 +0000 (13:07 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Fri, 6 May 2011 17:07:16 +0000 (13:07 -0400)
This is the one place in Camel that needs to know about Evolution folder
URI formats.  It's fine for now; it's marked with a FIXME comment and I'll
clean it up properly later.

camel/camel-folder-search.c

index 0c1a575..c4dc3df 100644 (file)
@@ -1833,9 +1833,20 @@ search_message_location (struct _ESExp *f, gint argc, struct _ESExpResult **argv
 
        if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) {
                if (argv[0]->value.string && search->folder) {
-                       const gchar *furi = camel_folder_get_uri (search->folder);
+                       CamelStore *store;
+                       const gchar *name;
+                       const gchar *uid;
+                       gchar *uri;
+
+                       /* FIXME Folder URI formats are Evolution-specific
+                        *       knowledge and doesn't belong here! */
+                       store = camel_folder_get_parent_store (search->folder);
+                       name = camel_folder_get_full_name (search->folder);
+                       uid = camel_service_get_uid (CAMEL_SERVICE (store));
 
-                       same = g_str_equal (furi ? furi : "", argv[0]->value.string);
+                       uri = g_strdup_printf ("folder://%s/%s", uid, name);
+                       same = g_str_equal (uri, argv[0]->value.string);
+                       g_free (uri);
                }
        }