diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-06 20:57:15 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-06 20:57:15 +0400 |
commit | 38c4c4c5274905130e5bab354ef6cdf0472d5525 (patch) | |
tree | 17441043b63c4f58645dca0fc144722eb4b5d636 | |
parent | 79224aed0da78f42c90e2f5ccaf84163d08787b2 (diff) | |
download | rspamd-38c4c4c5274905130e5bab354ef6cdf0472d5525.tar.gz rspamd-38c4c4c5274905130e5bab354ef6cdf0472d5525.zip |
Json...
-rw-r--r-- | src/webui.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/webui.c b/src/webui.c index 5e6d037c0..05512286a 100644 --- a/src/webui.c +++ b/src/webui.c @@ -393,6 +393,7 @@ http_handle_maps (struct evhttp_request *req, gpointer arg) GList *cur; struct rspamd_map *map, *next; gboolean editable; + gchar *comma; evb = evbuffer_new (); if (!evb) { @@ -413,13 +414,20 @@ http_handle_maps (struct evhttp_request *req, gpointer arg) editable = access (map->uri, W_OK) == 0; if (cur->next) { next = cur->next->data; + if (next->protocol == MAP_PROTO_FILE && next->description != NULL && + access (next->uri, R_OK) == 0) { + comma = "},"; + } + else { + comma = "}"; + } } else { - next = NULL; + comma = "}"; } evbuffer_add_printf (evb, "{\"map\":%u,\"description\":\"%s\",\"editable\":%s%s", map->id, map->description, editable ? "true" : "false", - (next && next->protocol == MAP_PROTO_FILE && next->description) ? "}," : "}"); + comma); } } cur = g_list_next (cur); |