aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/html.c13
-rw-r--r--src/libserver/html.h5
2 files changed, 10 insertions, 8 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index c679c07bb..4674ee371 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1411,6 +1411,7 @@ rspamd_html_process_color (const gchar *line, guint len, struct html_color *cl)
p ++;
rspamd_strlcpy (hexbuf, p, MIN ((gint)sizeof(hexbuf), end - p + 1));
cl->d.val = strtoul (hexbuf, NULL, 16);
+ cl->valid = TRUE;
}
else {
/* Compare color by name */
@@ -1424,6 +1425,7 @@ rspamd_html_process_color (const gchar *line, guint len, struct html_color *cl)
cl->d.comp.r = el->r;
cl->d.comp.g = el->g;
cl->d.comp.b = el->b;
+ cl->valid = TRUE;
}
}
}
@@ -1524,7 +1526,7 @@ rspamd_html_process_block_tag (rspamd_mempool_t *pool, struct html_tag *tag,
cur = tag->params;
bl = rspamd_mempool_alloc0 (pool, sizeof (*bl));
- bl->id = tag->id;
+ bl->tag = tag;
while (cur) {
comp = cur->data;
@@ -1536,11 +1538,10 @@ rspamd_html_process_block_tag (rspamd_mempool_t *pool, struct html_tag *tag,
msg_debug ("got color: %xd", bl->font_color.d.val);
}
else if (comp->type == RSPAMD_HTML_COMPONENT_STYLE && comp->len > 0) {
- fstr.begin = (gchar *)comp->start;
- fstr.len = comp->len;
- bl->style = rspamd_mempool_fstrdup (pool, &fstr);
- msg_debug ("got style: %s", bl->style);
- rspamd_html_process_style (pool, bl, hc, bl->style, comp->len);
+ bl->style.len = comp->len;
+ bl->style.start = comp->start;
+ msg_debug ("got style: %*s", (gint)bl->style.len, bl->style.start);
+ rspamd_html_process_style (pool, bl, hc, comp->start, comp->len);
}
else if (comp->type == RSPAMD_HTML_COMPONENT_CLASS && comp->len > 0) {
fstr.begin = (gchar *)comp->start;
diff --git a/src/libserver/html.h b/src/libserver/html.h
index 912f5ef6a..341060517 100644
--- a/src/libserver/html.h
+++ b/src/libserver/html.h
@@ -64,13 +64,14 @@ struct html_color {
} comp;
guint32 val;
} d;
+ gboolean valid;
};
struct html_block {
- gint id;
+ struct html_tag *tag;
struct html_color font_color;
struct html_color background_color;
- gchar *style;
+ struct html_tag_component style;
guint font_size;
gchar *class;
};