Added account setting to ignore bodystructure size

pull/162/head
M66B 5 years ago
parent 56a2de7bb7
commit d1520be8e7

File diff suppressed because it is too large Load Diff

@ -243,6 +243,7 @@ public class ActivityEML extends ActivityBase {
try (MailService iservice = new MailService(context, account.getProtocol(), account.realm, account.insecure, true)) {
iservice.setPartialFetch(account.partial_fetch);
iservice.setIgnoreBodyStructureSize(account.ignore_size);
iservice.setSeparateStoreConnection();
iservice.connect(account);

@ -255,6 +255,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
Log.i("Boundary server connecting account=" + account.name);
state.iservice = new MailService(context, account.getProtocol(), account.realm, account.insecure, debug);
state.iservice.setPartialFetch(account.partial_fetch);
state.iservice.setIgnoreBodyStructureSize(account.ignore_size);
state.iservice.setSeparateStoreConnection();
state.iservice.connect(account);

@ -58,7 +58,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 108,
version = 109,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -1063,6 +1063,13 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `folder` ADD COLUMN `color` INTEGER");
}
})
.addMigrations(new Migration(108, 109) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `ignore_size` INTEGER NOT NULL DEFAULT 0");
}
})
.build();
}

@ -95,6 +95,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
public Integer poll_interval = DEFAULT_KEEP_ALIVE_INTERVAL; // keep-alive interval
@NonNull
public Boolean partial_fetch = true;
@NonNull
public Boolean ignore_size = false;
public String prefix; // namespace, obsolete
public Long created;
@ -173,6 +175,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
json.put("poll_interval", poll_interval);
json.put("partial_fetch", partial_fetch);
json.put("ignore_size", ignore_size);
// not prefix
// not created
// not tbd
@ -225,10 +228,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
account.poll_interval = json.getInt("poll_interval");
if (json.has("partial_fetch"))
account.partial_fetch = json.getBoolean("partial_fetch");
else
account.partial_fetch = true;
account.partial_fetch = json.optBoolean("partial_fetch", true);
account.ignore_size = json.optBoolean("ignore_size", false);
return account;
}
@ -258,6 +259,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
Objects.equals(this.swipe_right, other.swipe_right) &&
this.poll_interval.equals(other.poll_interval) &&
this.partial_fetch == other.partial_fetch &&
this.ignore_size == other.ignore_size &&
Objects.equals(this.created, other.created) &&
Objects.equals(this.tbd, other.tbd) &&
Objects.equals(this.state, other.state) &&

