1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00
FairEmail/patches/JavaMail.patch

76 lines
2.9 KiB
Diff
Raw Normal View History

2020-07-05 15:09:51 +00:00
diff --git a/app/src/main/java/com/sun/mail/imap/IMAPStore.java b/app/src/main/java/com/sun/mail/imap/IMAPStore.java
2020-07-05 15:24:56 +00:00
index 866f17737..929e82d33 100644
2020-07-05 15:09:51 +00:00
--- a/app/src/main/java/com/sun/mail/imap/IMAPStore.java
+++ b/app/src/main/java/com/sun/mail/imap/IMAPStore.java
2020-07-05 15:24:56 +00:00
@@ -1014,6 +1014,8 @@ public class IMAPStore extends Store
2020-07-05 15:09:51 +00:00
p.disconnect();
} catch (Exception ex2) { }
p = null;
2020-07-05 15:24:56 +00:00
+ eu.faircode.email.Log.e(new MessagingException("IMAP connection failure", ex1));
+ throw new MessagingException("connection failure", ex1);
2020-07-05 15:09:51 +00:00
}
if (p == null)
2020-07-05 15:24:56 +00:00
@@ -1529,6 +1531,30 @@ public class IMAPStore extends Store
2020-07-05 15:09:51 +00:00
}
}
+ public synchronized String getCapability(String capability)
+ throws MessagingException {
+ IMAPProtocol p = null;
+ try {
+ p = getStoreProtocol();
+ Map<String, String> caps = p.getCapabilities();
+ if (caps != null)
+ for (String cap : caps.values()) {
+ int eq = (cap == null ? -1 : cap.indexOf('='));
+ if (eq > 0) {
+ String key = cap.substring(0, eq);
+ String value = cap.substring(eq + 1);
+ if (capability.equals(key))
+ return value;
+ }
+ }
+ return null;
+ } catch (ProtocolException pex) {
+ throw new MessagingException(pex.getMessage(), pex);
+ } finally {
+ releaseStoreProtocol(p);
+ }
+ }
+
/**
* Set the user name to be used with the PROXYAUTH command.
* The PROXYAUTH user name can also be set using the
diff --git a/app/src/main/java/com/sun/mail/imap/IMAPMessage.java b/app/src/main/java/com/sun/mail/imap/IMAPMessage.java
index 453479d98..acd5b42f9 100644
--- a/app/src/main/java/com/sun/mail/imap/IMAPMessage.java
+++ b/app/src/main/java/com/sun/mail/imap/IMAPMessage.java
@@ -1697,4 +1697,26 @@ public class IMAPMessage extends MimeMessage implements ReadableMime {
Session _getSession() {
return session;
}
+
+ @Override
+ public boolean isExpunged() {
+ if (super.isExpunged())
+ return true;
+
+ // Workaround expunged messages without deleted flag
+ if (envelope != null &&
+ envelope.date == null &&
+ envelope.subject == null &&
+ envelope.from == null &&
+ envelope.sender == null &&
+ envelope.replyTo == null &&
+ envelope.to == null &&
+ envelope.cc == null &&
+ envelope.inReplyTo == null &&
+ envelope.messageId == null &&
+ headersLoaded && loadedHeaders.size() == 0)
+ return true;
+
+ return false;
+ }
}