diff options
Diffstat (limited to 'src/plugins/scripts/lua/weechat-lua-api.c')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 388 |
1 files changed, 209 insertions, 179 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 1f59ba5b0..e9a3523e1 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -76,6 +76,9 @@ lua_pushnumber (lua_current_interpreter, __long); \ return 1; +#define API_DEF_FUNC(__name) \ + { #__name, &weechat_lua_api_##__name } + /* * weechat_lua_api_register: startup function for all WeeChat Lua scripts @@ -5543,6 +5546,32 @@ weechat_lua_api_hdata_time (lua_State *L) } /* + * weechat_lua_api_hdata_hashtable: get hashtable value of a variable in + * structure using hdata + */ + +static int +weechat_lua_api_hdata_hashtable (lua_State *L) +{ + const char *hdata, *pointer, *name; + + API_FUNC(1, "hdata_hashtable", API_RETURN_EMPTY); + if (lua_gettop (lua_current_interpreter) < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + hdata = lua_tostring (lua_current_interpreter, -3); + pointer = lua_tostring (lua_current_interpreter, -2); + name = lua_tostring (lua_current_interpreter, -1); + + weechat_lua_pushhashtable (lua_current_interpreter, + weechat_hdata_hashtable (script_str2ptr (hdata), + script_str2ptr (pointer), + name)); + + return 1; +} + +/* * weechat_lua_api_hdata_get_string: get hdata property as string */ @@ -6097,185 +6126,186 @@ weechat_lua_api_constant_weechat_hook_signal_pointer (lua_State *L) */ const struct luaL_reg weechat_lua_api_funcs[] = { - { "register", &weechat_lua_api_register }, - { "plugin_get_name", &weechat_lua_api_plugin_get_name }, - { "charset_set", &weechat_lua_api_charset_set }, - { "iconv_to_internal", &weechat_lua_api_iconv_to_internal }, - { "iconv_from_internal", &weechat_lua_api_iconv_from_internal }, - { "gettext", &weechat_lua_api_gettext }, - { "ngettext", &weechat_lua_api_ngettext }, - { "string_match", &weechat_lua_api_string_match }, - { "string_has_highlight", &weechat_lua_api_string_has_highlight }, - { "string_has_highlight_regex", &weechat_lua_api_string_has_highlight_regex }, - { "string_mask_to_regex", &weechat_lua_api_string_mask_to_regex }, - { "string_remove_color", &weechat_lua_api_string_remove_color }, - { "string_is_command_char", &weechat_lua_api_string_is_command_char }, - { "string_input_for_buffer", &weechat_lua_api_string_input_for_buffer }, - { "mkdir_home", &weechat_lua_api_mkdir_home }, - { "mkdir", &weechat_lua_api_mkdir }, - { "mkdir_parents", &weechat_lua_api_mkdir_parents }, - { "list_new", &weechat_lua_api_list_new }, - { "list_add", &weechat_lua_api_list_add }, - { "list_search", &weechat_lua_api_list_search }, - { "list_search_pos", &weechat_lua_api_list_search_pos }, - { "list_casesearch", &weechat_lua_api_list_casesearch }, - { "list_casesearch_pos", &weechat_lua_api_list_casesearch_pos }, - { "list_get", &weechat_lua_api_list_get }, - { "list_set", &weechat_lua_api_list_set }, - { "list_next", &weechat_lua_api_list_next }, - { "list_prev", &weechat_lua_api_list_prev }, - { "list_string", &weechat_lua_api_list_string }, - { "list_size", &weechat_lua_api_list_size }, - { "list_remove", &weechat_lua_api_list_remove }, - { "list_remove_all", &weechat_lua_api_list_remove_all }, - { "list_free", &weechat_lua_api_list_free }, - { "config_new", &weechat_lua_api_config_new }, - { "config_new_section", &weechat_lua_api_config_new_section }, - { "config_search_section", &weechat_lua_api_config_search_section }, - { "config_new_option", &weechat_lua_api_config_new_option }, - { "config_search_option", &weechat_lua_api_config_search_option }, - { "config_string_to_boolean", &weechat_lua_api_config_string_to_boolean }, - { "config_option_reset", &weechat_lua_api_config_option_reset }, - { "config_option_set", &weechat_lua_api_config_option_set }, - { "config_option_set_null", &weechat_lua_api_config_option_set_null }, - { "config_option_unset", &weechat_lua_api_config_option_unset }, - { "config_option_rename", &weechat_lua_api_config_option_rename }, - { "config_option_is_null", &weechat_lua_api_config_option_is_null }, - { "config_option_default_is_null", &weechat_lua_api_config_option_default_is_null }, - { "config_boolean", &weechat_lua_api_config_boolean }, - { "config_boolean_default", &weechat_lua_api_config_boolean_default }, - { "config_integer", &weechat_lua_api_config_integer }, - { "config_integer_default", &weechat_lua_api_config_integer_default }, - { "config_string", &weechat_lua_api_config_string }, - { "config_string_default", &weechat_lua_api_config_string_default }, - { "config_color", &weechat_lua_api_config_color }, - { "config_color_default", &weechat_lua_api_config_color_default }, - { "config_write_option", &weechat_lua_api_config_write_option }, - { "config_write_line", &weechat_lua_api_config_write_line }, - { "config_write", &weechat_lua_api_config_write }, - { "config_read", &weechat_lua_api_config_read }, - { "config_reload", &weechat_lua_api_config_reload }, - { "config_option_free", &weechat_lua_api_config_option_free }, - { "config_section_free_options", &weechat_lua_api_config_section_free_options }, - { "config_section_free", &weechat_lua_api_config_section_free }, - { "config_free", &weechat_lua_api_config_free }, - { "config_get", &weechat_lua_api_config_get }, - { "config_get_plugin", &weechat_lua_api_config_get_plugin }, - { "config_is_set_plugin", &weechat_lua_api_config_is_set_plugin }, - { "config_set_plugin", &weechat_lua_api_config_set_plugin }, - { "config_set_desc_plugin", &weechat_lua_api_config_set_desc_plugin }, - { "config_unset_plugin", &weechat_lua_api_config_unset_plugin }, - { "key_bind", &weechat_lua_api_key_bind }, - { "key_unbind", &weechat_lua_api_key_unbind }, - { "prefix", &weechat_lua_api_prefix }, - { "color", &weechat_lua_api_color }, - { "print", &weechat_lua_api_print }, - { "print_date_tags", &weechat_lua_api_print_date_tags }, - { "print_y", &weechat_lua_api_print_y }, - { "log_print", &weechat_lua_api_log_print }, - { "hook_command", &weechat_lua_api_hook_command }, - { "hook_command_run", &weechat_lua_api_hook_command_run }, - { "hook_timer", &weechat_lua_api_hook_timer }, - { "hook_fd", &weechat_lua_api_hook_fd }, - { "hook_process", &weechat_lua_api_hook_process }, - { "hook_connect", &weechat_lua_api_hook_connect }, - { "hook_print", &weechat_lua_api_hook_print }, - { "hook_signal", &weechat_lua_api_hook_signal }, - { "hook_signal_send", &weechat_lua_api_hook_signal_send }, - { "hook_hsignal", &weechat_lua_api_hook_hsignal }, - { "hook_hsignal_send", &weechat_lua_api_hook_hsignal_send }, - { "hook_config", &weechat_lua_api_hook_config }, - { "hook_completion", &weechat_lua_api_hook_completion }, - { "hook_completion_list_add", &weechat_lua_api_hook_completion_list_add }, - { "hook_modifier", &weechat_lua_api_hook_modifier }, - { "hook_modifier_exec", &weechat_lua_api_hook_modifier_exec }, - { "hook_info", &weechat_lua_api_hook_info }, - { "hook_info_hashtable", &weechat_lua_api_hook_info_hashtable }, - { "hook_infolist", &weechat_lua_api_hook_infolist }, - { "hook_focus", &weechat_lua_api_hook_focus }, - { "unhook", &weechat_lua_api_unhook }, - { "unhook_all", &weechat_lua_api_unhook_all }, - { "buffer_new", &weechat_lua_api_buffer_new }, - { "buffer_search", &weechat_lua_api_buffer_search }, - { "buffer_search_main", &weechat_lua_api_buffer_search_main }, - { "current_buffer", &weechat_lua_api_current_buffer }, - { "buffer_clear", &weechat_lua_api_buffer_clear }, - { "buffer_close", &weechat_lua_api_buffer_close }, - { "buffer_merge", &weechat_lua_api_buffer_merge }, - { "buffer_unmerge", &weechat_lua_api_buffer_unmerge }, - { "buffer_get_integer", &weechat_lua_api_buffer_get_integer }, - { "buffer_get_string", &weechat_lua_api_buffer_get_string }, - { "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer }, - { "buffer_set", &weechat_lua_api_buffer_set }, - { "buffer_string_replace_local_var", &weechat_lua_api_buffer_string_replace_local_var }, - { "buffer_match_list", &weechat_lua_api_buffer_match_list }, - { "current_window", &weechat_lua_api_current_window }, - { "window_search_with_buffer", &weechat_lua_api_window_search_with_buffer }, - { "window_get_integer", &weechat_lua_api_window_get_integer }, - { "window_get_string", &weechat_lua_api_window_get_string }, - { "window_get_pointer", &weechat_lua_api_window_get_pointer }, - { "window_set_title", &weechat_lua_api_window_set_title }, - { "nicklist_add_group", &weechat_lua_api_nicklist_add_group }, - { "nicklist_search_group", &weechat_lua_api_nicklist_search_group }, - { "nicklist_add_nick", &weechat_lua_api_nicklist_add_nick }, - { "nicklist_search_nick", &weechat_lua_api_nicklist_search_nick }, - { "nicklist_remove_group", &weechat_lua_api_nicklist_remove_group }, - { "nicklist_remove_nick", &weechat_lua_api_nicklist_remove_nick }, - { "nicklist_remove_all", &weechat_lua_api_nicklist_remove_all }, - { "nicklist_group_get_integer", &weechat_lua_api_nicklist_group_get_integer }, - { "nicklist_group_get_string", &weechat_lua_api_nicklist_group_get_string }, - { "nicklist_group_get_pointer", &weechat_lua_api_nicklist_group_get_pointer }, - { "nicklist_group_set", &weechat_lua_api_nicklist_group_set }, - { "nicklist_nick_get_integer", &weechat_lua_api_nicklist_nick_get_integer }, - { "nicklist_nick_get_string", &weechat_lua_api_nicklist_nick_get_string }, - { "nicklist_nick_get_pointer", &weechat_lua_api_nicklist_nick_get_pointer }, - { "nicklist_nick_set", &weechat_lua_api_nicklist_nick_set }, - { "bar_item_search", &weechat_lua_api_bar_item_search }, - { "bar_item_new", &weechat_lua_api_bar_item_new }, - { "bar_item_update", &weechat_lua_api_bar_item_update }, - { "bar_item_remove", &weechat_lua_api_bar_item_remove }, - { "bar_search", &weechat_lua_api_bar_search }, - { "bar_new", &weechat_lua_api_bar_new }, - { "bar_set", &weechat_lua_api_bar_set }, - { "bar_update", &weechat_lua_api_bar_update }, - { "bar_remove", &weechat_lua_api_bar_remove }, - { "command", &weechat_lua_api_command }, - { "info_get", &weechat_lua_api_info_get }, - { "info_get_hashtable", &weechat_lua_api_info_get_hashtable }, - { "infolist_new", &weechat_lua_api_infolist_new }, - { "infolist_new_item", &weechat_lua_api_infolist_new_item }, - { "infolist_new_var_integer", &weechat_lua_api_infolist_new_var_integer }, - { "infolist_new_var_string", &weechat_lua_api_infolist_new_var_string }, - { "infolist_new_var_pointer", &weechat_lua_api_infolist_new_var_pointer }, - { "infolist_new_var_time", &weechat_lua_api_infolist_new_var_time }, - { "infolist_get", &weechat_lua_api_infolist_get }, - { "infolist_next", &weechat_lua_api_infolist_next }, - { "infolist_prev", &weechat_lua_api_infolist_prev }, - { "infolist_reset_item_cursor", &weechat_lua_api_infolist_reset_item_cursor }, - { "infolist_fields", &weechat_lua_api_infolist_fields }, - { "infolist_integer", &weechat_lua_api_infolist_integer }, - { "infolist_string", &weechat_lua_api_infolist_string }, - { "infolist_pointer", &weechat_lua_api_infolist_pointer }, - { "infolist_time", &weechat_lua_api_infolist_time }, - { "infolist_free", &weechat_lua_api_infolist_free }, - { "hdata_get", &weechat_lua_api_hdata_get }, - { "hdata_get_var_offset", &weechat_lua_api_hdata_get_var_offset }, - { "hdata_get_var_type_string", &weechat_lua_api_hdata_get_var_type_string }, - { "hdata_get_var_hdata", &weechat_lua_api_hdata_get_var_hdata }, - { "hdata_get_list", &weechat_lua_api_hdata_get_list }, - { "hdata_check_pointer", &weechat_lua_api_hdata_check_pointer }, - { "hdata_move", &weechat_lua_api_hdata_move }, - { "hdata_char", &weechat_lua_api_hdata_char }, - { "hdata_integer", &weechat_lua_api_hdata_integer }, - { "hdata_long", &weechat_lua_api_hdata_long }, - { "hdata_string", &weechat_lua_api_hdata_string }, - { "hdata_pointer", &weechat_lua_api_hdata_pointer }, - { "hdata_time", &weechat_lua_api_hdata_time }, - { "hdata_get_string", &weechat_lua_api_hdata_get_string }, - { "upgrade_new", &weechat_lua_api_upgrade_new }, - { "upgrade_write_object", &weechat_lua_api_upgrade_write_object }, - { "upgrade_read", &weechat_lua_api_upgrade_read }, - { "upgrade_close", &weechat_lua_api_upgrade_close }, + API_DEF_FUNC(register), + API_DEF_FUNC(plugin_get_name), + API_DEF_FUNC(charset_set), + API_DEF_FUNC(iconv_to_internal), + API_DEF_FUNC(iconv_from_internal), + API_DEF_FUNC(gettext), + API_DEF_FUNC(ngettext), + API_DEF_FUNC(string_match), + API_DEF_FUNC(string_has_highlight), + API_DEF_FUNC(string_has_highlight_regex), + API_DEF_FUNC(string_mask_to_regex), + API_DEF_FUNC(string_remove_color), + API_DEF_FUNC(string_is_command_char), + API_DEF_FUNC(string_input_for_buffer), + API_DEF_FUNC(mkdir_home), + API_DEF_FUNC(mkdir), + API_DEF_FUNC(mkdir_parents), + API_DEF_FUNC(list_new), + API_DEF_FUNC(list_add), + API_DEF_FUNC(list_search), + API_DEF_FUNC(list_search_pos), + API_DEF_FUNC(list_casesearch), + API_DEF_FUNC(list_casesearch_pos), + API_DEF_FUNC(list_get), + API_DEF_FUNC(list_set), + API_DEF_FUNC(list_next), + API_DEF_FUNC(list_prev), + API_DEF_FUNC(list_string), + API_DEF_FUNC(list_size), + API_DEF_FUNC(list_remove), + API_DEF_FUNC(list_remove_all), + API_DEF_FUNC(list_free), + API_DEF_FUNC(config_new), + API_DEF_FUNC(config_new_section), + API_DEF_FUNC(config_search_section), + API_DEF_FUNC(config_new_option), + API_DEF_FUNC(config_search_option), + API_DEF_FUNC(config_string_to_boolean), + API_DEF_FUNC(config_option_reset), + API_DEF_FUNC(config_option_set), + API_DEF_FUNC(config_option_set_null), + API_DEF_FUNC(config_option_unset), + API_DEF_FUNC(config_option_rename), + API_DEF_FUNC(config_option_is_null), + API_DEF_FUNC(config_option_default_is_null), + API_DEF_FUNC(config_boolean), + API_DEF_FUNC(config_boolean_default), + API_DEF_FUNC(config_integer), + API_DEF_FUNC(config_integer_default), + API_DEF_FUNC(config_string), + API_DEF_FUNC(config_string_default), + API_DEF_FUNC(config_color), + API_DEF_FUNC(config_color_default), + API_DEF_FUNC(config_write_option), + API_DEF_FUNC(config_write_line), + API_DEF_FUNC(config_write), + API_DEF_FUNC(config_read), + API_DEF_FUNC(config_reload), + API_DEF_FUNC(config_option_free), + API_DEF_FUNC(config_section_free_options), + API_DEF_FUNC(config_section_free), + API_DEF_FUNC(config_free), + API_DEF_FUNC(config_get), + API_DEF_FUNC(config_get_plugin), + API_DEF_FUNC(config_is_set_plugin), + API_DEF_FUNC(config_set_plugin), + API_DEF_FUNC(config_set_desc_plugin), + API_DEF_FUNC(config_unset_plugin), + API_DEF_FUNC(key_bind), + API_DEF_FUNC(key_unbind), + API_DEF_FUNC(prefix), + API_DEF_FUNC(color), + API_DEF_FUNC(print), + API_DEF_FUNC(print_date_tags), + API_DEF_FUNC(print_y), + API_DEF_FUNC(log_print), + API_DEF_FUNC(hook_command), + API_DEF_FUNC(hook_command_run), + API_DEF_FUNC(hook_timer), + API_DEF_FUNC(hook_fd), + API_DEF_FUNC(hook_process), + API_DEF_FUNC(hook_connect), + API_DEF_FUNC(hook_print), + API_DEF_FUNC(hook_signal), + API_DEF_FUNC(hook_signal_send), + API_DEF_FUNC(hook_hsignal), + API_DEF_FUNC(hook_hsignal_send), + API_DEF_FUNC(hook_config), + API_DEF_FUNC(hook_completion), + API_DEF_FUNC(hook_completion_list_add), + API_DEF_FUNC(hook_modifier), + API_DEF_FUNC(hook_modifier_exec), + API_DEF_FUNC(hook_info), + API_DEF_FUNC(hook_info_hashtable), + API_DEF_FUNC(hook_infolist), + API_DEF_FUNC(hook_focus), + API_DEF_FUNC(unhook), + API_DEF_FUNC(unhook_all), + API_DEF_FUNC(buffer_new), + API_DEF_FUNC(buffer_search), + API_DEF_FUNC(buffer_search_main), + API_DEF_FUNC(current_buffer), + API_DEF_FUNC(buffer_clear), + API_DEF_FUNC(buffer_close), + API_DEF_FUNC(buffer_merge), + API_DEF_FUNC(buffer_unmerge), + API_DEF_FUNC(buffer_get_integer), + API_DEF_FUNC(buffer_get_string), + API_DEF_FUNC(buffer_get_pointer), + API_DEF_FUNC(buffer_set), + API_DEF_FUNC(buffer_string_replace_local_var), + API_DEF_FUNC(buffer_match_list), + API_DEF_FUNC(current_window), + API_DEF_FUNC(window_search_with_buffer), + API_DEF_FUNC(window_get_integer), + API_DEF_FUNC(window_get_string), + API_DEF_FUNC(window_get_pointer), + API_DEF_FUNC(window_set_title), + API_DEF_FUNC(nicklist_add_group), + API_DEF_FUNC(nicklist_search_group), + API_DEF_FUNC(nicklist_add_nick), + API_DEF_FUNC(nicklist_search_nick), + API_DEF_FUNC(nicklist_remove_group), + API_DEF_FUNC(nicklist_remove_nick), + API_DEF_FUNC(nicklist_remove_all), + API_DEF_FUNC(nicklist_group_get_integer), + API_DEF_FUNC(nicklist_group_get_string), + API_DEF_FUNC(nicklist_group_get_pointer), + API_DEF_FUNC(nicklist_group_set), + API_DEF_FUNC(nicklist_nick_get_integer), + API_DEF_FUNC(nicklist_nick_get_string), + API_DEF_FUNC(nicklist_nick_get_pointer), + API_DEF_FUNC(nicklist_nick_set), + API_DEF_FUNC(bar_item_search), + API_DEF_FUNC(bar_item_new), + API_DEF_FUNC(bar_item_update), + API_DEF_FUNC(bar_item_remove), + API_DEF_FUNC(bar_search), + API_DEF_FUNC(bar_new), + API_DEF_FUNC(bar_set), + API_DEF_FUNC(bar_update), + API_DEF_FUNC(bar_remove), + API_DEF_FUNC(command), + API_DEF_FUNC(info_get), + API_DEF_FUNC(info_get_hashtable), + API_DEF_FUNC(infolist_new), + API_DEF_FUNC(infolist_new_item), + API_DEF_FUNC(infolist_new_var_integer), + API_DEF_FUNC(infolist_new_var_string), + API_DEF_FUNC(infolist_new_var_pointer), + API_DEF_FUNC(infolist_new_var_time), + API_DEF_FUNC(infolist_get), + API_DEF_FUNC(infolist_next), + API_DEF_FUNC(infolist_prev), + API_DEF_FUNC(infolist_reset_item_cursor), + API_DEF_FUNC(infolist_fields), + API_DEF_FUNC(infolist_integer), + API_DEF_FUNC(infolist_string), + API_DEF_FUNC(infolist_pointer), + API_DEF_FUNC(infolist_time), + API_DEF_FUNC(infolist_free), + API_DEF_FUNC(hdata_get), + API_DEF_FUNC(hdata_get_var_offset), + API_DEF_FUNC(hdata_get_var_type_string), + API_DEF_FUNC(hdata_get_var_hdata), + API_DEF_FUNC(hdata_get_list), + API_DEF_FUNC(hdata_check_pointer), + API_DEF_FUNC(hdata_move), + API_DEF_FUNC(hdata_char), + API_DEF_FUNC(hdata_integer), + API_DEF_FUNC(hdata_long), + API_DEF_FUNC(hdata_string), + API_DEF_FUNC(hdata_pointer), + API_DEF_FUNC(hdata_time), + API_DEF_FUNC(hdata_hashtable), + API_DEF_FUNC(hdata_get_string), + API_DEF_FUNC(upgrade_new), + API_DEF_FUNC(upgrade_write_object), + API_DEF_FUNC(upgrade_read), + API_DEF_FUNC(upgrade_close), /* define constants as function which returns values */ |