diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-15 15:28:47 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-02-15 15:28:47 +0000 |
commit | 5a9b7ee710a43901b7cc6605506be035bfe335b1 (patch) | |
tree | f3a5cdb82ca3f6ef68e9e77fa35f264da022567b /src/rspamadm/stat_convert.c | |
parent | 4b7e987b91a8782d5558f24cbd6bda7a70a53da1 (diff) | |
download | rspamd-5a9b7ee710a43901b7cc6605506be035bfe335b1.tar.gz rspamd-5a9b7ee710a43901b7cc6605506be035bfe335b1.zip |
[Project] Preliminary version of the new stat_convert
Diffstat (limited to 'src/rspamadm/stat_convert.c')
-rw-r--r-- | src/rspamadm/stat_convert.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rspamadm/stat_convert.c b/src/rspamadm/stat_convert.c index c88bc54bb..67d943f7b 100644 --- a/src/rspamadm/stat_convert.c +++ b/src/rspamadm/stat_convert.c @@ -24,6 +24,8 @@ static gchar *config_file = NULL; static gchar *symbol_ham = NULL; static gchar *symbol_spam = NULL; +static gdouble expire = 0.0; + /* Inputs */ static gchar *spam_db = NULL; static gchar *ham_db = NULL; @@ -51,6 +53,8 @@ static GOptionEntry entries[] = { "Config file to read data from", NULL}, {"reset", 'r', 0, G_OPTION_ARG_NONE, &reset_previous, "Reset previous data instead of appending values", NULL}, + {"expire", 'e', 0, G_OPTION_ARG_DOUBLE, &expire, + "Set expiration in seconds (can be fractional)", NULL}, {"symbol-spam", 0, 0, G_OPTION_ARG_STRING, &symbol_spam, "Symbol for spam (e.g. BAYES_SPAM)", NULL}, @@ -83,6 +87,7 @@ rspamadm_statconvert_help (gboolean full_help) "Where options are:\n\n" "-c: config file to read data from\n" "-r: reset previous data instead of increasing values\n" + "-e: set expire to that amount of seconds\n" "** Or specify options directly **\n" "--redis-host: output redis ip (in format ip:port)\n" "--redis-db: output redis database\n" @@ -235,6 +240,10 @@ rspamadm_statconvert (gint argc, gchar **argv) ucl_object_insert_key (obj, ucl_object_frombool (reset_previous), "reset_previous", 0, false); + if (expire != 0) { + ucl_object_insert_key (obj, ucl_object_fromdouble (expire), + "expire", 0, false); + } rspamadm_execute_lua_ucl_subr (L, argc, |