projects
/
modest
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/widgets/modest-recpt-view.c:
[modest]
/
src
/
modest-search.c
diff --git
a/src/modest-search.c
b/src/modest-search.c
index
94a5c3e
..
477638f
100644
(file)
--- a/
src/modest-search.c
+++ b/
src/modest-search.c
@@
-43,6
+43,8
@@
#include <tny-list.h>
#include <tny-iterator.h>
#include <tny-simple-list.h>
#include <tny-list.h>
#include <tny-iterator.h>
#include <tny-simple-list.h>
+#include <tny-camel-imap-store-account.h>
+#include <tny-camel-pop-store-account.h>
#include <libmodest-dbus-client/libmodest-dbus-client.h>
#include <libmodest-dbus-client/libmodest-dbus-client.h>
@@
-52,6
+54,7
@@
#include "modest-tny-account.h"
#include "modest-search.h"
#include "modest-runtime.h"
#include "modest-tny-account.h"
#include "modest-search.h"
#include "modest-runtime.h"
+#include "modest-platform.h"
static gchar *
g_strdup_or_null (const gchar *str)
static gchar *
g_strdup_or_null (const gchar *str)
@@
-65,7
+68,6
@@
g_strdup_or_null (const gchar *str)
return string;
}
return string;
}
-
static GList*
add_hit (GList *list, TnyHeader *header, TnyFolder *folder)
{
static GList*
add_hit (GList *list, TnyHeader *header, TnyFolder *folder)
{
@@
-420,15
+422,19
@@
modest_search_folder (TnyFolder *folder, ModestSearch *search)
while (!tny_iterator_is_done (iter)) {
TnyHeader *cur = (TnyHeader *) tny_iterator_get_current (iter);
while (!tny_iterator_is_done (iter)) {
TnyHeader *cur = (TnyHeader *) tny_iterator_get_current (iter);
- time_t t = tny_header_get_date_sent (cur);
+ const time_t t = tny_header_get_date_sent (cur);
gboolean found = FALSE;
gboolean found = FALSE;
+ /* Ignore deleted (not yet expunged) emails: */
+ if (tny_header_get_flags(cur) & TNY_HEADER_FLAG_DELETED)
+ goto go_next;
+
if (search->flags & MODEST_SEARCH_BEFORE)
if (search->flags & MODEST_SEARCH_BEFORE)
- if (!(t <= search->before))
+ if (!(t <= search->end_date))
goto go_next;
if (search->flags & MODEST_SEARCH_AFTER)
goto go_next;
if (search->flags & MODEST_SEARCH_AFTER)
- if (!(t >= search->after))
+ if (!(t >= search->start_date))
goto go_next;
if (search->flags & MODEST_SEARCH_SIZE)
goto go_next;
if (search->flags & MODEST_SEARCH_SIZE)
@@
-488,6
+494,7
@@
modest_search_folder (TnyFolder *folder, ModestSearch *search)
retval = add_hit (retval, cur, folder);
}
}
retval = add_hit (retval, cur, folder);
}
}
+
if (msg)
g_object_unref (msg);
}
if (msg)
g_object_unref (msg);
}
@@
-583,6
+590,13
@@
modest_search_all_accounts (ModestSearch *search)
if (account) {
/* g_debug ("DEBUG: %s: Searching account %s",
__FUNCTION__, tny_account_get_name (account)); */
if (account) {
/* g_debug ("DEBUG: %s: Searching account %s",
__FUNCTION__, tny_account_get_name (account)); */
+
+ /* Give the account time to go online if necessary,
+ * for instance if this is immediately after startup,
+ * after D-Bus activation: */
+ modest_platform_check_and_wait_for_account_is_online (account);
+
+ /* Search: */
res = modest_search_account (account, search);
if (res != NULL) {
res = modest_search_account (account, search);
if (res != NULL) {