Added option for 8BITMIME

pull/208/head
M66B 3 years ago
parent 983ee91a73
commit 0fdd510381

File diff suppressed because it is too large Load Diff

@ -71,7 +71,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 235, version = 236,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.class, EntityAccount.class,
@ -2349,6 +2349,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion); logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `recent` INTEGER NOT NULL DEFAULT 0"); db.execSQL("ALTER TABLE `message` ADD COLUMN `recent` INTEGER NOT NULL DEFAULT 0");
} }
}).addMigrations(new Migration(235, 236) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `identity` ADD COLUMN `octetmime` INTEGER NOT NULL DEFAULT 0");
}
}).addMigrations(new Migration(998, 999) { }).addMigrations(new Migration(998, 999) {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -315,6 +315,10 @@ public class EmailService implements AutoCloseable {
properties.put("mail.mime.allowutf8", Boolean.toString(value)); properties.put("mail.mime.allowutf8", Boolean.toString(value));
} }
void set8BitMime(boolean value) {
properties.put("mail." + protocol + ".allow8bitmime", Boolean.toString(value));
}
// https://tools.ietf.org/html/rfc3461 // https://tools.ietf.org/html/rfc3461
void setDsnNotify(String what) { void setDsnNotify(String what) {
properties.put("mail." + protocol + ".dsn.notify", what); properties.put("mail." + protocol + ".dsn.notify", what);

@ -106,6 +106,8 @@ public class EntityIdentity {
@NonNull @NonNull
public Boolean unicode = false; public Boolean unicode = false;
@NonNull @NonNull
public Boolean octetmime = false;
@NonNull
public Boolean plain_only = false; // obsolete public Boolean plain_only = false; // obsolete
@NonNull @NonNull
public Boolean sign_default = false; public Boolean sign_default = false;
@ -220,6 +222,7 @@ public class EntityIdentity {
json.put("internal", internal); json.put("internal", internal);
json.put("unicode", unicode); json.put("unicode", unicode);
json.put("octetmime", octetmime);
// not plain_only // not plain_only
json.put("sign_default", sign_default); json.put("sign_default", sign_default);
json.put("encrypt_default", encrypt_default); json.put("encrypt_default", encrypt_default);
@ -297,6 +300,9 @@ public class EntityIdentity {
if (json.has("unicode")) if (json.has("unicode"))
identity.unicode = json.getBoolean("unicode"); identity.unicode = json.getBoolean("unicode");
if (json.has("octetmime"))
identity.octetmime = json.getBoolean("octetmime");
if (json.has("sign_default")) if (json.has("sign_default"))
identity.sign_default = json.getBoolean("sign_default"); identity.sign_default = json.getBoolean("sign_default");
if (json.has("encrypt_default")) if (json.has("encrypt_default"))

@ -123,6 +123,7 @@ public class FragmentIdentity extends FragmentBase {
private CheckBox cbSignDefault; private CheckBox cbSignDefault;
private CheckBox cbEncryptDefault; private CheckBox cbEncryptDefault;
private CheckBox cbUnicode; private CheckBox cbUnicode;
private CheckBox cbOctetMime;
private EditText etMaxSize; private EditText etMaxSize;
private Button btnSave; private Button btnSave;
@ -221,6 +222,7 @@ public class FragmentIdentity extends FragmentBase {
cbSignDefault = view.findViewById(R.id.cbSignDefault); cbSignDefault = view.findViewById(R.id.cbSignDefault);
cbEncryptDefault = view.findViewById(R.id.cbEncryptDefault); cbEncryptDefault = view.findViewById(R.id.cbEncryptDefault);
cbUnicode = view.findViewById(R.id.cbUnicode); cbUnicode = view.findViewById(R.id.cbUnicode);
cbOctetMime = view.findViewById(R.id.cbOctetMime);
etMaxSize = view.findViewById(R.id.etMaxSize); etMaxSize = view.findViewById(R.id.etMaxSize);
btnSave = view.findViewById(R.id.btnSave); btnSave = view.findViewById(R.id.btnSave);
@ -666,6 +668,7 @@ public class FragmentIdentity extends FragmentBase {
args.putBoolean("sign_default", cbSignDefault.isChecked()); args.putBoolean("sign_default", cbSignDefault.isChecked());
args.putBoolean("encrypt_default", cbEncryptDefault.isChecked()); args.putBoolean("encrypt_default", cbEncryptDefault.isChecked());
args.putBoolean("unicode", cbUnicode.isChecked()); args.putBoolean("unicode", cbUnicode.isChecked());
args.putBoolean("octetmime",cbOctetMime.isChecked());
args.putString("max_size", etMaxSize.getText().toString()); args.putString("max_size", etMaxSize.getText().toString());
args.putLong("account", account == null ? -1 : account.id); args.putLong("account", account == null ? -1 : account.id);
args.putString("host", etHost.getText().toString().trim().replace(" ", "")); args.putString("host", etHost.getText().toString().trim().replace(" ", ""));
@ -752,6 +755,7 @@ public class FragmentIdentity extends FragmentBase {
boolean sign_default = args.getBoolean("sign_default"); boolean sign_default = args.getBoolean("sign_default");
boolean encrypt_default = args.getBoolean("encrypt_default"); boolean encrypt_default = args.getBoolean("encrypt_default");
boolean unicode = args.getBoolean("unicode"); boolean unicode = args.getBoolean("unicode");
boolean octetmime = args.getBoolean("octetmime");
String max_size = args.getString("max_size"); String max_size = args.getString("max_size");
boolean should = args.getBoolean("should"); boolean should = args.getBoolean("should");
@ -907,6 +911,8 @@ public class FragmentIdentity extends FragmentBase {
return true; return true;
if (!Objects.equals(identity.unicode, unicode)) if (!Objects.equals(identity.unicode, unicode))
return true; return true;
if (!Objects.equals(identity.octetmime, octetmime))
return true;
if (user_max_size != null && !Objects.equals(identity.max_size, user_max_size)) if (user_max_size != null && !Objects.equals(identity.max_size, user_max_size))
return true; return true;
if (identity.error != null && identity.synchronize) if (identity.error != null && identity.synchronize)
@ -1004,6 +1010,7 @@ public class FragmentIdentity extends FragmentBase {
identity.sign_default = sign_default; identity.sign_default = sign_default;
identity.encrypt_default = encrypt_default; identity.encrypt_default = encrypt_default;
identity.unicode = unicode; identity.unicode = unicode;
identity.octetmime = octetmime;
identity.sent_folder = null; identity.sent_folder = null;
identity.sign_key = null; identity.sign_key = null;
identity.sign_key_alias = null; identity.sign_key_alias = null;
@ -1188,6 +1195,7 @@ public class FragmentIdentity extends FragmentBase {
cbSignDefault.setChecked(identity != null && identity.sign_default); cbSignDefault.setChecked(identity != null && identity.sign_default);
cbEncryptDefault.setChecked(identity != null && identity.encrypt_default); cbEncryptDefault.setChecked(identity != null && identity.encrypt_default);
cbUnicode.setChecked(identity != null && identity.unicode); cbUnicode.setChecked(identity != null && identity.unicode);
cbOctetMime.setChecked(identity != null && identity.octetmime);
auth = (identity == null ? AUTH_TYPE_PASSWORD : identity.auth_type); auth = (identity == null ? AUTH_TYPE_PASSWORD : identity.auth_type);
provider = (identity == null ? null : identity.provider); provider = (identity == null ? null : identity.provider);

@ -674,6 +674,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
try { try {
iservice.setUseIp(ident.use_ip, ident.ehlo); iservice.setUseIp(ident.use_ip, ident.ehlo);
iservice.setUnicode(ident.unicode); iservice.setUnicode(ident.unicode);
iservice.set8BitMime(ident.octetmime);
// 0=Read receipt // 0=Read receipt
// 1=Delivery receipt // 1=Delivery receipt

@ -809,6 +809,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnicode" /> app:layout_constraintTop_toBottomOf="@id/cbUnicode" />
<CheckBox
android:id="@+id/cbOctetMime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_identity_octetmime"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvUnicodeHint" />
<TextView <TextView
android:id="@+id/tvMaxSize" android:id="@+id/tvMaxSize"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -817,7 +826,7 @@
android:text="@string/title_identity_max_size" android:text="@string/title_identity_max_size"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvUnicodeHint" /> app:layout_constraintTop_toBottomOf="@id/cbOctetMime" />
<eu.faircode.email.EditTextPlain <eu.faircode.email.EditTextPlain
android:id="@+id/etMaxSize" android:id="@+id/etMaxSize"
@ -964,7 +973,7 @@
tvReplyTo,etReplyTo,tvCc,etCc,tvCcHint,tvBcc,etBcc,tvBccHint, tvReplyTo,etReplyTo,tvCc,etCc,tvCcHint,tvBcc,etBcc,tvBccHint,
tvInternal,etInternal,tvInternalHint, tvInternal,etInternal,tvInternalHint,
tvE2Encryption,cbSignDefault,cbEncryptDefault, tvE2Encryption,cbSignDefault,cbEncryptDefault,
cbUnicode,tvUnicodeHint,tvMaxSize,etMaxSize" /> cbUnicode,tvUnicodeHint,cbOctetMime,tvMaxSize,etMaxSize" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpError" android:id="@+id/grpError"

@ -920,6 +920,7 @@
<string name="title_identity_internal">Internal domain names (comma separated)</string> <string name="title_identity_internal">Internal domain names (comma separated)</string>
<string name="title_identity_unicode">Use Unicode transport</string> <string name="title_identity_unicode">Use Unicode transport</string>
<string name="title_identity_unicode_remark">Most servers do not support this</string> <string name="title_identity_unicode_remark">Most servers do not support this</string>
<string name="title_identity_octetmime">Allow 8BITMIME</string>
<string name="title_identity_max_size">Maximum message size (MB)</string> <string name="title_identity_max_size">Maximum message size (MB)</string>
<string name="title_identity_receipt">Request delivery/read receipt by default</string> <string name="title_identity_receipt">Request delivery/read receipt by default</string>
<string name="title_identity_receipt_legacy">Use legacy receipt request headers</string> <string name="title_identity_receipt_legacy">Use legacy receipt request headers</string>

Loading…
Cancel
Save