Merge branch 'master' of github.com:M66B/FairEmail

pull/190/head
M66B 5 years ago
commit d31cc29097

@ -1948,7 +1948,7 @@ Messages will automatically be marked read on expanding, unless this was disable
<a name="faq71"></a>
**(71) How do I use filter rules?**
You can edit filter rules by long pressing a folder in the folder list.
You can edit filter rules by long pressing a folder in the folder list of an account (tap the account name in the navigation/side menu).
New rules will be applied to new messages received in the folder, not to existing messages.
You can check the rule and apply the rule to existing messages or, alternatively, long press the rule in the rule list and select *Execute now*.
@ -2004,7 +2004,7 @@ You can select one of these actions to apply to matching messages:
* Add keyword
* Move
* Copy (Gmail: label)
* Answer (with template)
* Answer/forward (with template)
* Text-to-speech (sender and subject)
* Automation (Tasker, etc)

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'com.bugsnag.android.gradle'
def getVersionCode = { -> return 1417 }
def getReleaseName = { -> return "\"Bambiraptor\"" }
def getReleaseName = { -> return "\"Camelotia\"" }
// https://en.wikipedia.org/wiki/List_of_dinosaur_genera
def keystorePropertiesFile = rootProject.file("keystore.properties")

File diff suppressed because it is too large Load Diff

