gboolean res = FALSE;
PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, text_parts), i, p) {
- if (IS_TEXT_PART_HTML (p) && (p->html == NULL)) {
+ if (IS_TEXT_PART_HTML (p) && (rspamd_html_get_tags_count(p->html) < 2)) {
res = TRUE;
}
dest->len = hc->parsed.size();
return true;
+}
+
+gsize
+rspamd_html_get_tags_count(void *html_content)
+{
+ auto *hc = rspamd::html::html_content::from_ptr(html_content);
+
+ if (!hc) {
+ return 0;
+ }
+
+ return hc->all_tags.size();
}
\ No newline at end of file
*/
bool rspamd_html_get_parsed_content(void *html_content, rspamd_ftok_t *dest);
+/**
+ * Returns number of tags in the html content
+ * @param html_content
+ * @return
+ */
+gsize rspamd_html_get_tags_count(void *html_content);
+
#ifdef __cplusplus
}