mirror of https://github.com/M66B/FairEmail.git
Add keyword blacklist
This commit is contained in:
parent
38398fefdc
commit
594f6d85c6
|
@ -260,8 +260,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
));
|
||||
|
||||
// https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
|
||||
private static final List<String> IMAP_KEYWORDS = Collections.unmodifiableList(Arrays.asList(
|
||||
"$Phishing"
|
||||
private static final List<String> IMAP_KEYWORDS_WHITELIST = Collections.unmodifiableList(Arrays.asList(
|
||||
"$Phishing".toLowerCase()
|
||||
));
|
||||
|
||||
private static final List<String> IMAP_KEYWORDS_BLACKLIST = Collections.unmodifiableList(Arrays.asList(
|
||||
"DTAG_document".toLowerCase(),
|
||||
"DTAG_image".toLowerCase()
|
||||
));
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements
|
||||
|
@ -869,9 +874,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
tvSubject.setText(message.subject);
|
||||
|
||||
List<String> keywords = new ArrayList<>();
|
||||
for (String keyword : message.keywords)
|
||||
if (!keyword.startsWith("$") || IMAP_KEYWORDS.contains(keyword))
|
||||
for (String keyword : message.keywords) {
|
||||
String k = keyword.toLowerCase();
|
||||
if (IMAP_KEYWORDS_WHITELIST.contains(k) ||
|
||||
!(k.startsWith("$") || IMAP_KEYWORDS_BLACKLIST.contains(k)))
|
||||
keywords.add(keyword);
|
||||
}
|
||||
|
||||
tvKeywords.setVisibility(keywords.size() > 0 ? View.VISIBLE : View.GONE);
|
||||
tvKeywords.setText(TextUtils.join(" ", keywords));
|
||||
|
|
Loading…
Reference in New Issue