mirror of https://github.com/M66B/FairEmail.git
Generate preview / detect language of encrypted messages
This commit is contained in:
parent
5ecb3fe03c
commit
a8e2abb677
|
@ -6215,16 +6215,29 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
MessageHelper helper = new MessageHelper(imessage, context);
|
||||
parts = helper.getMessageParts();
|
||||
String subject = parts.getProtectedSubject();
|
||||
if (subject != null)
|
||||
db.message().setMessageSubject(message.id, subject);
|
||||
String protect_subject = parts.getProtectedSubject();
|
||||
|
||||
// Write decrypted body
|
||||
String html = parts.getHtml(context);
|
||||
Helper.writeText(message.getFile(context), html);
|
||||
Log.i("pgp html=" + (html == null ? null : html.length()));
|
||||
|
||||
String text = HtmlHelper.getFullText(html);
|
||||
message.preview = HtmlHelper.getPreview(text);
|
||||
message.language = HtmlHelper.getLanguage(context, message.subject, text);
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
// Write decrypted body
|
||||
String html = parts.getHtml(context);
|
||||
Helper.writeText(message.getFile(context), html);
|
||||
if (protect_subject != null)
|
||||
db.message().setMessageSubject(message.id, protect_subject);
|
||||
|
||||
db.message().setMessageContent(message.id,
|
||||
true,
|
||||
message.language,
|
||||
parts.isPlainOnly(),
|
||||
message.preview,
|
||||
message.warning);
|
||||
|
||||
// Remove existing attachments
|
||||
db.attachment().deleteAttachments(message.id);
|
||||
|
@ -6851,14 +6864,25 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
MessageHelper helper = new MessageHelper(imessage, context);
|
||||
MessageHelper.MessageParts parts = helper.getMessageParts();
|
||||
|
||||
// Write decrypted body
|
||||
String html = parts.getHtml(context);
|
||||
Helper.writeText(message.getFile(context), html);
|
||||
Log.i("s/mime html=" + (html == null ? null : html.length()));
|
||||
|
||||
String text = HtmlHelper.getFullText(html);
|
||||
message.preview = HtmlHelper.getPreview(text);
|
||||
message.language = HtmlHelper.getLanguage(context, message.subject, text);
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
// Write decrypted body
|
||||
String html = parts.getHtml(context);
|
||||
Helper.writeText(message.getFile(context), html);
|
||||
Log.i("s/mime html=" + (html == null ? null : html.length()));
|
||||
db.message().setMessageContent(message.id,
|
||||
true,
|
||||
message.language,
|
||||
parts.isPlainOnly(),
|
||||
message.preview,
|
||||
message.warning);
|
||||
|
||||
// Remove existing attachments
|
||||
db.attachment().deleteAttachments(message.id);
|
||||
|
|
Loading…
Reference in New Issue