diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-24 13:00:50 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-03-24 13:00:50 +0100 |
commit | c4cfd651fc5ff993fd52ae48794a72a09cd1ee05 (patch) | |
tree | d0dd73d599d7530d011300e3fe7b506aa34f3845 /src | |
parent | 93ec33d491732e7f5d8094f105d45c0145271c77 (diff) | |
download | weechat-c4cfd651fc5ff993fd52ae48794a72a09cd1ee05.zip |
api: display warning in scripts when invalid pointers (malformed strings) are given to plugin API functions (warning displayed if debug for plugin is >= 1)
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/scripts/guile/weechat-guile-api.c | 299 | ||||
-rw-r--r-- | src/plugins/scripts/guile/weechat-guile.c | 4 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 299 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 4 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 298 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 4 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 299 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 4 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 299 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 4 | ||||
-rw-r--r-- | src/plugins/scripts/script.c | 27 | ||||
-rw-r--r-- | src/plugins/scripts/script.h | 4 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 292 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl.c | 4 |
14 files changed, 942 insertions, 899 deletions
diff --git a/src/plugins/scripts/guile/weechat-guile-api.c b/src/plugins/scripts/guile/weechat-guile-api.c index 80e319164..cc67a2171 100644 --- a/src/plugins/scripts/guile/weechat-guile-api.c +++ b/src/plugins/scripts/guile/weechat-guile-api.c @@ -48,6 +48,9 @@ guile_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_guile_plugin, GUILE_CURRENT_SCRIPT_NAME, \ + guile_function_name, __string) #define API_RETURN_OK return SCM_BOOL_T; #define API_RETURN_ERROR return SCM_BOOL_F; #define API_RETURN_EMPTY \ @@ -119,7 +122,7 @@ weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license, if (guile_current_script) { guile_registered_script = guile_current_script; - if ((weechat_guile_plugin->debug >= 1) || !guile_quiet) + if ((weechat_guile_plugin->debug >= 2) || !guile_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -152,7 +155,7 @@ weechat_guile_api_plugin_get_name (SCM plugin) if (!scm_is_string (plugin)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_plugin_get_name (script_str2ptr (scm_i_string_chars (plugin))); + result = weechat_plugin_get_name (API_STR2PTR(scm_i_string_chars (plugin))); API_RETURN_STRING(result); } @@ -485,10 +488,10 @@ weechat_guile_api_list_add (SCM weelist, SCM data, SCM where, SCM user_data) || !scm_is_string (where) || !scm_is_string (user_data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_add (script_str2ptr(scm_i_string_chars (weelist)), + result = script_ptr2str (weechat_list_add (API_STR2PTR(scm_i_string_chars (weelist)), scm_i_string_chars (data), scm_i_string_chars (where), - script_str2ptr (scm_i_string_chars (user_data)))); + API_STR2PTR(scm_i_string_chars (user_data)))); API_RETURN_STRING(result); } @@ -506,7 +509,7 @@ weechat_guile_api_list_search (SCM weelist, SCM data) if (!scm_is_string (weelist) || !scm_is_string (data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_search (script_str2ptr(scm_i_string_chars (weelist)), + result = script_ptr2str (weechat_list_search (API_STR2PTR(scm_i_string_chars (weelist)), scm_i_string_chars (data))); API_RETURN_STRING(result); @@ -525,7 +528,7 @@ weechat_guile_api_list_search_pos (SCM weelist, SCM data) if (!scm_is_string (weelist) || !scm_is_string (data)) API_WRONG_ARGS(API_RETURN_INT(-1)); - pos = weechat_list_search_pos (script_str2ptr (scm_i_string_chars (weelist)), + pos = weechat_list_search_pos (API_STR2PTR(scm_i_string_chars (weelist)), scm_i_string_chars (data)); API_RETURN_INT(pos); @@ -544,7 +547,7 @@ weechat_guile_api_list_casesearch (SCM weelist, SCM data) if (!scm_is_string (weelist) || !scm_is_string (data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (scm_i_string_chars (weelist)), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(scm_i_string_chars (weelist)), scm_i_string_chars (data))); API_RETURN_STRING(result); @@ -564,7 +567,7 @@ weechat_guile_api_list_casesearch_pos (SCM weelist, SCM data) if (!scm_is_string (weelist) || !scm_is_string (data)) API_WRONG_ARGS(API_RETURN_INT(-1)); - pos = weechat_list_casesearch_pos (script_str2ptr (scm_i_string_chars (weelist)), + pos = weechat_list_casesearch_pos (API_STR2PTR(scm_i_string_chars (weelist)), scm_i_string_chars (data)); API_RETURN_INT(pos); @@ -583,7 +586,7 @@ weechat_guile_api_list_get (SCM weelist, SCM position) if (!scm_is_string (weelist) || !scm_is_integer (position)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_get (script_str2ptr (scm_i_string_chars (weelist)), + result = script_ptr2str (weechat_list_get (API_STR2PTR(scm_i_string_chars (weelist)), scm_to_int (position))); API_RETURN_STRING(result); @@ -600,7 +603,7 @@ weechat_guile_api_list_set (SCM item, SCM new_value) if (!scm_is_string (item) || !scm_is_string (new_value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_set (script_str2ptr (scm_i_string_chars (item)), + weechat_list_set (API_STR2PTR(scm_i_string_chars (item)), scm_i_string_chars (new_value)); API_RETURN_OK; @@ -619,7 +622,7 @@ weechat_guile_api_list_next (SCM item) if (!scm_is_string (item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_next (script_str2ptr (scm_i_string_chars (item)))); + result = script_ptr2str (weechat_list_next (API_STR2PTR(scm_i_string_chars (item)))); API_RETURN_STRING(result); } @@ -637,7 +640,7 @@ weechat_guile_api_list_prev (SCM item) if (!scm_is_string (item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_prev (script_str2ptr (scm_i_string_chars (item)))); + result = script_ptr2str (weechat_list_prev (API_STR2PTR(scm_i_string_chars (item)))); API_RETURN_STRING(result); } @@ -655,7 +658,7 @@ weechat_guile_api_list_string (SCM item) if (!scm_is_string (item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_list_string (script_str2ptr (scm_i_string_chars (item))); + result = weechat_list_string (API_STR2PTR(scm_i_string_chars (item))); API_RETURN_STRING(result); } @@ -673,7 +676,7 @@ weechat_guile_api_list_size (SCM weelist) if (!scm_is_string (weelist)) API_WRONG_ARGS(API_RETURN_INT(0)); - size = weechat_list_size (script_str2ptr (scm_i_string_chars (weelist))); + size = weechat_list_size (API_STR2PTR(scm_i_string_chars (weelist))); API_RETURN_INT(size); } @@ -689,8 +692,8 @@ weechat_guile_api_list_remove (SCM weelist, SCM item) if (!scm_is_string (weelist) || !scm_is_string (item)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove (script_str2ptr (scm_i_string_chars (weelist)), - script_str2ptr (scm_i_string_chars (item))); + weechat_list_remove (API_STR2PTR(scm_i_string_chars (weelist)), + API_STR2PTR(scm_i_string_chars (item))); API_RETURN_OK; } @@ -706,7 +709,7 @@ weechat_guile_api_list_remove_all (SCM weelist) if (!scm_is_string (weelist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove_all (script_str2ptr (scm_i_string_chars (weelist))); + weechat_list_remove_all (API_STR2PTR(scm_i_string_chars (weelist))); API_RETURN_OK; } @@ -722,7 +725,7 @@ weechat_guile_api_list_free (SCM weelist) if (!scm_is_string (weelist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_free (script_str2ptr (scm_i_string_chars (weelist))); + weechat_list_free (API_STR2PTR(scm_i_string_chars (weelist))); API_RETURN_OK; } @@ -1072,7 +1075,7 @@ weechat_guile_api_config_new_section (SCM args) result = script_ptr2str (script_api_config_new_section (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (config_file)), + API_STR2PTR(scm_i_string_chars (config_file)), scm_i_string_chars (name), scm_to_int (user_can_add_options), scm_to_int (user_can_delete_options), @@ -1109,7 +1112,7 @@ weechat_guile_api_config_search_section (SCM config_file, SCM section_name) if (!scm_is_string (config_file) || !scm_is_string (section_name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (scm_i_string_chars (config_file)), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(scm_i_string_chars (config_file)), scm_i_string_chars (section_name))); API_RETURN_STRING_FREE(result); @@ -1275,8 +1278,8 @@ weechat_guile_api_config_new_option (SCM args) result = script_ptr2str (script_api_config_new_option (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (config_file)), - script_str2ptr (scm_i_string_chars (section)), + API_STR2PTR(scm_i_string_chars (config_file)), + API_STR2PTR(scm_i_string_chars (section)), scm_i_string_chars (name), scm_i_string_chars (type), scm_i_string_chars (description), @@ -1316,8 +1319,8 @@ weechat_guile_api_config_search_option (SCM config_file, SCM section, || !scm_is_string (option_name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (scm_i_string_chars (config_file)), - script_str2ptr (scm_i_string_chars (section)), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(scm_i_string_chars (config_file)), + API_STR2PTR(scm_i_string_chars (section)), scm_i_string_chars (option_name))); API_RETURN_STRING_FREE(result); @@ -1354,7 +1357,7 @@ weechat_guile_api_config_option_reset (SCM option, SCM run_callback) if (!scm_is_string (option) || !scm_is_integer (run_callback)) API_WRONG_ARGS(API_RETURN_INT(0)); - rc = weechat_config_option_reset (script_str2ptr (scm_i_string_chars (option)), + rc = weechat_config_option_reset (API_STR2PTR(scm_i_string_chars (option)), scm_to_int (run_callback)); API_RETURN_INT(rc); @@ -1375,7 +1378,7 @@ weechat_guile_api_config_option_set (SCM option, SCM new_value, || !scm_is_integer (run_callback)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR)); - rc = weechat_config_option_set (script_str2ptr (scm_i_string_chars (option)), + rc = weechat_config_option_set (API_STR2PTR(scm_i_string_chars (option)), scm_i_string_chars (new_value), scm_to_int (run_callback)); @@ -1396,7 +1399,7 @@ weechat_guile_api_config_option_set_null (SCM option, SCM run_callback) if (!scm_is_string (option) || !scm_is_integer (run_callback)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR)); - rc = weechat_config_option_set_null (script_str2ptr (scm_i_string_chars (option)), + rc = weechat_config_option_set_null (API_STR2PTR(scm_i_string_chars (option)), scm_to_int (run_callback)); API_RETURN_INT(rc); @@ -1415,7 +1418,7 @@ weechat_guile_api_config_option_unset (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR)); - rc = weechat_config_option_unset (script_str2ptr (scm_i_string_chars (option))); + rc = weechat_config_option_unset (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(rc); } @@ -1431,7 +1434,7 @@ weechat_guile_api_config_option_rename (SCM option, SCM new_name) if (!scm_is_string (option) || !scm_is_string (new_name)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_option_rename (script_str2ptr (scm_i_string_chars (option)), + weechat_config_option_rename (API_STR2PTR(scm_i_string_chars (option)), scm_i_string_chars (new_name)); API_RETURN_OK; @@ -1450,7 +1453,7 @@ weechat_guile_api_config_option_is_null (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_is_null (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_option_is_null (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1469,7 +1472,7 @@ weechat_guile_api_config_option_default_is_null (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_default_is_null (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_option_default_is_null (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1487,7 +1490,7 @@ weechat_guile_api_config_boolean (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_boolean (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1505,7 +1508,7 @@ weechat_guile_api_config_boolean_default (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean_default (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_boolean_default (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1523,7 +1526,7 @@ weechat_guile_api_config_integer (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_integer (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1541,7 +1544,7 @@ weechat_guile_api_config_integer_default (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer_default (script_str2ptr (scm_i_string_chars (option))); + value = weechat_config_integer_default (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_INT(value); } @@ -1559,7 +1562,7 @@ weechat_guile_api_config_string (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string (script_str2ptr (scm_i_string_chars (option))); + result = weechat_config_string (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_STRING(result); } @@ -1577,7 +1580,7 @@ weechat_guile_api_config_string_default (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string_default (script_str2ptr (scm_i_string_chars (option))); + result = weechat_config_string_default (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_STRING(result); } @@ -1595,7 +1598,7 @@ weechat_guile_api_config_color (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color (script_str2ptr (scm_i_string_chars (option))); + result = weechat_config_color (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_STRING(result); } @@ -1613,7 +1616,7 @@ weechat_guile_api_config_color_default (SCM option) if (!scm_is_string (option)) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color_default (script_str2ptr (scm_i_string_chars (option))); + result = weechat_config_color_default (API_STR2PTR(scm_i_string_chars (option))); API_RETURN_STRING(result); } @@ -1629,8 +1632,8 @@ weechat_guile_api_config_write_option (SCM config_file, SCM option) if (!scm_is_string (config_file) || !scm_is_string (option)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_write_option (script_str2ptr (scm_i_string_chars (config_file)), - script_str2ptr (scm_i_string_chars (option))); + weechat_config_write_option (API_STR2PTR(scm_i_string_chars (config_file)), + API_STR2PTR(scm_i_string_chars (option))); API_RETURN_OK; } @@ -1647,7 +1650,7 @@ weechat_guile_api_config_write_line (SCM config_file, if (!scm_is_string (config_file) || !scm_is_string (option_name) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_write_line (script_str2ptr (scm_i_string_chars (config_file)), + weechat_config_write_line (API_STR2PTR(scm_i_string_chars (config_file)), scm_i_string_chars (option_name), "%s", scm_i_string_chars (value)); @@ -1668,7 +1671,7 @@ weechat_guile_api_config_write (SCM config_file) if (!scm_is_string (config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_write (script_str2ptr (scm_i_string_chars (config_file))); + rc = weechat_config_write (API_STR2PTR(scm_i_string_chars (config_file))); API_RETURN_INT(rc); } @@ -1686,7 +1689,7 @@ weechat_guile_api_config_read (SCM config_file) if (!scm_is_string (config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_read (script_str2ptr (scm_i_string_chars (config_file))); + rc = weechat_config_read (API_STR2PTR(scm_i_string_chars (config_file))); API_RETURN_INT(rc); } @@ -1704,7 +1707,7 @@ weechat_guile_api_config_reload (SCM config_file) if (!scm_is_string (config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_reload (script_str2ptr (scm_i_string_chars (config_file))); + rc = weechat_config_reload (API_STR2PTR(scm_i_string_chars (config_file))); API_RETURN_INT(rc); } @@ -1722,7 +1725,7 @@ weechat_guile_api_config_option_free (SCM option) script_api_config_option_free (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (option))); + API_STR2PTR(scm_i_string_chars (option))); API_RETURN_OK; } @@ -1741,7 +1744,7 @@ weechat_guile_api_config_section_free_options (SCM section) script_api_config_section_free_options (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (section))); + API_STR2PTR(scm_i_string_chars (section))); API_RETURN_OK; } @@ -1759,7 +1762,7 @@ weechat_guile_api_config_section_free (SCM section) script_api_config_section_free (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (section))); + API_STR2PTR(scm_i_string_chars (section))); API_RETURN_OK; } @@ -1777,7 +1780,7 @@ weechat_guile_api_config_free (SCM config_file) script_api_config_free (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (config_file))); + API_STR2PTR(scm_i_string_chars (config_file))); API_RETURN_OK; } @@ -1994,7 +1997,7 @@ weechat_guile_api_print (SCM buffer, SCM message) script_api_printf (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (buffer)), "%s", scm_i_string_chars (message)); API_RETURN_OK; @@ -2015,7 +2018,7 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message) script_api_printf_date_tags (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (buffer)), scm_to_int (date), scm_i_string_chars (tags), "%s", scm_i_string_chars (message)); @@ -2037,7 +2040,7 @@ weechat_guile_api_print_y (SCM buffer, SCM y, SCM message) script_api_printf_y (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (buffer)), scm_to_int (y), "%s", scm_i_string_chars (message)); @@ -2586,7 +2589,7 @@ weechat_guile_api_hook_print (SCM buffer, SCM tags, SCM message, result = script_ptr2str (script_api_hook_print (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (tags), scm_i_string_chars (message), scm_to_int (strip_colors), @@ -2720,7 +2723,7 @@ weechat_guile_api_hook_signal_send (SCM signal, SCM type_data, API_WRONG_ARGS(API_RETURN_ERROR); weechat_hook_signal_send (scm_i_string_chars (signal), scm_i_string_chars (type_data), - script_str2ptr (scm_i_string_chars (signal_data))); + API_STR2PTR(scm_i_string_chars (signal_data))); API_RETURN_OK; } @@ -2966,7 +2969,7 @@ weechat_guile_api_hook_completion_list_add (SCM completion, SCM word, || !scm_is_integer (nick_completion) || !scm_is_string (where)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_hook_completion_list_add (script_str2ptr (scm_i_string_chars (completion)), + weechat_hook_completion_list_add (API_STR2PTR(scm_i_string_chars (completion)), scm_i_string_chars (word), scm_to_int (nick_completion), scm_i_string_chars (where)); @@ -3303,7 +3306,7 @@ weechat_guile_api_unhook (SCM hook) script_api_unhook (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (hook))); + API_STR2PTR(scm_i_string_chars (hook))); API_RETURN_OK; } @@ -3499,7 +3502,7 @@ weechat_guile_api_buffer_clear (SCM buffer) if (!scm_is_string (buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_clear (script_str2ptr (scm_i_string_chars (buffer))); + weechat_buffer_clear (API_STR2PTR(scm_i_string_chars (buffer))); API_RETURN_OK; } @@ -3517,7 +3520,7 @@ weechat_guile_api_buffer_close (SCM buffer) script_api_buffer_close (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer))); + API_STR2PTR(scm_i_string_chars (buffer))); API_RETURN_OK; } @@ -3533,8 +3536,8 @@ weechat_guile_api_buffer_merge (SCM buffer, SCM target_buffer) if (!scm_is_string (buffer) || !scm_is_string (target_buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_merge (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (target_buffer))); + weechat_buffer_merge (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (target_buffer))); API_RETURN_OK; } @@ -3551,7 +3554,7 @@ weechat_guile_api_buffer_unmerge (SCM buffer, SCM number) if (!scm_is_string (buffer) || !scm_is_integer (number)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_unmerge (script_str2ptr (scm_i_string_chars (buffer)), + weechat_buffer_unmerge (API_STR2PTR(scm_i_string_chars (buffer)), scm_to_int (number)); API_RETURN_OK; @@ -3570,7 +3573,7 @@ weechat_guile_api_buffer_get_integer (SCM buffer, SCM property) if (!scm_is_string (buffer) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_buffer_get_integer (script_str2ptr (scm_i_string_chars (buffer)), + value = weechat_buffer_get_integer (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (property)); API_RETURN_INT(value); @@ -3589,7 +3592,7 @@ weechat_guile_api_buffer_get_string (SCM buffer, SCM property) if (!scm_is_string (buffer) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_buffer_get_string (script_str2ptr (scm_i_string_chars (buffer)), + result = weechat_buffer_get_string (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (property)); API_RETURN_STRING(result); @@ -3609,7 +3612,7 @@ weechat_guile_api_buffer_get_pointer (SCM buffer, SCM property) if (!scm_is_string (buffer) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (scm_i_string_chars (buffer)), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (property))); API_RETURN_STRING_FREE(result); @@ -3627,7 +3630,7 @@ weechat_guile_api_buffer_set (SCM buffer, SCM property, SCM value) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_set (script_str2ptr (scm_i_string_chars (buffer)), + weechat_buffer_set (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (property), scm_i_string_chars (value)); @@ -3650,7 +3653,7 @@ weechat_guile_api_buffer_string_replace_local_var (SCM buffer, SCM string) if (!scm_is_string (buffer) || !scm_is_string (string)) API_WRONG_ARGS(API_RETURN_ERROR); - result = weechat_buffer_string_replace_local_var (script_str2ptr (scm_i_string_chars (buffer)), + result = weechat_buffer_string_replace_local_var (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (string)); API_RETURN_STRING_FREE(result); @@ -3669,7 +3672,7 @@ weechat_guile_api_buffer_match_list (SCM buffer, SCM string) if (!scm_is_string (buffer) || !scm_is_string (string)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_buffer_match_list (script_str2ptr (scm_i_string_chars (buffer)), + value = weechat_buffer_match_list (API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (string)); API_RETURN_INT(value); @@ -3707,7 +3710,7 @@ weechat_guile_api_window_search_with_buffer (SCM buffer) if (!scm_is_string (buffer)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (scm_i_string_chars (buffer)))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(scm_i_string_chars (buffer)))); API_RETURN_STRING_FREE(result); } @@ -3725,7 +3728,7 @@ weechat_guile_api_window_get_integer (SCM window, SCM property) if (!scm_is_string (window) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_window_get_integer (script_str2ptr (scm_i_string_chars (window)), + value = weechat_window_get_integer (API_STR2PTR(scm_i_string_chars (window)), scm_i_string_chars (property)); API_RETURN_INT(value); @@ -3744,7 +3747,7 @@ weechat_guile_api_window_get_string (SCM window, SCM property) if (!scm_is_string (window) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_window_get_string (script_str2ptr (scm_i_string_chars (window)), + result = weechat_window_get_string (API_STR2PTR(scm_i_string_chars (window)), scm_i_string_chars (property)); API_RETURN_STRING(result); @@ -3764,7 +3767,7 @@ weechat_guile_api_window_get_pointer (SCM window, SCM property) if (!scm_is_string (window) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (scm_i_string_chars (window)), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(scm_i_string_chars (window)), scm_i_string_chars (property))); API_RETURN_STRING_FREE(result); @@ -3803,8 +3806,8 @@ weechat_guile_api_nicklist_add_group (SCM buffer, SCM parent_group, SCM name, || !scm_is_integer (visible)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (parent_group)), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (parent_group)), scm_i_string_chars (name), scm_i_string_chars (color), scm_to_int (visible))); @@ -3827,8 +3830,8 @@ weechat_guile_api_nicklist_search_group (SCM buffer, SCM from_group, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (from_group)), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (from_group)), scm_i_string_chars (name))); API_RETURN_STRING_FREE(result); @@ -3853,8 +3856,8 @@ weechat_guile_api_nicklist_add_nick (SCM buffer, SCM group, SCM name, || !scm_is_integer (visible)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group)), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group)), scm_i_string_chars (name), scm_i_string_chars (color), scm_i_string_chars (prefix), @@ -3879,8 +3882,8 @@ weechat_guile_api_nicklist_search_nick (SCM buffer, SCM from_group, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (from_group)), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (from_group)), scm_i_string_chars (name))); API_RETURN_STRING_FREE(result); @@ -3897,8 +3900,8 @@ weechat_guile_api_nicklist_remove_group (SCM buffer, SCM group) if (!scm_is_string (buffer) || !scm_is_string (group)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_group (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group))); + weechat_nicklist_remove_group (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group))); API_RETURN_OK; } @@ -3914,8 +3917,8 @@ weechat_guile_api_nicklist_remove_nick (SCM buffer, SCM nick) if (!scm_is_string (buffer) || !scm_is_string (nick)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_nick (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (nick))); + weechat_nicklist_remove_nick (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (nick))); API_RETURN_OK; } @@ -3931,7 +3934,7 @@ weechat_guile_api_nicklist_remove_all (SCM buffer) if (!scm_is_string (buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_all (script_str2ptr (scm_i_string_chars (buffer))); + weechat_nicklist_remove_all (API_STR2PTR(scm_i_string_chars (buffer))); API_RETURN_OK; } @@ -3951,8 +3954,8 @@ weechat_guile_api_nicklist_group_get_integer (SCM buffer, SCM group, || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_nicklist_group_get_integer (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group)), + value = weechat_nicklist_group_get_integer (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group)), scm_i_string_chars (property)); API_RETURN_INT(value); @@ -3973,8 +3976,8 @@ weechat_guile_api_nicklist_group_get_string (SCM buffer, SCM group, || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_nicklist_group_get_string (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group)), + result = weechat_nicklist_group_get_string (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group)), scm_i_string_chars (property)); API_RETURN_STRING(result); @@ -3996,8 +3999,8 @@ weechat_guile_api_nicklist_group_get_pointer (SCM buffer, SCM group, || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group)), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group)), scm_i_string_chars (property))); API_RETURN_STRING_FREE(result); @@ -4015,8 +4018,8 @@ weechat_guile_api_nicklist_group_set (SCM buffer, SCM group, SCM property, if (!scm_is_string (buffer) || !scm_is_string (group) || !scm_is_string (property) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_group_set (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (group)), + weechat_nicklist_group_set (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (group)), scm_i_string_chars (property), scm_i_string_chars (value)); @@ -4037,8 +4040,8 @@ weechat_guile_api_nicklist_nick_get_integer (SCM buffer, SCM nick, SCM property) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_nicklist_nick_get_integer (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (nick)), + value = weechat_nicklist_nick_get_integer (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (nick)), scm_i_string_chars (property)); API_RETURN_INT(value); @@ -4058,8 +4061,8 @@ weechat_guile_api_nicklist_nick_get_string (SCM buffer, SCM nick, SCM property) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_nicklist_nick_get_string (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (nick)), + result = weechat_nicklist_nick_get_string (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (nick)), scm_i_string_chars (property)); API_RETURN_STRING(result); @@ -4080,8 +4083,8 @@ weechat_guile_api_nicklist_nick_get_pointer (SCM buffer, SCM nick, SCM property) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (nick)), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (nick)), scm_i_string_chars (property))); API_RETURN_STRING_FREE(result); @@ -4100,8 +4103,8 @@ weechat_guile_api_nicklist_nick_set (SCM buffer, SCM nick, SCM property, || !scm_is_string (property) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_nick_set (script_str2ptr (scm_i_string_chars (buffer)), - script_str2ptr (scm_i_string_chars (nick)), + weechat_nicklist_nick_set (API_STR2PTR(scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (nick)), scm_i_string_chars (property), scm_i_string_chars (value)); @@ -4217,7 +4220,7 @@ weechat_guile_api_bar_item_remove (SCM item) script_api_bar_item_remove (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (item))); + API_STR2PTR(scm_i_string_chars (item))); API_RETURN_OK; } @@ -4315,7 +4318,7 @@ weechat_guile_api_bar_set (SCM bar, SCM property, SCM value) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_set (script_str2ptr (scm_i_string_chars (bar)), + weechat_bar_set (API_STR2PTR(scm_i_string_chars (bar)), scm_i_string_chars (property), scm_i_string_chars (value)); @@ -4349,7 +4352,7 @@ weechat_guile_api_bar_remove (SCM bar) if (!scm_is_string (bar)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_remove (script_str2ptr (scm_i_string_chars (bar))); + weechat_bar_remove (API_STR2PTR(scm_i_string_chars (bar))); API_RETURN_OK; } @@ -4367,7 +4370,7 @@ weechat_guile_api_command (SCM buffer, SCM command) script_api_command (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (buffer)), + API_STR2PTR(scm_i_string_chars (buffer)), scm_i_string_chars (command)); API_RETURN_OK; @@ -4452,7 +4455,7 @@ weechat_guile_api_infolist_new_item (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (scm_i_string_chars (infolist)))); + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(scm_i_string_chars (infolist)))); API_RETURN_STRING_FREE(result); } @@ -4473,7 +4476,7 @@ weechat_guile_api_infolist_new_var_integer (SCM infolist, SCM name, SCM value) || !scm_is_integer (value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (scm_i_string_chars (infolist)), + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (name), scm_to_int (value))); @@ -4496,7 +4499,7 @@ weechat_guile_api_infolist_new_var_string (SCM infolist, SCM name, SCM value) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (scm_i_string_chars (infolist)), + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (name), scm_i_string_chars (value))); @@ -4519,9 +4522,9 @@ weechat_guile_api_infolist_new_var_pointer (SCM infolist, SCM name, SCM value) || !scm_is_string (value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (scm_i_string_chars (infolist)), + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (name), - script_str2ptr (scm_i_string_chars (value)))); + API_STR2PTR(scm_i_string_chars (value)))); API_RETURN_STRING_FREE(result); } @@ -4541,7 +4544,7 @@ weechat_guile_api_infolist_new_var_time (SCM infolist, SCM name, SCM value) || !scm_is_integer (value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (scm_i_string_chars (infolist)), + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (name), scm_to_int (value))); @@ -4564,7 +4567,7 @@ weechat_guile_api_infolist_get (SCM name, SCM pointer, SCM arguments) API_WRONG_ARGS(API_RETURN_EMPTY); result = script_ptr2str (weechat_infolist_get (scm_i_string_chars (name), - script_str2ptr (scm_i_string_chars (pointer)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (arguments))); API_RETURN_STRING_FREE(result); @@ -4583,7 +4586,7 @@ weechat_guile_api_infolist_next (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_next (script_str2ptr (scm_i_string_chars (infolist))); + value = weechat_infolist_next (API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_INT(value); } @@ -4602,7 +4605,7 @@ weechat_guile_api_infolist_prev (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_prev (script_str2ptr (scm_i_string_chars (infolist))); + value = weechat_infolist_prev (API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_INT(value); } @@ -4619,7 +4622,7 @@ weechat_guile_api_infolist_reset_item_cursor (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_reset_item_cursor (script_str2ptr (scm_i_string_chars (infolist))); + weechat_infolist_reset_item_cursor (API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_OK; } @@ -4637,7 +4640,7 @@ weechat_guile_api_infolist_fields (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_fields (script_str2ptr (scm_i_string_chars (infolist))); + result = weechat_infolist_fields (API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_STRING(result); } @@ -4656,7 +4659,7 @@ weechat_guile_api_infolist_integer (SCM infolist, SCM variable) if (!scm_is_string (infolist) || !scm_is_string (variable)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_integer (script_str2ptr (scm_i_string_chars (infolist)), + value = weechat_infolist_integer (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (variable)); API_RETURN_INT(value); @@ -4675,7 +4678,7 @@ weechat_guile_api_infolist_string (SCM infolist, SCM variable) if (!scm_is_string (infolist) || !scm_is_string (variable)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_string (script_str2ptr (scm_i_string_chars (infolist)), + result = weechat_infolist_string (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (variable)); API_RETURN_STRING(result); @@ -4696,7 +4699,7 @@ weechat_guile_api_infolist_pointer (SCM infolist, SCM variable) if (!scm_is_string (infolist) || !scm_is_string (variable)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (scm_i_string_chars (infolist)), + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (variable))); API_RETURN_STRING_FREE(result); @@ -4719,7 +4722,7 @@ weechat_guile_api_infolist_time (SCM infolist, SCM variable) API_WRONG_ARGS(API_RETURN_EMPTY); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (scm_i_string_chars (infolist)), + time = weechat_infolist_time (API_STR2PTR(scm_i_string_chars (infolist)), scm_i_string_chars (variable)); date_tmp = localtime (&time); if (date_tmp) @@ -4740,7 +4743,7 @@ weechat_guile_api_infolist_free (SCM infolist) if (!scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_free (script_str2ptr (scm_i_string_chars (infolist))); + weechat_infolist_free (API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_OK; } @@ -4777,7 +4780,7 @@ weechat_guile_api_hdata_get_var_offset (SCM hdata, SCM name) if (!scm_is_string (hdata) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_get_var_offset (script_str2ptr (scm_i_string_chars (hdata)), + value = weechat_hdata_get_var_offset (API_STR2PTR(scm_i_string_chars (hdata)), scm_i_string_chars (name)); API_RETURN_INT(value); @@ -4797,7 +4800,7 @@ weechat_guile_api_hdata_get_var_type_string (SCM hdata, SCM name) if (!scm_is_string (hdata) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_var_type_string (script_str2ptr (scm_i_string_chars (hdata)), + result = weechat_hdata_get_var_type_string (API_STR2PTR(scm_i_string_chars (hdata)), scm_i_string_chars (name)); API_RETURN_STRING(result); @@ -4816,7 +4819,7 @@ weechat_guile_api_hdata_get_var_hdata (SCM hdata, SCM name) if (!scm_is_string (hdata) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_var_hdata (script_str2ptr (scm_i_string_chars (hdata)), + result = weechat_hdata_get_var_hdata (API_STR2PTR(scm_i_string_chars (hdata)), scm_i_string_chars (name)); API_RETURN_STRING(result); @@ -4836,7 +4839,7 @@ weechat_guile_api_hdata_get_list (SCM hdata, SCM name) if (!scm_is_string (hdata) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (scm_i_string_chars (hdata)), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(scm_i_string_chars (hdata)), scm_i_string_chars (name))); API_RETURN_STRING_FREE(result); @@ -4856,9 +4859,9 @@ weechat_guile_api_hdata_check_pointer (SCM hdata, SCM list, SCM pointer) || !scm_is_string (pointer)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_check_pointer (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (list)), - script_str2ptr (scm_i_string_chars (pointer))); + value = weechat_hdata_check_pointer (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (list)), + API_STR2PTR(scm_i_string_chars (pointer))); API_RETURN_INT(value); } @@ -4878,8 +4881,8 @@ weechat_guile_api_hdata_move (SCM hdata, SCM pointer, SCM count) || !scm_is_integer (count)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_move (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + result = weechat_hdata_move (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_to_int (count)); API_RETURN_STRING_FREE(result); @@ -4900,8 +4903,8 @@ weechat_guile_api_hdata_char (SCM hdata, SCM pointer, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = (int)weechat_hdata_char (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + value = (int)weechat_hdata_char (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name)); API_RETURN_INT(value); @@ -4922,8 +4925,8 @@ weechat_guile_api_hdata_integer (SCM hdata, SCM pointer, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_integer (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + value = weechat_hdata_integer (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name)); API_RETURN_INT(value); @@ -4944,8 +4947,8 @@ weechat_guile_api_hdata_long (SCM hdata, SCM pointer, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_LONG(0)); - value = weechat_hdata_long (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + value = weechat_hdata_long (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name)); API_RETURN_LONG(value); @@ -4966,8 +4969,8 @@ weechat_guile_api_hdata_string (SCM hdata, SCM pointer, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_string (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + result = weechat_hdata_string (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name)); API_RETURN_STRING(result); @@ -4989,8 +4992,8 @@ weechat_guile_api_hdata_pointer (SCM hdata, SCM pointer, SCM name) || !scm_is_string (name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name))); API_RETURN_STRING_FREE(result); @@ -5014,8 +5017,8 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name) API_WRONG_ARGS(API_RETURN_EMPTY); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + time = weechat_hdata_time (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name)); date_tmp = localtime (&time); if (date_tmp) @@ -5041,8 +5044,8 @@ weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name) API_WRONG_ARGS(API_RETURN_EMPTY); result_alist = weechat_guile_hashtable_to_alist ( - weechat_hdata_hashtable (script_str2ptr (scm_i_string_chars (hdata)), - script_str2ptr (scm_i_string_chars (pointer)), + weechat_hdata_hashtable (API_STR2PTR(scm_i_string_chars (hdata)), + API_STR2PTR(scm_i_string_chars (pointer)), scm_i_string_chars (name))); return result_alist; @@ -5061,7 +5064,7 @@ weechat_guile_api_hdata_get_string (SCM hdata, SCM property) if (!scm_is_string (hdata) || !scm_is_string (property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_var_type_string (script_str2ptr (scm_i_string_chars (hdata)), + result = weechat_hdata_get_var_type_string (API_STR2PTR(scm_i_string_chars (hdata)), scm_i_string_chars (property)); API_RETURN_STRING(result); @@ -5102,9 +5105,9 @@ weechat_guile_api_upgrade_write_object (SCM upgrade_file, SCM object_id, || !scm_is_string (infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - rc = weechat_upgrade_write_object (script_str2ptr (scm_i_string_chars (upgrade_file)), + rc = weechat_upgrade_write_object (API_STR2PTR(scm_i_string_chars (upgrade_file)), scm_to_int (object_id), - script_str2ptr (scm_i_string_chars (infolist))); + API_STR2PTR(scm_i_string_chars (infolist))); API_RETURN_INT(rc); } @@ -5175,7 +5178,7 @@ weechat_guile_api_upgrade_read (SCM upgrade_file, SCM function, SCM data) rc = script_api_upgrade_read (weechat_guile_plugin, guile_current_script, - script_str2ptr (scm_i_string_chars (upgrade_file)), + API_STR2PTR(scm_i_string_chars (upgrade_file)), &weechat_guile_api_upgrade_read_cb, scm_i_string_chars (function), scm_i_string_chars (data)); @@ -5194,7 +5197,7 @@ weechat_guile_api_upgrade_close (SCM upgrade_file) if (!scm_is_string (upgrade_file)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_upgrade_close (script_str2ptr (scm_i_string_chars (upgrade_file))); + weechat_upgrade_close (API_STR2PTR(scm_i_string_chars (upgrade_file))); API_RETURN_OK; } diff --git a/src/plugins/scripts/guile/weechat-guile.c b/src/plugins/scripts/guile/weechat-guile.c index ee07f46e2..574d30849 100644 --- a/src/plugins/scripts/guile/weechat-guile.c +++ b/src/plugins/scripts/guile/weechat-guile.c @@ -367,7 +367,7 @@ weechat_guile_load (const char *filename) char *filename2, *ptr_base_name, *base_name; SCM module; - if ((weechat_guile_plugin->debug >= 1) || !guile_quiet) + if ((weechat_guile_plugin->debug >= 2) || !guile_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -437,7 +437,7 @@ weechat_guile_unload (struct t_plugin_script *script) { int *rc; - if ((weechat_guile_plugin->debug >= 1) || !guile_quiet) + if ((weechat_guile_plugin->debug >= 2) || !guile_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 29e7a794a..ca787456b 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -54,6 +54,9 @@ lua_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_lua_plugin, LUA_CURRENT_SCRIPT_NAME, \ + lua_function_name, __string) #define API_RETURN_OK return 1 #define API_RETURN_ERROR return 0 #define API_RETURN_EMPTY \ @@ -129,7 +132,7 @@ weechat_lua_api_register (lua_State *L) if (lua_current_script) { lua_registered_script = lua_current_script; - if ((weechat_lua_plugin->debug >= 1) || !lua_quiet) + if ((weechat_lua_plugin->debug >= 2) || !lua_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -161,7 +164,7 @@ weechat_lua_api_plugin_get_name (lua_State *L) plugin = lua_tostring (lua_current_interpreter, -1); - result = weechat_plugin_get_name (script_str2ptr (plugin)); + result = weechat_plugin_get_name (API_STR2PTR(plugin)); API_RETURN_STRING(result); } @@ -547,10 +550,10 @@ weechat_lua_api_list_add (lua_State *L) where = lua_tostring (lua_current_interpreter, -2); user_data = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_add (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_add (API_STR2PTR(weelist), data, where, - script_str2ptr (user_data))); + API_STR2PTR(user_data))); API_RETURN_STRING_FREE(result); } @@ -572,7 +575,7 @@ weechat_lua_api_list_search (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); data = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_search (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_search (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -595,7 +598,7 @@ weechat_lua_api_list_search_pos (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); data = lua_tostring (lua_current_interpreter, -1); - pos = weechat_list_search_pos (script_str2ptr (weelist), data); + pos = weechat_list_search_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -617,7 +620,7 @@ weechat_lua_api_list_casesearch (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); data = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -641,7 +644,7 @@ weechat_lua_api_list_casesearch_pos (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); data = lua_tostring (lua_current_interpreter, -1); - pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data); + pos = weechat_list_casesearch_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -664,7 +667,7 @@ weechat_lua_api_list_get (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); position = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_get (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_get (API_STR2PTR(weelist), position)); API_RETURN_STRING_FREE(result); @@ -686,7 +689,7 @@ weechat_lua_api_list_set (lua_State *L) item = lua_tostring (lua_current_interpreter, -2); new_value = lua_tostring (lua_current_interpreter, -1); - weechat_list_set (script_str2ptr (item), + weechat_list_set (API_STR2PTR(item), new_value); API_RETURN_OK; @@ -708,7 +711,7 @@ weechat_lua_api_list_next (lua_State *L) item = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_next (script_str2ptr (item))); + result = script_ptr2str (weechat_list_next (API_STR2PTR(item))); API_RETURN_STRING_FREE(result); } @@ -729,7 +732,7 @@ weechat_lua_api_list_prev (lua_State *L) item = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_list_prev (script_str2ptr (item))); + result = script_ptr2str (weechat_list_prev (API_STR2PTR(item))); API_RETURN_STRING_FREE(result); } @@ -749,7 +752,7 @@ weechat_lua_api_list_string (lua_State *L) item = lua_tostring (lua_current_interpreter, -1); - result = weechat_list_string (script_str2ptr (item)); + result = weechat_list_string (API_STR2PTR(item)); API_RETURN_STRING(result); } @@ -770,7 +773,7 @@ weechat_lua_api_list_size (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -1); - size = weechat_list_size (script_str2ptr (weelist)); + size = weechat_list_size (API_STR2PTR(weelist)); API_RETURN_INT(size); } @@ -791,8 +794,8 @@ weechat_lua_api_list_remove (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -2); item = lua_tostring (lua_current_interpreter, -1); - weechat_list_remove (script_str2ptr (weelist), - script_str2ptr (item)); + weechat_list_remove (API_STR2PTR(weelist), + API_STR2PTR(item)); API_RETURN_OK; } @@ -812,7 +815,7 @@ weechat_lua_api_list_remove_all (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -1); - weechat_list_remove_all (script_str2ptr (weelist)); + weechat_list_remove_all (API_STR2PTR(weelist)); API_RETURN_OK; } @@ -832,7 +835,7 @@ weechat_lua_api_list_free (lua_State *L) weelist = lua_tostring (lua_current_interpreter, -1); - weechat_list_free (script_str2ptr (weelist)); + weechat_list_free (API_STR2PTR(weelist)); API_RETURN_OK; } @@ -1175,7 +1178,7 @@ weechat_lua_api_config_new_section (lua_State *L) result = script_ptr2str (script_api_config_new_section (weechat_lua_plugin, lua_current_script, - script_str2ptr (config_file), + API_STR2PTR(config_file), name, user_can_add_options, user_can_delete_options, @@ -1215,7 +1218,7 @@ weechat_lua_api_config_search_section (lua_State *L) config_file = lua_tostring (lua_current_interpreter, -2); section_name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(config_file), section_name)); API_RETURN_STRING_FREE(result); @@ -1369,8 +1372,8 @@ weechat_lua_api_config_new_option (lua_State *L) result = script_ptr2str (script_api_config_new_option (weechat_lua_plugin, lua_current_script, - script_str2ptr (config_file), - script_str2ptr (section), + API_STR2PTR(config_file), + API_STR2PTR(section), name, type, description, @@ -1411,8 +1414,8 @@ weechat_lua_api_config_search_option (lua_State *L) section = lua_tostring (lua_current_interpreter, -2); option_name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file), - script_str2ptr (section), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(config_file), + API_STR2PTR(section), option_name)); API_RETURN_STRING_FREE(result); @@ -1456,7 +1459,7 @@ weechat_lua_api_config_option_reset (lua_State *L) option = lua_tostring (lua_current_interpreter, -2); run_callback = lua_tonumber (lua_current_interpreter, -1); - rc = weechat_config_option_reset (script_str2ptr (option), + rc = weechat_config_option_reset (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1480,7 +1483,7 @@ weechat_lua_api_config_option_set (lua_State *L) new_value = lua_tostring (lua_current_interpreter, -2); run_callback = lua_tonumber (lua_current_interpreter, -1); - rc = weechat_config_option_set (script_str2ptr (option), + rc = weechat_config_option_set (API_STR2PTR(option), new_value, run_callback); @@ -1505,7 +1508,7 @@ weechat_lua_api_config_option_set_null (lua_State *L) option = lua_tostring (lua_current_interpreter, -2); run_callback = lua_tonumber (lua_current_interpreter, -1); - rc = weechat_config_option_set_null (script_str2ptr (option), + rc = weechat_config_option_set_null (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1527,7 +1530,7 @@ weechat_lua_api_config_option_unset (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - rc = weechat_config_option_unset (script_str2ptr (option)); + rc = weechat_config_option_unset (API_STR2PTR(option)); API_RETURN_INT(rc); } @@ -1548,7 +1551,7 @@ weechat_lua_api_config_option_rename (lua_State *L) option = lua_tostring (lua_current_interpreter, -2); new_name = lua_tostring (lua_current_interpreter, -1); - weechat_config_option_rename (script_str2ptr (option), + weechat_config_option_rename (API_STR2PTR(option), new_name); API_RETURN_OK; @@ -1570,7 +1573,7 @@ weechat_lua_api_config_option_is_null (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_option_is_null (script_str2ptr (option)); + value = weechat_config_option_is_null (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1592,7 +1595,7 @@ weechat_lua_api_config_option_default_is_null (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_option_default_is_null (script_str2ptr (option)); + value = weechat_config_option_default_is_null (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1613,7 +1616,7 @@ weechat_lua_api_config_boolean (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_boolean (script_str2ptr (option)); + value = weechat_config_boolean (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1634,7 +1637,7 @@ weechat_lua_api_config_boolean_default (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_boolean_default (script_str2ptr (option)); + value = weechat_config_boolean_default (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1655,7 +1658,7 @@ weechat_lua_api_config_integer (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_integer (script_str2ptr (option)); + value = weechat_config_integer (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1676,7 +1679,7 @@ weechat_lua_api_config_integer_default (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - value = weechat_config_integer_default (script_str2ptr (option)); + value = weechat_config_integer_default (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1696,7 +1699,7 @@ weechat_lua_api_config_string (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - result = weechat_config_string (script_str2ptr (option)); + result = weechat_config_string (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1716,7 +1719,7 @@ weechat_lua_api_config_string_default (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - result = weechat_config_string_default (script_str2ptr (option)); + result = weechat_config_string_default (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1736,7 +1739,7 @@ weechat_lua_api_config_color (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - result = weechat_config_color (script_str2ptr (option)); + result = weechat_config_color (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1756,7 +1759,7 @@ weechat_lua_api_config_color_default (lua_State *L) option = lua_tostring (lua_current_interpreter, -1); - result = weechat_config_color_default (script_str2ptr (option)); + result = weechat_config_color_default (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1777,8 +1780,8 @@ weechat_lua_api_config_write_option (lua_State *L) config_file = lua_tostring (lua_current_interpreter, -2); option = lua_tostring (lua_current_interpreter, -1); - weechat_config_write_option (script_str2ptr (config_file), - script_str2ptr (option)); + weechat_config_write_option (API_STR2PTR(config_file), + API_STR2PTR(option)); API_RETURN_OK; } @@ -1800,7 +1803,7 @@ weechat_lua_api_config_write_line (lua_State *L) option_name = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - weechat_config_write_line (script_str2ptr (config_file), + weechat_config_write_line (API_STR2PTR(config_file), option_name, "%s", value); @@ -1824,7 +1827,7 @@ weechat_lua_api_config_write (lua_State *L) config_file = lua_tostring (lua_current_interpreter, -1); - rc = weechat_config_write (script_str2ptr (config_file)); + rc = weechat_config_write (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1845,7 +1848,7 @@ weechat_lua_api_config_read (lua_State *L) config_file = lua_tostring (lua_current_interpreter, -1); - rc = weechat_config_read (script_str2ptr (config_file)); + rc = weechat_config_read (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1866,7 +1869,7 @@ weechat_lua_api_config_reload (lua_State *L) config_file = lua_tostring (lua_current_interpreter, -1); - rc = weechat_config_reload (script_str2ptr (config_file)); + rc = weechat_config_reload (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1888,7 +1891,7 @@ weechat_lua_api_config_option_free (lua_State *L) script_api_config_option_free (weechat_lua_plugin, lua_current_script, - script_str2ptr (option)); + API_STR2PTR(option)); API_RETURN_OK; } @@ -1911,7 +1914,7 @@ weechat_lua_api_config_section_free_options (lua_State *L) script_api_config_section_free_options (weechat_lua_plugin, lua_current_script, - script_str2ptr (section)); + API_STR2PTR(section)); API_RETURN_OK; } @@ -1933,7 +1936,7 @@ weechat_lua_api_config_section_free (lua_State *L) script_api_config_section_free (weechat_lua_plugin, lua_current_script, - script_str2ptr (section)); + API_STR2PTR(section)); API_RETURN_OK; } @@ -1955,7 +1958,7 @@ weechat_lua_api_config_free (lua_State *L) script_api_config_free (weechat_lua_plugin, lua_current_script, - script_str2ptr (config_file)); + API_STR2PTR(config_file)); API_RETURN_OK; } @@ -2205,7 +2208,7 @@ weechat_lua_api_print (lua_State *L) script_api_printf (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), "%s", message); API_RETURN_OK; @@ -2233,7 +2236,7 @@ weechat_lua_api_print_date_tags (lua_State *L) script_api_printf_date_tags (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), date, tags, "%s", message); @@ -2261,7 +2264,7 @@ weechat_lua_api_print_y (lua_State *L) script_api_printf_y (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), y, "%s", message); @@ -2883,7 +2886,7 @@ weechat_lua_api_hook_print (lua_State *L) result = script_ptr2str (script_api_hook_print (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), tags, message, strip_colors, @@ -3017,7 +3020,7 @@ weechat_lua_api_hook_signal_send (lua_State *L) { signal_data = lua_tostring (lua_current_interpreter, -1); weechat_hook_signal_send (signal, type_data, - script_str2ptr (signal_data)); + API_STR2PTR(signal_data)); API_RETURN_OK; } @@ -3281,7 +3284,7 @@ weechat_lua_api_hook_completion_list_add (lua_State *L) nick_completion = lua_tonumber (lua_current_interpreter, -2); where = lua_tostring (lua_current_interpreter, -1); - weechat_hook_completion_list_add (script_str2ptr (completion), + weechat_hook_completion_list_add (API_STR2PTR(completion), word, nick_completion, where); @@ -3640,7 +3643,7 @@ weechat_lua_api_unhook (lua_State *L) script_api_unhook (weechat_lua_plugin, lua_current_script, - script_str2ptr (hook)); + API_STR2PTR(hook)); API_RETURN_OK; } @@ -3844,7 +3847,7 @@ weechat_lua_api_buffer_clear (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -1); - weechat_buffer_clear (script_str2ptr (buffer)); + weechat_buffer_clear (API_STR2PTR(buffer)); API_RETURN_OK; } @@ -3866,7 +3869,7 @@ weechat_lua_api_buffer_close (lua_State *L) script_api_buffer_close (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer)); + API_STR2PTR(buffer)); API_RETURN_OK; } @@ -3887,8 +3890,8 @@ weechat_lua_api_buffer_merge (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); target_buffer = lua_tostring (lua_current_interpreter, -1); - weechat_buffer_merge (script_str2ptr (buffer), - script_str2ptr (target_buffer)); + weechat_buffer_merge (API_STR2PTR(buffer), + API_STR2PTR(target_buffer)); API_RETURN_OK; } @@ -3911,7 +3914,7 @@ weechat_lua_api_buffer_unmerge (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); number = lua_tonumber (lua_current_interpreter, -1); - weechat_buffer_unmerge (script_str2ptr (buffer), number); + weechat_buffer_unmerge (API_STR2PTR(buffer), number); API_RETURN_OK; } @@ -3933,7 +3936,7 @@ weechat_lua_api_buffer_get_integer (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - value = weechat_buffer_get_integer (script_str2ptr (buffer), + value = weechat_buffer_get_integer (API_STR2PTR(buffer), property); API_RETURN_INT(value); @@ -3955,7 +3958,7 @@ weechat_lua_api_buffer_get_string (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = weechat_buffer_get_string (script_str2ptr (buffer), + result = weechat_buffer_get_string (API_STR2PTR(buffer), property); API_RETURN_STRING(result); @@ -3978,7 +3981,7 @@ weechat_lua_api_buffer_get_pointer (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(buffer), property)); API_RETURN_STRING_FREE(result); @@ -4001,7 +4004,7 @@ weechat_lua_api_buffer_set (lua_State *L) property = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - weechat_buffer_set (script_str2ptr (buffer), property, value); + weechat_buffer_set (API_STR2PTR(buffer), property, value); API_RETURN_OK; } @@ -4024,7 +4027,7 @@ weechat_lua_api_buffer_string_replace_local_var (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); string = lua_tostring (lua_current_interpreter, -1); - result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string); + result = weechat_buffer_string_replace_local_var (API_STR2PTR(buffer), string); API_RETURN_STRING_FREE(result); } @@ -4046,7 +4049,7 @@ weechat_lua_api_buffer_match_list (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -2); string = lua_tostring (lua_current_interpreter, -1); - value = weechat_buffer_match_list (script_str2ptr (buffer), + value = weechat_buffer_match_list (API_STR2PTR(buffer), string); API_RETURN_INT(value); @@ -4085,7 +4088,7 @@ weechat_lua_api_window_search_with_buffer (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(buffer))); API_RETURN_STRING_FREE(result); } @@ -4107,7 +4110,7 @@ weechat_lua_api_window_get_integer (lua_State *L) window = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - value = weechat_window_get_integer (script_str2ptr (window), + value = weechat_window_get_integer (API_STR2PTR(window), property); API_RETURN_INT(value); @@ -4129,7 +4132,7 @@ weechat_lua_api_window_get_string (lua_State *L) window = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = weechat_window_get_string (script_str2ptr (window), + result = weechat_window_get_string (API_STR2PTR(window), property); API_RETURN_STRING(result); @@ -4152,7 +4155,7 @@ weechat_lua_api_window_get_pointer (lua_State *L) window = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(window), property)); API_RETURN_STRING_FREE(result); @@ -4199,8 +4202,8 @@ weechat_lua_api_nicklist_add_group (lua_State *L) color = lua_tostring (lua_current_interpreter, -2); visible = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer), - script_str2ptr (parent_group), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(buffer), + API_STR2PTR(parent_group), name, color, visible)); @@ -4226,8 +4229,8 @@ weechat_lua_api_nicklist_search_group (lua_State *L) from_group = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4256,8 +4259,8 @@ weechat_lua_api_nicklist_add_nick (lua_State *L) prefix_color = lua_tostring (lua_current_interpreter, -2); visible = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(buffer), + API_STR2PTR(group), name, color, prefix, @@ -4285,8 +4288,8 @@ weechat_lua_api_nicklist_search_nick (lua_State *L) from_group = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4308,8 +4311,8 @@ weechat_lua_api_nicklist_remove_group (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -3); group = lua_tostring (lua_current_interpreter, -2); - weechat_nicklist_remove_group (script_str2ptr (buffer), - script_str2ptr (group)); + weechat_nicklist_remove_group (API_STR2PTR(buffer), + API_STR2PTR(group)); API_RETURN_OK; } @@ -4330,8 +4333,8 @@ weechat_lua_api_nicklist_remove_nick (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -3); nick = lua_tostring (lua_current_interpreter, -2); - weechat_nicklist_remove_nick (script_str2ptr (buffer), - script_str2ptr (nick)); + weechat_nicklist_remove_nick (API_STR2PTR(buffer), + API_STR2PTR(nick)); API_RETURN_OK; } @@ -4351,7 +4354,7 @@ weechat_lua_api_nicklist_remove_all (lua_State *L) buffer = lua_tostring (lua_current_interpreter, -3); - weechat_nicklist_remove_all (script_str2ptr (buffer)); + weechat_nicklist_remove_all (API_STR2PTR(buffer)); API_RETURN_OK; } @@ -4374,8 +4377,8 @@ weechat_lua_api_nicklist_group_get_integer (lua_State *L) group = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), - script_str2ptr (group), + value = weechat_nicklist_group_get_integer (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_INT(value); @@ -4398,8 +4401,8 @@ weechat_lua_api_nicklist_group_get_string (lua_State *L) group = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = weechat_nicklist_group_get_string (script_str2ptr (buffer), - script_str2ptr (group), + result = weechat_nicklist_group_get_string (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_STRING(result); @@ -4423,8 +4426,8 @@ weechat_lua_api_nicklist_group_get_pointer (lua_State *L) group = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(group), property)); API_RETURN_STRING_FREE(result); @@ -4448,8 +4451,8 @@ weechat_lua_api_nicklist_group_set (lua_State *L) property = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - weechat_nicklist_group_set (script_str2ptr (buffer), - script_str2ptr (group), + weechat_nicklist_group_set (API_STR2PTR(buffer), + API_STR2PTR(group), property, value); @@ -4474,8 +4477,8 @@ weechat_lua_api_nicklist_nick_get_integer (lua_State *L) nick = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), - script_str2ptr (nick), + value = weechat_nicklist_nick_get_integer (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_INT(value); @@ -4498,8 +4501,8 @@ weechat_lua_api_nicklist_nick_get_string (lua_State *L) nick = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), - script_str2ptr (nick), + result = weechat_nicklist_nick_get_string (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_STRING(result); @@ -4523,8 +4526,8 @@ weechat_lua_api_nicklist_nick_get_pointer (lua_State *L) nick = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), - script_str2ptr (nick), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(nick), property)); API_RETURN_STRING_FREE(result); @@ -4548,8 +4551,8 @@ weechat_lua_api_nicklist_nick_set (lua_State *L) property = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - weechat_nicklist_nick_set (script_str2ptr (buffer), - script_str2ptr (nick), + weechat_nicklist_nick_set (API_STR2PTR(buffer), + API_STR2PTR(nick), property, value); @@ -4678,7 +4681,7 @@ weechat_lua_api_bar_item_remove (lua_State *L) script_api_bar_item_remove (weechat_lua_plugin, lua_current_script, - script_str2ptr (item)); + API_STR2PTR(item)); API_RETURN_OK; } @@ -4772,7 +4775,7 @@ weechat_lua_api_bar_set (lua_State *L) property = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - weechat_bar_set (script_str2ptr (bar), + weechat_bar_set (API_STR2PTR(bar), property, value); @@ -4814,7 +4817,7 @@ weechat_lua_api_bar_remove (lua_State *L) bar = lua_tostring (lua_current_interpreter, -1); - weechat_bar_remove (script_str2ptr (bar)); + weechat_bar_remove (API_STR2PTR(bar)); API_RETURN_OK; } @@ -4837,7 +4840,7 @@ weechat_lua_api_command (lua_State *L) script_api_command (weechat_lua_plugin, lua_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), command); API_RETURN_OK; @@ -4926,7 +4929,7 @@ weechat_lua_api_infolist_new_item (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist))); + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(infolist))); API_RETURN_STRING_FREE(result); } @@ -4951,7 +4954,7 @@ weechat_lua_api_infolist_new_var_integer (lua_State *L) name = lua_tostring (lua_current_interpreter, -2); value = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(infolist), name, value)); @@ -4977,7 +4980,7 @@ weechat_lua_api_infolist_new_var_string (lua_State *L) name = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(infolist), name, value)); @@ -5003,9 +5006,9 @@ weechat_lua_api_infolist_new_var_pointer (lua_State *L) name = lua_tostring (lua_current_interpreter, -2); value = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(infolist), name, - script_str2ptr (value))); + API_STR2PTR(value))); API_RETURN_STRING_FREE(result); } @@ -5029,7 +5032,7 @@ weechat_lua_api_infolist_new_var_time (lua_State *L) name = lua_tostring (lua_current_interpreter, -2); value = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(infolist), name, value)); @@ -5055,7 +5058,7 @@ weechat_lua_api_infolist_get (lua_State *L) arguments = lua_tostring (lua_current_interpreter, -1); result = script_ptr2str (weechat_infolist_get (name, - script_str2ptr (pointer), + API_STR2PTR(pointer), arguments)); API_RETURN_STRING_FREE(result); @@ -5077,7 +5080,7 @@ weechat_lua_api_infolist_next (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - value = weechat_infolist_next (script_str2ptr (infolist)); + value = weechat_infolist_next (API_STR2PTR(infolist)); API_RETURN_INT(value); } @@ -5098,7 +5101,7 @@ weechat_lua_api_infolist_prev (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - value = weechat_infolist_prev (script_str2ptr (infolist)); + value = weechat_infolist_prev (API_STR2PTR(infolist)); API_RETURN_INT(value); } @@ -5119,7 +5122,7 @@ weechat_lua_api_infolist_reset_item_cursor (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - weechat_infolist_reset_item_cursor (script_str2ptr (infolist)); + weechat_infolist_reset_item_cursor (API_STR2PTR(infolist)); API_RETURN_OK; } @@ -5139,7 +5142,7 @@ weechat_lua_api_infolist_fields (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - result = weechat_infolist_fields (script_str2ptr (infolist)); + result = weechat_infolist_fields (API_STR2PTR(infolist)); API_RETURN_STRING(result); } @@ -5161,7 +5164,7 @@ weechat_lua_api_infolist_integer (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -2); variable = lua_tostring (lua_current_interpreter, -1); - value = weechat_infolist_integer (script_str2ptr (infolist), + value = weechat_infolist_integer (API_STR2PTR(infolist), variable); API_RETURN_INT(value); @@ -5183,7 +5186,7 @@ weechat_lua_api_infolist_string (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -2); variable = lua_tostring (lua_current_interpreter, -1); - result = weechat_infolist_string (script_str2ptr (infolist), + result = weechat_infolist_string (API_STR2PTR(infolist), variable); API_RETURN_STRING(result); @@ -5206,7 +5209,7 @@ weechat_lua_api_infolist_pointer (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -2); variable = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(infolist), variable)); API_RETURN_STRING_FREE(result); @@ -5232,7 +5235,7 @@ weechat_lua_api_infolist_time (lua_State *L) variable = lua_tostring (lua_current_interpreter, -1); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (infolist), + time = weechat_infolist_time (API_STR2PTR(infolist), variable); date_tmp = localtime (&time); if (date_tmp) @@ -5257,7 +5260,7 @@ weechat_lua_api_infolist_free (lua_State *L) infolist = lua_tostring (lua_current_interpreter, -1); - weechat_infolist_free (script_str2ptr (infolist)); + weechat_infolist_free (API_STR2PTR(infolist)); API_RETURN_OK; } @@ -5300,7 +5303,7 @@ weechat_lua_api_hdata_get_var_offset (lua_State *L) hdata = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name); + value = weechat_hdata_get_var_offset (API_STR2PTR(hdata), name); API_RETURN_INT(value); } @@ -5322,7 +5325,7 @@ weechat_lua_api_hdata_get_var_type_string (lua_State *L) hdata = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_type_string (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5343,7 +5346,7 @@ weechat_lua_api_hdata_get_var_hdata (lua_State *L) hdata = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_hdata (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5365,7 +5368,7 @@ weechat_lua_api_hdata_get_list (lua_State *L) hdata = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(hdata), name)); API_RETURN_STRING_FREE(result); @@ -5389,9 +5392,9 @@ weechat_lua_api_hdata_check_pointer (lua_State *L) list = lua_tostring (lua_current_interpreter, -2); pointer = lua_tostring (lua_current_interpreter, -1); - value = weechat_hdata_check_pointer (script_str2ptr (hdata), - script_str2ptr (list), - script_str2ptr (pointer)); + value = weechat_hdata_check_pointer (API_STR2PTR(hdata), + API_STR2PTR(list), + API_STR2PTR(pointer)); API_RETURN_INT(value); } @@ -5415,8 +5418,8 @@ weechat_lua_api_hdata_move (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); count = lua_tonumber (lua_current_interpreter, -1); - result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_move (API_STR2PTR(hdata), + API_STR2PTR(pointer), count)); API_RETURN_STRING_FREE(result); @@ -5441,8 +5444,8 @@ weechat_lua_api_hdata_char (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - value = (int)weechat_hdata_char (script_str2ptr (hdata), - script_str2ptr (pointer), + value = (int)weechat_hdata_char (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5467,8 +5470,8 @@ weechat_lua_api_hdata_integer (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - value = weechat_hdata_integer (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_integer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5493,8 +5496,8 @@ weechat_lua_api_hdata_long (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - value = weechat_hdata_long (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_long (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_LONG(value); @@ -5518,8 +5521,8 @@ weechat_lua_api_hdata_string (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = weechat_hdata_string (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_STRING(result); @@ -5544,8 +5547,8 @@ weechat_lua_api_hdata_pointer (lua_State *L) pointer = lua_tostring (lua_current_interpreter, -2); name = lua_tostring (lua_current_interpreter, -1); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_STRING_FREE(result); @@ -5573,8 +5576,8 @@ weechat_lua_api_hdata_time (lua_State *L) name = lua_tostring (lua_current_interpreter, -1); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (hdata), - script_str2ptr (pointer), + time = weechat_hdata_time (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); date_tmp = localtime (&time); if (date_tmp) @@ -5603,8 +5606,8 @@ weechat_lua_api_hdata_hashtable (lua_State *L) name = lua_tostring (lua_current_interpreter, -1); weechat_lua_pushhashtable (lua_current_interpreter, - weechat_hdata_hashtable (script_str2ptr (hdata), - script_str2ptr (pointer), + weechat_hdata_hashtable (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); return 1; @@ -5626,7 +5629,7 @@ weechat_lua_api_hdata_get_string (lua_State *L) hdata = lua_tostring (lua_current_interpreter, -2); property = lua_tostring (lua_current_interpreter, -1); - result = weechat_hdata_get_string (script_str2ptr (hdata), property); + result = weechat_hdata_get_string (API_STR2PTR(hdata), property); API_RETURN_STRING(result); } @@ -5672,9 +5675,9 @@ weechat_lua_api_upgrade_write_object (lua_State *L) object_id = lua_tonumber (lua_current_interpreter, -2); infolist = lua_tostring (lua_current_interpreter, -1); - rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file), + rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file), object_id, - script_str2ptr (infolist)); + API_STR2PTR(infolist)); API_RETURN_INT(rc); } @@ -5748,7 +5751,7 @@ weechat_lua_api_upgrade_read (lua_State *L) rc = script_api_upgrade_read (weechat_lua_plugin, lua_current_script, - script_str2ptr (upgrade_file), + API_STR2PTR(upgrade_file), &weechat_lua_api_upgrade_read_cb, function, data); @@ -5771,7 +5774,7 @@ weechat_lua_api_upgrade_close (lua_State *L) upgrade_file = lua_tostring (lua_current_interpreter, -1); - weechat_upgrade_close (script_str2ptr (upgrade_file)); + weechat_upgrade_close (API_STR2PTR(upgrade_file)); API_RETURN_OK; } diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 1890765f1..a6f36a5e3 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -251,7 +251,7 @@ weechat_lua_load (const char *filename) return 0; } - if ((weechat_lua_plugin->debug >= 1) || !lua_quiet) + if ((weechat_lua_plugin->debug >= 2) || !lua_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -385,7 +385,7 @@ weechat_lua_unload (struct t_plugin_script *script) int *rc; void *interpreter; - if ((weechat_lua_plugin->debug >= 1) || !lua_quiet) + if ((weechat_lua_plugin->debug >= 2) || !lua_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 9cc6d37bd..4d3a4dacb 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -52,6 +52,9 @@ perl_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_perl_plugin, PERL_CURRENT_SCRIPT_NAME, \ + perl_function_name, __string) #define API_RETURN_OK XSRETURN_YES #define API_RETURN_ERROR XSRETURN_NO #define API_RETURN_EMPTY XSRETURN_EMPTY @@ -139,7 +142,7 @@ XS (XS_weechat_api_register) if (perl_current_script) { perl_registered_script = perl_current_script; - if ((weechat_perl_plugin->debug >= 1) || !perl_quiet) + if ((weechat_perl_plugin->debug >= 2) || !perl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -168,7 +171,7 @@ XS (XS_weechat_api_plugin_get_name) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_plugin_get_name (script_str2ptr (SvPV_nolen (ST (0)))); /* plugin */ + result = weechat_plugin_get_name (API_STR2PTR(SvPV_nolen (ST (0)))); /* plugin */ API_RETURN_STRING(result); } @@ -515,10 +518,10 @@ XS (XS_weechat_api_list_add) where = SvPV_nolen (ST (2)); user_data = SvPV_nolen (ST (3)); - result = script_ptr2str (weechat_list_add (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_add (API_STR2PTR(weelist), data, where, - script_str2ptr (user_data))); + API_STR2PTR(user_data))); API_RETURN_STRING_FREE(result); } @@ -539,7 +542,7 @@ XS (XS_weechat_api_list_search) weelist = SvPV_nolen (ST (0)); data = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_list_search (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_search (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -562,7 +565,7 @@ XS (XS_weechat_api_list_search_pos) weelist = SvPV_nolen (ST (0)); data = SvPV_nolen (ST (1)); - pos = weechat_list_search_pos (script_str2ptr (weelist), data); + pos = weechat_list_search_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -583,7 +586,7 @@ XS (XS_weechat_api_list_casesearch) weelist = SvPV_nolen (ST (0)); data = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -607,7 +610,7 @@ XS (XS_weechat_api_list_casesearch_pos) weelist = SvPV_nolen (ST (0)); data = SvPV_nolen (ST (1)); - pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data); + pos = weechat_list_casesearch_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -625,7 +628,7 @@ XS (XS_weechat_api_list_get) if (items < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_get (script_str2ptr (SvPV_nolen (ST (0))), /* weelist */ + result = script_ptr2str (weechat_list_get (API_STR2PTR(SvPV_nolen (ST (0))), /* weelist */ SvIV (ST (1)))); /* position */ API_RETURN_STRING_FREE(result); @@ -647,7 +650,7 @@ XS (XS_weechat_api_list_set) item = SvPV_nolen (ST (0)); new_value = SvPV_nolen (ST (1)); - weechat_list_set (script_str2ptr (item), new_value); + weechat_list_set (API_STR2PTR(item), new_value); API_RETURN_OK; } @@ -665,7 +668,7 @@ XS (XS_weechat_api_list_next) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_next (script_str2ptr (SvPV_nolen (ST (0))))); /* item */ + result = script_ptr2str (weechat_list_next (API_STR2PTR(SvPV_nolen (ST (0))))); /* item */ API_RETURN_STRING_FREE(result); } @@ -683,7 +686,7 @@ XS (XS_weechat_api_list_prev) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_prev (script_str2ptr (SvPV_nolen (ST (0))))); /* item */ + result = script_ptr2str (weechat_list_prev (API_STR2PTR(SvPV_nolen (ST (0))))); /* item */ API_RETURN_STRING_FREE(result); } @@ -701,7 +704,7 @@ XS (XS_weechat_api_list_string) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_list_string (script_str2ptr (SvPV_nolen (ST (0)))); /* item */ + result = weechat_list_string (API_STR2PTR(SvPV_nolen (ST (0)))); /* item */ API_RETURN_STRING(result); } @@ -719,7 +722,7 @@ XS (XS_weechat_api_list_size) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - size = weechat_list_size (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */ + size = weechat_list_size (API_STR2PTR(SvPV_nolen (ST (0)))); /* weelist */ API_RETURN_INT(size); } @@ -740,7 +743,8 @@ XS (XS_weechat_api_list_remove) weelist = SvPV_nolen (ST (0)); item = SvPV_nolen (ST (1)); - weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item)); + weechat_list_remove (API_STR2PTR(weelist), + API_STR2PTR(item)); API_RETURN_OK; } @@ -757,7 +761,7 @@ XS (XS_weechat_api_list_remove_all) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */ + weechat_list_remove_all (API_STR2PTR(SvPV_nolen (ST (0)))); /* weelist */ API_RETURN_OK; } @@ -774,7 +778,7 @@ XS (XS_weechat_api_list_free) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_free (script_str2ptr (SvPV_nolen (ST (0)))); /* weelist */ + weechat_list_free (API_STR2PTR(SvPV_nolen (ST (0)))); /* weelist */ API_RETURN_OK; } @@ -1113,7 +1117,7 @@ XS (XS_weechat_api_config_new_section) result = script_ptr2str (script_api_config_new_section (weechat_perl_plugin, perl_current_script, - script_str2ptr (cfg_file), + API_STR2PTR(cfg_file), name, SvIV (ST (2)), /* user_can_add_options */ SvIV (ST (3)), /* user_can_delete_options */ @@ -1152,7 +1156,7 @@ XS (XS_weechat_api_config_search_section) config_file = SvPV_nolen (ST (0)); section_name = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(config_file), section_name)); API_RETURN_STRING_FREE(result); @@ -1301,8 +1305,8 @@ XS (XS_weechat_api_config_new_option) result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin, perl_current_script, - script_str2ptr (config_file), - script_str2ptr (section), + API_STR2PTR(config_file), + API_STR2PTR(section), name, type, description, @@ -1342,8 +1346,8 @@ XS (XS_weechat_api_config_search_option) section = SvPV_nolen (ST (1)); option_name = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file), - script_str2ptr (section), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(config_file), + API_STR2PTR(section), option_name)); API_RETURN_STRING_FREE(result); @@ -1383,7 +1387,7 @@ XS (XS_weechat_api_config_option_reset) option = SvPV_nolen (ST (0)); - rc = weechat_config_option_reset (script_str2ptr (option), + rc = weechat_config_option_reset (API_STR2PTR(option), SvIV (ST (1))); /* run_callback */ API_RETURN_INT(rc); @@ -1406,7 +1410,7 @@ XS (XS_weechat_api_config_option_set) option = SvPV_nolen (ST (0)); new_value = SvPV_nolen (ST (1)); - rc = weechat_config_option_set (script_str2ptr (option), + rc = weechat_config_option_set (API_STR2PTR(option), new_value, SvIV (ST (2))); /* run_callback */ @@ -1429,7 +1433,7 @@ XS (XS_weechat_api_config_option_set_null) option = SvPV_nolen (ST (0)); - rc = weechat_config_option_set_null (script_str2ptr (option), + rc = weechat_config_option_set_null (API_STR2PTR(option), SvIV (ST (1))); /* run_callback */ API_RETURN_INT(rc); @@ -1451,7 +1455,7 @@ XS (XS_weechat_api_config_option_unset) option = SvPV_nolen (ST (0)); - rc = weechat_config_option_unset (script_str2ptr (option)); + rc = weechat_config_option_unset (API_STR2PTR(option)); API_RETURN_INT(rc); } @@ -1472,7 +1476,7 @@ XS (XS_weechat_api_config_option_rename) option = SvPV_nolen (ST (0)); new_name = SvPV_nolen (ST (1)); - weechat_config_option_rename (script_str2ptr (option), + weechat_config_option_rename (API_STR2PTR(option), new_name); API_RETURN_OK; @@ -1491,7 +1495,7 @@ XS (XS_weechat_api_config_option_is_null) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_option_is_null (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1510,7 +1514,7 @@ XS (XS_weechat_api_config_option_default_is_null) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_default_is_null (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_option_default_is_null (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1528,7 +1532,7 @@ XS (XS_weechat_api_config_boolean) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_boolean (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1546,7 +1550,7 @@ XS (XS_weechat_api_config_boolean_default) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_boolean_default (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1564,7 +1568,7 @@ XS (XS_weechat_api_config_integer) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_integer (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1582,7 +1586,7 @@ XS (XS_weechat_api_config_integer_default) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + value = weechat_config_integer_default (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_INT(value); } @@ -1600,7 +1604,7 @@ XS (XS_weechat_api_config_string) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + result = weechat_config_string (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_STRING(result); } @@ -1618,7 +1622,7 @@ XS (XS_weechat_api_config_string_default) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + result = weechat_config_string_default (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_STRING(result); } @@ -1636,7 +1640,7 @@ XS (XS_weechat_api_config_color) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + result = weechat_config_color (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_STRING(result); } @@ -1654,7 +1658,7 @@ XS (XS_weechat_api_config_color_default) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color_default (script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + result = weechat_config_color_default (API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_STRING(result); } @@ -1675,8 +1679,8 @@ XS (XS_weechat_api_config_write_option) config_file = SvPV_nolen (ST (0)); option = SvPV_nolen (ST (1)); - weechat_config_write_option (script_str2ptr (config_file), - script_str2ptr (option)); + weechat_config_write_option (API_STR2PTR(config_file), + API_STR2PTR(option)); API_RETURN_OK; } @@ -1698,7 +1702,7 @@ XS (XS_weechat_api_config_write_line) option_name = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - weechat_config_write_line (script_str2ptr (config_file), option_name, + weechat_config_write_line (API_STR2PTR(config_file), option_name, "%s", value); API_RETURN_OK; @@ -1717,7 +1721,7 @@ XS (XS_weechat_api_config_write) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_write (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */ + rc = weechat_config_write (API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */ API_RETURN_INT(rc); } @@ -1735,7 +1739,7 @@ XS (XS_weechat_api_config_read) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_read (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */ + rc = weechat_config_read (API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */ API_RETURN_INT(rc); } @@ -1753,7 +1757,7 @@ XS (XS_weechat_api_config_reload) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_reload (script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */ + rc = weechat_config_reload (API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */ API_RETURN_INT(rc); } @@ -1772,7 +1776,7 @@ XS (XS_weechat_api_config_option_free) script_api_config_option_free (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* option */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* option */ API_RETURN_OK; } @@ -1792,7 +1796,7 @@ XS (XS_weechat_api_config_section_free_options) script_api_config_section_free_options (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* section */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* section */ API_RETURN_OK; } @@ -1811,7 +1815,7 @@ XS (XS_weechat_api_config_section_free) script_api_config_section_free (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* section */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* section */ API_RETURN_OK; } @@ -1830,7 +1834,7 @@ XS (XS_weechat_api_config_free) script_api_config_free (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* config_file */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* config_file */ API_RETURN_OK; } @@ -2071,7 +2075,7 @@ XS (XS_weechat_api_print) script_api_printf (weechat_perl_plugin, perl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), "%s", message); API_RETURN_OK; @@ -2097,7 +2101,7 @@ XS (XS_weechat_api_print_date_tags) script_api_printf_date_tags (weechat_perl_plugin, perl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), SvIV (ST (1)), tags, "%s", message); @@ -2123,7 +2127,7 @@ XS (XS_weechat_api_print_y) script_api_printf_y (weechat_perl_plugin, perl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), SvIV (ST (1)), "%s", message); @@ -2709,7 +2713,7 @@ XS (XS_weechat_api_hook_print) result = script_ptr2str (script_api_hook_print (weechat_perl_plugin, perl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), tags, message, SvIV (ST (3)), /* strip_colors */ @@ -2842,7 +2846,7 @@ XS (XS_weechat_api_hook_signal_send) { weechat_hook_signal_send (signal, type_data, - script_str2ptr (SvPV_nolen (ST (2)))); /* signal_data */ + API_STR2PTR(SvPV_nolen (ST (2)))); /* signal_data */ API_RETURN_OK; } @@ -3100,7 +3104,7 @@ XS (XS_weechat_api_hook_completion_list_add) word = SvPV_nolen (ST (1)); where = SvPV_nolen (ST (3)); - weechat_hook_completion_list_add (script_str2ptr (completion), + weechat_hook_completion_list_add (API_STR2PTR(completion), word, SvIV (ST (2)), /* nick_completion */ where); @@ -3449,7 +3453,7 @@ XS (XS_weechat_api_unhook) script_api_unhook (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* hook */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* hook */ API_RETURN_OK; } @@ -3659,7 +3663,7 @@ XS (XS_weechat_api_buffer_clear) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_clear (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */ + weechat_buffer_clear (API_STR2PTR(SvPV_nolen (ST (0)))); /* buffer */ API_RETURN_OK; } @@ -3678,7 +3682,7 @@ XS (XS_weechat_api_buffer_close) script_api_buffer_close (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* buffer */ API_RETURN_OK; } @@ -3695,8 +3699,8 @@ XS (XS_weechat_api_buffer_merge) if (items < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_merge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */ - script_str2ptr (SvPV_nolen (ST (1)))); /* target_buffer */ + weechat_buffer_merge (API_STR2PTR(SvPV_nolen (ST (0))), /* buffer */ + API_STR2PTR(SvPV_nolen (ST (1)))); /* target_buffer */ API_RETURN_OK; } @@ -3713,7 +3717,7 @@ XS (XS_weechat_api_buffer_unmerge) if (items < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_unmerge (script_str2ptr (SvPV_nolen (ST (0))), /* buffer */ + weechat_buffer_unmerge (API_STR2PTR(SvPV_nolen (ST (0))), /* buffer */ SvIV (ST (1))); /* number */ API_RETURN_OK; @@ -3736,7 +3740,7 @@ XS (XS_weechat_api_buffer_get_integer) buffer = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - value = weechat_buffer_get_integer (script_str2ptr (buffer), property); + value = weechat_buffer_get_integer (API_STR2PTR(buffer), property); API_RETURN_INT(value); } @@ -3758,7 +3762,7 @@ XS (XS_weechat_api_buffer_get_string) buffer = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - result = weechat_buffer_get_string (script_str2ptr (buffer), property); + result = weechat_buffer_get_string (API_STR2PTR(buffer), property); API_RETURN_STRING(result); } @@ -3779,7 +3783,7 @@ XS (XS_weechat_api_buffer_get_pointer) buffer = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(buffer), property)); API_RETURN_STRING_FREE(result); @@ -3802,7 +3806,7 @@ XS (XS_weechat_api_buffer_set) property = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - weechat_buffer_set (script_str2ptr (buffer), property, value); + weechat_buffer_set (API_STR2PTR(buffer), property, value); API_RETURN_OK; } @@ -3824,7 +3828,7 @@ XS (XS_weechat_api_buffer_string_replace_local_var) buffer = SvPV_nolen (ST (0)); string = SvPV_nolen (ST (1)); - result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string); + result = weechat_buffer_string_replace_local_var (API_STR2PTR(buffer), string); API_RETURN_STRING_FREE(result); } @@ -3846,7 +3850,7 @@ XS (XS_weechat_api_buffer_match_list) buffer = SvPV_nolen (ST (0)); string = SvPV_nolen (ST (1)); - value = weechat_buffer_match_list (script_str2ptr (buffer), string); + value = weechat_buffer_match_list (API_STR2PTR(buffer), string); API_RETURN_INT(value); } @@ -3884,7 +3888,7 @@ XS (XS_weechat_api_window_search_with_buffer) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (SvPV_nolen (ST (0))))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(SvPV_nolen (ST (0))))); API_RETURN_STRING_FREE(result); } @@ -3907,7 +3911,7 @@ XS (XS_weechat_api_window_get_integer) window = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - value = weechat_window_get_integer (script_str2ptr (window), property); + value = weechat_window_get_integer (API_STR2PTR(window), property); API_RETURN_INT(value); } @@ -3929,7 +3933,7 @@ XS (XS_weechat_api_window_get_string) window = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - result = weechat_window_get_string (script_str2ptr (window), property); + result = weechat_window_get_string (API_STR2PTR(window), property); API_RETURN_STRING(result); } @@ -3950,7 +3954,7 @@ XS (XS_weechat_api_window_get_pointer) window = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(window), property)); API_RETURN_STRING_FREE(result); @@ -3991,8 +3995,8 @@ XS (XS_weechat_api_nicklist_add_group) name = SvPV_nolen (ST (2)); color = SvPV_nolen (ST (3)); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer), - script_str2ptr (parent_group), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(buffer), + API_STR2PTR(parent_group), name, color, SvIV (ST (4)))); /* visible */ @@ -4017,8 +4021,8 @@ XS (XS_weechat_api_nicklist_search_group) from_group = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4044,8 +4048,8 @@ XS (XS_weechat_api_nicklist_add_nick) prefix = SvPV_nolen (ST (4)); prefix_color = SvPV_nolen (ST (5)); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(buffer), + API_STR2PTR(group), name, color, prefix, @@ -4072,8 +4076,8 @@ XS (XS_weechat_api_nicklist_search_nick) from_group = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4095,8 +4099,8 @@ XS (XS_weechat_api_nicklist_remove_group) buffer = SvPV_nolen (ST (0)); group = SvPV_nolen (ST (1)); - weechat_nicklist_remove_group (script_str2ptr (buffer), - script_str2ptr (group)); + weechat_nicklist_remove_group (API_STR2PTR(buffer), + API_STR2PTR(group)); API_RETURN_OK; } @@ -4117,8 +4121,8 @@ XS (XS_weechat_api_nicklist_remove_nick) buffer = SvPV_nolen (ST (0)); nick = SvPV_nolen (ST (1)); - weechat_nicklist_remove_nick (script_str2ptr (buffer), - script_str2ptr (nick)); + weechat_nicklist_remove_nick (API_STR2PTR(buffer), + API_STR2PTR(nick)); API_RETURN_OK; } @@ -4135,7 +4139,7 @@ XS (XS_weechat_api_nicklist_remove_all) if (items < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_all (script_str2ptr (SvPV_nolen (ST (0)))); /* buffer */ + weechat_nicklist_remove_all (API_STR2PTR(SvPV_nolen (ST (0)))); /* buffer */ API_RETURN_OK; } @@ -4158,8 +4162,8 @@ XS (XS_weechat_api_nicklist_group_get_integer) group = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), - script_str2ptr (group), + value = weechat_nicklist_group_get_integer (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_INT(value); @@ -4183,8 +4187,8 @@ XS (XS_weechat_api_nicklist_group_get_string) group = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - result = weechat_nicklist_group_get_string (script_str2ptr (buffer), - script_str2ptr (group), + result = weechat_nicklist_group_get_string (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_STRING(result); @@ -4207,8 +4211,8 @@ XS (XS_weechat_api_nicklist_group_get_pointer) group = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(group), property)); API_RETURN_STRING_FREE(result); @@ -4232,8 +4236,8 @@ XS (XS_weechat_api_nicklist_group_set) property = SvPV_nolen (ST (2)); value = SvPV_nolen (ST (3)); - weechat_nicklist_group_set (script_str2ptr (buffer), - script_str2ptr (group), + weechat_nicklist_group_set (API_STR2PTR(buffer), + API_STR2PTR(group), property, value); @@ -4258,8 +4262,8 @@ XS (XS_weechat_api_nicklist_nick_get_integer) nick = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), - script_str2ptr (nick), + value = weechat_nicklist_nick_get_integer (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_INT(value); @@ -4283,8 +4287,8 @@ XS (XS_weechat_api_nicklist_nick_get_string) nick = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), - script_str2ptr (nick), + result = weechat_nicklist_nick_get_string (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_STRING(result); @@ -4307,8 +4311,8 @@ XS (XS_weechat_api_nicklist_nick_get_pointer) nick = SvPV_nolen (ST (1)); property = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), - script_str2ptr (nick), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(nick), property)); API_RETURN_STRING_FREE(result); @@ -4332,8 +4336,8 @@ XS (XS_weechat_api_nicklist_nick_set) property = SvPV_nolen (ST (2)); value = SvPV_nolen (ST (3)); - weechat_nicklist_nick_set (script_str2ptr (buffer), - script_str2ptr (nick), + weechat_nicklist_nick_set (API_STR2PTR(buffer), + API_STR2PTR(nick), property, value); @@ -4452,7 +4456,7 @@ XS (XS_weechat_api_bar_item_remove) script_api_bar_item_remove (weechat_perl_plugin, perl_current_script, - script_str2ptr (SvPV_nolen (ST (0)))); /* item */ + API_STR2PTR(SvPV_nolen (ST (0)))); /* item */ API_RETURN_OK; } @@ -4542,7 +4546,7 @@ XS (XS_weechat_api_bar_set) property = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - weechat_bar_set (script_str2ptr (bar), property, value); + weechat_bar_set (API_STR2PTR(bar), property, value); API_RETURN_OK; } @@ -4576,7 +4580,7 @@ XS (XS_weechat_api_bar_remove) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_remove (script_str2ptr (SvPV_nolen (ST (0)))); /* bar */ + weechat_bar_remove (API_STR2PTR(SvPV_nolen (ST (0)))); /* bar */ API_RETURN_OK; } @@ -4599,7 +4603,7 @@ XS (XS_weechat_api_command) script_api_command (weechat_perl_plugin, perl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), command); API_RETURN_OK; @@ -4692,7 +4696,7 @@ XS (XS_weechat_api_infolist_new_item) infolist = SvPV_nolen (ST (0)); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist))); + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(infolist))); API_RETURN_STRING_FREE(result); } @@ -4713,7 +4717,7 @@ XS (XS_weechat_api_infolist_new_var_integer) infolist = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(infolist), name, SvIV (ST (2)))); /* value */ @@ -4737,7 +4741,7 @@ XS (XS_weechat_api_infolist_new_var_string) name = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(infolist), name, value)); @@ -4761,9 +4765,9 @@ XS (XS_weechat_api_infolist_new_var_pointer) name = SvPV_nolen (ST (1)); value = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(infolist), name, - script_str2ptr (value))); + API_STR2PTR(value))); API_RETURN_STRING_FREE(result); } @@ -4784,7 +4788,7 @@ XS (XS_weechat_api_infolist_new_var_time) infolist = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(infolist), name, SvIV (ST (2)))); /* value */ @@ -4809,7 +4813,7 @@ XS (XS_weechat_api_infolist_get) arguments = SvPV_nolen (ST (2)); result = script_ptr2str (weechat_infolist_get (name, - script_str2ptr (pointer), + API_STR2PTR(pointer), arguments)); API_RETURN_STRING_FREE(result); @@ -4828,7 +4832,7 @@ XS (XS_weechat_api_infolist_next) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_next (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */ + value = weechat_infolist_next (API_STR2PTR(SvPV_nolen (ST (0)))); /* infolist */ API_RETURN_INT(value); } @@ -4846,7 +4850,7 @@ XS (XS_weechat_api_infolist_prev) if (items < 1) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_prev (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */ + value = weechat_infolist_prev (API_STR2PTR(SvPV_nolen (ST (0)))); /* infolist */ API_RETURN_INT(value); } @@ -4864,7 +4868,7 @@ XS (XS_weechat_api_infolist_reset_item_cursor) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_reset_item_cursor (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */ + weechat_infolist_reset_item_cursor (API_STR2PTR(SvPV_nolen (ST (0)))); /* infolist */ API_RETURN_OK; } @@ -4882,7 +4886,7 @@ XS (XS_weechat_api_infolist_fields) if (items < 1) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_fields (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */ + result = weechat_infolist_fields (API_STR2PTR(SvPV_nolen (ST (0)))); /* infolist */ API_RETURN_STRING(result); } @@ -4904,7 +4908,7 @@ XS (XS_weechat_api_infolist_integer) infolist = SvPV_nolen (ST (0)); variable = SvPV_nolen (ST (1)); - value = weechat_infolist_integer (script_str2ptr (infolist), variable); + value = weechat_infolist_integer (API_STR2PTR(infolist), variable); API_RETURN_INT(value); } @@ -4926,7 +4930,7 @@ XS (XS_weechat_api_infolist_string) infolist = SvPV_nolen (ST (0)); variable = SvPV_nolen (ST (1)); - result = weechat_infolist_string (script_str2ptr (infolist), variable); + result = weechat_infolist_string (API_STR2PTR(infolist), variable); API_RETURN_STRING(result); } @@ -4948,7 +4952,7 @@ XS (XS_weechat_api_infolist_pointer) infolist = SvPV_nolen (ST (0)); variable = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable)); + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(infolist), variable)); API_RETURN_STRING_FREE(result); } @@ -4972,7 +4976,7 @@ XS (XS_weechat_api_infolist_time) variable = SvPV_nolen (ST (1)); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (infolist), variable); + time = weechat_infolist_time (API_STR2PTR(infolist), variable); date_tmp = localtime (&time); if (date_tmp) strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp); @@ -4993,7 +4997,7 @@ XS (XS_weechat_api_infolist_free) if (items < 1) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_free (script_str2ptr (SvPV_nolen (ST (0)))); /* infolist */ + weechat_infolist_free (API_STR2PTR(SvPV_nolen (ST (0)))); /* infolist */ API_RETURN_OK; } @@ -5035,7 +5039,7 @@ XS (XS_weechat_api_hdata_get_var_offset) hdata = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name); + value = weechat_hdata_get_var_offset (API_STR2PTR(hdata), name); API_RETURN_INT(value); } @@ -5057,7 +5061,7 @@ XS (XS_weechat_api_hdata_get_var_type_string) hdata = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_type_string (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5079,7 +5083,7 @@ XS (XS_weechat_api_hdata_get_var_hdata) hdata = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_hdata (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5101,7 +5105,7 @@ XS (XS_weechat_api_hdata_get_list) hdata = SvPV_nolen (ST (0)); name = SvPV_nolen (ST (1)); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(hdata), name)); API_RETURN_STRING_FREE(result); @@ -5125,9 +5129,9 @@ XS (XS_weechat_api_hdata_check_pointer) list = SvPV_nolen (ST (1)); pointer = SvPV_nolen (ST (2)); - value = weechat_hdata_check_pointer (script_str2ptr (hdata), - script_str2ptr (list), - script_str2ptr (pointer)); + value = weechat_hdata_check_pointer (API_STR2PTR(hdata), + API_STR2PTR(list), + API_STR2PTR(pointer)); API_RETURN_INT(value); } @@ -5150,8 +5154,8 @@ XS (XS_weechat_api_hdata_move) pointer = SvPV_nolen (ST (1)); count = SvIV(ST (2)); - result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_move (API_STR2PTR(hdata), + API_STR2PTR(pointer), count)); API_RETURN_STRING_FREE(result); @@ -5175,8 +5179,8 @@ XS (XS_weechat_api_hdata_char) pointer = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - value = (int)weechat_hdata_char (script_str2ptr (hdata), - script_str2ptr (pointer), + value = (int)weechat_hdata_char (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5201,8 +5205,8 @@ XS (XS_weechat_api_hdata_integer) pointer = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - value = weechat_hdata_integer (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_integer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5226,8 +5230,8 @@ XS (XS_weechat_api_hdata_long) pointer = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - value = weechat_hdata_long (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_long (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_LONG(value); @@ -5252,8 +5256,8 @@ XS (XS_weechat_api_hdata_string) pointer = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - result = weechat_hdata_string (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_STRING(result); @@ -5278,8 +5282,8 @@ XS (XS_weechat_api_hdata_pointer) pointer = SvPV_nolen (ST (1)); name = SvPV_nolen (ST (2)); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_STRING_FREE(result); @@ -5305,8 +5309,8 @@ XS (XS_weechat_api_hdata_time) name = SvPV_nolen (ST (2)); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (hdata), - script_str2ptr (pointer), + time = weechat_hdata_time (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); date_tmp = localtime (&time); if (date_tmp) @@ -5336,8 +5340,8 @@ XS (XS_weechat_api_hdata_hashtable) name = SvPV_nolen (ST (2)); result_hash = weechat_perl_hashtable_to_hash ( - weechat_hdata_hashtable (script_str2ptr (hdata), - script_str2ptr (pointer), + weechat_hdata_hashtable (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_OBJ(result_hash); @@ -5360,7 +5364,7 @@ XS (XS_weechat_api_hdata_get_string) hdata = SvPV_nolen (ST (0)); property = SvPV_nolen (ST (1)); - result = weechat_hdata_get_string (script_str2ptr (hdata), property); + result = weechat_hdata_get_string (API_STR2PTR(hdata), property); API_RETURN_STRING(result); } @@ -5403,9 +5407,9 @@ XS (XS_weechat_api_upgrade_write_object) upgrade_file = SvPV_nolen (ST (0)); infolist = SvPV_nolen (ST (2)); - rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file), + rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file), SvIV (ST (1)), /* object_id */ - script_str2ptr (infolist)); + API_STR2PTR(infolist)); API_RETURN_INT(rc); } @@ -5479,7 +5483,7 @@ XS (XS_weechat_api_upgrade_read) rc = script_api_upgrade_read (weechat_perl_plugin, perl_current_script, - script_str2ptr (upgrade_file), + API_STR2PTR(upgrade_file), &weechat_perl_api_upgrade_read_cb, function, data); @@ -5502,7 +5506,7 @@ XS (XS_weechat_api_upgrade_close) upgrade_file = SvPV_nolen (ST (0)); - weechat_upgrade_close (script_str2ptr (upgrade_file)); + weechat_upgrade_close (API_STR2PTR(upgrade_file)); API_RETURN_OK; } diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index b3b062045..5a05f4227 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -390,7 +390,7 @@ weechat_perl_load (const char *filename) return 0; } - if ((weechat_perl_plugin->debug >= 1) || !perl_quiet) + if ((weechat_perl_plugin->debug >= 2) || !perl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -557,7 +557,7 @@ weechat_perl_unload (struct t_plugin_script *script) int *rc; void *interpreter; - if ((weechat_perl_plugin->debug >= 1) || !perl_quiet) + if ((weechat_perl_plugin->debug >= 2) || !perl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 42e2223ae..ca9984299 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -50,6 +50,9 @@ python_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_python_plugin, PYTHON_CURRENT_SCRIPT_NAME, \ + python_function_name, __string) #define API_RETURN_OK return PyLong_FromLong((long)1); #define API_RETURN_ERROR return PyLong_FromLong ((long)0); #define API_RETURN_EMPTY \ @@ -121,7 +124,7 @@ weechat_python_api_register (PyObject *self, PyObject *args) if (python_current_script) { python_registered_script = python_current_script; - if ((weechat_python_plugin->debug >= 1) || !python_quiet) + if ((weechat_python_plugin->debug >= 2) || !python_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -153,7 +156,7 @@ weechat_python_api_plugin_get_name (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &plugin)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_plugin_get_name (script_str2ptr (plugin)); + result = weechat_plugin_get_name (API_STR2PTR(plugin)); API_RETURN_STRING(result); } @@ -531,10 +534,10 @@ weechat_python_api_list_add (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_add (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_add (API_STR2PTR(weelist), data, where, - script_str2ptr (user_data))); + API_STR2PTR(user_data))); API_RETURN_STRING_FREE(result); } @@ -555,7 +558,7 @@ weechat_python_api_list_search (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &weelist, &data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_search (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_search (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -577,7 +580,7 @@ weechat_python_api_list_search_pos (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &weelist, &data)) API_WRONG_ARGS(API_RETURN_INT(-1)); - pos = weechat_list_search_pos (script_str2ptr (weelist), data); + pos = weechat_list_search_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -598,7 +601,7 @@ weechat_python_api_list_casesearch (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &weelist, &data)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -621,7 +624,7 @@ weechat_python_api_list_casesearch_pos (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &weelist, &data)) API_WRONG_ARGS(API_RETURN_INT(-1)); - pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data); + pos = weechat_list_casesearch_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -643,7 +646,7 @@ weechat_python_api_list_get (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "si", &weelist, &position)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_get (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_get (API_STR2PTR(weelist), position)); API_RETURN_STRING_FREE(result); } @@ -663,7 +666,7 @@ weechat_python_api_list_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &item, &new_value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_set (script_str2ptr (item), + weechat_list_set (API_STR2PTR(item), new_value); API_RETURN_OK; @@ -684,7 +687,7 @@ weechat_python_api_list_next (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_next (script_str2ptr (item))); + result = script_ptr2str (weechat_list_next (API_STR2PTR(item))); API_RETURN_STRING_FREE(result); } @@ -704,7 +707,7 @@ weechat_python_api_list_prev (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_prev (script_str2ptr (item))); + result = script_ptr2str (weechat_list_prev (API_STR2PTR(item))); API_RETURN_STRING_FREE(result); } @@ -724,7 +727,7 @@ weechat_python_api_list_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &item)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_list_string (script_str2ptr (item)); + result = weechat_list_string (API_STR2PTR(item)); API_RETURN_STRING(result); } @@ -744,7 +747,7 @@ weechat_python_api_list_size (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &weelist)) API_WRONG_ARGS(API_RETURN_INT(0)); - size = weechat_list_size (script_str2ptr (weelist)); + size = weechat_list_size (API_STR2PTR(weelist)); API_RETURN_INT(size); } @@ -764,8 +767,8 @@ weechat_python_api_list_remove (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &weelist, &item)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove (script_str2ptr (weelist), - script_str2ptr (item)); + weechat_list_remove (API_STR2PTR(weelist), + API_STR2PTR(item)); API_RETURN_OK; } @@ -784,7 +787,7 @@ weechat_python_api_list_remove_all (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &weelist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove_all (script_str2ptr (weelist)); + weechat_list_remove_all (API_STR2PTR(weelist)); API_RETURN_OK; } @@ -803,7 +806,7 @@ weechat_python_api_list_free (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &weelist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_free (script_str2ptr (weelist)); + weechat_list_free (API_STR2PTR(weelist)); API_RETURN_OK; } @@ -1149,7 +1152,7 @@ weechat_python_api_config_new_section (PyObject *self, PyObject *args) result = script_ptr2str (script_api_config_new_section (weechat_python_plugin, python_current_script, - script_str2ptr (config_file), + API_STR2PTR(config_file), name, user_can_add_options, user_can_delete_options, @@ -1188,7 +1191,7 @@ weechat_python_api_config_search_section (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &config_file, §ion_name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(config_file), section_name)); API_RETURN_STRING_FREE(result); @@ -1343,8 +1346,8 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args) result = script_ptr2str (script_api_config_new_option (weechat_python_plugin, python_current_script, - script_str2ptr (config_file), - script_str2ptr (section), + API_STR2PTR(config_file), + API_STR2PTR(section), name, type, description, @@ -1384,8 +1387,8 @@ weechat_python_api_config_search_option (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &config_file, §ion, &option_name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file), - script_str2ptr (section), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(config_file), + API_STR2PTR(section), option_name)); API_RETURN_STRING_FREE(result); @@ -1427,7 +1430,7 @@ weechat_python_api_config_option_reset (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "si", &option, &run_callback)) API_WRONG_ARGS(API_RETURN_INT(0)); - rc = weechat_config_option_reset (script_str2ptr (option), + rc = weechat_config_option_reset (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1450,7 +1453,7 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR)); - rc = weechat_config_option_set (script_str2ptr (option), + rc = weechat_config_option_set (API_STR2PTR(option), new_value, run_callback); @@ -1474,7 +1477,7 @@ weechat_python_api_config_option_set_null (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "si", &option, &run_callback)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR)); - rc = weechat_config_option_set_null (script_str2ptr (option), + rc = weechat_config_option_set_null (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1495,7 +1498,7 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR)); - rc = weechat_config_option_unset (script_str2ptr (option)); + rc = weechat_config_option_unset (API_STR2PTR(option)); API_RETURN_INT(rc); } @@ -1515,7 +1518,7 @@ weechat_python_api_config_option_rename (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &option, &new_name)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_option_rename (script_str2ptr (option), + weechat_config_option_rename (API_STR2PTR(option), new_name); API_RETURN_OK; @@ -1536,7 +1539,7 @@ weechat_python_api_config_option_is_null (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_is_null (script_str2ptr (option)); + value = weechat_config_option_is_null (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1557,7 +1560,7 @@ weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(1)); - value = weechat_config_option_default_is_null (script_str2ptr (option)); + value = weechat_config_option_default_is_null (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1577,7 +1580,7 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean (script_str2ptr (option)); + value = weechat_config_boolean (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1597,7 +1600,7 @@ weechat_python_api_config_boolean_default (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_boolean_default (script_str2ptr (option)); + value = weechat_config_boolean_default (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1617,7 +1620,7 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer (script_str2ptr (option)); + value = weechat_config_integer (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1637,7 +1640,7 @@ weechat_python_api_config_integer_default (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_config_integer_default (script_str2ptr (option)); + value = weechat_config_integer_default (API_STR2PTR(option)); API_RETURN_INT(value); } @@ -1657,7 +1660,7 @@ weechat_python_api_config_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string (script_str2ptr (option)); + result = weechat_config_string (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1677,7 +1680,7 @@ weechat_python_api_config_string_default (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string_default (script_str2ptr (option)); + result = weechat_config_string_default (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1697,7 +1700,7 @@ weechat_python_api_config_color (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color (script_str2ptr (option)); + result = weechat_config_color (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1717,7 +1720,7 @@ weechat_python_api_config_color_default (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color_default (script_str2ptr (option)); + result = weechat_config_color_default (API_STR2PTR(option)); API_RETURN_STRING(result); } @@ -1737,8 +1740,8 @@ weechat_python_api_config_write_option (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &config_file, &option)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_write_option (script_str2ptr (config_file), - script_str2ptr (option)); + weechat_config_write_option (API_STR2PTR(config_file), + API_STR2PTR(option)); API_RETURN_OK; } @@ -1759,7 +1762,7 @@ weechat_python_api_config_write_line (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &config_file, &option_name, &value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_config_write_line (script_str2ptr (config_file), + weechat_config_write_line (API_STR2PTR(config_file), option_name, "%s", value); @@ -1782,7 +1785,7 @@ weechat_python_api_config_write (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_write (script_str2ptr (config_file)); + rc = weechat_config_write (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1802,7 +1805,7 @@ weechat_python_api_config_read (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_read (script_str2ptr (config_file)); + rc = weechat_config_read (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1822,7 +1825,7 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &config_file)) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_reload (script_str2ptr (config_file)); + rc = weechat_config_reload (API_STR2PTR(config_file)); API_RETURN_INT(rc); } @@ -1843,7 +1846,7 @@ weechat_python_api_config_option_free (PyObject *self, PyObject *args) script_api_config_option_free (weechat_python_plugin, python_current_script, - script_str2ptr (option)); + API_STR2PTR(option)); API_RETURN_OK; } @@ -1865,7 +1868,7 @@ weechat_python_api_config_section_free_options (PyObject *self, PyObject *args) script_api_config_section_free_options (weechat_python_plugin, python_current_script, - script_str2ptr (section)); + API_STR2PTR(section)); API_RETURN_OK; } @@ -1886,7 +1889,7 @@ weechat_python_api_config_section_free (PyObject *self, PyObject *args) script_api_config_section_free (weechat_python_plugin, python_current_script, - script_str2ptr (section)); + API_STR2PTR(section)); API_RETURN_OK; } @@ -1907,7 +1910,7 @@ weechat_python_api_config_free (PyObject *self, PyObject *args) script_api_config_free (weechat_python_plugin, python_current_script, - script_str2ptr (config_file)); + API_STR2PTR(config_file)); API_RETURN_OK; } @@ -2151,7 +2154,7 @@ weechat_python_api_prnt (PyObject *self, PyObject *args) script_api_printf (weechat_python_plugin, python_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), "%s", message); API_RETURN_OK; @@ -2178,7 +2181,7 @@ weechat_python_api_prnt_date_tags (PyObject *self, PyObject *args) script_api_printf_date_tags (weechat_python_plugin, python_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), date, tags, "%s", message); @@ -2205,7 +2208,7 @@ weechat_python_api_prnt_y (PyObject *self, PyObject *args) script_api_printf_y (weechat_python_plugin, python_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), y, "%s", message); @@ -2824,7 +2827,7 @@ weechat_python_api_hook_print (PyObject *self, PyObject *args) result = script_ptr2str (script_api_hook_print (weechat_python_plugin, python_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), tags, message, strip_colors, @@ -2957,7 +2960,7 @@ weechat_python_api_hook_signal_send (PyObject *self, PyObject *args) else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_POINTER) == 0) { weechat_hook_signal_send (signal, type_data, - script_str2ptr (signal_data)); + API_STR2PTR(signal_data)); API_RETURN_OK; } @@ -3223,7 +3226,7 @@ weechat_python_api_hook_completion_list_add (PyObject *self, PyObject *args) &where)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_hook_completion_list_add (script_str2ptr (completion), + weechat_hook_completion_list_add (API_STR2PTR(completion), word, nick_completion, where); @@ -3594,7 +3597,7 @@ weechat_python_api_unhook (PyObject *self, PyObject *args) script_api_unhook (weechat_python_plugin, python_current_script, - script_str2ptr (hook)); + API_STR2PTR(hook)); API_RETURN_OK; } @@ -3806,7 +3809,7 @@ weechat_python_api_buffer_clear (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_clear (script_str2ptr (buffer)); + weechat_buffer_clear (API_STR2PTR(buffer)); API_RETURN_OK; } @@ -3827,7 +3830,7 @@ weechat_python_api_buffer_close (PyObject *self, PyObject *args) script_api_buffer_close (weechat_python_plugin, python_current_script, - script_str2ptr (buffer)); + API_STR2PTR(buffer)); API_RETURN_OK; } @@ -3847,8 +3850,8 @@ weechat_python_api_buffer_merge (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &target_buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_merge (script_str2ptr (buffer), - script_str2ptr (target_buffer)); + weechat_buffer_merge (API_STR2PTR(buffer), + API_STR2PTR(target_buffer)); API_RETURN_OK; } @@ -3870,7 +3873,7 @@ weechat_python_api_buffer_unmerge (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "si", &buffer, &number)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_unmerge (script_str2ptr (buffer), number); + weechat_buffer_unmerge (API_STR2PTR(buffer), number); API_RETURN_OK; } @@ -3891,7 +3894,7 @@ weechat_python_api_buffer_get_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_buffer_get_integer (script_str2ptr (buffer), property); + value = weechat_buffer_get_integer (API_STR2PTR(buffer), property); API_RETURN_INT(value); } @@ -3912,7 +3915,7 @@ weechat_python_api_buffer_get_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_buffer_get_string (script_str2ptr (buffer), property); + result = weechat_buffer_get_string (API_STR2PTR(buffer), property); API_RETURN_STRING(result); } @@ -3933,7 +3936,7 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(buffer), property)); API_RETURN_STRING_FREE(result); @@ -3955,7 +3958,7 @@ weechat_python_api_buffer_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &property, &value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_set (script_str2ptr (buffer), + weechat_buffer_set (API_STR2PTR(buffer), property, value); @@ -3979,7 +3982,7 @@ weechat_python_api_buffer_string_replace_local_var (PyObject *self, PyObject *ar if (!PyArg_ParseTuple (args, "ss", &buffer, &string)) API_WRONG_ARGS(API_RETURN_ERROR); - result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string); + result = weechat_buffer_string_replace_local_var (API_STR2PTR(buffer), string); API_RETURN_STRING_FREE(result); } @@ -4001,7 +4004,7 @@ weechat_python_api_buffer_match_list (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &string)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_buffer_match_list (script_str2ptr (buffer), string); + value = weechat_buffer_match_list (API_STR2PTR(buffer), string); API_RETURN_INT(value); } @@ -4042,7 +4045,7 @@ weechat_python_api_window_search_with_buffer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &buffer)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(buffer))); API_RETURN_STRING_FREE(result); } @@ -4063,7 +4066,7 @@ weechat_python_api_window_get_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &window, &property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_window_get_integer (script_str2ptr (window), property); + value = weechat_window_get_integer (API_STR2PTR(window), property); API_RETURN_INT(value); } @@ -4084,7 +4087,7 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &window, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_window_get_string (script_str2ptr (window), property); + result = weechat_window_get_string (API_STR2PTR(window), property); API_RETURN_STRING(result); } @@ -4105,7 +4108,7 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &window, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(window), property)); API_RETURN_STRING_FREE(result); @@ -4151,8 +4154,8 @@ weechat_python_api_nicklist_add_group (PyObject *self, PyObject *args) &color, &visible)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer), - script_str2ptr (parent_group), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(buffer), + API_STR2PTR(parent_group), name, color, visible)); @@ -4177,8 +4180,8 @@ weechat_python_api_nicklist_search_group (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4207,8 +4210,8 @@ weechat_python_api_nicklist_add_nick (PyObject *self, PyObject *args) &prefix, &prefix_color, &visible)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(buffer), + API_STR2PTR(group), name, color, prefix, @@ -4235,8 +4238,8 @@ weechat_python_api_nicklist_search_nick (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &from_group, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4257,8 +4260,8 @@ weechat_python_api_nicklist_remove_group (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &group)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_group (script_str2ptr (buffer), - script_str2ptr (group)); + weechat_nicklist_remove_group (API_STR2PTR(buffer), + API_STR2PTR(group)); API_RETURN_OK; } @@ -4278,8 +4281,8 @@ weechat_python_api_nicklist_remove_nick (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &buffer, &nick)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_nick (script_str2ptr (buffer), - script_str2ptr (nick)); + weechat_nicklist_remove_nick (API_STR2PTR(buffer), + API_STR2PTR(nick)); API_RETURN_OK; } @@ -4298,7 +4301,7 @@ weechat_python_api_nicklist_remove_all (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &buffer)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_all (script_str2ptr (buffer)); + weechat_nicklist_remove_all (API_STR2PTR(buffer)); API_RETURN_OK; } @@ -4320,8 +4323,8 @@ weechat_python_api_nicklist_group_get_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_nicklist_group_get_integer (script_str2ptr (buffer), - script_str2ptr (group), + value = weechat_nicklist_group_get_integer (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_INT(value); @@ -4344,8 +4347,8 @@ weechat_python_api_nicklist_group_get_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_nicklist_group_get_string (script_str2ptr (buffer), - script_str2ptr (group), + result = weechat_nicklist_group_get_string (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_STRING(result); @@ -4368,8 +4371,8 @@ weechat_python_api_nicklist_group_get_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &group, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(group), property)); API_RETURN_STRING_FREE(result); @@ -4392,8 +4395,8 @@ weechat_python_api_nicklist_group_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssss", &buffer, &group, &property, &value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_group_set (script_str2ptr (buffer), - script_str2ptr (group), + weechat_nicklist_group_set (API_STR2PTR(buffer), + API_STR2PTR(group), property, value); @@ -4417,8 +4420,8 @@ weechat_python_api_nicklist_nick_get_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) API_WRONG_ARGS(API_RETURN_INT(-1)); - value = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), - script_str2ptr (nick), + value = weechat_nicklist_nick_get_integer (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_INT(value); @@ -4441,8 +4444,8 @@ weechat_python_api_nicklist_nick_get_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), - script_str2ptr (nick), + result = weechat_nicklist_nick_get_string (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_STRING(result); @@ -4465,8 +4468,8 @@ weechat_python_api_nicklist_nick_get_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &buffer, &nick, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), - script_str2ptr (nick), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(nick), property)); API_RETURN_STRING_FREE(result); @@ -4489,8 +4492,8 @@ weechat_python_api_nicklist_nick_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssss", &buffer, &nick, &property, &value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_nick_set (script_str2ptr (buffer), - script_str2ptr (nick), + weechat_nicklist_nick_set (API_STR2PTR(buffer), + API_STR2PTR(nick), property, value); @@ -4615,7 +4618,7 @@ weechat_python_api_bar_item_remove (PyObject *self, PyObject *args) script_api_bar_item_remove (weechat_python_plugin, python_current_script, - script_str2ptr (item)); + API_STR2PTR(item)); API_RETURN_OK; } @@ -4709,7 +4712,7 @@ weechat_python_api_bar_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_set (script_str2ptr (bar), + weechat_bar_set (API_STR2PTR(bar), property, value); @@ -4749,7 +4752,7 @@ weechat_python_api_bar_remove (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &bar)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_remove (script_str2ptr (bar)); + weechat_bar_remove (API_STR2PTR(bar)); API_RETURN_OK; } @@ -4771,7 +4774,7 @@ weechat_python_api_command (PyObject *self, PyObject *args) script_api_command (weechat_python_plugin, python_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), command); API_RETURN_OK; @@ -4861,7 +4864,7 @@ weechat_python_api_infolist_new_item (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist))); + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(infolist))); API_RETURN_STRING_FREE(result); } @@ -4885,7 +4888,7 @@ weechat_python_api_infolist_new_var_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(infolist), name, value)); @@ -4910,7 +4913,7 @@ weechat_python_api_infolist_new_var_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(infolist), name, value)); @@ -4935,9 +4938,9 @@ weechat_python_api_infolist_new_var_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &infolist, &name, &value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(infolist), name, - script_str2ptr (value))); + API_STR2PTR(value))); API_RETURN_STRING_FREE(result); } @@ -4961,7 +4964,7 @@ weechat_python_api_infolist_new_var_time (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssi", &infolist, &name, &value)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(infolist), name, value)); @@ -4986,7 +4989,7 @@ weechat_python_api_infolist_get (PyObject *self, PyObject *args) API_WRONG_ARGS(API_RETURN_EMPTY); result = script_ptr2str (weechat_infolist_get (name, - script_str2ptr (pointer), + API_STR2PTR(pointer), arguments)); API_RETURN_STRING_FREE(result); @@ -5007,7 +5010,7 @@ weechat_python_api_infolist_next (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_next (script_str2ptr (infolist)); + value = weechat_infolist_next (API_STR2PTR(infolist)); API_RETURN_INT(value); } @@ -5027,7 +5030,7 @@ weechat_python_api_infolist_prev (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_prev (script_str2ptr (infolist)); + value = weechat_infolist_prev (API_STR2PTR(infolist)); API_RETURN_INT(value); } @@ -5047,7 +5050,7 @@ weechat_python_api_infolist_reset_item_cursor (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_reset_item_cursor (script_str2ptr (infolist)); + weechat_infolist_reset_item_cursor (API_STR2PTR(infolist)); API_RETURN_OK; } @@ -5067,7 +5070,7 @@ weechat_python_api_infolist_fields (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_fields (script_str2ptr (infolist)); + result = weechat_infolist_fields (API_STR2PTR(infolist)); API_RETURN_STRING(result); } @@ -5088,7 +5091,7 @@ weechat_python_api_infolist_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &infolist, &variable)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_infolist_integer (script_str2ptr (infolist), + value = weechat_infolist_integer (API_STR2PTR(infolist), variable); API_RETURN_INT(value); @@ -5110,7 +5113,7 @@ weechat_python_api_infolist_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &infolist, &variable)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_string (script_str2ptr (infolist), + result = weechat_infolist_string (API_STR2PTR(infolist), variable); API_RETURN_STRING(result); @@ -5132,7 +5135,7 @@ weechat_python_api_infolist_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &infolist, &variable)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(infolist), variable)); API_RETURN_STRING_FREE(result); @@ -5157,7 +5160,7 @@ weechat_python_api_infolist_time (PyObject *self, PyObject *args) API_WRONG_ARGS(API_RETURN_EMPTY); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (infolist), + time = weechat_infolist_time (API_STR2PTR(infolist), variable); date_tmp = localtime (&time); if (date_tmp) @@ -5181,7 +5184,7 @@ weechat_python_api_infolist_free (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &infolist)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_free (script_str2ptr (infolist)); + weechat_infolist_free (API_STR2PTR(infolist)); API_RETURN_OK; } @@ -5222,7 +5225,7 @@ weechat_python_api_hdata_get_var_offset (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &hdata, &name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_get_var_offset (script_str2ptr (hdata), name); + value = weechat_hdata_get_var_offset (API_STR2PTR(hdata), name); API_RETURN_INT(value); } @@ -5244,7 +5247,7 @@ weechat_python_api_hdata_get_var_type_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &hdata, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_type_string (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5265,7 +5268,7 @@ weechat_python_api_hdata_get_var_hdata (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &hdata, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_hdata (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5286,7 +5289,7 @@ weechat_python_api_hdata_get_list (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &hdata, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(hdata), name)); API_RETURN_STRING_FREE(result); @@ -5309,9 +5312,9 @@ weechat_python_api_hdata_check_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &list, &pointer)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_check_pointer (script_str2ptr (hdata), - script_str2ptr (list), - script_str2ptr (pointer)); + value = weechat_hdata_check_pointer (API_STR2PTR(hdata), + API_STR2PTR(list), + API_STR2PTR(pointer)); API_RETURN_INT(value); } @@ -5334,8 +5337,8 @@ weechat_python_api_hdata_move (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssi", &hdata, &pointer, &count)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_move (API_STR2PTR(hdata), + API_STR2PTR(pointer), count)); API_RETURN_STRING_FREE(result); @@ -5359,8 +5362,8 @@ weechat_python_api_hdata_char (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = (int)weechat_hdata_char (script_str2ptr (hdata), - script_str2ptr (pointer), + value = (int)weechat_hdata_char (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5384,8 +5387,8 @@ weechat_python_api_hdata_integer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) API_WRONG_ARGS(API_RETURN_INT(0)); - value = weechat_hdata_integer (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_integer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(value); @@ -5409,8 +5412,8 @@ weechat_python_api_hdata_long (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) API_WRONG_ARGS(API_RETURN_LONG(0)); - value = weechat_hdata_long (script_str2ptr (hdata), - script_str2ptr (pointer), + value = weechat_hdata_long (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_LONG(value); @@ -5434,8 +5437,8 @@ weechat_python_api_hdata_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_string (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_STRING(result); @@ -5459,8 +5462,8 @@ weechat_python_api_hdata_pointer (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sss", &hdata, &pointer, &name)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_STRING_FREE(result); @@ -5487,8 +5490,8 @@ weechat_python_api_hdata_time (PyObject *self, PyObject *args) API_WRONG_ARGS(API_RETURN_EMPTY); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (hdata), - script_str2ptr (pointer), + time = weechat_hdata_time (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); date_tmp = localtime (&time); if (date_tmp) @@ -5517,8 +5520,8 @@ weechat_python_api_hdata_hashtable (PyObject *self, PyObject *args) API_WRONG_ARGS(API_RETURN_EMPTY); result_dict = weechat_python_hashtable_to_dict ( - weechat_hdata_hashtable (script_str2ptr (hdata), - script_str2ptr (pointer), + weechat_hdata_hashtable (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); return result_dict; @@ -5540,7 +5543,7 @@ weechat_python_api_hdata_get_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ss", &hdata, &property)) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_hdata_get_string (script_str2ptr (hdata), property); + result = weechat_hdata_get_string (API_STR2PTR(hdata), property); API_RETURN_STRING(result); } @@ -5584,9 +5587,9 @@ weechat_python_api_upgrade_write_object (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "sis", &upgrade_file, &object_id, &infolist)) API_WRONG_ARGS(API_RETURN_INT(0)); - rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file), + rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file), object_id, - script_str2ptr (infolist)); + API_STR2PTR(infolist)); API_RETURN_INT(rc); } @@ -5659,7 +5662,7 @@ weechat_python_api_upgrade_read (PyObject *self, PyObject *args) rc = script_api_upgrade_read (weechat_python_plugin, python_current_script, - script_str2ptr (upgrade_file), + API_STR2PTR(upgrade_file), &weechat_python_api_upgrade_read_cb, function, data); @@ -5681,7 +5684,7 @@ weechat_python_api_upgrade_close (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &upgrade_file)) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_upgrade_close (script_str2ptr (upgrade_file)); + weechat_upgrade_close (API_STR2PTR(upgrade_file)); API_RETURN_OK; } diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index de507ef23..cdf20bdd1 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -583,7 +583,7 @@ weechat_python_load (const char *filename) return 0; } - if ((weechat_python_plugin->debug >= 1) || !python_quiet) + if ((weechat_python_plugin->debug >= 2) || !python_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -767,7 +767,7 @@ weechat_python_unload (struct t_plugin_script *script) void *interpreter; PyThreadState *old_interpreter; - if ((weechat_python_plugin->debug >= 1) || !python_quiet) + if ((weechat_python_plugin->debug >= 2) || !python_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 31d6de065..32f85a5f2 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -50,6 +50,9 @@ ruby_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_ruby_plugin, RUBY_CURRENT_SCRIPT_NAME, \ + ruby_function_name, __string) #define API_RETURN_OK return INT2FIX (1); #define API_RETURN_ERROR return INT2FIX (0); #define API_RETURN_EMPTY return Qnil; @@ -134,7 +137,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author, if (ruby_current_script) { ruby_registered_script = ruby_current_script; - if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet) + if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -169,7 +172,7 @@ weechat_ruby_api_plugin_get_name (VALUE class, VALUE plugin) c_plugin = StringValuePtr (plugin); - result = weechat_plugin_get_name (script_str2ptr (c_plugin)); + result = weechat_plugin_get_name (API_STR2PTR(c_plugin)); API_RETURN_STRING(result); } @@ -609,10 +612,10 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where, c_where = StringValuePtr (where); c_user_data = StringValuePtr (user_data); - result = script_ptr2str (weechat_list_add (script_str2ptr (c_weelist), + result = script_ptr2str (weechat_list_add (API_STR2PTR(c_weelist), c_data, c_where, - script_str2ptr (c_user_data))); + API_STR2PTR(c_user_data))); API_RETURN_STRING(result); } @@ -636,7 +639,7 @@ weechat_ruby_api_list_search (VALUE class, VALUE weelist, VALUE data) c_weelist = StringValuePtr (weelist); c_data = StringValuePtr (data); - result = script_ptr2str (weechat_list_search (script_str2ptr (c_weelist), + result = script_ptr2str (weechat_list_search (API_STR2PTR(c_weelist), c_data)); API_RETURN_STRING(result); @@ -662,7 +665,7 @@ weechat_ruby_api_list_search_pos (VALUE class, VALUE weelist, VALUE data) c_weelist = StringValuePtr (weelist); c_data = StringValuePtr (data); - pos = weechat_list_search_pos (script_str2ptr (c_weelist), c_data); + pos = weechat_list_search_pos (API_STR2PTR(c_weelist), c_data); API_RETURN_INT(pos); } @@ -686,7 +689,7 @@ weechat_ruby_api_list_casesearch (VALUE class, VALUE weelist, VALUE data) c_weelist = StringValuePtr (weelist); c_data = StringValuePtr (data); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (c_weelist), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(c_weelist), c_data)); API_RETURN_STRING(result); @@ -713,7 +716,7 @@ weechat_ruby_api_list_casesearch_pos (VALUE class, VALUE weelist, VALUE data) c_weelist = StringValuePtr (weelist); c_data = StringValuePtr (data); - pos = weechat_list_casesearch_pos (script_str2ptr (c_weelist), c_data); + pos = weechat_list_casesearch_pos (API_STR2PTR(c_weelist), c_data); API_RETURN_INT(pos); } @@ -738,7 +741,7 @@ weechat_ruby_api_list_get (VALUE class, VALUE weelist, VALUE position) c_weelist = StringValuePtr (weelist); c_position = FIX2INT (position); - result = script_ptr2str (weechat_list_get (script_str2ptr (c_weelist), + result = script_ptr2str (weechat_list_get (API_STR2PTR(c_weelist), c_position)); API_RETURN_STRING(result); @@ -763,7 +766,7 @@ weechat_ruby_api_list_set (VALUE class, VALUE item, VALUE new_value) c_item = StringValuePtr (item); c_new_value = StringValuePtr (new_value); - weechat_list_set (script_str2ptr (c_item), + weechat_list_set (API_STR2PTR(c_item), c_new_value); API_RETURN_OK; @@ -786,7 +789,7 @@ weechat_ruby_api_list_next (VALUE class, VALUE item) c_item = StringValuePtr (item); - result = script_ptr2str (weechat_list_next (script_str2ptr (c_item))); + result = script_ptr2str (weechat_list_next (API_STR2PTR(c_item))); API_RETURN_STRING(result); } @@ -808,7 +811,7 @@ weechat_ruby_api_list_prev (VALUE class, VALUE item) c_item = StringValuePtr (item); - result = script_ptr2str (weechat_list_prev (script_str2ptr (c_item))); + result = script_ptr2str (weechat_list_prev (API_STR2PTR(c_item))); API_RETURN_STRING(result); } @@ -831,7 +834,7 @@ weechat_ruby_api_list_string (VALUE class, VALUE item) c_item = StringValuePtr (item); - result = weechat_list_string (script_str2ptr (c_item)); + result = weechat_list_string (API_STR2PTR(c_item)); API_RETURN_STRING(result); } @@ -854,7 +857,7 @@ weechat_ruby_api_list_size (VALUE class, VALUE weelist) c_weelist = StringValuePtr (weelist); - size = weechat_list_size (script_str2ptr (c_weelist)); + size = weechat_list_size (API_STR2PTR(c_weelist)); API_RETURN_INT(size); } @@ -878,8 +881,8 @@ weechat_ruby_api_list_remove (VALUE class, VALUE weelist, VALUE item) c_weelist = StringValuePtr (weelist); c_item = StringValuePtr (item); - weechat_list_remove (script_str2ptr (c_weelist), - script_str2ptr (c_item)); + weechat_list_remove (API_STR2PTR(c_weelist), + API_STR2PTR(c_item)); API_RETURN_OK; } @@ -901,7 +904,7 @@ weechat_ruby_api_list_remove_all (VALUE class, VALUE weelist) c_weelist = StringValuePtr (weelist); - weechat_list_remove_all (script_str2ptr (c_weelist)); + weechat_list_remove_all (API_STR2PTR(c_weelist)); API_RETURN_OK; } @@ -923,7 +926,7 @@ weechat_ruby_api_list_free (VALUE class, VALUE weelist) c_weelist = StringValuePtr (weelist); - weechat_list_free (script_str2ptr (c_weelist)); + weechat_list_free (API_STR2PTR(c_weelist)); API_RETURN_OK; } @@ -1303,7 +1306,7 @@ weechat_ruby_api_config_new_section (VALUE class, VALUE config_file, result = script_ptr2str (script_api_config_new_section (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_config_file), + API_STR2PTR(c_config_file), c_name, c_user_can_add_options, c_user_can_delete_options, @@ -1347,7 +1350,7 @@ weechat_ruby_api_config_search_section (VALUE class, VALUE config_file, c_config_file = StringValuePtr (config_file); c_section_name = StringValuePtr (section_name); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (c_config_file), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(c_config_file), c_section_name)); API_RETURN_STRING_FREE(result); @@ -1535,8 +1538,8 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, result = script_ptr2str (script_api_config_new_option (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_config_file), - script_str2ptr (c_section), + API_STR2PTR(c_config_file), + API_STR2PTR(c_section), c_name, c_type, c_description, @@ -1582,8 +1585,8 @@ weechat_ruby_api_config_search_option (VALUE class, VALUE config_file, c_section = StringValuePtr (section); c_option_name = StringValuePtr (option_name); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (c_config_file), - script_str2ptr (c_section), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(c_config_file), + API_STR2PTR(c_section), c_option_name)); API_RETURN_STRING_FREE(result); @@ -1633,7 +1636,7 @@ weechat_ruby_api_config_option_reset (VALUE class, VALUE option, c_option = StringValuePtr (option); c_run_callback = FIX2INT (run_callback); - rc = weechat_config_option_reset (script_str2ptr (c_option), + rc = weechat_config_option_reset (API_STR2PTR(c_option), c_run_callback); API_RETURN_INT(rc); @@ -1662,7 +1665,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value, c_new_value = StringValuePtr (new_value); c_run_callback = FIX2INT (run_callback); - rc = weechat_config_option_set (script_str2ptr (c_option), + rc = weechat_config_option_set (API_STR2PTR(c_option), c_new_value, c_run_callback); @@ -1691,7 +1694,7 @@ weechat_ruby_api_config_option_set_null (VALUE class, VALUE option, c_option = StringValuePtr (option); c_run_callback = FIX2INT (run_callback); - rc = weechat_config_option_set_null (script_str2ptr (c_option), + rc = weechat_config_option_set_null (API_STR2PTR(c_option), c_run_callback); API_RETURN_INT(rc); @@ -1715,7 +1718,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option) c_option = StringValuePtr (option); - rc = weechat_config_option_unset (script_str2ptr (c_option)); + rc = weechat_config_option_unset (API_STR2PTR(c_option)); API_RETURN_INT(rc); } @@ -1740,7 +1743,7 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option, c_option = StringValuePtr (option); c_new_name = StringValuePtr (new_name); - weechat_config_option_rename (script_str2ptr (c_option), + weechat_config_option_rename (API_STR2PTR(c_option), c_new_name); API_RETURN_OK; @@ -1764,7 +1767,7 @@ weechat_ruby_api_config_option_is_null (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_option_is_null (script_str2ptr (c_option)); + value = weechat_config_option_is_null (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1787,7 +1790,7 @@ weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_option_default_is_null (script_str2ptr (c_option)); + value = weechat_config_option_default_is_null (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1810,7 +1813,7 @@ weechat_ruby_api_config_boolean (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_boolean (script_str2ptr (c_option)); + value = weechat_config_boolean (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1833,7 +1836,7 @@ weechat_ruby_api_config_boolean_default (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_boolean_default (script_str2ptr (c_option)); + value = weechat_config_boolean_default (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1856,7 +1859,7 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_integer (script_str2ptr (c_option)); + value = weechat_config_integer (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1879,7 +1882,7 @@ weechat_ruby_api_config_integer_default (VALUE class, VALUE option) c_option = StringValuePtr (option); - value = weechat_config_integer_default (script_str2ptr (c_option)); + value = weechat_config_integer_default (API_STR2PTR(c_option)); API_RETURN_INT(value); } @@ -1902,7 +1905,7 @@ weechat_ruby_api_config_string (VALUE class, VALUE option) c_option = StringValuePtr (option); - result = weechat_config_string (script_str2ptr (c_option)); + result = weechat_config_string (API_STR2PTR(c_option)); API_RETURN_STRING(result); } @@ -1925,7 +1928,7 @@ weechat_ruby_api_config_string_default (VALUE class, VALUE option) c_option = StringValuePtr (option); - result = weechat_config_string_default (script_str2ptr (c_option)); + result = weechat_config_string_default (API_STR2PTR(c_option)); API_RETURN_STRING(result); } @@ -1948,7 +1951,7 @@ weechat_ruby_api_config_color (VALUE class, VALUE option) c_option = StringValuePtr (option); - result = weechat_config_color (script_str2ptr (c_option)); + result = weechat_config_color (API_STR2PTR(c_option)); API_RETURN_STRING(result); } @@ -1971,7 +1974,7 @@ weechat_ruby_api_config_color_default (VALUE class, VALUE option) c_option = StringValuePtr (option); - result = weechat_config_color_default (script_str2ptr (c_option)); + result = weechat_config_color_default (API_STR2PTR(c_option)); API_RETURN_STRING(result); } @@ -1996,8 +1999,8 @@ weechat_ruby_api_config_write_option (VALUE class, VALUE config_file, c_config_file = StringValuePtr (config_file); c_option = StringValuePtr (option); - weechat_config_write_option (script_str2ptr (c_config_file), - script_str2ptr (c_option)); + weechat_config_write_option (API_STR2PTR(c_config_file), + API_STR2PTR(c_option)); API_RETURN_OK; } @@ -2024,7 +2027,7 @@ weechat_ruby_api_config_write_line (VALUE class, VALUE config_file, c_option_name = StringValuePtr (option_name); c_value = StringValuePtr (value); - weechat_config_write_line (script_str2ptr (c_config_file), + weechat_config_write_line (API_STR2PTR(c_config_file), c_option_name, "%s", c_value); @@ -2050,7 +2053,7 @@ weechat_ruby_api_config_write (VALUE class, VALUE config_file) c_config_file = StringValuePtr (config_file); - rc = weechat_config_write (script_str2ptr (c_config_file)); + rc = weechat_config_write (API_STR2PTR(c_config_file)); API_RETURN_INT(rc); } @@ -2073,7 +2076,7 @@ weechat_ruby_api_config_read (VALUE class, VALUE config_file) c_config_file = StringValuePtr (config_file); - rc = weechat_config_read (script_str2ptr (c_config_file)); + rc = weechat_config_read (API_STR2PTR(c_config_file)); API_RETURN_INT(rc); } @@ -2096,7 +2099,7 @@ weechat_ruby_api_config_reload (VALUE class, VALUE config_file) c_config_file = StringValuePtr (config_file); - rc = weechat_config_reload (script_str2ptr (c_config_file)); + rc = weechat_config_reload (API_STR2PTR(c_config_file)); API_RETURN_INT(rc); } @@ -2120,7 +2123,7 @@ weechat_ruby_api_config_option_free (VALUE class, VALUE option) script_api_config_option_free (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_option)); + API_STR2PTR(c_option)); API_RETURN_OK; } @@ -2145,7 +2148,7 @@ weechat_ruby_api_config_section_free_options (VALUE class, VALUE section) script_api_config_section_free_options (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_section)); + API_STR2PTR(c_section)); API_RETURN_OK; } @@ -2169,7 +2172,7 @@ weechat_ruby_api_config_section_free (VALUE class, VALUE section) script_api_config_section_free (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_section)); + API_STR2PTR(c_section)); API_RETURN_OK; } @@ -2193,7 +2196,7 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file) script_api_config_free (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_config_file)); + API_STR2PTR(c_config_file)); API_RETURN_OK; } @@ -2474,7 +2477,7 @@ weechat_ruby_api_print (VALUE class, VALUE buffer, VALUE message) script_api_printf (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer), + API_STR2PTR(c_buffer), "%s", c_message); API_RETURN_OK; @@ -2508,7 +2511,7 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date, script_api_printf_date_tags (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer), + API_STR2PTR(c_buffer), c_date, c_tags, "%s", c_message); @@ -2540,7 +2543,7 @@ weechat_ruby_api_print_y (VALUE class, VALUE buffer, VALUE y, VALUE message) script_api_printf_y (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer), + API_STR2PTR(c_buffer), c_y, "%s", c_message); @@ -3237,7 +3240,7 @@ weechat_ruby_api_hook_print (VALUE class, VALUE buffer, VALUE tags, result = script_ptr2str (script_api_hook_print (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer), + API_STR2PTR(c_buffer), c_tags, c_message, c_strip_colors, @@ -3381,7 +3384,7 @@ weechat_ruby_api_hook_signal_send (VALUE class, VALUE signal, VALUE type_data, Check_Type (signal_data, T_STRING); c_signal_data = StringValuePtr (signal_data); weechat_hook_signal_send (c_signal, c_type_data, - script_str2ptr (c_signal_data)); + API_STR2PTR(c_signal_data)); API_RETURN_OK; } @@ -3673,7 +3676,7 @@ weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion, c_nick_completion = FIX2INT (nick_completion); c_where = StringValuePtr (where); - weechat_hook_completion_list_add (script_str2ptr (c_completion), + weechat_hook_completion_list_add (API_STR2PTR(c_completion), c_word, c_nick_completion, c_where); @@ -4081,7 +4084,7 @@ weechat_ruby_api_unhook (VALUE class, VALUE hook) script_api_unhook (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_hook)); + API_STR2PTR(c_hook)); API_RETURN_OK; } @@ -4301,7 +4304,7 @@ weechat_ruby_api_buffer_clear (VALUE class, VALUE buffer) c_buffer = StringValuePtr (buffer); - weechat_buffer_clear (script_str2ptr (c_buffer)); + weechat_buffer_clear (API_STR2PTR(c_buffer)); API_RETURN_OK; } @@ -4325,7 +4328,7 @@ weechat_ruby_api_buffer_close (VALUE class, VALUE buffer) script_api_buffer_close (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer)); + API_STR2PTR(c_buffer)); API_RETURN_OK; } @@ -4349,8 +4352,8 @@ weechat_ruby_api_buffer_merge (VALUE class, VALUE buffer, VALUE target_buffer) c_buffer = StringValuePtr (buffer); c_target_buffer = StringValuePtr (target_buffer); - weechat_buffer_merge (script_str2ptr (c_buffer), - script_str2ptr (c_target_buffer)); + weechat_buffer_merge (API_STR2PTR(c_buffer), + API_STR2PTR(c_target_buffer)); API_RETURN_OK; } @@ -4376,7 +4379,7 @@ weechat_ruby_api_buffer_unmerge (VALUE class, VALUE buffer, VALUE number) c_buffer = StringValuePtr (buffer); c_number = FIX2INT (number); - weechat_buffer_unmerge (script_str2ptr (c_buffer), c_number); + weechat_buffer_unmerge (API_STR2PTR(c_buffer), c_number); API_RETURN_OK; } @@ -4401,7 +4404,7 @@ weechat_ruby_api_buffer_get_integer (VALUE class, VALUE buffer, VALUE property) c_buffer = StringValuePtr (buffer); c_property = StringValuePtr (property); - value = weechat_buffer_get_integer (script_str2ptr (c_buffer), + value = weechat_buffer_get_integer (API_STR2PTR(c_buffer), c_property); API_RETURN_INT(value); @@ -4427,7 +4430,7 @@ weechat_ruby_api_buffer_get_string (VALUE class, VALUE buffer, VALUE property) c_buffer = StringValuePtr (buffer); c_property = StringValuePtr (property); - result = weechat_buffer_get_string (script_str2ptr (c_buffer), + result = weechat_buffer_get_string (API_STR2PTR(c_buffer), c_property); API_RETURN_STRING(result); @@ -4453,7 +4456,7 @@ weechat_ruby_api_buffer_get_pointer (VALUE class, VALUE buffer, VALUE property) c_buffer = StringValuePtr (buffer); c_property = StringValuePtr (property); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (c_buffer), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(c_buffer), c_property)); API_RETURN_STRING_FREE(result); @@ -4481,7 +4484,7 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property, c_property = StringValuePtr (property); c_value = StringValuePtr (value); - weechat_buffer_set (script_str2ptr (c_buffer), + weechat_buffer_set (API_STR2PTR(c_buffer), c_property, c_value); @@ -4509,7 +4512,7 @@ weechat_ruby_api_buffer_string_replace_local_var (VALUE class, VALUE buffer, VAL c_buffer = StringValuePtr (buffer); c_string = StringValuePtr (string); - result = weechat_buffer_string_replace_local_var (script_str2ptr (c_buffer), c_string); + result = weechat_buffer_string_replace_local_var (API_STR2PTR(c_buffer), c_string); API_RETURN_STRING_FREE(result); } @@ -4534,7 +4537,7 @@ weechat_ruby_api_buffer_match_list (VALUE class, VALUE buffer, VALUE string) c_buffer = StringValuePtr (buffer); c_string = StringValuePtr (string); - value = weechat_buffer_match_list (script_str2ptr (c_buffer), + value = weechat_buffer_match_list (API_STR2PTR(c_buffer), c_string); API_RETURN_INT(value); @@ -4576,7 +4579,7 @@ weechat_ruby_api_window_search_with_buffer (VALUE class, VALUE buffer) c_buffer = StringValuePtr (buffer); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (c_buffer))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(c_buffer))); API_RETURN_STRING_FREE(result); } @@ -4601,7 +4604,7 @@ weechat_ruby_api_window_get_integer (VALUE class, VALUE window, VALUE property) c_window = StringValuePtr (window); c_property = StringValuePtr (property); - value = weechat_window_get_integer (script_str2ptr (c_window), + value = weechat_window_get_integer (API_STR2PTR(c_window), c_property); API_RETURN_INT(value); @@ -4627,7 +4630,7 @@ weechat_ruby_api_window_get_string (VALUE class, VALUE window, VALUE property) c_window = StringValuePtr (window); c_property = StringValuePtr (property); - result = weechat_window_get_string (script_str2ptr (c_window), + result = weechat_window_get_string (API_STR2PTR(c_window), c_property); API_RETURN_STRING(result); @@ -4653,7 +4656,7 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property) c_window = StringValuePtr (window); c_property = StringValuePtr (property); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (c_window), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(c_window), c_property)); API_RETURN_STRING_FREE(result); @@ -4711,8 +4714,8 @@ weechat_ruby_api_nicklist_add_group (VALUE class, VALUE buffer, c_color = StringValuePtr (color); c_visible = FIX2INT (visible); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (c_buffer), - script_str2ptr (c_parent_group), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(c_buffer), + API_STR2PTR(c_parent_group), c_name, c_color, c_visible)); @@ -4743,8 +4746,8 @@ weechat_ruby_api_nicklist_search_group (VALUE class, VALUE buffer, c_from_group = StringValuePtr (from_group); c_name = StringValuePtr (name); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (c_buffer), - script_str2ptr (c_from_group), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(c_buffer), + API_STR2PTR(c_from_group), c_name)); API_RETURN_STRING_FREE(result); @@ -4785,8 +4788,8 @@ weechat_ruby_api_nicklist_add_nick (VALUE class, VALUE buffer, VALUE group, c_prefix_color = StringValuePtr (prefix_color); c_visible = FIX2INT (visible); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (c_buffer), - script_str2ptr (c_group), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(c_buffer), + API_STR2PTR(c_group), c_name, c_color, c_prefix, @@ -4819,8 +4822,8 @@ weechat_ruby_api_nicklist_search_nick (VALUE class, VALUE buffer, c_from_group = StringValuePtr (from_group); c_name = StringValuePtr (name); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (c_buffer), - script_str2ptr (c_from_group), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(c_buffer), + API_STR2PTR(c_from_group), c_name)); API_RETURN_STRING_FREE(result); @@ -4845,8 +4848,8 @@ weechat_ruby_api_nicklist_remove_group (VALUE class, VALUE buffer, VALUE group) c_buffer = StringValuePtr (buffer); c_group = StringValuePtr (group); - weechat_nicklist_remove_group (script_str2ptr (c_buffer), - script_str2ptr (c_group)); + weechat_nicklist_remove_group (API_STR2PTR(c_buffer), + API_STR2PTR(c_group)); API_RETURN_OK; } @@ -4870,8 +4873,8 @@ weechat_ruby_api_nicklist_remove_nick (VALUE class, VALUE buffer, VALUE nick) c_buffer = StringValuePtr (buffer); c_nick = StringValuePtr (nick); - weechat_nicklist_remove_nick (script_str2ptr (c_buffer), - script_str2ptr (c_nick)); + weechat_nicklist_remove_nick (API_STR2PTR(c_buffer), + API_STR2PTR(c_nick)); API_RETURN_OK; } @@ -4893,7 +4896,7 @@ weechat_ruby_api_nicklist_remove_all (VALUE class, VALUE buffer) c_buffer = StringValuePtr (buffer); - weechat_nicklist_remove_all (script_str2ptr (c_buffer)); + weechat_nicklist_remove_all (API_STR2PTR(c_buffer)); API_RETURN_OK; } @@ -4921,8 +4924,8 @@ weechat_ruby_api_nicklist_group_get_integer (VALUE class, VALUE buffer, c_group = StringValuePtr (group); c_property = StringValuePtr (property); - value = weechat_nicklist_group_get_integer (script_str2ptr (c_buffer), - script_str2ptr (c_group), + value = weechat_nicklist_group_get_integer (API_STR2PTR(c_buffer), + API_STR2PTR(c_group), c_property); API_RETURN_INT(value); @@ -4951,8 +4954,8 @@ weechat_ruby_api_nicklist_group_get_string (VALUE class, VALUE buffer, c_group = StringValuePtr (group); c_property = StringValuePtr (property); - result = weechat_nicklist_group_get_string (script_str2ptr (c_buffer), - script_str2ptr (c_group), + result = weechat_nicklist_group_get_string (API_STR2PTR(c_buffer), + API_STR2PTR(c_group), c_property); API_RETURN_STRING(result); @@ -4981,8 +4984,8 @@ weechat_ruby_api_nicklist_group_get_pointer (VALUE class, VALUE buffer, c_group = StringValuePtr (group); c_property = StringValuePtr (property); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (c_buffer), - script_str2ptr (c_group), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(c_buffer), + API_STR2PTR(c_group), c_property)); API_RETURN_STRING_FREE(result); @@ -5012,8 +5015,8 @@ weechat_ruby_api_nicklist_group_set (VALUE class, VALUE buffer, VALUE group, c_property = StringValuePtr (property); c_value = StringValuePtr (value); - weechat_nicklist_group_set (script_str2ptr (c_buffer), - script_str2ptr (c_group), + weechat_nicklist_group_set (API_STR2PTR(c_buffer), + API_STR2PTR(c_group), c_property, c_value); @@ -5043,8 +5046,8 @@ weechat_ruby_api_nicklist_nick_get_integer (VALUE class, VALUE buffer, c_nick = StringValuePtr (nick); c_property = StringValuePtr (property); - value = weechat_nicklist_nick_get_integer (script_str2ptr (c_buffer), - script_str2ptr (c_nick), + value = weechat_nicklist_nick_get_integer (API_STR2PTR(c_buffer), + API_STR2PTR(c_nick), c_property); API_RETURN_INT(value); @@ -5073,8 +5076,8 @@ weechat_ruby_api_nicklist_nick_get_string (VALUE class, VALUE buffer, c_nick = StringValuePtr (nick); c_property = StringValuePtr (property); - result = weechat_nicklist_nick_get_string (script_str2ptr (c_buffer), - script_str2ptr (c_nick), + result = weechat_nicklist_nick_get_string (API_STR2PTR(c_buffer), + API_STR2PTR(c_nick), c_property); API_RETURN_STRING(result); @@ -5103,8 +5106,8 @@ weechat_ruby_api_nicklist_nick_get_pointer (VALUE class, VALUE buffer, c_nick = StringValuePtr (nick); c_property = StringValuePtr (property); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (c_buffer), - script_str2ptr (c_nick), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(c_buffer), + API_STR2PTR(c_nick), c_property)); API_RETURN_STRING_FREE(result); @@ -5134,8 +5137,8 @@ weechat_ruby_api_nicklist_nick_set (VALUE class, VALUE buffer, VALUE nick, c_property = StringValuePtr (property); c_value = StringValuePtr (value); - weechat_nicklist_nick_set (script_str2ptr (c_buffer), - script_str2ptr (c_nick), + weechat_nicklist_nick_set (API_STR2PTR(c_buffer), + API_STR2PTR(c_nick), c_property, c_value); @@ -5275,7 +5278,7 @@ weechat_ruby_api_bar_item_remove (VALUE class, VALUE item) script_api_bar_item_remove (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_item)); + API_STR2PTR(c_item)); API_RETURN_OK; } @@ -5401,7 +5404,7 @@ weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value) c_property = StringValuePtr (property); c_value = StringValuePtr (value); - weechat_bar_set (script_str2ptr (c_bar), + weechat_bar_set (API_STR2PTR(c_bar), c_property, c_value); @@ -5447,7 +5450,7 @@ weechat_ruby_api_bar_remove (VALUE class, VALUE bar) c_bar = StringValuePtr (bar); - weechat_bar_remove (script_str2ptr (c_bar)); + weechat_bar_remove (API_STR2PTR(c_bar)); API_RETURN_OK; } @@ -5473,7 +5476,7 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command) script_api_command (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_buffer), + API_STR2PTR(c_buffer), c_command); API_RETURN_OK; @@ -5573,7 +5576,7 @@ weechat_ruby_api_infolist_new_item (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (c_infolist))); + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(c_infolist))); API_RETURN_STRING_FREE(result); } @@ -5603,7 +5606,7 @@ weechat_ruby_api_infolist_new_var_integer (VALUE class, VALUE infolist, c_name = StringValuePtr (name); c_value = FIX2INT (value); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (c_infolist), + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(c_infolist), c_name, c_value)); @@ -5634,7 +5637,7 @@ weechat_ruby_api_infolist_new_var_string (VALUE class, VALUE infolist, c_name = StringValuePtr (name); c_value = StringValuePtr (value); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (c_infolist), + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(c_infolist), c_name, c_value)); @@ -5665,9 +5668,9 @@ weechat_ruby_api_infolist_new_var_pointer (VALUE class, VALUE infolist, c_name = StringValuePtr (name); c_value = StringValuePtr (value); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (c_infolist), + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(c_infolist), c_name, - script_str2ptr (c_value))); + API_STR2PTR(c_value))); API_RETURN_STRING_FREE(result); } @@ -5696,7 +5699,7 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE infolist, c_name = StringValuePtr (name); c_value = FIX2INT (value); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (c_infolist), + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(c_infolist), c_name, c_value)); @@ -5727,7 +5730,7 @@ weechat_ruby_api_infolist_get (VALUE class, VALUE name, VALUE pointer, c_arguments = StringValuePtr (arguments); result = script_ptr2str (weechat_infolist_get (c_name, - script_str2ptr (c_pointer), + API_STR2PTR(c_pointer), c_arguments)); API_RETURN_STRING_FREE(result); @@ -5751,7 +5754,7 @@ weechat_ruby_api_infolist_next (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - value = weechat_infolist_next (script_str2ptr (c_infolist)); + value = weechat_infolist_next (API_STR2PTR(c_infolist)); API_RETURN_INT(value); } @@ -5774,7 +5777,7 @@ weechat_ruby_api_infolist_prev (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - value = weechat_infolist_prev (script_str2ptr (c_infolist)); + value = weechat_infolist_prev (API_STR2PTR(c_infolist)); API_RETURN_INT(value); } @@ -5797,7 +5800,7 @@ weechat_ruby_api_infolist_reset_item_cursor (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - weechat_infolist_reset_item_cursor (script_str2ptr (c_infolist)); + weechat_infolist_reset_item_cursor (API_STR2PTR(c_infolist)); API_RETURN_OK; } @@ -5820,7 +5823,7 @@ weechat_ruby_api_infolist_fields (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - result = weechat_infolist_fields (script_str2ptr (c_infolist)); + result = weechat_infolist_fields (API_STR2PTR(c_infolist)); API_RETURN_STRING(result); } @@ -5845,7 +5848,7 @@ weechat_ruby_api_infolist_integer (VALUE class, VALUE infolist, VALUE variable) c_infolist = StringValuePtr (infolist); c_variable = StringValuePtr (variable); - value = weechat_infolist_integer (script_str2ptr (c_infolist), c_variable); + value = weechat_infolist_integer (API_STR2PTR(c_infolist), c_variable); API_RETURN_INT(value); } @@ -5870,7 +5873,7 @@ weechat_ruby_api_infolist_string (VALUE class, VALUE infolist, VALUE variable) c_infolist = StringValuePtr (infolist); c_variable = StringValuePtr (variable); - result = weechat_infolist_string (script_str2ptr (c_infolist), c_variable); + result = weechat_infolist_string (API_STR2PTR(c_infolist), c_variable); API_RETURN_STRING(result); } @@ -5895,7 +5898,7 @@ weechat_ruby_api_infolist_pointer (VALUE class, VALUE infolist, VALUE variable) c_infolist = StringValuePtr (infolist); c_variable = StringValuePtr (variable); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (c_infolist), c_variable)); + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(c_infolist), c_variable)); API_RETURN_STRING_FREE(result); } @@ -5923,7 +5926,7 @@ weechat_ruby_api_infolist_time (VALUE class, VALUE infolist, VALUE variable) c_variable = StringValuePtr (variable); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (c_infolist), c_variable); + time = weechat_infolist_time (API_STR2PTR(c_infolist), c_variable); date_tmp = localtime (&time); if (date_tmp) strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp); @@ -5949,7 +5952,7 @@ weechat_ruby_api_infolist_free (VALUE class, VALUE infolist) c_infolist = StringValuePtr (infolist); - weechat_infolist_free (script_str2ptr (c_infolist)); + weechat_infolist_free (API_STR2PTR(c_infolist)); API_RETURN_OK; } @@ -5997,7 +6000,7 @@ weechat_ruby_api_hdata_get_var_offset (VALUE class, VALUE hdata, VALUE name) c_hdata = StringValuePtr (hdata); c_name = StringValuePtr (name); - value = weechat_hdata_get_var_offset (script_str2ptr (c_hdata), c_name); + value = weechat_hdata_get_var_offset (API_STR2PTR(c_hdata), c_name); API_RETURN_INT(value); } @@ -6024,7 +6027,7 @@ weechat_ruby_api_hdata_get_var_type_string (VALUE class, VALUE hdata, c_hdata = StringValuePtr (hdata); c_name = StringValuePtr (name); - result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata), c_name); + result = weechat_hdata_get_var_type_string (API_STR2PTR(c_hdata), c_name); API_RETURN_STRING(result); } @@ -6049,7 +6052,7 @@ weechat_ruby_api_hdata_get_var_hdata (VALUE class, VALUE hdata, VALUE name) c_hdata = StringValuePtr (hdata); c_name = StringValuePtr (name); - result = weechat_hdata_get_var_hdata (script_str2ptr (c_hdata), c_name); + result = weechat_hdata_get_var_hdata (API_STR2PTR(c_hdata), c_name); API_RETURN_STRING(result); } @@ -6074,7 +6077,7 @@ weechat_ruby_api_hdata_get_list (VALUE class, VALUE hdata, VALUE name) c_hdata = StringValuePtr (hdata); c_name = StringValuePtr (name); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (c_hdata), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(c_hdata), c_name)); API_RETURN_STRING_FREE(result); @@ -6103,9 +6106,9 @@ weechat_ruby_api_hdata_check_pointer (VALUE class, VALUE hdata, VALUE list, c_list = StringValuePtr (list); c_pointer = StringValuePtr (pointer); - value = weechat_hdata_check_pointer (script_str2ptr (c_hdata), - script_str2ptr (c_list), - script_str2ptr (c_pointer)); + value = weechat_hdata_check_pointer (API_STR2PTR(c_hdata), + API_STR2PTR(c_list), + API_STR2PTR(c_pointer)); API_RETURN_INT(value); } @@ -6134,8 +6137,8 @@ weechat_ruby_api_hdata_move (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_count = FIX2INT (count); - result = weechat_hdata_move (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + result = weechat_hdata_move (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_count); API_RETURN_STRING_FREE(result); @@ -6165,8 +6168,8 @@ weechat_ruby_api_hdata_char (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_name = StringValuePtr (name); - value = (int)weechat_hdata_char (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + value = (int)weechat_hdata_char (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name); API_RETURN_INT(value); @@ -6196,8 +6199,8 @@ weechat_ruby_api_hdata_integer (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_name = StringValuePtr (name); - value = weechat_hdata_integer (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + value = weechat_hdata_integer (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name); API_RETURN_INT(value); @@ -6227,8 +6230,8 @@ weechat_ruby_api_hdata_long (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_name = StringValuePtr (name); - value = weechat_hdata_long (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + value = weechat_hdata_long (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name); API_RETURN_LONG(value); @@ -6258,8 +6261,8 @@ weechat_ruby_api_hdata_string (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_name = StringValuePtr (name); - result = weechat_hdata_string (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + result = weechat_hdata_string (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name); API_RETURN_STRING(result); @@ -6289,8 +6292,8 @@ weechat_ruby_api_hdata_pointer (VALUE class, VALUE hdata, VALUE pointer, c_pointer = StringValuePtr (pointer); c_name = StringValuePtr (name); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name)); API_RETURN_STRING_FREE(result); @@ -6323,8 +6326,8 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer, c_name = StringValuePtr (name); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + time = weechat_hdata_time (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name); date_tmp = localtime (&time); if (date_tmp) @@ -6359,8 +6362,8 @@ weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer, c_name = StringValuePtr (name); result_hash = weechat_ruby_hashtable_to_hash ( - weechat_hdata_hashtable (script_str2ptr (c_hdata), - script_str2ptr (c_pointer), + weechat_hdata_hashtable (API_STR2PTR(c_hdata), + API_STR2PTR(c_pointer), c_name)); return result_hash; @@ -6386,7 +6389,7 @@ weechat_ruby_api_hdata_get_string (VALUE class, VALUE hdata, VALUE property) c_hdata = StringValuePtr (hdata); c_property = StringValuePtr (property); - result = weechat_hdata_get_var_type_string (script_str2ptr (c_hdata), + result = weechat_hdata_get_var_type_string (API_STR2PTR(c_hdata), c_property); API_RETURN_STRING(result); @@ -6442,9 +6445,9 @@ weechat_ruby_api_upgrade_write_object (VALUE class, VALUE upgrade_file, c_object_id = FIX2INT (object_id); c_infolist = StringValuePtr (infolist); - rc = weechat_upgrade_write_object (script_str2ptr (c_upgrade_file), + rc = weechat_upgrade_write_object (API_STR2PTR(c_upgrade_file), c_object_id, - script_str2ptr (c_infolist)); + API_STR2PTR(c_infolist)); API_RETURN_INT(rc); } @@ -6523,7 +6526,7 @@ weechat_ruby_api_upgrade_read (VALUE class, VALUE upgrade_file, rc = script_api_upgrade_read (weechat_ruby_plugin, ruby_current_script, - script_str2ptr (c_upgrade_file), + API_STR2PTR(c_upgrade_file), &weechat_ruby_api_upgrade_read_cb, c_function, c_data); @@ -6548,7 +6551,7 @@ weechat_ruby_api_upgrade_close (VALUE class, VALUE upgrade_file) c_upgrade_file = StringValuePtr (upgrade_file); - weechat_upgrade_close (script_str2ptr (c_upgrade_file)); + weechat_upgrade_close (API_STR2PTR(c_upgrade_file)); API_RETURN_OK; } diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index 43b36017b..012d541b1 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -485,7 +485,7 @@ weechat_ruby_load (const char *filename) return 0; } - if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet) + if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -621,7 +621,7 @@ weechat_ruby_unload (struct t_plugin_script *script) int *rc; void *interpreter; - if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet) + if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c index 95766a518..3f4268a4a 100644 --- a/src/plugins/scripts/script.c +++ b/src/plugins/scripts/script.c @@ -262,18 +262,39 @@ script_ptr2str (void *pointer) */ void * -script_str2ptr (const char *pointer_str) +script_str2ptr (struct t_weechat_plugin *weechat_plugin, + const char *script_name, const char *function_name, + const char *str_pointer) { long unsigned int value; int rc; + struct t_gui_buffer *ptr_buffer; - if (!pointer_str || (pointer_str[0] != '0') || (pointer_str[1] != 'x')) + if (!str_pointer || !str_pointer[0]) return NULL; - rc = sscanf (pointer_str + 2, "%lx", &value); + if ((str_pointer[0] != '0') || (str_pointer[1] != 'x')) + goto invalid; + + rc = sscanf (str_pointer + 2, "%lx", &value); if ((rc != EOF) && (rc >= 1)) return (void *)value; +invalid: + if (weechat_plugin->debug >= 1) + { + ptr_buffer = weechat_buffer_search_main (); + if (ptr_buffer) + { + weechat_buffer_set (ptr_buffer, "print_hooks_enabled", "0"); + weechat_printf (NULL, + _("%s%s: warning, invalid pointer (\"%s\") for " + "function \"%s\" (script: %s)"), + weechat_prefix ("error"), weechat_plugin->name, + str_pointer, function_name, script_name); + weechat_buffer_set (ptr_buffer, "print_hooks_enabled", "1"); + } + } return NULL; } diff --git a/src/plugins/scripts/script.h b/src/plugins/scripts/script.h index d93c3af94..55b692a1a 100644 --- a/src/plugins/scripts/script.h +++ b/src/plugins/scripts/script.h @@ -97,7 +97,9 @@ extern void script_init (struct t_weechat_plugin *weechat_plugin, extern int script_valid (struct t_plugin_script *scripts, struct t_plugin_script *script); extern char *script_ptr2str (void *pointer); -extern void *script_str2ptr (const char *pointer_str); +extern void *script_str2ptr (struct t_weechat_plugin *weechat_plugin, + const char *script_name, const char *function_name, + const char *pointer_str); extern void script_auto_load (struct t_weechat_plugin *weechat_plugin, void (*callback)(void *data, const char *filename)); extern struct t_plugin_script *script_search (struct t_weechat_plugin *weechat_plugin, diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 472117b18..03812d0d0 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -53,6 +53,9 @@ tcl_function_name); \ __ret; \ } +#define API_STR2PTR(__string) \ + script_str2ptr (weechat_tcl_plugin, TCL_CURRENT_SCRIPT_NAME, \ + tcl_function_name, __string) #define API_RETURN_OK \ { \ objp = Tcl_GetObjResult (interp); \ @@ -250,7 +253,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc, if (tcl_current_script) { tcl_registered_script = tcl_current_script; - if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet) + if ((weechat_tcl_plugin->debug >= 2) || !tcl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: registered script \"%s\", " @@ -287,7 +290,7 @@ weechat_tcl_api_plugin_get_name (ClientData clientData, Tcl_Interp *interp, plugin = Tcl_GetStringFromObj (objv[1], &i); - result = weechat_plugin_get_name (script_str2ptr (plugin)); + result = weechat_plugin_get_name (API_STR2PTR(plugin)); API_RETURN_STRING(result); } @@ -715,10 +718,10 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp, where = Tcl_GetStringFromObj (objv[3], &i); user_data = Tcl_GetStringFromObj (objv[4], &i); - result = script_ptr2str (weechat_list_add (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_add (API_STR2PTR(weelist), data, where, - script_str2ptr (user_data))); + API_STR2PTR(user_data))); API_RETURN_STRING_FREE(result); } @@ -742,7 +745,7 @@ weechat_tcl_api_list_search (ClientData clientData, Tcl_Interp *interp, weelist = Tcl_GetStringFromObj (objv[1], &i); data = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_list_search (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_search (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -767,7 +770,7 @@ weechat_tcl_api_list_search_pos (ClientData clientData, Tcl_Interp *interp, weelist = Tcl_GetStringFromObj (objv[1], &i); data = Tcl_GetStringFromObj (objv[2], &i); - pos = weechat_list_search_pos (script_str2ptr (weelist), data); + pos = weechat_list_search_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -791,7 +794,7 @@ weechat_tcl_api_list_casesearch (ClientData clientData, Tcl_Interp *interp, weelist = Tcl_GetStringFromObj (objv[1], &i); data = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_list_casesearch (script_str2ptr (weelist), + result = script_ptr2str (weechat_list_casesearch (API_STR2PTR(weelist), data)); API_RETURN_STRING_FREE(result); @@ -817,7 +820,7 @@ weechat_tcl_api_list_casesearch_pos (ClientData clientData, Tcl_Interp *interp, weelist = Tcl_GetStringFromObj (objv[1], &i); data = Tcl_GetStringFromObj (objv[2], &i); - pos = weechat_list_casesearch_pos (script_str2ptr (weelist), data); + pos = weechat_list_casesearch_pos (API_STR2PTR(weelist), data); API_RETURN_INT(pos); } @@ -841,7 +844,7 @@ weechat_tcl_api_list_get (ClientData clientData, Tcl_Interp *interp, if (Tcl_GetIntFromObj (interp, objv[2], &position) != TCL_OK) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_get (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* weelist */ + result = script_ptr2str (weechat_list_get (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* weelist */ position)); API_RETURN_STRING_FREE(result); @@ -866,7 +869,7 @@ weechat_tcl_api_list_set (ClientData clientData, Tcl_Interp *interp, item = Tcl_GetStringFromObj (objv[1], &i); new_value = Tcl_GetStringFromObj (objv[2], &i); - weechat_list_set (script_str2ptr (item), new_value); + weechat_list_set (API_STR2PTR(item), new_value); API_RETURN_OK; } @@ -887,7 +890,7 @@ weechat_tcl_api_list_next (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */ + result = script_ptr2str (weechat_list_next (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)))); /* item */ API_RETURN_STRING_FREE(result); } @@ -908,7 +911,7 @@ weechat_tcl_api_list_prev (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_list_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* item */ + result = script_ptr2str (weechat_list_prev (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)))); /* item */ API_RETURN_STRING_FREE(result); } @@ -929,7 +932,7 @@ weechat_tcl_api_list_string (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_list_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */ + result = weechat_list_string (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* item */ API_RETURN_STRING(result); } @@ -950,7 +953,7 @@ weechat_tcl_api_list_size (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - size = weechat_list_size (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ + size = weechat_list_size (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ API_RETURN_INT(size); } @@ -974,7 +977,8 @@ weechat_tcl_api_list_remove (ClientData clientData, Tcl_Interp *interp, weelist = Tcl_GetStringFromObj (objv[1], &i); item = Tcl_GetStringFromObj (objv[2], &i); - weechat_list_remove (script_str2ptr (weelist), script_str2ptr (item)); + weechat_list_remove (API_STR2PTR(weelist), + API_STR2PTR(item)); API_RETURN_OK; } @@ -996,7 +1000,7 @@ weechat_tcl_api_list_remove_all (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ + weechat_list_remove_all (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ API_RETURN_OK; } @@ -1016,7 +1020,7 @@ weechat_tcl_api_list_free (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_list_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ + weechat_list_free (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* weelist */ API_RETURN_OK; } @@ -1371,7 +1375,7 @@ weechat_tcl_api_config_new_section (ClientData clientData, Tcl_Interp *interp, result = script_ptr2str (script_api_config_new_section (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (cfg_file), + API_STR2PTR(cfg_file), name, can_add, /* user_can_add_options */ can_delete, /* user_can_delete_options */ @@ -1413,7 +1417,7 @@ weechat_tcl_api_config_search_section (ClientData clientData, Tcl_Interp *interp config_file = Tcl_GetStringFromObj (objv[1], &i); section_name = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_config_search_section (script_str2ptr (config_file), + result = script_ptr2str (weechat_config_search_section (API_STR2PTR(config_file), section_name)); API_RETURN_STRING_FREE(result); @@ -1571,8 +1575,8 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp, result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (config_file), - script_str2ptr (section), + API_STR2PTR(config_file), + API_STR2PTR(section), name, type, description, @@ -1616,8 +1620,8 @@ weechat_tcl_api_config_search_option (ClientData clientData, Tcl_Interp *interp, section = Tcl_GetStringFromObj (objv[2], &i); option_name = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_config_search_option (script_str2ptr (config_file), - script_str2ptr (section), + result = script_ptr2str (weechat_config_search_option (API_STR2PTR(config_file), + API_STR2PTR(section), option_name)); API_RETURN_STRING_FREE(result); @@ -1665,7 +1669,7 @@ weechat_tcl_api_config_option_reset (ClientData clientData, Tcl_Interp *interp, option = Tcl_GetStringFromObj (objv[1], &i); - rc = weechat_config_option_reset (script_str2ptr (option), + rc = weechat_config_option_reset (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1694,7 +1698,7 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp, option = Tcl_GetStringFromObj (objv[1], &i); new_value = Tcl_GetStringFromObj (objv[2], &i); - rc = weechat_config_option_set (script_str2ptr (option), + rc = weechat_config_option_set (API_STR2PTR(option), new_value, run_callback); @@ -1723,7 +1727,7 @@ weechat_tcl_api_config_option_set_null (ClientData clientData, Tcl_Interp *inter option = Tcl_GetStringFromObj (objv[1], &i); - rc = weechat_config_option_set_null (script_str2ptr (option), + rc = weechat_config_option_set_null (API_STR2PTR(option), run_callback); API_RETURN_INT(rc); @@ -1748,7 +1752,7 @@ weechat_tcl_api_config_option_unset (ClientData clientData, Tcl_Interp *interp, option = Tcl_GetStringFromObj (objv[1], &i); - rc = weechat_config_option_unset (script_str2ptr (option)); + rc = weechat_config_option_unset (API_STR2PTR(option)); API_RETURN_INT(rc); } @@ -1772,7 +1776,7 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp, option = Tcl_GetStringFromObj (objv[1], &i); new_name = Tcl_GetStringFromObj (objv[2], &i); - weechat_config_option_rename (script_str2ptr (option), + weechat_config_option_rename (API_STR2PTR(option), new_name); API_RETURN_OK; @@ -1793,7 +1797,7 @@ weechat_tcl_api_config_option_is_null (ClientData clientData, Tcl_Interp *interp if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(1)); - result = weechat_config_option_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_option_is_null (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1815,7 +1819,7 @@ weechat_tcl_api_config_option_default_is_null (ClientData clientData, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(1)); - result = weechat_config_option_default_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_option_default_is_null (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1835,7 +1839,7 @@ weechat_tcl_api_config_boolean (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_boolean (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_boolean (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1855,7 +1859,7 @@ weechat_tcl_api_config_boolean_default (ClientData clientData, Tcl_Interp *inter if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_boolean_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_boolean_default (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1875,7 +1879,7 @@ weechat_tcl_api_config_integer (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_integer (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1895,7 +1899,7 @@ weechat_tcl_api_config_integer_default (ClientData clientData, Tcl_Interp *inter if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_integer_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_integer_default (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_INT(result); } @@ -1916,7 +1920,7 @@ weechat_tcl_api_config_string (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_string (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_STRING(result); } @@ -1937,7 +1941,7 @@ weechat_tcl_api_config_string_default (ClientData clientData, Tcl_Interp *interp if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_config_string_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_string_default (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_STRING(result); } @@ -1958,7 +1962,7 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_color (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_STRING(result); } @@ -1979,7 +1983,7 @@ weechat_tcl_api_config_color_default (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_config_color_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + result = weechat_config_color_default (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_STRING(result); } @@ -2003,8 +2007,8 @@ weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp, config_file = Tcl_GetStringFromObj (objv[1], &i); option = Tcl_GetStringFromObj (objv[2], &i); - weechat_config_write_option (script_str2ptr (config_file), - script_str2ptr (option)); + weechat_config_write_option (API_STR2PTR(config_file), + API_STR2PTR(option)); API_RETURN_OK; } @@ -2029,7 +2033,7 @@ weechat_tcl_api_config_write_line (ClientData clientData, Tcl_Interp *interp, option_name = Tcl_GetStringFromObj (objv[2], &i); value = Tcl_GetStringFromObj (objv[3], &i); - weechat_config_write_line (script_str2ptr (config_file), option_name, + weechat_config_write_line (API_STR2PTR(config_file), option_name, "%s", value); API_RETURN_OK; @@ -2051,7 +2055,7 @@ weechat_tcl_api_config_write (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_write (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ + rc = weechat_config_write (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ API_RETURN_INT(rc); } @@ -2072,7 +2076,7 @@ weechat_tcl_api_config_read (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_read (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ + rc = weechat_config_read (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ API_RETURN_INT(rc); } @@ -2093,7 +2097,7 @@ weechat_tcl_api_config_reload (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(-1)); - rc = weechat_config_reload (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ + rc = weechat_config_reload (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ API_RETURN_INT(rc); } @@ -2115,7 +2119,7 @@ weechat_tcl_api_config_option_free (ClientData clientData, Tcl_Interp *interp, script_api_config_option_free (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* option */ API_RETURN_OK; } @@ -2138,7 +2142,7 @@ weechat_tcl_api_config_section_free_options (ClientData clientData, Tcl_Interp * script_api_config_section_free_options (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */ API_RETURN_OK; } @@ -2160,7 +2164,7 @@ weechat_tcl_api_config_section_free (ClientData clientData, Tcl_Interp *interp, script_api_config_section_free (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* section */ API_RETURN_OK; } @@ -2182,7 +2186,7 @@ weechat_tcl_api_config_free (ClientData clientData, Tcl_Interp *interp, script_api_config_free (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* config_file */ API_RETURN_OK; } @@ -2451,7 +2455,7 @@ weechat_tcl_api_print (ClientData clientData, Tcl_Interp *interp, script_api_printf (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), "%s", message); API_RETURN_OK; @@ -2483,7 +2487,7 @@ weechat_tcl_api_print_date_tags (ClientData clientData, Tcl_Interp *interp, script_api_printf_date_tags (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), tdate, tags, "%s", message); @@ -2515,7 +2519,7 @@ weechat_tcl_api_print_y (ClientData clientData, Tcl_Interp *interp, script_api_printf_y (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), y, "%s", message); @@ -3159,7 +3163,7 @@ weechat_tcl_api_hook_print (ClientData clientData, Tcl_Interp *interp, result = script_ptr2str (script_api_hook_print (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), tags, message, strip_colors, /* strip_colors */ @@ -3577,7 +3581,7 @@ weechat_tcl_api_hook_completion_list_add (ClientData clientData, Tcl_Interp *int word = Tcl_GetStringFromObj (objv[2], &i); where = Tcl_GetStringFromObj (objv[4], &i); - weechat_hook_completion_list_add (script_str2ptr (completion), + weechat_hook_completion_list_add (API_STR2PTR(completion), word, nick_completion, /* nick_completion */ where); @@ -3947,7 +3951,7 @@ weechat_tcl_api_unhook (ClientData clientData, Tcl_Interp *interp, script_api_unhook (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* hook */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* hook */ API_RETURN_OK; } @@ -4175,7 +4179,7 @@ weechat_tcl_api_buffer_clear (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_clear (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ + weechat_buffer_clear (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ API_RETURN_OK; } @@ -4197,7 +4201,7 @@ weechat_tcl_api_buffer_close (ClientData clientData, Tcl_Interp *interp, script_api_buffer_close (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ API_RETURN_OK; } @@ -4217,8 +4221,8 @@ weechat_tcl_api_buffer_merge (ClientData clientData, Tcl_Interp *interp, if (objc < 3) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_merge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* buffer */ - script_str2ptr (Tcl_GetStringFromObj (objv[2], &i))); /* target_buffer */ + weechat_buffer_merge (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* buffer */ + API_STR2PTR(Tcl_GetStringFromObj (objv[2], &i))); /* target_buffer */ API_RETURN_OK; } @@ -4242,7 +4246,7 @@ weechat_tcl_api_buffer_unmerge (ClientData clientData, Tcl_Interp *interp, if (Tcl_GetIntFromObj (interp, objv[2], &number) != TCL_OK) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_buffer_unmerge (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), + weechat_buffer_unmerge (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), number); API_RETURN_OK; @@ -4268,7 +4272,7 @@ weechat_tcl_api_buffer_get_integer (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_buffer_get_integer (script_str2ptr (buffer), property); + result = weechat_buffer_get_integer (API_STR2PTR(buffer), property); API_RETURN_INT(result); } @@ -4293,7 +4297,7 @@ weechat_tcl_api_buffer_get_string (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_buffer_get_string (script_str2ptr (buffer), property); + result = weechat_buffer_get_string (API_STR2PTR(buffer), property); API_RETURN_STRING(result); } @@ -4317,7 +4321,7 @@ weechat_tcl_api_buffer_get_pointer (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_buffer_get_pointer (script_str2ptr (buffer), + result = script_ptr2str (weechat_buffer_get_pointer (API_STR2PTR(buffer), property)); API_RETURN_STRING_FREE(result); @@ -4343,7 +4347,7 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp, property = Tcl_GetStringFromObj (objv[2], &i); value = Tcl_GetStringFromObj (objv[3], &i); - weechat_buffer_set (script_str2ptr (buffer), property, value); + weechat_buffer_set (API_STR2PTR(buffer), property, value); API_RETURN_OK; } @@ -4368,7 +4372,7 @@ weechat_tcl_api_buffer_string_replace_local_var (ClientData clientData, Tcl_Inte buffer = Tcl_GetStringFromObj (objv[1], &i); string = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_buffer_string_replace_local_var (script_str2ptr (buffer), string); + result = weechat_buffer_string_replace_local_var (API_STR2PTR(buffer), string); API_RETURN_STRING_FREE(result); } @@ -4393,7 +4397,7 @@ weechat_tcl_api_buffer_match_list (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); string = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_buffer_match_list (script_str2ptr (buffer), string); + result = weechat_buffer_match_list (API_STR2PTR(buffer), string); API_RETURN_INT(result); } @@ -4440,7 +4444,7 @@ weechat_tcl_api_window_search_with_buffer (ClientData clientData, Tcl_Interp *in buffer = Tcl_GetStringFromObj (objv[1], &i); - result = script_ptr2str (weechat_window_search_with_buffer (script_str2ptr (buffer))); + result = script_ptr2str (weechat_window_search_with_buffer (API_STR2PTR(buffer))); API_RETURN_STRING_FREE(result); } @@ -4465,7 +4469,7 @@ weechat_tcl_api_window_get_integer (ClientData clientData, Tcl_Interp *interp, window = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_window_get_integer (script_str2ptr (window), property); + result = weechat_window_get_integer (API_STR2PTR(window), property); API_RETURN_INT(result); } @@ -4490,7 +4494,7 @@ weechat_tcl_api_window_get_string (ClientData clientData, Tcl_Interp *interp, window = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_window_get_string (script_str2ptr (window), property); + result = weechat_window_get_string (API_STR2PTR(window), property); API_RETURN_STRING(result); } @@ -4514,7 +4518,7 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp, window = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_window_get_pointer (script_str2ptr (window), + result = script_ptr2str (weechat_window_get_pointer (API_STR2PTR(window), property)); API_RETURN_STRING_FREE(result); @@ -4567,8 +4571,8 @@ weechat_tcl_api_nicklist_add_group (ClientData clientData, Tcl_Interp *interp, name = Tcl_GetStringFromObj (objv[3], &i); color = Tcl_GetStringFromObj (objv[4], &i); - result = script_ptr2str (weechat_nicklist_add_group (script_str2ptr (buffer), - script_str2ptr (parent_group), + result = script_ptr2str (weechat_nicklist_add_group (API_STR2PTR(buffer), + API_STR2PTR(parent_group), name, color, visible)); /* visible */ @@ -4596,8 +4600,8 @@ weechat_tcl_api_nicklist_search_group (ClientData clientData, Tcl_Interp *interp from_group = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_nicklist_search_group (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_group (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4629,8 +4633,8 @@ weechat_tcl_api_nicklist_add_nick (ClientData clientData, Tcl_Interp *interp, prefix = Tcl_GetStringFromObj (objv[5], &i); prefix_color = Tcl_GetStringFromObj (objv[6], &i); - result = script_ptr2str (weechat_nicklist_add_nick (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_add_nick (API_STR2PTR(buffer), + API_STR2PTR(group), name, color, prefix, @@ -4660,8 +4664,8 @@ weechat_tcl_api_nicklist_search_nick (ClientData clientData, Tcl_Interp *interp, from_group = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_nicklist_search_nick (script_str2ptr (buffer), - script_str2ptr (from_group), + result = script_ptr2str (weechat_nicklist_search_nick (API_STR2PTR(buffer), + API_STR2PTR(from_group), name)); API_RETURN_STRING_FREE(result); @@ -4686,8 +4690,8 @@ weechat_tcl_api_nicklist_remove_group (ClientData clientData, Tcl_Interp *interp buffer = Tcl_GetStringFromObj (objv[1], &i); group = Tcl_GetStringFromObj (objv[2], &i); - weechat_nicklist_remove_group (script_str2ptr (buffer), - script_str2ptr (group)); + weechat_nicklist_remove_group (API_STR2PTR(buffer), + API_STR2PTR(group)); API_RETURN_OK; } @@ -4711,8 +4715,8 @@ weechat_tcl_api_nicklist_remove_nick (ClientData clientData, Tcl_Interp *interp, buffer = Tcl_GetStringFromObj (objv[1], &i); nick = Tcl_GetStringFromObj (objv[2], &i); - weechat_nicklist_remove_nick (script_str2ptr (buffer), - script_str2ptr (nick)); + weechat_nicklist_remove_nick (API_STR2PTR(buffer), + API_STR2PTR(nick)); API_RETURN_OK; } @@ -4732,7 +4736,7 @@ weechat_tcl_api_nicklist_remove_all (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_nicklist_remove_all (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ + weechat_nicklist_remove_all (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* buffer */ API_RETURN_OK; } @@ -4759,8 +4763,8 @@ weechat_tcl_api_nicklist_group_get_integer (ClientData clientData, group = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_nicklist_group_get_integer (script_str2ptr (buffer), - script_str2ptr (group), + result = weechat_nicklist_group_get_integer (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_INT(result); @@ -4788,8 +4792,8 @@ weechat_tcl_api_nicklist_group_get_string (ClientData clientData, group = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_nicklist_group_get_string (script_str2ptr (buffer), - script_str2ptr (group), + result = weechat_nicklist_group_get_string (API_STR2PTR(buffer), + API_STR2PTR(group), property); API_RETURN_STRING(result); @@ -4816,8 +4820,8 @@ weechat_tcl_api_nicklist_group_get_pointer (ClientData clientData, group = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_nicklist_group_get_pointer (script_str2ptr (buffer), - script_str2ptr (group), + result = script_ptr2str (weechat_nicklist_group_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(group), property)); API_RETURN_STRING_FREE(result); @@ -4844,8 +4848,8 @@ weechat_tcl_api_nicklist_group_set (ClientData clientData, Tcl_Interp *interp, property = Tcl_GetStringFromObj (objv[3], &i); value = Tcl_GetStringFromObj (objv[4], &i); - weechat_nicklist_group_set (script_str2ptr (buffer), - script_str2ptr (group), + weechat_nicklist_group_set (API_STR2PTR(buffer), + API_STR2PTR(group), property, value); @@ -4874,8 +4878,8 @@ weechat_tcl_api_nicklist_nick_get_integer (ClientData clientData, nick = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_nicklist_nick_get_integer (script_str2ptr (buffer), - script_str2ptr (nick), + result = weechat_nicklist_nick_get_integer (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_INT(result); @@ -4903,8 +4907,8 @@ weechat_tcl_api_nicklist_nick_get_string (ClientData clientData, nick = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_nicklist_nick_get_string (script_str2ptr (buffer), - script_str2ptr (nick), + result = weechat_nicklist_nick_get_string (API_STR2PTR(buffer), + API_STR2PTR(nick), property); API_RETURN_STRING(result); @@ -4931,8 +4935,8 @@ weechat_tcl_api_nicklist_nick_get_pointer (ClientData clientData, nick = Tcl_GetStringFromObj (objv[2], &i); property = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_nicklist_nick_get_pointer (script_str2ptr (buffer), - script_str2ptr (nick), + result = script_ptr2str (weechat_nicklist_nick_get_pointer (API_STR2PTR(buffer), + API_STR2PTR(nick), property)); API_RETURN_STRING_FREE(result); @@ -4959,8 +4963,8 @@ weechat_tcl_api_nicklist_nick_set (ClientData clientData, Tcl_Interp *interp, property = Tcl_GetStringFromObj (objv[3], &i); value = Tcl_GetStringFromObj (objv[4], &i); - weechat_nicklist_nick_set (script_str2ptr (buffer), - script_str2ptr (nick), + weechat_nicklist_nick_set (API_STR2PTR(buffer), + API_STR2PTR(nick), property, value); @@ -5091,7 +5095,7 @@ weechat_tcl_api_bar_item_remove (ClientData clientData, Tcl_Interp *interp, script_api_bar_item_remove (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* item */ + API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* item */ API_RETURN_OK; } @@ -5190,7 +5194,7 @@ weechat_tcl_api_bar_set (ClientData clientData, Tcl_Interp *interp, property = Tcl_GetStringFromObj (objv[2], &i); value = Tcl_GetStringFromObj (objv[3], &i); - weechat_bar_set (script_str2ptr (bar), property, value); + weechat_bar_set (API_STR2PTR(bar), property, value); API_RETURN_OK; } @@ -5230,7 +5234,7 @@ weechat_tcl_api_bar_remove (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_bar_remove (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* bar */ + weechat_bar_remove (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* bar */ API_RETURN_OK; } @@ -5256,7 +5260,7 @@ weechat_tcl_api_command (ClientData clientData, Tcl_Interp *interp, script_api_command (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (buffer), + API_STR2PTR(buffer), command); API_RETURN_OK; @@ -5354,7 +5358,7 @@ weechat_tcl_api_infolist_new_item (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* infolist */ + result = script_ptr2str (weechat_infolist_new_item (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)))); /* infolist */ API_RETURN_STRING_FREE(result); } @@ -5379,7 +5383,7 @@ weechat_tcl_api_infolist_new_var_integer (ClientData clientData, Tcl_Interp *int if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_integer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ + result = script_ptr2str (weechat_infolist_new_var_integer (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ Tcl_GetStringFromObj (objv[2], &i), /* name */ value)); @@ -5403,7 +5407,7 @@ weechat_tcl_api_infolist_new_var_string (ClientData clientData, Tcl_Interp *inte if (objc < 4) API_WRONG_ARGS(API_RETURN_INT(0)); - result = script_ptr2str (weechat_infolist_new_var_string (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ + result = script_ptr2str (weechat_infolist_new_var_string (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ Tcl_GetStringFromObj (objv[2], &i), /* name */ Tcl_GetStringFromObj (objv[3], &i))); /* value */ @@ -5426,9 +5430,9 @@ weechat_tcl_api_infolist_new_var_pointer (ClientData clientData, Tcl_Interp *int if (objc < 4) API_WRONG_ARGS(API_RETURN_INT(0)); - result = script_ptr2str (weechat_infolist_new_var_pointer (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ + result = script_ptr2str (weechat_infolist_new_var_pointer (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ Tcl_GetStringFromObj (objv[2], &i), /* name */ - script_str2ptr (Tcl_GetStringFromObj (objv[3], &i)))); /* value */ + API_STR2PTR(Tcl_GetStringFromObj (objv[3], &i)))); /* value */ API_RETURN_STRING_FREE(result); } @@ -5452,7 +5456,7 @@ weechat_tcl_api_infolist_new_var_time (ClientData clientData, Tcl_Interp *interp if (Tcl_GetIntFromObj (interp, objv[3], &value) != TCL_OK) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_infolist_new_var_time (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ + result = script_ptr2str (weechat_infolist_new_var_time (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i)), /* infolist */ Tcl_GetStringFromObj (objv[2], &i), /* name */ value)); @@ -5480,7 +5484,7 @@ weechat_tcl_api_infolist_get (ClientData clientData, Tcl_Interp *interp, arguments = Tcl_GetStringFromObj (objv[3], &i); result = script_ptr2str (weechat_infolist_get (name, - script_str2ptr (pointer), + API_STR2PTR(pointer), arguments)); API_RETURN_STRING_FREE(result); @@ -5501,7 +5505,7 @@ weechat_tcl_api_infolist_next (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_infolist_next (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + result = weechat_infolist_next (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ API_RETURN_INT(result); } @@ -5522,7 +5526,7 @@ weechat_tcl_api_infolist_prev (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_INT(0)); - result = weechat_infolist_prev (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + result = weechat_infolist_prev (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ API_RETURN_INT(result); } @@ -5544,7 +5548,7 @@ weechat_tcl_api_infolist_reset_item_cursor (ClientData clientData, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_reset_item_cursor (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + weechat_infolist_reset_item_cursor (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ API_RETURN_OK; } @@ -5566,7 +5570,7 @@ weechat_tcl_api_infolist_fields (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_EMPTY); - result = weechat_infolist_fields (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + result = weechat_infolist_fields (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ API_RETURN_STRING(result); } @@ -5591,7 +5595,7 @@ weechat_tcl_api_infolist_integer (ClientData clientData, Tcl_Interp *interp, infolist = Tcl_GetStringFromObj (objv[1], &i); variable = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_infolist_integer (script_str2ptr (infolist), variable); + result = weechat_infolist_integer (API_STR2PTR(infolist), variable); API_RETURN_INT(result); } @@ -5616,7 +5620,7 @@ weechat_tcl_api_infolist_string (ClientData clientData, Tcl_Interp *interp, infolist = Tcl_GetStringFromObj (objv[1], &i); variable = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_infolist_string (script_str2ptr (infolist), variable); + result = weechat_infolist_string (API_STR2PTR(infolist), variable); API_RETURN_STRING(result); } @@ -5641,7 +5645,7 @@ weechat_tcl_api_infolist_pointer (ClientData clientData, Tcl_Interp *interp, infolist = Tcl_GetStringFromObj (objv[1], &i); variable = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_infolist_pointer (script_str2ptr (infolist), variable)); + result = script_ptr2str (weechat_infolist_pointer (API_STR2PTR(infolist), variable)); API_RETURN_STRING_FREE(result); } @@ -5668,7 +5672,7 @@ weechat_tcl_api_infolist_time (ClientData clientData, Tcl_Interp *interp, variable = Tcl_GetStringFromObj (objv[2], &i); timebuffer[0] = '\0'; - time = weechat_infolist_time (script_str2ptr (infolist), variable); + time = weechat_infolist_time (API_STR2PTR(infolist), variable); date_tmp = localtime (&time); if (date_tmp) strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp); @@ -5692,7 +5696,7 @@ weechat_tcl_api_infolist_free (ClientData clientData, Tcl_Interp *interp, if (objc < 2) API_WRONG_ARGS(API_RETURN_ERROR); - weechat_infolist_free (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ + weechat_infolist_free (API_STR2PTR(Tcl_GetStringFromObj (objv[1], &i))); /* infolist */ API_RETURN_OK; } @@ -5739,7 +5743,7 @@ weechat_tcl_api_hdata_get_var_offset (ClientData clientData, Tcl_Interp *interp, hdata = Tcl_GetStringFromObj (objv[1], &i); name = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_hdata_get_var_offset (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_offset (API_STR2PTR(hdata), name); API_RETURN_INT(result); } @@ -5766,7 +5770,7 @@ weechat_tcl_api_hdata_get_var_type_string (ClientData clientData, hdata = Tcl_GetStringFromObj (objv[1], &i); name = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_hdata_get_var_type_string (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_type_string (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5791,7 +5795,7 @@ weechat_tcl_api_hdata_get_var_hdata (ClientData clientData, Tcl_Interp *interp, hdata = Tcl_GetStringFromObj (objv[1], &i); name = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_hdata_get_var_hdata (script_str2ptr (hdata), name); + result = weechat_hdata_get_var_hdata (API_STR2PTR(hdata), name); API_RETURN_STRING(result); } @@ -5815,7 +5819,7 @@ weechat_tcl_api_hdata_get_list (ClientData clientData, Tcl_Interp *interp, hdata = Tcl_GetStringFromObj (objv[1], &i); name = Tcl_GetStringFromObj (objv[2], &i); - result = script_ptr2str (weechat_hdata_get_list (script_str2ptr (hdata), + result = script_ptr2str (weechat_hdata_get_list (API_STR2PTR(hdata), name)); API_RETURN_STRING_FREE(result); @@ -5841,9 +5845,9 @@ weechat_tcl_api_hdata_check_pointer (ClientData clientData, Tcl_Interp *interp, list = Tcl_GetStringFromObj (objv[2], &i); pointer = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_hdata_check_pointer (script_str2ptr (hdata), - script_str2ptr (list), - script_str2ptr (pointer)); + result = weechat_hdata_check_pointer (API_STR2PTR(hdata), + API_STR2PTR(list), + API_STR2PTR(pointer)); API_RETURN_INT(result); } @@ -5870,8 +5874,8 @@ weechat_tcl_api_hdata_move (ClientData clientData, Tcl_Interp *interp, if (Tcl_GetIntFromObj (interp, objv[3], &count) != TCL_OK) API_WRONG_ARGS(API_RETURN_EMPTY); - result = script_ptr2str (weechat_hdata_move (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_move (API_STR2PTR(hdata), + API_STR2PTR(pointer), count)); API_RETURN_STRING_FREE(result); @@ -5898,8 +5902,8 @@ weechat_tcl_api_hdata_integer (ClientData clientData, Tcl_Interp *interp, pointer = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_hdata_integer (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_integer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_INT(result); @@ -5926,8 +5930,8 @@ weechat_tcl_api_hdata_long (ClientData clientData, Tcl_Interp *interp, pointer = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_hdata_long (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_long (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_LONG(result); @@ -5955,8 +5959,8 @@ weechat_tcl_api_hdata_string (ClientData clientData, Tcl_Interp *interp, pointer = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = weechat_hdata_string (script_str2ptr (hdata), - script_str2ptr (pointer), + result = weechat_hdata_string (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); API_RETURN_STRING(result); @@ -5983,8 +5987,8 @@ weechat_tcl_api_hdata_pointer (ClientData clientData, Tcl_Interp *interp, pointer = Tcl_GetStringFromObj (objv[2], &i); name = Tcl_GetStringFromObj (objv[3], &i); - result = script_ptr2str (weechat_hdata_pointer (script_str2ptr (hdata), - script_str2ptr (pointer), + result = script_ptr2str (weechat_hdata_pointer (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_STRING_FREE(result); @@ -6014,8 +6018,8 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp, name = Tcl_GetStringFromObj (objv[3], &i); timebuffer[0] = '\0'; - time = weechat_hdata_time (script_str2ptr (hdata), - script_str2ptr (pointer), + time = weechat_hdata_time (API_STR2PTR(hdata), + API_STR2PTR(pointer), name); date_tmp = localtime (&time); if (date_tmp) @@ -6048,8 +6052,8 @@ weechat_tcl_api_hdata_hashtable (ClientData clientData, Tcl_Interp *interp, result_dict = weechat_tcl_hashtable_to_dict ( interp, - weechat_hdata_hashtable (script_str2ptr (hdata), - script_str2ptr (pointer), + weechat_hdata_hashtable (API_STR2PTR(hdata), + API_STR2PTR(pointer), name)); API_RETURN_OBJ(result_dict); @@ -6075,7 +6079,7 @@ weechat_tcl_api_hdata_get_string (ClientData clientData, Tcl_Interp *interp, hdata = Tcl_GetStringFromObj (objv[1], &i); property = Tcl_GetStringFromObj (objv[2], &i); - result = weechat_hdata_get_string (script_str2ptr (hdata), property); + result = weechat_hdata_get_string (API_STR2PTR(hdata), property); API_RETURN_STRING(result); } @@ -6128,9 +6132,9 @@ weechat_tcl_api_upgrade_write_object (ClientData clientData, Tcl_Interp *interp, upgrade_file = Tcl_GetStringFromObj (objv[1], &i); infolist = Tcl_GetStringFromObj (objv[3], &i); - rc = weechat_upgrade_write_object (script_str2ptr (upgrade_file), + rc = weechat_upgrade_write_object (API_STR2PTR(upgrade_file), object_id, - script_str2ptr (infolist)); + API_STR2PTR(infolist)); API_RETURN_INT(rc); } @@ -6206,7 +6210,7 @@ weechat_tcl_api_upgrade_read (ClientData clientData, Tcl_Interp *interp, rc = script_api_upgrade_read (weechat_tcl_plugin, tcl_current_script, - script_str2ptr (upgrade_file), + API_STR2PTR(upgrade_file), &weechat_tcl_api_upgrade_read_cb, function, data); @@ -6232,7 +6236,7 @@ weechat_tcl_api_upgrade_close (ClientData clientData, Tcl_Interp *interp, upgrade_file = Tcl_GetStringFromObj (objv[1], &i); - weechat_upgrade_close (script_str2ptr (upgrade_file)); + weechat_upgrade_close (API_STR2PTR(upgrade_file)); API_RETURN_OK; } diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c index 16f6e0316..429ca119a 100644 --- a/src/plugins/scripts/tcl/weechat-tcl.c +++ b/src/plugins/scripts/tcl/weechat-tcl.c @@ -290,7 +290,7 @@ weechat_tcl_load (const char *filename) return 0; } - if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet) + if ((weechat_tcl_plugin->debug >= 2) || !tcl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: loading script \"%s\""), @@ -369,7 +369,7 @@ weechat_tcl_unload (struct t_plugin_script *script) Tcl_Interp* interp; int *rc; - if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet) + if ((weechat_tcl_plugin->debug >= 2) || !tcl_quiet) { weechat_printf (NULL, weechat_gettext ("%s: unloading script \"%s\""), |