POP support

This commit is contained in:
M66B
2019-02-08 11:51:17 +00:00
parent 1768028fd4
commit f246284812
11 changed files with 1614 additions and 34 deletions

View File

@@ -49,7 +49,9 @@ public class EntityAccount implements Serializable {
@NonNull
public Integer auth_type;
@NonNull
public String host; // IMAP
public Boolean pop = false;
@NonNull
public String host; // POP3/IMAP
@NonNull
public Boolean starttls;
@NonNull
@@ -86,6 +88,10 @@ public class EntityAccount implements Serializable {
public String error;
public Long last_connected;
String getProtocol() {
return (pop ? "pop3" : "imap") + (starttls ? "" : "s");
}
static String getNotificationChannelName(long account) {
return "notification." + account;
}
@@ -110,6 +116,7 @@ public class EntityAccount implements Serializable {
JSONObject json = new JSONObject();
json.put("id", id);
json.put("auth_type", auth_type);
json.put("pop", pop);
json.put("host", host);
json.put("starttls", starttls);
json.put("insecure", insecure);
@@ -142,6 +149,8 @@ public class EntityAccount implements Serializable {
EntityAccount account = new EntityAccount();
// id
account.auth_type = json.getInt("auth_type");
if (json.has("pop"))
account.pop = json.getBoolean("pop");
account.host = json.getString("host");
account.starttls = (json.has("starttls") && json.getBoolean("starttls"));
account.insecure = (json.has("insecure") && json.getBoolean("insecure"));