diff -r 1be9411caf31 -r 75a7d595817c lua.c --- a/lua.c Sun May 20 06:24:50 2012 +0300 +++ b/lua.c Sun May 20 06:24:53 2012 +0300 @@ -45,25 +45,35 @@ #include "config.h" #include "util.h" -// module description +// +// options +// + +#define OPT_MLUA_RC "lua_init_filename" +#define OPT_MLUA_LM_DEBUG "lua_lm_debug" + +// +// module description +// + void mlua_init (void); void mlua_uninit (void); #ifdef LLM_LOG_HANDLER #define DESCRIPTION ( \ "Lua scripting interface\n" \ - "Recognizes options lua_init_file, lua_hook_function and lua_lm_debug\n" \ - "Provides command /lua" ) + "Options: " OPT_MLUA_RC ", " OPT_MLUA_LM_DEBUG "\n" \ + "Command: /lua" ) #else #define DESCRIPTION ( \ "Lua scripting interface\n" \ - "Recognizes options lua_init_file and lua_hook_function\n" \ - "Provides command /lua" ) + "Options: " OPT_MLUA_RC "\n" \ + "Command: /lua" ) #endif -static module_info_t info_lua_experimental = { - .branch = "experimental", - .api = 34, +static module_info_t info_lua_dev = { + .branch = "dev", + .api = 23, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -72,18 +82,7 @@ .next = NULL, }; -static module_info_t info_lua_dev = { - .branch = "dev", - .api = 20, - .version = PROJECT_VERSION, - .description = DESCRIPTION, - .requires = NULL, - .init = mlua_init, - .uninit = mlua_uninit, - .next = &info_lua_experimental, -}; - -module_info_t info_lua_0_10_0 = { +static module_info_t info_lua_0_10_0 = { .branch = "0.10.0", .api = 1, .version = PROJECT_VERSION, @@ -105,6 +104,10 @@ .next = &info_lua_0_10_0, }; +// +// globals +// + #ifdef MCABBER_API_HAVE_CMD_ID static gpointer lua_cmdid; #endif @@ -112,6 +115,10 @@ // global lua state object, necessary for uninitialization function static lua_State *lua = NULL; +// +// code +// + // caller sould g_free result static char *mcabber_config_filename (const char *file) { @@ -1605,7 +1612,7 @@ void lua_lm_log_handler (const gchar *domain, GLogLevelFlags log_level, const gchar *message, gpointer ignore) { - if (settings_opt_get_int ("lua_lm_debug")) + if (settings_opt_get_int (OPT_MLUA_LM_DEBUG)) scr_log_print (LPRINT_LOGNORM, "%s: %s", domain, message); } #endif @@ -1749,7 +1756,7 @@ lua_guard_init (lua); { - char *initfile = expand_filename (settings_opt_get ("lua_init_filename")); + char *initfile = expand_filename (settings_opt_get (OPT_MLUA_RC)); if (!initfile) scr_log_print (LPRINT_LOGNORM, "lua: Cannot determine config file name");