diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | ReleaseNotes.adoc | 15 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 8 | ||||
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 8 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 8 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 8 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 8 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 8 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 8 |
9 files changed, 37 insertions, 35 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index d3c80c910..6aff9386f 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -41,6 +41,7 @@ Bug fixes:: * core: fix wrong terminal title on terminal resize (issue #1702) * api: change type of argument remaining_calls in hook_timer callback from string to integer (in scripts) + * api: change type of argument object_id in upgrade_new callback from string to integer (in scripts) * irc: fix duplicated channels in autojoin option when autojoin_dynamic is enabled (issue #1795) * irc: fix display of TOPIC and QUIT messages with an empty trailing parameter (issue #1797) * irc: fix parsing of messages with trailing spaces and no trailing parameter (issue #1803) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index c4030389a..b09c28a8d 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -20,6 +20,21 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog] [[v3.7]] == Version 3.7 (under dev) +[[v3.7_upgrade_new_callback_object_id]] +=== Argument "object_id" in callback of upgrade_new + +In all script languages (except PHP), the argument "object_id" sent to the +callback of "upgrade_new" is now an integer (it was a string in older releases). + +To be compatible with all versions, it is recommended to convert the argument +to integer before testing it, for example in Python: + +[source,python] +---- +if int(object_id) == 1: + # ... +---- + [[v3.7_hook_timer_callback_remaining_calls]] === Argument "remaining_calls" in callback of hook_timer diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 539c37020..04af03ecd 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -4979,7 +4979,7 @@ weechat_guile_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -4988,17 +4988,15 @@ weechat_guile_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_guile_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index 8e2e56b85..e880be653 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -4901,7 +4901,7 @@ weechat_js_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -4910,17 +4910,15 @@ weechat_js_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *)weechat_js_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index f5bd9ec14..4022cfd92 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -5298,7 +5298,7 @@ weechat_lua_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -5307,17 +5307,15 @@ weechat_lua_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_lua_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index c7fc20bde..e63784040 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -5237,7 +5237,7 @@ weechat_perl_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -5246,17 +5246,15 @@ weechat_perl_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_perl_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index c487e7d84..1aab910f8 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -5166,7 +5166,7 @@ weechat_python_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -5175,17 +5175,15 @@ weechat_python_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_python_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 59bfcfffc..771b90234 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -6381,7 +6381,7 @@ weechat_ruby_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -6390,17 +6390,15 @@ weechat_ruby_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_ruby_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index e4fb7395a..cd1474521 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -5637,7 +5637,7 @@ weechat_tcl_api_upgrade_read_cb (const void *pointer, void *data, { struct t_plugin_script *script; void *func_argv[4]; - char empty_arg[1] = { '\0' }, str_object_id[32]; + char empty_arg[1] = { '\0' }; const char *ptr_function, *ptr_data; int *rc, ret; @@ -5646,17 +5646,15 @@ weechat_tcl_api_upgrade_read_cb (const void *pointer, void *data, if (ptr_function && ptr_function[0]) { - snprintf (str_object_id, sizeof (str_object_id), "%d", object_id); - func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg; func_argv[1] = (char *)API_PTR2STR(upgrade_file); - func_argv[2] = str_object_id; + func_argv[2] = &object_id; func_argv[3] = (char *)API_PTR2STR(infolist); rc = (int *) weechat_tcl_exec (script, WEECHAT_SCRIPT_EXEC_INT, ptr_function, - "ssss", func_argv); + "ssis", func_argv); if (!rc) ret = WEECHAT_RC_ERROR; |