mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 14:46:31 +02:00
Show account capabilities
This commit is contained in:
@@ -35,6 +35,7 @@ import androidx.preference.PreferenceManager;
|
||||
import com.sun.mail.gimap.GmailSSLProvider;
|
||||
import com.sun.mail.imap.IMAPFolder;
|
||||
import com.sun.mail.imap.IMAPStore;
|
||||
import com.sun.mail.pop3.POP3Store;
|
||||
import com.sun.mail.smtp.SMTPTransport;
|
||||
import com.sun.mail.util.MailConnectException;
|
||||
import com.sun.mail.util.SocketConnectException;
|
||||
@@ -721,6 +722,24 @@ public class EmailService implements AutoCloseable {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> getCapabilities() throws MessagingException {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
Store store = getStore();
|
||||
Map<String, String> capabilities;
|
||||
if (store instanceof IMAPStore)
|
||||
capabilities = ((IMAPStore) getStore()).getCapabilities();
|
||||
else if (store instanceof POP3Store)
|
||||
capabilities = ((POP3Store) getStore()).getCapabilities();
|
||||
else
|
||||
capabilities = null;
|
||||
|
||||
if (capabilities != null)
|
||||
result.addAll(capabilities.keySet());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean hasCapability(String capability) throws MessagingException {
|
||||
Store store = getStore();
|
||||
if (store instanceof IMAPStore)
|
||||
|
||||
Reference in New Issue
Block a user