mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-09 02:23:38 +02:00
Added support for Outlook categories (read only)
This commit is contained in:
@@ -253,6 +253,7 @@ public class MessageHelper {
|
||||
static final String FLAG_LOW_IMPORTANCE = "$LowImportance";
|
||||
static final String FLAG_HIGH_IMPORTANCE = "$HighImportance";
|
||||
static final String FLAG_PHISHING = "$Phishing"; // Gmail
|
||||
static final String CATEGORY_PREFIX = "$category:";
|
||||
|
||||
// https://www.iana.org/assignments/imap-jmap-keywords/imap-jmap-keywords.xhtml
|
||||
// Not black listed: Gmail $Phishing
|
||||
@@ -1544,10 +1545,19 @@ public class MessageHelper {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
String[] getKeywords() throws MessagingException {
|
||||
String[] getKeywords(boolean outlook) throws MessagingException {
|
||||
List<String> keywords = new ArrayList<>(Arrays.asList(imessage.getFlags().getUserFlags()));
|
||||
|
||||
if (outlook) {
|
||||
String categories = imessage.getHeader("Keywords", null);
|
||||
if (!TextUtils.isEmpty(categories))
|
||||
for (String category : categories.split(","))
|
||||
keywords.add(CATEGORY_PREFIX + category);
|
||||
}
|
||||
|
||||
while (keywords.size() > MAX_KEYWORDS)
|
||||
keywords.remove(keywords.size() - 1);
|
||||
|
||||
Collections.sort(keywords);
|
||||
return keywords.toArray(new String[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user