Fixed signature location

This commit is contained in:
M66B 2020-03-15 13:49:17 +01:00
parent 2118fff65c
commit abf77d7640
2 changed files with 16 additions and 13 deletions

View File

@ -1264,6 +1264,20 @@ public class HtmlHelper {
static void convertLists(Document document) {
for (Element p : document.select("p")) {
// Skip signature and referenced message
boolean body = true;
Element parent = p.parent();
while (parent != null) {
if ("div".equals(parent.tagName()) &&
!TextUtils.isEmpty(parent.attr("fairemail"))) {
body = false;
break;
}
parent = parent.parent();
}
if (!body)
continue;
Element list = null;
for (int i = 0; i < p.childNodeSize(); i++) {
boolean item = false;

View File

@ -36,7 +36,6 @@ import com.sun.mail.util.QDecoderStream;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@ -516,20 +515,10 @@ public class MessageHelper {
// When sending message
if (identity != null) {
Elements sig = document.select("div[fairemail=signature]");
Elements ref = document.select("div[fairemail=reference]");
sig.remove();
ref.remove();
HtmlHelper.convertLists(document);
sig.removeAttr("fairemail");
ref.removeAttr("fairemail");
for (Element e : sig)
document.body().appendChild(e);
for (Element e : ref)
document.body().appendChild(e);
document.select("div[fairemail=signature]").removeAttr("fairemail");
document.select("div[fairemail=reference]").removeAttr("fairemail");
DB db = DB.getInstance(context);
try {