gboolean rspamd_config_post_load (struct rspamd_config *cfg,
enum rspamd_post_load_options opts);
-/**
- * Calculate checksum for config file
- * @param cfg config file
- */
-gboolean rspamd_config_calculate_checksum (struct rspamd_config *cfg);
-
-
-/**
- * Replace all \" with a single " in given string
- * @param line input string
- */
-void rspamd_config_unescape_quotes (gchar *line);
-
-/*
- * Convert comma separated string to a list of strings
- */
-GList *rspamd_config_parse_comma_list (rspamd_mempool_t *pool,
- const gchar *line);
-
/*
* Return a new classifier_config structure, setting default and non-conflicting attributes
*/
return ret;
}
-#if 0
-void
-parse_err (const gchar *fmt, ...)
-{
- va_list aq;
- gchar logbuf[BUFSIZ], readbuf[32];
- gint r;
-
- va_start (aq, fmt);
- rspamd_strlcpy (readbuf, yytext, sizeof (readbuf));
-
- r = snprintf (logbuf,
- sizeof (logbuf),
- "config file parse error! line: %d, text: %s, reason: ",
- yylineno,
- readbuf);
- r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq);
-
- va_end (aq);
- g_critical ("%s", logbuf);
-}
-
-void
-parse_warn (const gchar *fmt, ...)
-{
- va_list aq;
- gchar logbuf[BUFSIZ], readbuf[32];
- gint r;
-
- va_start (aq, fmt);
- rspamd_strlcpy (readbuf, yytext, sizeof (readbuf));
-
- r = snprintf (logbuf,
- sizeof (logbuf),
- "config file parse warning! line: %d, text: %s, reason: ",
- yylineno,
- readbuf);
- r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq);
-
- va_end (aq);
- g_warning ("%s", logbuf);
-}
-#endif
-
-void
-rspamd_config_unescape_quotes (gchar *line)
-{
- gchar *c = line, *t;
-
- while (*c) {
- if (*c == '\\' && *(c + 1) == '"') {
- t = c;
- while (*t) {
- *t = *(t + 1);
- t++;
- }
- }
- c++;
- }
-}
-
-GList *
-rspamd_config_parse_comma_list (rspamd_mempool_t * pool, const gchar *line)
-{
- GList *res = NULL;
- const gchar *c, *p;
- gchar *str;
-
- c = line;
- p = c;
-
- while (*p) {
- if (*p == ',' && *c != *p) {
- str = rspamd_mempool_alloc (pool, p - c + 1);
- rspamd_strlcpy (str, c, p - c + 1);
- res = g_list_prepend (res, str);
- /* Skip spaces */
- while (g_ascii_isspace (*(++p))) ;
- c = p;
- continue;
- }
- p++;
- }
- if (res != NULL) {
- rspamd_mempool_add_destructor (pool,
- (rspamd_mempool_destruct_t) g_list_free,
- res);
- }
-
- return res;
-}
-
struct rspamd_classifier_config *
rspamd_config_new_classifier (struct rspamd_config *cfg,
struct rspamd_classifier_config *c)