]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow all types of symbols to be added via __newindex method
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 4 Aug 2016 11:17:37 +0000 (12:17 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 4 Aug 2016 11:17:37 +0000 (12:17 +0100)
src/lua/lua_config.c

index ee6ab3ef757b6ee44009fc042bce7ce417a888fc..ddd5d9146125530b7a6a3460a55460532919542e 100644 (file)
@@ -1497,18 +1497,7 @@ lua_config_newindex (lua_State *L)
 
                        if (lua_type (L, -1) == LUA_TSTRING) {
                                type_str = lua_tostring (L, -1);
-                               if (strcmp (type_str, "normal") == 0) {
-                                       type = SYMBOL_TYPE_NORMAL;
-                               }
-                               else if (strcmp (type_str, "virtual") == 0) {
-                                       type = SYMBOL_TYPE_VIRTUAL;
-                               }
-                               else if (strcmp (type_str, "callback") == 0) {
-                                       type = SYMBOL_TYPE_CALLBACK;
-                               }
-                               else {
-                                       msg_info_config ("unknown type: %s", type_str);
-                               }
+                               type = lua_parse_symbol_type (type_str);
 
                        }
                        lua_pop (L, 1);