aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-06-16 14:48:47 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-06-16 14:48:47 +0100
commit310cada28d15cc629e7c4c73fe5a842e2af851ae (patch)
treed805e7e5f6fa13df795a440807b165bc552dcc70
parentfb55acaa1aa930df113936aef303345932168997 (diff)
downloadrspamd-310cada28d15cc629e7c4c73fe5a842e2af851ae.tar.gz
rspamd-310cada28d15cc629e7c4c73fe5a842e2af851ae.zip
[Minor] Implement C++ function to get tag id by name
-rw-r--r--src/libserver/html/html.cxx12
-rw-r--r--src/libserver/html/html.hxx2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 139c59bd2..5c5157740 100644
--- a/src/libserver/html/html.cxx
+++ b/src/libserver/html/html.cxx
@@ -1726,6 +1726,18 @@ html_debug_structure(const html_content &hc) -> std::string
return output;
}
+auto html_tag_by_name(const std::string_view &name)
+ -> std::optional<tag_id_t>
+{
+ const auto *td = rspamd::html::html_tags_defs.by_name(name);
+
+ if (td != nullptr) {
+ return td->id;
+ }
+
+ return std::nullopt;
+}
+
/*
* Tests part
*/
diff --git a/src/libserver/html/html.hxx b/src/libserver/html/html.hxx
index d4a2fb58b..368155d81 100644
--- a/src/libserver/html/html.hxx
+++ b/src/libserver/html/html.hxx
@@ -125,6 +125,8 @@ private:
};
+auto html_tag_by_name(const std::string_view &name) -> std::optional<tag_id_t>;
+
}
#endif //RSPAMD_HTML_HXX