Wizards: set max message size

This commit is contained in:
M66B 2020-07-02 13:52:42 +02:00
parent 6da0031a32
commit 555a003805
3 changed files with 9 additions and 0 deletions

View File

@ -360,6 +360,7 @@ public class FragmentGmail extends FragmentBase {
throw new IllegalArgumentException(context.getString(R.string.title_setup_no_system_folders)); throw new IllegalArgumentException(context.getString(R.string.title_setup_no_system_folders));
} }
Long max_size;
String iprotocol = provider.smtp.starttls ? "smtp" : "smtps"; String iprotocol = provider.smtp.starttls ? "smtp" : "smtps";
try (EmailService iservice = new EmailService( try (EmailService iservice = new EmailService(
context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) { context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) {
@ -368,6 +369,7 @@ public class FragmentGmail extends FragmentBase {
EmailService.AUTH_TYPE_GMAIL, null, EmailService.AUTH_TYPE_GMAIL, null,
user, password, user, password,
null, null); null, null);
max_size = iservice.getMaxSize();
} }
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
@ -436,6 +438,7 @@ public class FragmentGmail extends FragmentBase {
identity.password = password; identity.password = password;
identity.synchronize = true; identity.synchronize = true;
identity.primary = true; identity.primary = true;
identity.max_size = max_size;
identity.id = db.identity().insertIdentity(identity); identity.id = db.identity().insertIdentity(identity);
EntityLog.log(context, "Gmail identity=" + identity.name + " email=" + identity.email); EntityLog.log(context, "Gmail identity=" + identity.name + " email=" + identity.email);

View File

@ -467,6 +467,7 @@ public class FragmentOAuth extends FragmentBase {
} }
Log.i("OAuth checking SMTP provider=" + provider.id); Log.i("OAuth checking SMTP provider=" + provider.id);
Long max_size;
String iprotocol = (provider.smtp.starttls ? "smtp" : "smtps"); String iprotocol = (provider.smtp.starttls ? "smtp" : "smtps");
try (EmailService iservice = new EmailService( try (EmailService iservice = new EmailService(
context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) { context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) {
@ -475,6 +476,7 @@ public class FragmentOAuth extends FragmentBase {
EmailService.AUTH_TYPE_OAUTH, provider.id, EmailService.AUTH_TYPE_OAUTH, provider.id,
primaryEmail, state, primaryEmail, state,
null, null); null, null);
max_size = iservice.getMaxSize();
} }
Log.i("OAuth passed provider=" + provider.id); Log.i("OAuth passed provider=" + provider.id);
@ -550,6 +552,7 @@ public class FragmentOAuth extends FragmentBase {
ident.password = state; ident.password = state;
ident.synchronize = true; ident.synchronize = true;
ident.primary = ident.user.equals(ident.email); ident.primary = ident.user.equals(ident.email);
ident.max_size = max_size;
ident.id = db.identity().insertIdentity(ident); ident.id = db.identity().insertIdentity(ident);
EntityLog.log(context, "OAuth identity=" + ident.name + " email=" + ident.email); EntityLog.log(context, "OAuth identity=" + ident.name + " email=" + ident.email);

View File

@ -331,6 +331,7 @@ public class FragmentQuickSetup extends FragmentBase {
throw new IllegalArgumentException(context.getString(R.string.title_setup_no_system_folders)); throw new IllegalArgumentException(context.getString(R.string.title_setup_no_system_folders));
} }
Long max_size = null;
String iprotocol = provider.smtp.starttls ? "smtp" : "smtps"; String iprotocol = provider.smtp.starttls ? "smtp" : "smtps";
try (EmailService iservice = new EmailService( try (EmailService iservice = new EmailService(
context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) { context, iprotocol, null, false, EmailService.PURPOSE_CHECK, true)) {
@ -340,6 +341,7 @@ public class FragmentQuickSetup extends FragmentBase {
EmailService.AUTH_TYPE_PASSWORD, null, EmailService.AUTH_TYPE_PASSWORD, null,
user, password, user, password,
null, smtp_fingerprint); null, smtp_fingerprint);
max_size = iservice.getMaxSize();
} catch (EmailService.UntrustedException ex) { } catch (EmailService.UntrustedException ex) {
if (check) if (check)
smtp_fingerprint = ex.getFingerprint(); smtp_fingerprint = ex.getFingerprint();
@ -422,6 +424,7 @@ public class FragmentQuickSetup extends FragmentBase {
identity.use_ip = provider.useip; identity.use_ip = provider.useip;
identity.synchronize = true; identity.synchronize = true;
identity.primary = true; identity.primary = true;
identity.max_size = max_size;
identity.id = db.identity().insertIdentity(identity); identity.id = db.identity().insertIdentity(identity);
EntityLog.log(context, "Quick added identity=" + identity.name + " email=" + identity.email); EntityLog.log(context, "Quick added identity=" + identity.name + " email=" + identity.email);