Log capabilities

This commit is contained in:
M66B 2023-12-14 17:06:40 +01:00
parent 0c78e76621
commit 2810115d2f
5 changed files with 18 additions and 9 deletions

View File

@ -2653,6 +2653,10 @@ public class SMTPTransport extends Transport {
extMap.get(ext.toUpperCase(Locale.ENGLISH));
}
public Map<String, String> getExtensionParameters() {
return extMap;
}
/**
* Does the server we're connected to support the specified
* authentication mechanism? Uses the extension information

View File

@ -3209,9 +3209,9 @@ class Core {
// Get capabilities
Map<String, String> caps = istore.capabilities();
boolean hasUidl = caps.containsKey("UIDL");
EntityLog.log(context, account.name +
" POP capabilities= " + caps.keySet() +
" uidl=" + account.capability_uidl);
String capabilities = TextUtils.join(" ", caps.values());
EntityLog.log(context, EntityLog.Type.Protocol, account, capabilities);
db.account().setAccountCapabilities(account.id, capabilities, false, false);
if (hasUidl) {
if (Boolean.FALSE.equals(account.capability_uidl)) {

View File

@ -940,17 +940,18 @@ public class EmailService implements AutoCloseable {
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();
if (iservice instanceof IMAPStore)
capabilities = ((IMAPStore) iservice).getCapabilities();
else if (iservice instanceof POP3Store)
capabilities = ((POP3Store) iservice).getCapabilities();
else if (iservice instanceof SMTPTransport)
capabilities = ((SMTPTransport) iservice).getExtensionParameters();
else
capabilities = null;
if (capabilities != null)
result.addAll(capabilities.keySet());
result.addAll(capabilities.values());
return result;
}

View File

@ -778,6 +778,9 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
throw new IOException("Test");
db.identity().setIdentityState(ident.id, "connected");
EntityLog.log(this, EntityLog.Type.Protocol, ident.email + " " +
TextUtils.join(" ", iservice.getCapabilities()));
max_size = iservice.getMaxSize();
List<Address> recipients = new ArrayList<>();

View File

@ -1738,6 +1738,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
final boolean capNotify = iservice.hasCapability("NOTIFY");
String capabilities = TextUtils.join(" ", iservice.getCapabilities());
EntityLog.log(this, EntityLog.Type.Protocol, account, capabilities);
if (capabilities.length() > 500)
capabilities = capabilities.substring(0, 500) + "...";