Age | Commit message (Collapse) | Author |
|
The callback_read and callback_create_option functions in the scripting
APIs always get the value as a string, never as null. This means that if
the value is null, there is no way for the script to distinguish this
from an empty string for string options. This makes it impossible to
properly make options with fallback values, like the irc server and
server_default options, as far as I can see.
All the scripting languages except Tcl use that language's equivalent
for null. For JavaScript which has both null and undefined, null is
used. For Tcl, the magic null string defined in commit 197a7a01e is used
and the documentation is updated to describe that.
I tested this with these scripts:
https://gist.github.com/trygveaa/2d49c609addf9773d2ed16e15d1e3447
You can load all of those scripts and see the result with this command
(assuming you have the scripts in the current directory):
weechat -t -r "/filter add script * * script; /script load $(echo script_config.*)"
|
|
config_new_option (scripting API)
|
|
|
|
|
|
Affected plugins: python, ruby, lua, tcl, guile, javascript, php.
|
|
|
|
These functions don't work with PHP 8+ and also don't seem to be
necessary anymore when reloading scripts.
|
|
|
|
The plugin API function config_new_option accepts null as the
default_value and/or value however the scripting APIs (except for lua)
didn't allow sending null as a parameter value, so it was impossible to
use it this way. This allows sending a null value for these parameters.
Lua already supported sending in nil for these parameters and it works
as expected, so nothing is changed for this plugin.
For Guile you can now send in #nil, for JavaScript null or undefined,
for Perl undef, for PHP NULL, for Python None, for Ruby nil and for Tcl
$::weechat::WEECHAT_NULL.
In all of these languages except Tcl this is the special value
indicating a missing value. However Tcl only has one type, string, so it
doesn't have a null value. Therefore I created a constant with the value
`\uFFFF\uFFFF\uFFFFWEECHAT_NULL\uFFFF\uFFFF\uFFFF` which is used
instead. This is very unlikely to appear unintentionally. Using the
unicode code point \uFFFF was suggested on
https://wiki.tcl-lang.org/page/null.
I tested this with these scripts:
https://gist.github.com/trygveaa/f91977dde5d2876d502bf55fbf9b50cc
|
|
free content, add function printf_y_date_tags (closes #1746)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
completion_{get_string|list_add}
Old functions are kept for compatibility reasons.
|
|
|
|
(issue #1484)
|
|
|
|
|
|
|
|
Functions fixed in PHP plugin:
- string_eval_expression
- string_eval_path_home
- key_bind
- hook_process_hashtable
- hook_hsignal_send
- info_get_hashtable
- hdata_update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fixed functions:
- iconv_to_internal
- iconv_from_internal
- string_mask_to_regex
- string_format_size
- string_remove_color
- string_eval_expression
- string_eval_path_home
- list_new
- list_add
- list_search
- list_casesearch
- list_get
- list_next
- list_prev
- config_new
- config_new_section
- config_search_section
- config_new_option
- config_search_option
- config_get
- hook_command
- hook_completion
- hook_command_run
- hook_timer
- hook_fd
- hook_process
- hook_process_hashtable
- hook_connect
- hook_print
- hook_signal
- hook_hsignal
- hook_config
- hook_modifier
- hook_modifier_exec
- hook_info
- hook_info_hashtable
- hook_infolist
- hook_focus
- buffer_new
- buffer_search
- buffer_search_main
- current_buffer
- buffer_get_pointer
- buffer_string_replace_local_var
- current_window
- window_search_with_buffer
- window_get_pointer
- nicklist_add_group
- nicklist_search_group
- nicklist_add_nick
- nicklist_search_nick
- nicklist_group_get_pointer
- nicklist_nick_get_pointer
- bar_item_search
- bar_item_new
- bar_search
- bar_new
- infolist_new
- infolist_new_item
- infolist_new_var_integer
- infolist_new_var_string
- infolist_new_var_pointer
- infolist_new_var_time
- infolist_search_var
- infolist_get
- infolist_pointer
- hdata_get
- hdata_get_list
- hdata_move
- hdata_search
- hdata_pointer
- upgrade_new
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rename:
- printf to print
- printf_date_tags to print_date_tags
- printf_y to print_y
- log_printf to log_print
|
|
values
|
|
|
|
|
|
|
|
Functions removed (not in scripting API):
- weechat_string_replace
- weechat_hdata_get_var
- weechat_hdata_get_var_type
|
|
|