Added option for 8BITMIME

This commit is contained in:
M66B 2022-06-20 22:02:22 +02:00
parent 983ee91a73
commit 0fdd510381
8 changed files with 2797 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -71,7 +71,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 235,
version = 236,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2349,6 +2349,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
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) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

View File

@ -315,6 +315,10 @@ public class EmailService implements AutoCloseable {
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
void setDsnNotify(String what) {
properties.put("mail." + protocol + ".dsn.notify", what);

View File

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

View File

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

View File

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

View File

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

View File

@ -920,6 +920,7 @@
<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_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_receipt">Request delivery/read receipt by default</string>
<string name="title_identity_receipt_legacy">Use legacy receipt request headers</string>