diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index c301db1584..18b8916e8f 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -338,6 +338,7 @@ public class EntityRule { if (jbody != null) { String value = jbody.getString("value"); boolean regex = jbody.getBoolean("regex"); + boolean skip_quotes = jbody.optBoolean("skip_quotes"); if (!regex) value = value.replaceAll("\\s+", " "); @@ -355,7 +356,8 @@ public class EntityRule { throw new IllegalArgumentException(context.getString(R.string.title_rule_no_body)); Document d = JsoupEx.parse(html); - //d.select("blockquote").remove(); + if (skip_quotes) + d.select("blockquote").remove(); String text = d.body().text(); if (!matches(context, message, value, text, regex)) return false; diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java index d3bdd4fa9d..835cd1a1e2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRule.java +++ b/app/src/main/java/eu/faircode/email/FragmentRule.java @@ -108,6 +108,7 @@ public class FragmentRule extends FragmentBase { private EditText etBody; private CheckBox cbBody; + private CheckBox cbSkipQuotes; private TextView tvDateAfter; private TextView tvDateBefore; @@ -257,6 +258,7 @@ public class FragmentRule extends FragmentBase { etBody = view.findViewById(R.id.etBody); cbBody = view.findViewById(R.id.cbBody); + cbSkipQuotes = view.findViewById(R.id.cbSkipQuotes); tvDateAfter = view.findViewById(R.id.tvDateAfter); tvDateBefore = view.findViewById(R.id.tvDateBefore); @@ -967,6 +969,7 @@ public class FragmentRule extends FragmentBase { etBody.setText(jbody == null ? null : jbody.getString("value")); cbBody.setChecked(jbody != null && jbody.getBoolean("regex")); + cbSkipQuotes.setChecked(jbody != null && jbody.optBoolean("skip_quotes")); long after = (jdate != null && jdate.has("after") ? jdate.getLong("after") : 0); long before = (jdate != null && jdate.has("before") ? jdate.getLong("before") : 0); @@ -1303,6 +1306,7 @@ public class FragmentRule extends FragmentBase { JSONObject jbody = new JSONObject(); jbody.put("value", body); jbody.put("regex", cbBody.isChecked()); + jbody.put("skip_quotes", cbSkipQuotes.isChecked()); jcondition.put("body", jbody); } diff --git a/app/src/main/res/layout/fragment_rule.xml b/app/src/main/res/layout/fragment_rule.xml index dd025ccf25..acc89feca2 100644 --- a/app/src/main/res/layout/fragment_rule.xml +++ b/app/src/main/res/layout/fragment_rule.xml @@ -458,6 +458,14 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/cbBody" /> + + + app:layout_constraintTop_toBottomOf="@id/cbSkipQuotes" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4ecd61b3dc..11580b6734 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1501,6 +1501,7 @@ Mime type Header contains Text contains + Skip quoted text Using this condition will always download the message text, which may slow down the synchronization of the message list Absolute time (received) between Received after