MDN decoding

pull/194/merge
M66B 3 years ago
parent 94986728a2
commit b57678200f

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

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

Loading…
Cancel
Save