]> source.dussan.org Git - rspamd.git/commitdiff
[Rework] Rework extended urls output
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 19 Apr 2021 16:20:02 +0000 (17:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 19 Apr 2021 16:20:02 +0000 (17:20 +0100)
src/libserver/protocol.c

index 878f0bb3e979c3032df54811e877387febf3d2ad..e7f4dbd508c80eff756df61d761fad9dc9e4850e 100644 (file)
@@ -889,11 +889,16 @@ rspamd_protocol_extended_url (struct rspamd_task *task,
                ucl_object_insert_key (obj, elt, "host", 0, false);
        }
 
-       elt = ucl_object_frombool (url->flags & RSPAMD_URL_FLAG_PHISHED);
-       ucl_object_insert_key (obj, elt, "phished", 0, false);
+       ucl_object_t *flags = ucl_object_typed_new (UCL_ARRAY);
 
-       elt = ucl_object_frombool (url->flags & RSPAMD_URL_FLAG_REDIRECTED);
-       ucl_object_insert_key (obj, elt, "redirected", 0, false);
+       for (unsigned int i = 0; i < RSPAMD_URL_MAX_FLAG_SHIFT; i ++) {
+               if (url->flags & (1u << i)) {
+                       ucl_object_t *fl = ucl_object_fromstring (rspamd_url_flag_to_string (1u << i));
+                       ucl_array_append (flags, fl);
+               }
+       }
+
+       ucl_object_insert_key (obj, flags, "flags", 0, false);
 
        if (url->linked_url) {
                encoded = rspamd_url_encode (url->linked_url, &enclen, task->task_pool);