X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-search.c;h=761598c5dc9f6117d7b106f1b3e363c56ca1a772;hp=477638f4c79239ca73268b83e3fb12dac7b25d64;hb=89c621790370dcbaddb8ff9b9dd233a7211e8d61;hpb=099ca69a75a3131d9eac8670971da057b7b4adda diff --git a/src/modest-search.c b/src/modest-search.c index 477638f..761598c 100644 --- a/src/modest-search.c +++ b/src/modest-search.c @@ -46,12 +46,11 @@ #include #include -#include - #include "modest-text-utils.h" #include "modest-account-mgr.h" #include "modest-tny-account-store.h" #include "modest-tny-account.h" +#include "modest-tny-folder.h" #include "modest-search.h" #include "modest-runtime.h" #include "modest-platform.h" @@ -71,7 +70,7 @@ g_strdup_or_null (const gchar *str) static GList* add_hit (GList *list, TnyHeader *header, TnyFolder *folder) { - ModestSearchHit *hit; + ModestSearchResultHit *hit; TnyHeaderFlags flags; char *furl; char *msg_url; @@ -79,7 +78,7 @@ add_hit (GList *list, TnyHeader *header, TnyFolder *folder) const char *subject; const char *sender; - hit = g_slice_new0 (ModestSearchHit); + hit = g_slice_new0 (ModestSearchResultHit); furl = tny_folder_get_url_string (folder); printf ("DEBUG: %s: folder URL=%s\n", __FUNCTION__, furl); @@ -111,7 +110,7 @@ add_hit (GList *list, TnyHeader *header, TnyFolder *folder) hit->msize = tny_header_get_message_size (header); hit->has_attachment = flags & TNY_HEADER_FLAG_ATTACHMENTS; hit->is_unread = ! (flags & TNY_HEADER_FLAG_SEEN); - hit->timestamp = tny_header_get_date_received (header); + hit->timestamp = MIN (tny_header_get_date_received (header), tny_header_get_date_sent (header)); return g_list_prepend (list, hit); } @@ -297,7 +296,7 @@ search_mime_part_strcmp (TnyMimePart *part, ModestSearch *search) buffer, TRUE); - if (found) { + if ((found)||(nread == 0)) { break; } @@ -388,8 +387,15 @@ 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 && strlen (search->folder) && (strcmp (tny_folder_get_id (folder), search->folder) != 0)) - return NULL; + if (search->folder && strlen (search->folder)) { + if (!strcmp (search->folder, "outbox")) { + if (modest_tny_folder_guess_folder_type (folder) != TNY_FOLDER_TYPE_OUTBOX) { + return NULL; + } + } else if (strcmp (tny_folder_get_id (folder), search->folder) != 0) { + return NULL; + } + } GList *retval = NULL; TnyIterator *iter = NULL;