Skip to content

Commit

Permalink
Add support for search in recipient addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
cketti committed Nov 28, 2022
1 parent de89124 commit 77756e5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Expand Up @@ -453,6 +453,9 @@ open class MessageList :
val search = LocalSearch().apply {
isManualSearch = true
or(SearchCondition(SearchField.SENDER, SearchSpecification.Attribute.CONTAINS, query))
or(SearchCondition(SearchField.TO, SearchSpecification.Attribute.CONTAINS, query))
or(SearchCondition(SearchField.CC, SearchSpecification.Attribute.CONTAINS, query))
or(SearchCondition(SearchField.BCC, SearchSpecification.Attribute.CONTAINS, query))
or(SearchCondition(SearchField.SUBJECT, SearchSpecification.Attribute.CONTAINS, query))
or(SearchCondition(SearchField.MESSAGE_CONTENTS, SearchSpecification.Attribute.CONTAINS, query))
}
Expand Down
Expand Up @@ -50,7 +50,11 @@ private void addQueryString(StringBuilder builder) {
if (performFullTextSearch) {
builder.append(" TEXT ").append(encodedQuery);
} else {
builder.append(" OR SUBJECT ").append(encodedQuery).append(" FROM ").append(encodedQuery);
builder.append(" OR OR OR OR SUBJECT ").append(encodedQuery)
.append(" FROM ").append(encodedQuery)
.append(" TO ").append(encodedQuery)
.append(" CC ").append(encodedQuery)
.append(" BCC ").append(encodedQuery);
}
}

Expand Down
Expand Up @@ -1066,7 +1066,7 @@ class RealImapFolderTest {

folder.search("query", emptySet(), emptySet(), false)

assertCommandIssued("UID SEARCH OR SUBJECT \"query\" FROM \"query\"")
assertCommandIssued("""UID SEARCH OR OR OR OR SUBJECT "query" FROM "query" TO "query" CC "query" BCC "query"""")
}

@Test
Expand Down
Expand Up @@ -32,6 +32,7 @@ public void build_withoutFullTextSearch() {
.queryString("query")
.build();

assertEquals("UID SEARCH OR SUBJECT \"query\" FROM \"query\" NOT DELETED", command);
assertEquals("UID SEARCH OR OR OR OR SUBJECT \"query\" FROM \"query\" TO \"query\" CC \"query\"" +
" BCC \"query\" NOT DELETED", command);
}
}

0 comments on commit 77756e5

Please sign in to comment.