diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-01 14:35:50 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-07-01 14:35:50 +0400 |
commit | 0f7464cc19e85b0200d7a59f3eb0a93efdcc6ce7 (patch) | |
tree | 97b846864e3a4e4b2989900a24f50c430b650f8e /src/cfg_xml.c | |
parent | d15768174c09689ad956997c599a97139e8f4bb0 (diff) | |
download | rspamd-0f7464cc19e85b0200d7a59f3eb0a93efdcc6ce7.tar.gz rspamd-0f7464cc19e85b0200d7a59f3eb0a93efdcc6ce7.zip |
* Handle lua tag in way that it is not required to write additional text:
- <lua src="/some/path" /> instead of <lua ...>fake</lua>
* Strip all starting whitespace symbols from xml texts
Diffstat (limited to 'src/cfg_xml.c')
-rw-r--r-- | src/cfg_xml.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/cfg_xml.c b/src/cfg_xml.c index 86ac49d93..030ec9b34 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -1241,6 +1241,17 @@ rspamd_xml_start_element (GMarkupParseContext *context, const gchar *element_nam /* Create object */ ud->section_pointer = check_worker_conf (ud->cfg, NULL); } + else if (g_ascii_strcasecmp (element_name, "lua") == 0) { + g_strlcpy (ud->section_name, element_name, sizeof (ud->section_name)); + ud->cur_attrs = process_attrs (ud->cfg, attribute_names, attribute_values); + if (! handle_lua (ud->cfg, ud, ud->cur_attrs, NULL, NULL, ud->cfg, 0)) { + *error = g_error_new (xml_error_quark (), XML_EXTRA_ELEMENT, "cannot parse tag '%s'", ud->section_name); + ud->state = XML_ERROR; + } + else { + ud->state = XML_READ_VALUE; + } + } else if (g_ascii_strcasecmp (element_name, "view") == 0) { ud->state = XML_READ_VIEW; /* Create object */ @@ -1411,8 +1422,13 @@ rspamd_xml_text (GMarkupParseContext *context, const gchar *text, gsize text_len struct rspamd_xml_userdata *ud = user_data; char *val; struct config_file *cfg = ud->cfg; - - if (*text == '\n') { + + /* Strip space symbols */ + while (*text && g_ascii_isspace (*text)) { + text ++; + } + if (*text == '\0') { + /* Skip empty text */ return; } |