]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Project] Add configuration method
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Nov 2019 19:04:35 +0000 (19:04 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 29 Nov 2019 19:04:35 +0000 (19:04 +0000)
src/lua/lua_spf.c

index 7deb8fef1b5baf2f17b38768e685f3fcb6c3abd5..bfa041051f2a83f34ecdefa5c6c62c373314b289 100644 (file)
@@ -230,5 +230,26 @@ lua_spf_record_dtor (lua_State *L)
                spf_record_unref (record);
        }
 
+       return 0;
+}
+
+/***
+ * @function rspamd_spf.config(object)
+ * Configures SPF library according to the UCL config
+ * @param {table} object configuration object
+*/
+gint
+lua_spf_config (lua_State * L)
+{
+       ucl_object_t *config_obj = ucl_object_lua_import (L, 1);
+
+       if (config_obj) {
+               spf_library_config (config_obj);
+               ucl_object_unref (config_obj); /* As we copy data all the time */
+       }
+       else {
+               return luaL_error (L, "invalid arguments");
+       }
+
        return 0;
 }
\ No newline at end of file