NEW_COMPONENT (RSPAMD_HTML_COMPONENT_CLASS);
}
}
+ else if (len == 7) {
+ if (g_ascii_strncasecmp (begin, "bgcolor", len) == 0) {
+ NEW_COMPONENT (RSPAMD_HTML_COMPONENT_BGCOLOR);
+ }
+ }
}
return ret;
rspamd_html_process_color (comp->start, comp->len, &bl->font_color);
msg_debug_pool ("got color: %xd", bl->font_color.d.val);
}
+ else if (comp->type == RSPAMD_HTML_COMPONENT_BGCOLOR && comp->len > 0) {
+ fstr.begin = (gchar *)comp->start;
+ fstr.len = comp->len;
+ rspamd_html_process_color (comp->start, comp->len, &bl->background_color);
+ msg_debug_pool ("got color: %xd", bl->font_color.d.val);
+
+ if (tag->id == Tag_BODY) {
+ /* Set global background color */
+ memcpy (&hc->bgcolor, &bl->background_color, sizeof (hc->bgcolor));
+ }
+ }
else if (comp->type == RSPAMD_HTML_COMPONENT_STYLE && comp->len > 0) {
bl->style.len = comp->len;
bl->style.start = comp->start;
hc->tags_seen = rspamd_mempool_alloc0 (pool, NBYTES (G_N_ELEMENTS (tag_defs)));
+ /* Set white background color by default */
+ hc->bgcolor.d.comp.alpha = 0;
+ hc->bgcolor.d.comp.r = 255;
+ hc->bgcolor.d.comp.g = 255;
+ hc->bgcolor.d.comp.b = 255;
+
dest = g_byte_array_sized_new (in->len / 3 * 2);
p = in->data;
RSPAMD_HTML_COMPONENT_NAME = 0,
RSPAMD_HTML_COMPONENT_HREF,
RSPAMD_HTML_COMPONENT_COLOR,
+ RSPAMD_HTML_COMPONENT_BGCOLOR,
RSPAMD_HTML_COMPONENT_STYLE,
RSPAMD_HTML_COMPONENT_CLASS,
RSPAMD_HTML_COMPONENT_WIDTH,
struct html_content {
GNode *html_tags;
gint flags;
+ struct html_color bgcolor;
guchar *tags_seen;
GPtrArray *images;
GPtrArray *blocks;
lua_settable (L, -3);
}
if (bl->background_color.valid) {
- lua_pushstring (L, "color");
+ lua_pushstring (L, "bgcolor");
lua_newtable (L);
lua_pushnumber (L, bl->background_color.d.comp.r);
lua_rawseti (L, -2, 1);