|
|
@ -6921,45 +6921,51 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
}.execute(this, args, "decrypt:s/mime");
|
|
|
|
}.execute(this, args, "decrypt:s/mime");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void checkPep(EntityMessage message, List<EntityAttachment> remotes, Context context) throws IOException, MessagingException {
|
|
|
|
private static void checkPep(EntityMessage message, List<EntityAttachment> remotes, Context context) {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
for (EntityAttachment remote : remotes)
|
|
|
|
for (EntityAttachment remote : remotes)
|
|
|
|
if ("message/rfc822".equals(remote.getMimeType())) {
|
|
|
|
if ("message/rfc822".equals(remote.getMimeType()))
|
|
|
|
Properties props = MessageHelper.getSessionProperties();
|
|
|
|
try {
|
|
|
|
Session isession = Session.getInstance(props, null);
|
|
|
|
Properties props = MessageHelper.getSessionProperties();
|
|
|
|
|
|
|
|
Session isession = Session.getInstance(props, null);
|
|
|
|
|
|
|
|
|
|
|
|
MimeMessage pep;
|
|
|
|
MimeMessage imessage;
|
|
|
|
try (InputStream fis = new FileInputStream(remote.getFile(context))) {
|
|
|
|
try (InputStream fis = new FileInputStream(remote.getFile(context))) {
|
|
|
|
pep = new MimeMessage(isession, fis);
|
|
|
|
imessage = new MimeMessage(isession, fis);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String[] xpep = pep.getHeader("X-pEp-Wrapped-Message-Info");
|
|
|
|
String[] xpep = imessage.getHeader("X-pEp-Wrapped-Message-Info");
|
|
|
|
if (xpep != null && xpep.length > 0 && "INNER".equals(xpep[0])) {
|
|
|
|
if (xpep != null && xpep.length > 0 &&
|
|
|
|
MessageHelper phelper = new MessageHelper(pep, context);
|
|
|
|
"INNER".equalsIgnoreCase(xpep[0])) {
|
|
|
|
String spep = phelper.getSubject();
|
|
|
|
MessageHelper helper = new MessageHelper(imessage, context);
|
|
|
|
if (!TextUtils.isEmpty(spep))
|
|
|
|
|
|
|
|
db.message().setMessageSubject(message.id, spep);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String shtml = phelper.getMessageParts().getHtml(context);
|
|
|
|
String subject = helper.getSubject();
|
|
|
|
if (!TextUtils.isEmpty(shtml)) {
|
|
|
|
if (!TextUtils.isEmpty(subject))
|
|
|
|
String html = Helper.readText(message.getFile(context));
|
|
|
|
db.message().setMessageSubject(message.id, subject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String html = helper.getMessageParts().getHtml(context);
|
|
|
|
if (!TextUtils.isEmpty(html)) {
|
|
|
|
if (!TextUtils.isEmpty(html)) {
|
|
|
|
EntityAttachment a = new EntityAttachment();
|
|
|
|
String orig_html = Helper.readText(message.getFile(context));
|
|
|
|
a.message = message.id;
|
|
|
|
if (!TextUtils.isEmpty(orig_html)) {
|
|
|
|
a.sequence = remotes.size();
|
|
|
|
EntityAttachment attachment = new EntityAttachment();
|
|
|
|
a.type = "text/html";
|
|
|
|
attachment.message = message.id;
|
|
|
|
a.disposition = Part.INLINE;
|
|
|
|
attachment.sequence = remotes.size();
|
|
|
|
a.id = db.attachment().insertAttachment(a);
|
|
|
|
attachment.type = "text/html";
|
|
|
|
|
|
|
|
attachment.disposition = Part.INLINE;
|
|
|
|
Helper.writeText(a.getFile(context), html);
|
|
|
|
attachment.id = db.attachment().insertAttachment(attachment);
|
|
|
|
db.attachment().setDownloaded(a.id, (long) html.length());
|
|
|
|
|
|
|
|
}
|
|
|
|
Helper.writeText(attachment.getFile(context), orig_html);
|
|
|
|
|
|
|
|
db.attachment().setDownloaded(attachment.id, (long) orig_html.length());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Helper.writeText(message.getFile(context), shtml);
|
|
|
|
Helper.writeText(message.getFile(context), html);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onDelete(long id) {
|
|
|
|
private void onDelete(long id) {
|
|
|
|