mirror of https://github.com/M66B/FairEmail.git
Workaround double encoded subjects
This commit is contained in:
parent
778c71cdf1
commit
47fed9180b
|
@ -54,6 +54,7 @@ import javax.mail.internet.InternetAddress;
|
|||
import javax.mail.internet.MimeBodyPart;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
import javax.mail.internet.MimeUtility;
|
||||
import javax.mail.internet.ParseException;
|
||||
|
||||
public class MessageHelper {
|
||||
|
@ -435,6 +436,19 @@ public class MessageHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
String getSubject() throws MessagingException, UnsupportedEncodingException {
|
||||
String subject = imessage.getSubject();
|
||||
if (subject != null && subject.indexOf("=?") >= 0) {
|
||||
String prev;
|
||||
do {
|
||||
prev = subject;
|
||||
subject = MimeUtility.decodeText(subject);
|
||||
}
|
||||
while (!subject.equals(prev));
|
||||
}
|
||||
return subject;
|
||||
}
|
||||
|
||||
Integer getSize() throws MessagingException {
|
||||
int size = imessage.getSize();
|
||||
return (size < 0 ? null : size);
|
||||
|
|
|
@ -2379,7 +2379,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
message.cc = helper.getCc();
|
||||
message.bcc = helper.getBcc();
|
||||
message.reply = helper.getReply();
|
||||
message.subject = imessage.getSubject();
|
||||
message.subject = helper.getSubject();
|
||||
message.size = helper.getSize();
|
||||
message.content = false;
|
||||
message.received = imessage.getReceivedDate().getTime();
|
||||
|
|
Loading…
Reference in New Issue