2007-06-20 Murray Cumming <murrayc@murrayc.com>
+ * src/dbus_api/modest-dbus-callbacks.c: (modest_dbus_req_filter):
+ Actually set the body query instead of the subject query.
+
+ * src/modest-search.c: (search_mime_part_ogs),
+ (search_mime_part_strcmp): Remove extra space from the text/* regex,
+ which would probably cause it to fail if we got this far.
+
+ (modest_search_folder): Use simple #ifdefs instead of the function pointer,
+ to simplify the code.
+ Warn when tny_mime_part_get_parts() returns an empty list, which seems to
+ be causing search-in-body to fail.
+
+2007-06-20 Murray Cumming <murrayc@murrayc.com>
+
* libmodest-dbus-client/libmodest-dbus-client.h: Document the folder
struct item.
* src/dbus_api/modest-dbus-callbacks.c: (find_message_by_url):
*nread = _nread;
return TRUE;
-
-
}
#ifdef MODEST_HAVE_OGS
gboolean res;
- if (! tny_mime_part_content_type_is (part, "text/ *") ||
+ if (! tny_mime_part_content_type_is (part, "text/*") ||
! (is_html = tny_mime_part_content_type_is (part, "text/html"))) {
+ g_debug ("%s: No text or html MIME part found.\n", __FUNCTION__);
return FALSE;
}
while ((res = read_chunk (stream, buffer, len, &nread))) {
+ /* search->text_searcher was instantiated in modest_search_folder(). */
+
if (is_html) {
found = ogs_text_searcher_search_html (search->text_searcher,
}
ogs_text_searcher_reset (search->text_searcher);
+
+ /* debug stuff:
+ if (!found) {
+ buffer[len -1] = 0;
+ printf ("DEBUG: %s: query %s was not found in message text: %s\n",
+ __FUNCTION__, search->query, buffer);
+
+ } else {
+ printf ("DEBUG: %s: found.\n", __FUNCTION__);
+ }
+ */
return found;
}
-#endif /*MODEST_HAVE_OGS*/
+
+#else
static gboolean
search_mime_part_strcmp (TnyMimePart *part, ModestSearch *search)
gboolean found;
gboolean res;
- if (! tny_mime_part_content_type_is (part, "text/ *")) {
+ if (! tny_mime_part_content_type_is (part, "text/*")) {
+ g_debug ("%s: No text MIME part found.\n", __FUNCTION__);
return FALSE;
}
g_object_unref (stream);
return found;
}
+#endif /*MODEST_HAVE_OGS*/
static gboolean
search_string (const char *what,
modest_search_folder (TnyFolder *folder, ModestSearch *search)
{
GList *retval = NULL;
- TnyIterator *iter;
- TnyList *list;
- gboolean (*part_search_func) (TnyMimePart *part, ModestSearch *search);
-
- part_search_func = search_mime_part_strcmp;
-
+ TnyIterator *iter = NULL;
+ TnyList *list = NULL;
+
#ifdef MODEST_HAVE_OGS
if (search->flags & MODEST_SEARCH_USE_OGS) {
ogs_text_searcher_parse_query (text_searcher, search->query);
search->text_searcher = text_searcher;
}
-
- part_search_func = search_mime_part_ogs;
}
#endif
parts = tny_simple_list_new ();
tny_mime_part_get_parts (TNY_MIME_PART (msg), parts);
+
+ if (tny_list_get_length(parts) == 0) {
+ gchar *url_string = tny_msg_get_url_string (msg);
+ g_debug ("DEBUG: %s: tny_mime_part_get_parts(msg) returned an empty list for message url=%s",
+ __FUNCTION__, url_string);
+ g_free (url_string);
+ }
piter = tny_list_create_iterator (parts);
while (!found && !tny_iterator_is_done (piter)) {
TnyMimePart *pcur = (TnyMimePart *) tny_iterator_get_current (piter);
- if ((found = part_search_func (pcur, search))) {
+ #ifdef MODEST_HAVE_OGS
+ found = search_mime_part_ogs (pcur, search);
+ #else
+ found = search_mime_part_strcmp (pcur, search);
+ #endif
+
+ if (found) {
retval = add_hit (retval, cur, folder);
}
GList *res;
folder = TNY_FOLDER (tny_iterator_get_current (iter));
+ /* g_debug ("DEBUG: %s: searching folder %s.",
+ __FUNCTION__, tny_folder_get_name (folder)); */
res = modest_search_folder (folder, search);
account = TNY_ACCOUNT (tny_iterator_get_current (iter));
- g_debug ("DEBUG: %s: Searching account %s",
- __FUNCTION__, tny_account_get_name (account));
+ /* g_debug ("DEBUG: %s: Searching account %s",
+ __FUNCTION__, tny_account_get_name (account)); */
res = modest_search_account (account, search);
if (res != NULL) {