aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/html
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-19 10:31:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-19 10:31:36 +0100
commite215f89e7cbbbeaeb5d0ed7bbd0631ea3a6a6d70 (patch)
tree522452f3de89ec8dfe9057428850abf7b294e4aa /src/libserver/html
parentdde092ef09cddfae6bd1d70977d5208bb88d2d7f (diff)
downloadrspamd-e215f89e7cbbbeaeb5d0ed7bbd0631ea3a6a6d70.tar.gz
rspamd-e215f89e7cbbbeaeb5d0ed7bbd0631ea3a6a6d70.zip
[Minor] Try to fix has_fake_html rule
Diffstat (limited to 'src/libserver/html')
-rw-r--r--src/libserver/html/html.cxx12
-rw-r--r--src/libserver/html/html.h7
2 files changed, 19 insertions, 0 deletions
diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 332229b50..beec91fac 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -2097,4 +2097,16 @@ rspamd_html_get_parsed_content(void *html_content, rspamd_ftok_t *dest)
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
diff --git a/src/libserver/html/html.h b/src/libserver/html/html.h
index cc8039c22..8b690499e 100644
--- a/src/libserver/html/html.h
+++ b/src/libserver/html/html.h
@@ -121,6 +121,13 @@ struct html_image* rspamd_html_find_embedded_image(void *html_content,
*/
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
}