@ -490,10 +490,15 @@ class Core {
// Drafts: javax.mail.FolderClosedException: * BYE Jakarta Mail Exception:
// javax.net.ssl.SSLException: Write error: ssl=0x8286cac0: I/O error during system call, Broken pipe
// Drafts: * BYE Jakarta Mail Exception: java.io.IOException: Connection dropped by server?
// Sync: BAD Could not parse command
// Seen: NO mailbox selected READ-ONLY
// Fetch: BAD Error in IMAP command FETCH: Invalid messageset
// Fetch: NO all of the requested messages have been expunged
// fetch: BAD parse error: invalid message sequence number:
// fetch: NO [SERVERBUG] SELECT Server error - Please try again later
// Move: NO No matching messages
// Move: NO [EXPUNGEISSUED] Some of the requested messages no longer exist
// Move: BAD parse error: invalid message sequence number:
// Delete: NO [CANNOT] STORE It's not possible to perform specified operation
// Delete: NO [UNAVAILABLE] EXPUNGE Backend error
String msg = "Unrecoverable operation=" + op.name + " tries=" + op.tries + " created=" + new Date(op.created);
@ -923,28 +928,19 @@ class Core {
} else
ifolder.appendMessages(new Message[]{imessage});
// Delete previous (external) version
if (message.uid != null) {
if (folder.id.equals(message.folder)) {
// Prevent deleting message
db.message().setMessageUid(message.id, null);
Message iexisting = ifolder.getMessageByUID(message.uid);
if (iexisting == null)
Log.w(folder.name + " existing not found uid=" + message.uid);
else {
try {
Log.i(folder.name + " deleting uid=" + message.uid);
iexisting.setFlag(Flags.Flag.DELETED, true);
ifolder.expunge();
} catch (MessageRemovedException ignored) {
Log.w(folder.name + " existing gone uid=" + message.uid);
}
}
}
if (folder.id.equals(message.folder)) {
// Some providers do not list the new message yet
Long found = findUid(ifolder, message.msgid, true);
if (newuid == null)
newuid = findUid(ifolder, message.msgid, true);
newuid = found;
else if (!newuid.equals(found)) {
Log.e(folder.name + " Added=" + newuid + " found=" + found);
newuid = found;
}
if (newuid != null && (message.uid == null || newuid > message.uid))
try {
Log.i(folder.name + " Fetching uid=" + newuid);
@ -1902,7 +1898,7 @@ class Core {
boolean notify_known = prefs.getBoolean("notify_known", false);
boolean pro = ActivityBilling.isPro(context);
Log.i(folder.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null));
EntityLog.log(context, folder.name + " POP sync type=" + folder.type + " connected=" + (ifolder != null));
if (!EntityFolder.INBOX.equals(folder.type)) {
db.folder().setFolderSyncState(folder.id, null);
@ -1915,10 +1911,10 @@ class Core {
db.folder().setFolderSyncState(folder.id, "syncing");
Map<String, String> caps = istore.capabilities();
Log.i(folder.name + " POP capabilities= " + caps.keySet());
EntityLog.log(context, folder.name + " POP capabilities= " + caps.keySet());
Message[] imessages = ifolder.getMessages();
Log.i(folder.name + " POP messages=" + imessages.length);
EntityLog.log(context, folder.name + " POP messages=" + imessages.length);
if (account.max_messages != null && imessages.length > account.max_messages)
imessages = Arrays.copyOfRange(imessages,
@ -1934,7 +1930,7 @@ class Core {
}
List<TupleUidl> ids = db.message().getUidls(folder.id);
Log.i(folder.name + " POP existing=" + ids.size() + " uidl=" + hasUidl);
EntityLog.log(context, folder.name + " POP existing=" + ids.size() + " uidl=" + hasUidl);
// Index UIDLs
Map<String, String> uidlMsgId = new HashMap<>();
@ -1958,7 +1954,7 @@ class Core {
}
for (TupleUidl uidl : known.values()) {
Log.i(folder.name + " POP purging uidl=" + uidl.uidl);
EntityLog.log(context, folder.name + " POP purging uidl=" + uidl.uidl);
db.message().deleteMessage(uidl.id);
}
} else {
@ -1975,7 +1971,7 @@ class Core {
}
for (TupleUidl uidl : known.values()) {
Log.i(folder.name + " POP purging msgid=" + uidl.msgid);
EntityLog.log(context, folder.name + " POP purging msgid=" + uidl.msgid);
db.message().deleteMessage(uidl.id);
}
}
@ -1993,7 +1989,7 @@ class Core {
if (hasUidl) {
uidl = ifolder.getUID(imessage);
if (TextUtils.isEmpty(uidl)) {
Log.w(folder.name + " POP no uidl");
EntityLog.log(context, folder.name + " POP no uidl");
continue;
}
@ -2025,12 +2021,12 @@ class Core {
}
if (TextUtils.isEmpty(msgid)) {
Log.w(folder.name + " POP no msgid");
EntityLog.log(context, folder.name + " POP no msgid");
continue;
}
try {
Log.i(folder.name + " POP sync=" + uidl + "/" + msgid);
EntityLog.log(context, folder.name + " POP sync=" + uidl + "/" + msgid);
Long sent = helper.getSent();
Long received = helper.getReceivedHeader();
@ -2158,7 +2154,7 @@ class Core {
}
db.folder().setFolderLastSync(folder.id, new Date().getTime());
Log.i(folder.name + " POP done");
EntityLog.log(context, folder.name + " POP done");
} finally {
db.folder().setFolderSyncState(folder.id, null);
}

@ -1902,6 +1902,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
getMainHandler().postDelayed(enableSelection, SWIPE_DISABLE_SELECT_DURATION);
}
Context context = getContext();
if (context == null)
return;
int pos = viewHolder.getAdapterPosition();
if (pos == NO_POSITION)
return;
@ -1937,8 +1941,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
AdapterMessage.ViewHolder holder = ((AdapterMessage.ViewHolder) viewHolder);
Rect rect = holder.getItemRect();
int margin = Helper.dp2pixels(getContext(), 12);
int size = Helper.dp2pixels(getContext(), 24);
int margin = Helper.dp2pixels(context, 12);
int size = Helper.dp2pixels(context, 24);
int icon;
if (EntityMessage.SWIPE_ACTION_ASK.equals(action))
@ -1964,8 +1968,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
else
icon = EntityFolder.getIcon(dX > 0 ? swipes.right_type : swipes.left_type);
Drawable d = getResources().getDrawable(icon, getContext().getTheme()).mutate();
d.setTint(Helper.resolveColor(getContext(), android.R.attr.textColorSecondary));
Drawable d = getResources().getDrawable(icon, context.getTheme()).mutate();
d.setTint(Helper.resolveColor(context, android.R.attr.textColorSecondary));
if (dX > 0) {
// Right swipe

@ -2165,32 +2165,36 @@ public class MessageHelper {
db.attachment().setDownloaded(attachment.id, (long) body.length());
}
for (org.apache.poi.hmef.Attachment at : msg.getAttachments()) {
String filename = at.getLongFilename();
if (filename == null)
filename = at.getFilename();
if (filename == null) {
String ext = at.getExtension();
if (ext != null)
filename = "document." + ext;
}
for (org.apache.poi.hmef.Attachment at : msg.getAttachments())
try {
String filename = at.getLongFilename();
if (filename == null)
filename = at.getFilename();
if (filename == null) {
String ext = at.getExtension();
if (ext != null)
filename = "document." + ext;
}
EntityAttachment attachment = new EntityAttachment();
attachment.message = local.message;
attachment.sequence = local.sequence;
attachment.subsequence = ++subsequence;
attachment.name = filename;
attachment.type = Helper.guessMimeType(attachment.name);
attachment.disposition = Part.ATTACHMENT;
attachment.id = db.attachment().insertAttachment(attachment);
EntityAttachment attachment = new EntityAttachment();
attachment.message = local.message;
attachment.sequence = local.sequence;
attachment.subsequence = ++subsequence;
attachment.name = filename;
attachment.type = Helper.guessMimeType(attachment.name);
attachment.disposition = Part.ATTACHMENT;
attachment.id = db.attachment().insertAttachment(attachment);
byte[] data = at.getContents();
try (OutputStream os = new FileOutputStream(attachment.getFile(context))) {
os.write(data);
}
byte[] data = at.getContents();
try (OutputStream os = new FileOutputStream(attachment.getFile(context))) {
os.write(data);
}
db.attachment().setDownloaded(attachment.id, (long) data.length);
}
db.attachment().setDownloaded(attachment.id, (long) data.length);
} catch (Throwable ex) {
// java.lang.IllegalArgumentException: Attachment corrupt - no Data section
Log.e(ex);
}
StringBuilder sb = new StringBuilder();
for (org.apache.poi.hmef.attribute.TNEFAttribute attr : msg.getMessageAttributes())

@ -420,6 +420,18 @@
app:layout_constraintTop_toBottomOf="@id/tvSyncKeptHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvGmailThreadHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_gmail_thread_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swGmailThread" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSyncFolders"
android:layout_width="0dp"
@ -429,7 +441,7 @@
android:text="@string/title_advanced_sync_folders"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swGmailThread"
app:layout_constraintTop_toBottomOf="@id/tvGmailThreadHint"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

@ -548,6 +548,7 @@
<string name="title_advanced_unseen_hint">Some providers don\'t support this properly, which may cause synchronizing none or all messages</string>
<string name="title_advanced_deleted_unseen">When disabled, unread messages are kept on the device forever</string>
<string name="title_advanced_sync_kept_hint">This will transfer extra data and consume extra battery power, especially if a lot of messages are stored on the device</string>
<string name="title_advanced_gmail_thread_hint">This only applies to newly received messages and can break existing groups</string>
<string name="title_advanced_sync_folders_hint">Disabling this will reduce data and battery usage somewhat, but will disable updating the list of folders too</string>
<string name="title_advanced_lookup_mx_hint">This will check if DNS MX records exist</string>
<string name="title_advanced_sync_delay_hint">This will slow down synchronizing messages</string>

Loading…
Cancel
Save