MDN decoding

This commit is contained in:
M66B 2022-02-24 18:02:37 +01:00
parent 94986728a2
commit b57678200f
2 changed files with 37 additions and 13 deletions

View File

@ -4071,7 +4071,7 @@ class Core {
if (r.isDeliveryStatus())
label = (r.isDelivered() ? MessageHelper.FLAG_DELIVERED : MessageHelper.FLAG_NOT_DELIVERED);
else if (r.isDispositionNotification())
label = (r.isDisplayed() ? MessageHelper.FLAG_DISPLAYED : MessageHelper.FLAG_NOT_DISPLAYED);
label = (r.isMdnDisplayed() ? MessageHelper.FLAG_DISPLAYED : MessageHelper.FLAG_NOT_DISPLAYED);
if (label != null) {
Map<Long, EntityFolder> map = new HashMap<>();

View File

@ -3104,8 +3104,7 @@ public class MessageHelper {
}
}
if (report.isDispositionNotification() &&
!(report.isDisplayed() || report.isDeleted())) {
if (report.isDispositionNotification() && !report.isMdnDisplayed()) {
if (report.disposition != null)
w.append(report.disposition);
}
@ -4348,23 +4347,48 @@ public class MessageHelper {
return ("delivered".equals(action) || "relayed".equals(action) || "expanded".equals(action));
}
boolean isDisplayed() {
return isType("displayed");
boolean isMdnManual() {
return "manual-action".equals(getAction(0));
}
boolean isDeleted() {
return isType("deleted");
boolean isMdnAutomatic() {
return "automatic-action".equals(getAction(0));
}
private boolean isType(String t) {
// manual-action/MDN-sent-manually; displayed
boolean isMdnManualSent() {
return "MDN-sent-manually".equals(getAction(1));
}
boolean isMdnAutomaticSent() {
return "MDN-sent-automatically".equals(getAction(1));
}
boolean isMdnDisplayed() {
return "displayed".equalsIgnoreCase(getType());
}
boolean isMdnDeleted() {
return "deleted".equalsIgnoreCase(getType());
}
private String getAction(int index) {
if (disposition == null)
return false;
return null;
int semi = disposition.lastIndexOf(';');
if (semi < 0)
return false;
String type = disposition.substring(semi + 1).trim();
return t.equals(type);
return null;
String[] action = disposition.substring(0, semi).trim().split("/");
return (index < action.length ? action[index] : null);
}
private String getType() {
// manual-action/MDN-sent-manually; displayed
if (disposition == null)
return null;
int semi = disposition.lastIndexOf(';');
if (semi < 0)
return null;
return disposition.substring(semi + 1).trim();
}
static boolean isDeliveryStatus(String type) {