diff --git a/FAQ.md b/FAQ.md index 639a431773..76e13788bf 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1146,11 +1146,13 @@ This will result in searching like this: ("apple" AND "banana" AND NOT "cherry") OR "nuts" ``` -Since version 1.1979 it is possible to use these prefixes as a search expression: +Since version 1.1980 it is possible to use these prefixes as a search expression: ``` from: to: +cc: +bcc: keyword: ``` diff --git a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java index bbebd178fe..91729be9bc 100644 --- a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java +++ b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java @@ -886,6 +886,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback TO.length() && w.startsWith(TO)) return true; + else if (w.length() > CC.length() && w.startsWith(CC)) + return true; + else if (w.length() > BCC.length() && w.startsWith(BCC)) + return true; else if (w.length() > KEYWORD.length() && w.startsWith(KEYWORD)) return true; @@ -931,6 +937,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback opt = new ArrayList<>(); List andFrom = new ArrayList<>(); List andTo = new ArrayList<>(); + List andCc = new ArrayList<>(); + List andBcc = new ArrayList<>(); List andKeyword = new ArrayList<>(); StringBuilder all = new StringBuilder(); for (String w : search.trim().split("\\s+")) { @@ -950,6 +958,10 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback TO.length() && w.startsWith(TO)) andTo.add(w.substring(TO.length())); + else if (w.length() > CC.length() && w.startsWith(CC)) + andCc.add(w.substring(CC.length())); + else if (w.length() > BCC.length() && w.startsWith(BCC)) + andBcc.add(w.substring(BCC.length())); else if (w.length() > KEYWORD.length() && w.startsWith(KEYWORD)) andKeyword.add(w.substring(KEYWORD.length())); else { @@ -959,7 +971,9 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback 0) + andFrom.size() + + andTo.size() + andCc.size() + andBcc.size() + + andKeyword.size() > 0) search = all.toString(); // Yahoo! does not support keyword search, but uses the flags $Forwarded $Junk $NotJunk @@ -978,9 +992,13 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback 0) { + if (andTo.size() + andCc.size() + andBcc.size() > 0) { for (String term : andTo) and.add(new RecipientStringTerm(Message.RecipientType.TO, term)); + for (String term : andCc) + and.add(new RecipientStringTerm(Message.RecipientType.CC, term)); + for (String term : andBcc) + and.add(new RecipientStringTerm(Message.RecipientType.BCC, term)); } else { if (in_recipients && !TextUtils.isEmpty(search)) { or.add(new RecipientStringTerm(Message.RecipientType.TO, search));