mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 22:26:06 +02:00
Refactoring
This commit is contained in:
@@ -105,7 +105,7 @@ public class EntityFolder implements Serializable {
|
||||
static final String USER = "User";
|
||||
|
||||
// https://www.iana.org/assignments/imap-mailbox-name-attributes/imap-mailbox-name-attributes.xhtml
|
||||
static final List<String> SYSTEM_FOLDER_ATTR = Arrays.asList(
|
||||
private static final List<String> SYSTEM_FOLDER_ATTR = Arrays.asList(
|
||||
"All",
|
||||
"Archive",
|
||||
"Drafts",
|
||||
@@ -115,7 +115,7 @@ public class EntityFolder implements Serializable {
|
||||
"Important",
|
||||
"Flagged"
|
||||
);
|
||||
static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(
|
||||
private static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(
|
||||
ARCHIVE,
|
||||
ARCHIVE,
|
||||
DRAFTS,
|
||||
@@ -184,6 +184,25 @@ public class EntityFolder implements Serializable {
|
||||
return DRAFTS.equals(type) || OUTBOX.equals(type) || SENT.equals(type);
|
||||
}
|
||||
|
||||
static String getType(String[] attrs, String fullName) {
|
||||
for (String attr : attrs) {
|
||||
if ("\\Noselect".equals(attr) || "\\NonExistent".equals(attr))
|
||||
return null;
|
||||
|
||||
if (attr.startsWith("\\")) {
|
||||
int index = SYSTEM_FOLDER_ATTR.indexOf(attr.substring(1));
|
||||
if (index >= 0)
|
||||
return SYSTEM_FOLDER_TYPE.get(index);
|
||||
}
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc3501#section-5.1
|
||||
if ("INBOX".equals(fullName.toUpperCase()))
|
||||
return INBOX;
|
||||
|
||||
return USER;
|
||||
}
|
||||
|
||||
static int getLevel(Character separator, String name) {
|
||||
int level = 0;
|
||||
if (separator != null) {
|
||||
|
||||
Reference in New Issue
Block a user