From 3e7043f0210deb0777573d2afb085073ca54a933 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 17 Aug 2021 14:21:19 +0200 Subject: [PATCH] Added log types --- .../java/eu/faircode/email/EmailProvider.java | 18 ++++++++++++------ .../main/java/eu/faircode/email/ServiceUI.java | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index 1ec1fc12d3..6ba3aecbc3 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -1038,7 +1038,8 @@ public class EmailProvider implements Parcelable { do { response = lis.readLine(); if (response != null) - EntityLog.log(context, socket.getRemoteSocketAddress() + " <" + response); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " <" + response); } while (response != null && !response.startsWith("220 ")); command = "EHLO " + EmailService.getDefaultEhlo() + "\n"; @@ -1048,7 +1049,8 @@ public class EmailProvider implements Parcelable { do { response = lis.readLine(); if (response != null) { - EntityLog.log(context, socket.getRemoteSocketAddress() + " <" + response); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " <" + response); if (response.contains("STARTTLS")) has = true; } @@ -1057,14 +1059,16 @@ public class EmailProvider implements Parcelable { if (has) { command = "STARTTLS\n"; - EntityLog.log(context, socket.getRemoteSocketAddress() + " >" + command); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " >" + command); socket.getOutputStream().write(command.getBytes()); } } else if (port == 143) { do { response = lis.readLine(); if (response != null) { - EntityLog.log(context, socket.getRemoteSocketAddress() + " <" + response); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " <" + response); if (response.contains("STARTTLS")) has = true; } @@ -1073,7 +1077,8 @@ public class EmailProvider implements Parcelable { if (has) { command = "A001 STARTTLS\n"; - EntityLog.log(context, socket.getRemoteSocketAddress() + " >" + command); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " >" + command); socket.getOutputStream().write(command.getBytes()); } } @@ -1082,7 +1087,8 @@ public class EmailProvider implements Parcelable { do { response = lis.readLine(); if (response != null) - EntityLog.log(context, socket.getRemoteSocketAddress() + " <" + response); + EntityLog.log(context, EntityLog.Type.Protocol, + socket.getRemoteSocketAddress() + " <" + response); } while (response != null && !(response.startsWith("A001 OK") || response.startsWith("220 "))); diff --git a/app/src/main/java/eu/faircode/email/ServiceUI.java b/app/src/main/java/eu/faircode/email/ServiceUI.java index 8b1e829f73..90fcfe060a 100644 --- a/app/src/main/java/eu/faircode/email/ServiceUI.java +++ b/app/src/main/java/eu/faircode/email/ServiceUI.java @@ -190,7 +190,8 @@ public class ServiceUI extends IntentService { cleared = db.message().ignoreAll(null, -group); else cleared = db.message().ignoreAll(group == 0 ? null : group, null); - EntityLog.log(this, "Notify clear group=" + group + " cleared=" + cleared); + EntityLog.log(this, EntityLog.Type.Notification, + "Notify clear group=" + group + " cleared=" + cleared); } private void cancel(long group, long id) {