mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-01 01:06:11 +00:00
Limit number of keywords/labels
This commit is contained in:
parent
4836366b48
commit
2634ed276b
1 changed files with 7 additions and 0 deletions
|
@ -192,6 +192,8 @@ public class MessageHelper {
|
|||
|
||||
private static final int MAX_HEADER_LENGTH = 998;
|
||||
private static final int MAX_MESSAGE_SIZE = 10 * 1024 * 1024; // bytes
|
||||
private static final int MAX_KEYWORDS = 32;
|
||||
private static final int MAX_LABELS = 32;
|
||||
private static final long ATTACHMENT_PROGRESS_UPDATE = 1500L; // milliseconds
|
||||
private static final int MAX_META_EXCERPT = 1024; // characters
|
||||
private static final int FORMAT_FLOWED_LINE_LENGTH = 72; // characters
|
||||
|
@ -1524,6 +1526,8 @@ public class MessageHelper {
|
|||
@NonNull
|
||||
String[] getKeywords() throws MessagingException {
|
||||
List<String> keywords = Arrays.asList(imessage.getFlags().getUserFlags());
|
||||
while (keywords.size() > MAX_KEYWORDS)
|
||||
keywords.remove(keywords.size() - 1);
|
||||
Collections.sort(keywords);
|
||||
return keywords.toArray(new String[0]);
|
||||
}
|
||||
|
@ -1962,6 +1966,9 @@ public class MessageHelper {
|
|||
if (!label.startsWith("\\"))
|
||||
labels.add(label);
|
||||
|
||||
while (labels.size() > MAX_LABELS)
|
||||
labels.remove(labels.size() - 1);
|
||||
|
||||
Collections.sort(labels);
|
||||
|
||||
return labels.toArray(new String[0]);
|
||||
|
|
Loading…
Reference in a new issue