aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_cfg_file.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-15 17:59:12 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-02-15 17:59:12 +0300
commitbeab78097de6a53430bb16310e41b93d74546cb9 (patch)
treebe45e11a8cbf7ed0b0640bdd3e0a2ffa290474e0 /src/lua/lua_cfg_file.c
parentb3928c8e33fe8fe7b5d496c6beeb8f66dcdfa104 (diff)
downloadrspamd-beab78097de6a53430bb16310e41b93d74546cb9.tar.gz
rspamd-beab78097de6a53430bb16310e41b93d74546cb9.zip
* Add ability to add descriptions for symbols
Diffstat (limited to 'src/lua/lua_cfg_file.c')
-rw-r--r--src/lua/lua_cfg_file.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index 6ec48ebef..eff2c138a 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -119,7 +119,7 @@ lua_process_metric (lua_State *L, const gchar *name, struct config_file *cfg)
if (lua_istable (L, -1)) {
/* We got a table, so extract individual attributes */
lua_pushstring (L, "weight");
- lua_gettable (L, -1);
+ lua_gettable (L, -2);
if (lua_isnumber (L, -1)) {
score = memory_pool_alloc (cfg->cfg_pool, sizeof (double));
*score = lua_tonumber (L, -1);
@@ -128,6 +128,14 @@ lua_process_metric (lua_State *L, const gchar *name, struct config_file *cfg)
msg_warn ("cannot get weight of symbol: %s", symbol);
continue;
}
+ lua_pop (L, 1);
+ lua_pushstring (L, "description");
+ lua_gettable (L, -2);
+ if (lua_isstring (L, -1)) {
+ g_hash_table_insert (metric->descriptions,
+ symbol, memory_pool_strdup (cfg->cfg_pool, lua_tostring (L, -1)));
+ }
+ lua_pop (L, 1);
}
else if (lua_isnumber (L, -1)) {
/* Just got weight */