Changed the changelog to build for week 29.
[modest] / src / modest-search.c
index 45fc996..46d5c90 100644 (file)
@@ -384,9 +384,9 @@ modest_search_folder (TnyFolder *folder, ModestSearch *search)
        /* Check that we should be searching this folder. */
        /* Note that we don't try to search sub-folders. 
         * Maybe we should, but that should be specified. */
-       if (search->folder && (strcmp (tny_folder_get_id (folder), search->folder) != 0))
+       if (search->folder && strlen (search->folder) && (strcmp (tny_folder_get_id (folder), search->folder) != 0))
                return NULL;
-               
+       
        GList *retval = NULL;
        TnyIterator *iter = NULL;
        TnyList *list = NULL;
@@ -478,16 +478,16 @@ modest_search_folder (TnyFolder *folder, ModestSearch *search)
                                if (msg) {
                                        g_object_unref (msg);
                                }
-                       }       
-
-                       found = search_mime_part_and_child_parts (TNY_MIME_PART (msg), 
-                               search);
-                       if (found) {
-                               retval = add_hit (retval, cur, folder);
-                       }
+                       } else {        
                        
-                       g_object_unref (msg);
-
+                               found = search_mime_part_and_child_parts (TNY_MIME_PART (msg), 
+                                                                         search);
+                               if (found) {
+                                       retval = add_hit (retval, cur, folder);
+                               }
+                       }
+                       if (msg)
+                               g_object_unref (msg);
                }
 
 go_next:
@@ -548,6 +548,7 @@ modest_search_account (TnyAccount *account, ModestSearch *search)
        g_object_unref (iter);
        g_object_unref (folders);
 
+       /* printf ("DEBUG: %s: hits length = %d\n", __FUNCTION__, g_list_length (hits)); */
        return hits;
 }
 
@@ -574,20 +575,21 @@ modest_search_all_accounts (ModestSearch *search)
                GList      *res;
 
                account = TNY_ACCOUNT (tny_iterator_get_current (iter));
-
+       
+               
                /* g_debug ("DEBUG: %s: Searching account %s",
-                        __FUNCTION__, tny_account_get_name (account)); */
+                  __FUNCTION__, tny_account_get_name (account)); */
                res = modest_search_account (account, search);
-               
+                       
                if (res != NULL) {
-
+                       
                        if (hits == NULL) {
                                hits = res;
                        } else {
                                hits = g_list_concat (hits, res);
                        }
                }
-
+                       
                g_object_unref (account);
                tny_iterator_next (iter);
        }
@@ -595,6 +597,7 @@ modest_search_all_accounts (ModestSearch *search)
        g_object_unref (accounts);
        g_object_unref (iter);
 
+       /* printf ("DEBUG: %s: end: hits length=%d\n", __FUNCTION__, g_list_length(hits)); */
        return hits;
 }