aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/abstract/MCMessageConstants.h11
-rw-r--r--src/core/imap/MCIMAPSearchExpression.cc79
-rw-r--r--src/core/imap/MCIMAPSearchExpression.h11
-rwxr-xr-xsrc/core/imap/MCIMAPSession.cc94
4 files changed, 193 insertions, 2 deletions
diff --git a/src/core/abstract/MCMessageConstants.h b/src/core/abstract/MCMessageConstants.h
index 82da94a4..72c62cdb 100644
--- a/src/core/abstract/MCMessageConstants.h
+++ b/src/core/abstract/MCMessageConstants.h
@@ -170,9 +170,20 @@ namespace mailcore {
IMAPSearchKindHeader,
IMAPSearchKindRead,
IMAPSearchKindUnread,
+ IMAPSearchKindFlagged,
+ IMAPSearchKindUnflagged,
+ IMAPSearchKindAnswered,
+ IMAPSearchKindUnanswered,
+ IMAPSearchKindDraft,
+ IMAPSearchKindUndraft,
+ IMAPSearchKindDeleted,
+ IMAPSearchKindSpam,
IMAPSearchKindBeforeDate,
IMAPSearchKindOnDate,
IMAPSearchKindSinceDate,
+ IMAPSearchKindBeforeRecievedDate,
+ IMAPSearchKindOnRecievedDate,
+ IMAPSearchKindSinceRecievedDate,
IMAPSearchKindGmailThreadID,
IMAPSearchKindOr,
IMAPSearchKindAnd,
diff --git a/src/core/imap/MCIMAPSearchExpression.cc b/src/core/imap/MCIMAPSearchExpression.cc
index 07e67ea1..4e843b98 100644
--- a/src/core/imap/MCIMAPSearchExpression.cc
+++ b/src/core/imap/MCIMAPSearchExpression.cc
@@ -138,6 +138,62 @@ IMAPSearchExpression * IMAPSearchExpression::searchUnread()
return (IMAPSearchExpression *) expr->autorelease();
}
+IMAPSearchExpression * IMAPSearchExpression::searchFlagged()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindFlagged;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchUnflagged()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindUnflagged;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchAnswered()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindAnswered;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchUnanswered()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindUnanswered;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchDraft()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindDraft;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchUndraft()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindUndraft;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchDeleted()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindDeleted;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchSpam()
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindSpam;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
IMAPSearchExpression * IMAPSearchExpression::searchBeforeDate(time_t date)
{
IMAPSearchExpression * expr = new IMAPSearchExpression();
@@ -162,6 +218,29 @@ IMAPSearchExpression * IMAPSearchExpression::searchSinceDate(time_t date)
return (IMAPSearchExpression *) expr->autorelease();
}
+IMAPSearchExpression * IMAPSearchExpression::searchBeforeRecievedDate(time_t date)
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindBeforeRecievedDate;
+ expr->mLongNumber = date;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+IMAPSearchExpression * IMAPSearchExpression::searchOnRecievedDate(time_t date)
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindOnRecievedDate;
+ expr->mLongNumber = date;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
+IMAPSearchExpression * IMAPSearchExpression::searchSinceReciviedDate(time_t date)
+{
+ IMAPSearchExpression * expr = new IMAPSearchExpression();
+ expr->mKind = IMAPSearchKindSinceRecievedDate;
+ expr->mLongNumber = date;
+ return (IMAPSearchExpression *) expr->autorelease();
+}
+
IMAPSearchExpression * IMAPSearchExpression::searchGmailThreadID(uint64_t number)
{
IMAPSearchExpression * expr = new IMAPSearchExpression();
diff --git a/src/core/imap/MCIMAPSearchExpression.h b/src/core/imap/MCIMAPSearchExpression.h
index edb5f0fc..27c7307b 100644
--- a/src/core/imap/MCIMAPSearchExpression.h
+++ b/src/core/imap/MCIMAPSearchExpression.h
@@ -29,9 +29,20 @@ namespace mailcore {
static IMAPSearchExpression * searchHeader(String * header, String * value);
static IMAPSearchExpression * searchRead();
static IMAPSearchExpression * searchUnread();
+ static IMAPSearchExpression * searchFlagged();
+ static IMAPSearchExpression * searchUnflagged();
+ static IMAPSearchExpression * searchAnswered();
+ static IMAPSearchExpression * searchUnanswered();
+ static IMAPSearchExpression * searchDraft();
+ static IMAPSearchExpression * searchUndraft();
+ static IMAPSearchExpression * searchDeleted();
+ static IMAPSearchExpression * searchSpam();
static IMAPSearchExpression * searchBeforeDate(time_t date);
static IMAPSearchExpression * searchOnDate(time_t date);
static IMAPSearchExpression * searchSinceDate(time_t date);
+ static IMAPSearchExpression * searchBeforeRecievedDate(time_t date);
+ static IMAPSearchExpression * searchOnRecievedDate(time_t date);
+ static IMAPSearchExpression * searchSinceReciviedDate(time_t date);
static IMAPSearchExpression * searchGmailThreadID(uint64_t number);
static IMAPSearchExpression * searchAnd(IMAPSearchExpression * left, IMAPSearchExpression * right);
static IMAPSearchExpression * searchOr(IMAPSearchExpression * left, IMAPSearchExpression * right);
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 0e6c07c4..fb820693 100755
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -2598,18 +2598,36 @@ static struct mailimap_search_key * searchKeyFromSearchExpression(IMAPSearchExpr
{
time_t date = expression->longNumber();
tm * timeinfo = localtime(&date);
- return mailimap_search_key_new_before(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
+ return mailimap_search_key_new_sentbefore(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
}
case IMAPSearchKindOnDate:
{
time_t date = expression->longNumber();
tm * timeinfo = localtime(&date);
- return mailimap_search_key_new_on(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
+ return mailimap_search_key_new_senton(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
}
case IMAPSearchKindSinceDate:
{
time_t date = expression->longNumber();
tm * timeinfo = localtime(&date);
+ return mailimap_search_key_new_sentsince(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
+ }
+ case IMAPSearchKindBeforeRecievedDate:
+ {
+ time_t date = expression->longNumber();
+ tm * timeinfo = localtime(&date);
+ return mailimap_search_key_new_before(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
+ }
+ case IMAPSearchKindOnRecievedDate:
+ {
+ time_t date = expression->longNumber();
+ tm * timeinfo = localtime(&date);
+ return mailimap_search_key_new_on(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
+ }
+ case IMAPSearchKindSinceRecievedDate:
+ {
+ time_t date = expression->longNumber();
+ tm * timeinfo = localtime(&date);
return mailimap_search_key_new_since(mailimap_date_new(timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year));
}
case IMAPSearchKindGmailThreadID:
@@ -2634,6 +2652,78 @@ static struct mailimap_search_key * searchKeyFromSearchExpression(IMAPSearchExpr
NULL, NULL, NULL, NULL, NULL,
NULL, 0, NULL, NULL, NULL);
}
+ case IMAPSearchKindFlagged:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_FLAGGED,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindUnflagged:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_UNFLAGGED,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindAnswered:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_ANSWERED,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindUnanswered:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_UNANSWERED,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindDraft:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_DRAFT,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindUndraft:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_UNDRAFT,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindDeleted:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_DELETED,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
+ case IMAPSearchKindSpam:
+ {
+ return mailimap_search_key_new(MAILIMAP_SEARCH_KEY_KEYWORD,
+ NULL, NULL, NULL, NULL, NULL,
+ strdup("Junk"), NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ NULL, 0, NULL, NULL, NULL);
+ }
case IMAPSearchKindOr:
{
return mailimap_search_key_new_or(searchKeyFromSearchExpression(expression->leftExpression()), searchKeyFromSearchExpression(expression->rightExpression()));