36 #include <mcabber/hooks.h> // hk_add_handler, hk_del_handler |
36 #include <mcabber/hooks.h> // hk_add_handler, hk_del_handler |
37 #include <mcabber/settings.h> // settings_set, settings_del, settings_get |
37 #include <mcabber/settings.h> // settings_set, settings_del, settings_get |
38 #include <mcabber/compl.h> // compl_new_category, compl_add_category_word, compl_del_category_word |
38 #include <mcabber/compl.h> // compl_new_category, compl_add_category_word, compl_del_category_word |
39 #include <mcabber/events.h> // evs_* |
39 #include <mcabber/events.h> // evs_* |
40 #include <mcabber/modules.h> // module_info_t |
40 #include <mcabber/modules.h> // module_info_t |
|
41 #include <mcabber/api.h> // mcabber_branch, mcabber_api_version |
|
42 #include <mcabber/main.h> // mcabber_version |
41 |
43 |
42 #include "config.h" |
44 #include "config.h" |
43 #include "util.h" |
45 #include "util.h" |
44 |
46 |
45 // module description |
47 // module description |
58 "Provides command /lua" ) |
60 "Provides command /lua" ) |
59 #endif |
61 #endif |
60 |
62 |
61 static module_info_t info_lua_experimental = { |
63 static module_info_t info_lua_experimental = { |
62 .branch = "experimental", |
64 .branch = "experimental", |
63 .api = 15, |
65 .api = 20, |
64 .version = PROJECT_VERSION, |
66 .version = PROJECT_VERSION, |
65 .description = DESCRIPTION, |
67 .description = DESCRIPTION, |
66 .requires = NULL, |
68 .requires = NULL, |
67 .init = mlua_init, |
69 .init = mlua_init, |
68 .uninit = mlua_uninit, |
70 .uninit = mlua_uninit, |
195 lua_pushboolean (L, ret); |
197 lua_pushboolean (L, ret); |
196 } else if (type == LUA_TNUMBER) |
198 } else if (type == LUA_TNUMBER) |
197 lua_pushboolean (L, lua_tointeger (L, 1)); |
199 lua_pushboolean (L, lua_tointeger (L, 1)); |
198 else if (type != LUA_TBOOLEAN) |
200 else if (type != LUA_TBOOLEAN) |
199 lua_pushnil (L); |
201 lua_pushnil (L); |
|
202 return 1; |
|
203 } |
|
204 |
|
205 /// main.version |
|
206 /// Returns information about mcabber version |
|
207 /// R: table |
|
208 static int lua_main_version (lua_State *L) |
|
209 { |
|
210 lua_createtable (L, 0, 3); |
|
211 lua_pushstring (L, mcabber_branch); |
|
212 lua_setfield (L, -2, "branch"); |
|
213 lua_pushinteger (L, mcabber_api_version); |
|
214 lua_setfield (L, -2, "api"); |
|
215 { |
|
216 gchar *version = mcabber_version (); |
|
217 lua_pushstring (L, version); |
|
218 g_free (version); |
|
219 } |
|
220 lua_setfield (L, -2, "version"); |
|
221 lua_pushliteral (L, MCABBER_BRANCH); |
|
222 lua_setfield (L, -2, "build_branch"); |
|
223 lua_pushinteger (L, MCABBER_API_VERSION); |
|
224 lua_setfield (L, -2, "build_api"); |
|
225 lua_pushinteger (L, MCABBER_API_MIN); |
|
226 lua_setfield (L, -2, "build_api_min"); |
200 return 1; |
227 return 1; |
201 } |
228 } |
202 |
229 |
203 /// log print type |
230 /// log print type |
204 /// G: |
231 /// G: |