mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-31 18:11:03 +01:00
Refactoring
This commit is contained in:
@@ -460,6 +460,31 @@ public class MessageHelper {
|
||||
return (header == null ? null : header.replaceAll("\\r?\\n", ""));
|
||||
}
|
||||
|
||||
static Boolean getAuthentication(String type, String header) {
|
||||
if (header == null)
|
||||
return null;
|
||||
|
||||
// https://tools.ietf.org/html/rfc7601
|
||||
Boolean result = null;
|
||||
String[] part = header.split(";");
|
||||
for (int i = 1; i < part.length; i++) {
|
||||
String[] kv = part[i].split("=");
|
||||
if (kv.length > 1) {
|
||||
String key = kv[0].trim();
|
||||
String[] val = kv[1].trim().split(" ");
|
||||
if (val.length > 0 && type.equals(key)) {
|
||||
if ("fail".equals(val[0]))
|
||||
result = false;
|
||||
else if ("pass".equals(val[0]))
|
||||
if (result == null)
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Address getSender() throws MessagingException {
|
||||
String sender = imessage.getHeader("Sender", null);
|
||||
if (sender == null)
|
||||
|
||||
Reference in New Issue
Block a user