Keep signatures in forwarded messages

pull/189/head
M66B 5 years ago
parent 209e3fa00d
commit 97d8728986

@ -3784,59 +3784,60 @@ public class FragmentCompose extends FragmentBase {
for (Element e : d.select("[x-plain=true]")) for (Element e : d.select("[x-plain=true]"))
e.removeAttr("x-plain"); e.removeAttr("x-plain");
// Remove signature separators if ("reply".equals(action) || "reply_all".equals(action)) {
boolean remove_signatures = prefs.getBoolean("remove_signatures", false); // Remove signature separators
if (remove_signatures) boolean remove_signatures = prefs.getBoolean("remove_signatures", false);
d.body().filter(new NodeFilter() { if (remove_signatures)
private boolean remove = false; d.body().filter(new NodeFilter() {
private boolean remove = false;
@Override
public FilterResult head(Node node, int depth) { @Override
if (node instanceof TextNode) { public FilterResult head(Node node, int depth) {
TextNode tnode = (TextNode) node; if (node instanceof TextNode) {
String text = tnode.getWholeText() TextNode tnode = (TextNode) node;
.replaceAll("[\r\n]+$", "") String text = tnode.getWholeText()
.replaceAll("^[\r\n]+", ""); .replaceAll("[\r\n]+$", "")
if ("-- ".equals(text)) { .replaceAll("^[\r\n]+", "");
if (tnode.getWholeText().endsWith("\n")) if ("-- ".equals(text)) {
remove = true; if (tnode.getWholeText().endsWith("\n"))
else {
Node next = node.nextSibling();
if (next == null) {
Node parent = node.parent();
if (parent != null)
next = parent.nextSibling();
}
if (next != null && "br".equals(next.nodeName()))
remove = true; remove = true;
else {
Node next = node.nextSibling();
if (next == null) {
Node parent = node.parent();
if (parent != null)
next = parent.nextSibling();
}
if (next != null && "br".equals(next.nodeName()))
remove = true;
}
} }
} }
}
return (remove ? FilterResult.REMOVE : FilterResult.CONTINUE);
}
@Override return (remove ? FilterResult.REMOVE : FilterResult.CONTINUE);
public FilterResult tail(Node node, int depth) { }
return FilterResult.CONTINUE;
}
});
// Limit number of nested block quotes @Override
boolean quote_limit = prefs.getBoolean("quote_limit", false); public FilterResult tail(Node node, int depth) {
if (quote_limit && return FilterResult.CONTINUE;
("reply".equals(action) || "reply_all".equals(action))) }
for (Element bq : d.select("blockquote")) { });
int level = 1;
Element parent = bq.parent(); // Limit number of nested block quotes
while (parent != null) { boolean quote_limit = prefs.getBoolean("quote_limit", false);
if ("blockquote".equals(parent.tagName())) if (quote_limit)
level++; for (Element bq : d.select("blockquote")) {
parent = parent.parent(); int level = 1;
Element parent = bq.parent();
while (parent != null) {
if ("blockquote".equals(parent.tagName()))
level++;
parent = parent.parent();
}
if (level >= MAX_QUOTE_LEVEL)
bq.html("…");
} }
if (level >= MAX_QUOTE_LEVEL) }
bq.html("…");
}
} else { } else {
// Selected text // Selected text
d = Document.createShell(""); d = Document.createShell("");

Loading…
Cancel
Save