static void
rspamc_symbol_output (const ucl_object_t *obj)
{
- const ucl_object_t *cur, *it;
+ const ucl_object_t *val, *cur;
+ ucl_object_iter_t it = NULL;
+ gboolean first = TRUE;
rspamd_fprintf (stdout, "Symbol: %s ", ucl_object_key (obj));
- cur = ucl_object_find_key (obj, "score");
+ val = ucl_object_find_key (obj, "score");
- if (cur != NULL) {
- rspamd_fprintf (stdout, "(%.2f)", ucl_object_todouble (cur));
+ if (val != NULL) {
+ rspamd_fprintf (stdout, "(%.2f)", ucl_object_todouble (val));
}
- cur = ucl_object_find_key (obj, "options");
- if (cur != NULL && cur->type == UCL_ARRAY) {
- it = cur->value.av;
+ val = ucl_object_find_key (obj, "options");
+ if (val != NULL && val->type == UCL_ARRAY) {
rspamd_fprintf (stdout, "[");
- while (it) {
- if (it->next) {
- rspamd_fprintf (stdout, "%s, ", ucl_object_tostring (it));
+
+ while ((cur = ucl_iterate_object (val, &it, TRUE)) != NULL) {
+ if (first) {
+ rspamd_fprintf (stdout, "%s", ucl_object_tostring (cur));
+ first = FALSE;
}
else {
- rspamd_fprintf (stdout, "%s", ucl_object_tostring (it));
+ rspamd_fprintf (stdout, ", %s", ucl_object_tostring (cur));
}
- it = it->next;
}
rspamd_fprintf (stdout, "]");
}
struct rspamd_controller_session *session = conn_ent->ud;
struct ucl_parser *parser;
struct metric *metric;
- ucl_object_t *obj, *cur;
+ ucl_object_t *obj;
+ const ucl_object_t *cur;
struct rspamd_controller_worker_ctx *ctx;
const gchar *error;
gdouble score;
gint i, added = 0;
enum rspamd_metric_action act;
+ ucl_object_iter_t it = NULL;
ctx = session->ctx;
return 0;
}
- cur = obj->value.av;
- for (i = 0; i < 3 && cur != NULL; i++, cur = cur->next) {
+ for (i = 0; i < 3; i++) {
+ cur = ucl_iterate_object (obj, &it, TRUE);
+ if (cur == NULL) {
+ break;
+ }
switch (i) {
case 0:
act = METRIC_ACTION_REJECT;
elt = ucl_object_frombool (url->is_phished);
ucl_object_insert_key (obj, elt, "phished", 0, false);
}
- DL_APPEND (cb->top->value.av, obj);
+ ucl_array_append (cb->top, obj);
if (cb->task->cfg->log_urls) {
msg_info ("<%s> URL: %s - %s: %s",
ucl_object_t *obj;
obj = ucl_object_fromlstring (url->user, url->userlen + url->hostlen + 1);
- DL_APPEND (cb->top->value.av, obj);
+ ucl_array_append (cb->top, obj);
return FALSE;
}
cur = str_list;
while (cur) {
obj = ucl_object_fromstring (cur->data);
- DL_APPEND (top->value.av, obj);
+ ucl_array_append (top, obj);
cur = g_list_next (cur);
}
fuzzy_module_ctx->fuzzy_pool);
if ((value = ucl_object_find_key (obj, "mime_types")) != NULL) {
- if (value->type == UCL_ARRAY) {
- value = value->value.av;
- }
- LL_FOREACH (value, cur) {
+ it = NULL;
+ while ((cur = ucl_iterate_object (value, &it, obj->type == UCL_ARRAY))
+ != NULL) {
rule->mime_types = g_list_concat (rule->mime_types,
parse_mime_types (ucl_obj_tostring (cur)));
}
rspamd_upstreams_from_ucl (rule->servers, value, DEFAULT_PORT, NULL);
}
if ((value = ucl_object_find_key (obj, "fuzzy_map")) != NULL) {
+ it = NULL;
while ((cur = ucl_iterate_object (value, &it, true)) != NULL) {
parse_flags (rule, cfg, cur);
}