@ -103,6 +103,7 @@ public class FragmentAccount extends FragmentBase {
private CheckBox cbAutoSeen;
private EditText etInterval;
private CheckBox cbPartialFetch;
private CheckBox cbIgnoreSize;
private Button btnCheck;
private ContentLoadingProgressBar pbCheck;
@ -198,6 +199,7 @@ public class FragmentAccount extends FragmentBase {
cbAutoSeen = view.findViewById(R.id.cbAutoSeen);
etInterval = view.findViewById(R.id.etInterval);
cbPartialFetch = view.findViewById(R.id.cbPartialFetch);
cbIgnoreSize = view.findViewById(R.id.cbIgnoreSize);
btnCheck = view.findViewById(R.id.btnCheck);
pbCheck = view.findViewById(R.id.pbCheck);
@ -693,6 +695,7 @@ public class FragmentAccount extends FragmentBase {
args.putBoolean("auto_seen", cbAutoSeen.isChecked());
args.putString("interval", etInterval.getText().toString());
args.putBoolean("partial_fetch", cbPartialFetch.isChecked());
args.putBoolean("ignore_size", cbIgnoreSize.isChecked());
args.putSerializable("drafts", drafts);
args.putSerializable("sent", sent);
@ -748,6 +751,7 @@ public class FragmentAccount extends FragmentBase {
boolean auto_seen = args.getBoolean("auto_seen");
String interval = args.getString("interval");
boolean partial_fetch = args.getBoolean("partial_fetch");
boolean ignore_size = args.getBoolean("ignore_size");
EntityFolder drafts = (EntityFolder) args.getSerializable("drafts");
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
@ -828,6 +832,8 @@ public class FragmentAccount extends FragmentBase {
return true;
if (!Objects.equals(account.partial_fetch, partial_fetch))
return true;
if (!Objects.equals(account.ignore_size, ignore_size))
return true;
EntityFolder edrafts = db.folder().getFolderByType(account.id, EntityFolder.DRAFTS);
if (!Objects.equals(edrafts == null ? null : edrafts.id, drafts == null ? null : drafts.id))
@ -872,7 +878,8 @@ public class FragmentAccount extends FragmentBase {
account.synchronize != synchronize ||
account.notify != notify ||
!account.poll_interval.equals(Integer.parseInt(interval)) ||
account.partial_fetch != partial_fetch);
account.partial_fetch != partial_fetch ||
account.ignore_size != ignore_size);
Log.i("Account check=" + check + " reload=" + reload);
Long last_connected = null;
@ -946,6 +953,7 @@ public class FragmentAccount extends FragmentBase {
account.auto_seen = auto_seen;
account.poll_interval = Integer.parseInt(interval);
account.partial_fetch = partial_fetch;
account.ignore_size = ignore_size;
if (!update)
account.created = now;
@ -1193,6 +1201,7 @@ public class FragmentAccount extends FragmentBase {
cbAutoSeen.setChecked(account == null ? true : account.auto_seen);
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
cbPartialFetch.setChecked(account == null ? true : account.partial_fetch);
cbIgnoreSize.setChecked(account == null ? true : account.ignore_size);
auth = (account == null ? MailService.AUTH_TYPE_PASSWORD : account.auth_type);

@ -142,8 +142,11 @@ public class MailService implements AutoCloseable {
}
void setPartialFetch(boolean enabled) {
if (!enabled)
properties.put("mail." + protocol + ".partialfetch", "false");
properties.put("mail." + protocol + ".partialfetch", Boolean.toString(enabled));
}
void setIgnoreBodyStructureSize(boolean enabled) {
properties.put("mail." + protocol + ".ignorebodystructuresize", Boolean.toString(enabled));
}
void setUseIp(boolean enabled) {

@ -718,6 +718,7 @@ public class ServiceSynchronize extends ServiceBase {
final MailService iservice = new MailService(
this, account.getProtocol(), account.realm, account.insecure, debug);
iservice.setPartialFetch(account.partial_fetch);
iservice.setIgnoreBodyStructureSize(account.ignore_size);
if (account.pop)
iservice.setLeaveOnServer(account.browse);

@ -495,6 +495,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbPartialFetch" />
<CheckBox
android:id="@+id/cbIgnoreSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_ignore_size"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPartialFetchRemark" />
<!-- check -->
<Button
@ -505,7 +514,7 @@
android:tag="disable"
android:text="@string/title_check"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPartialFetchRemark" />
app:layout_constraintTop_toBottomOf="@id/cbIgnoreSize" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbCheck"
@ -826,7 +835,7 @@
cbBrowse,tvBrowseHint,
cbAutoSeen,
tvInterval,etInterval,tvIntervalRemark,
cbPartialFetch,tvPartialFetchRemark" />
cbPartialFetch,tvPartialFetchRemark,cbIgnoreSize" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpFolders"

@ -411,6 +411,7 @@
<string name="title_leave_on_server">Leave messages on server</string>
<string name="title_keep_alive_interval">Keep-alive/poll interval (minutes)</string>
<string name="title_partial_fetch" translatable="false">Partial fetch</string>
<string name="title_ignore_size" translatable="false">Ignore bodystructure size</string>
<string name="title_check">Check</string>
<string name="title_no_name">Name missing</string>
<string name="title_no_email">Email address missing</string>

Loading…
Cancel
Save