Add keyword blacklist

pull/172/head
M66B 5 years ago
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 // https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
private static final List<String> IMAP_KEYWORDS = Collections.unmodifiableList(Arrays.asList( private static final List<String> IMAP_KEYWORDS_WHITELIST = Collections.unmodifiableList(Arrays.asList(
"$Phishing" "$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 public class ViewHolder extends RecyclerView.ViewHolder implements
@ -869,9 +874,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
List<String> keywords = new ArrayList<>(); List<String> keywords = new ArrayList<>();
for (String keyword : message.keywords) for (String keyword : message.keywords) {
if (!keyword.startsWith("$") || IMAP_KEYWORDS.contains(keyword)) String k = keyword.toLowerCase();
if (IMAP_KEYWORDS_WHITELIST.contains(k) ||
!(k.startsWith("$") || IMAP_KEYWORDS_BLACKLIST.contains(k)))
keywords.add(keyword); keywords.add(keyword);
}
tvKeywords.setVisibility(keywords.size() > 0 ? View.VISIBLE : View.GONE); tvKeywords.setVisibility(keywords.size() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setText(TextUtils.join(" ", keywords)); tvKeywords.setText(TextUtils.join(" ", keywords));

Loading…
Cancel
Save