summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-08-13 10:40:01 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-08-13 10:40:01 +0200
commitbfef8da84c685dea678c8aa2fcb6d5a570d7a7b2 (patch)
tree8c5064f94120fc7c5d700168c18bf00154c0b7ed
parentbf0df282a2a33ccc4179f5819b7936f37a0ebc37 (diff)
downloadweechat-bfef8da84c685dea678c8aa2fcb6d5a570d7a7b2.zip
api: change type of arguments status/gnutls_rc/sock in hook_connect() callback from string to integer (in scripts)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--ReleaseNotes.adoc8
-rw-r--r--doc/en/weechat_plugin_api.en.adoc8
-rw-r--r--doc/fr/weechat_plugin_api.fr.adoc9
-rw-r--r--doc/it/weechat_plugin_api.it.adoc9
-rw-r--r--doc/ja/weechat_plugin_api.ja.adoc10
-rw-r--r--src/plugins/guile/weechat-guile-api.c13
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp13
-rw-r--r--src/plugins/lua/weechat-lua-api.c13
-rw-r--r--src/plugins/perl/weechat-perl-api.c13
-rw-r--r--src/plugins/python/weechat-python-api.c14
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c13
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c13
13 files changed, 70 insertions, 67 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 6c4f0f6cb..27f501069 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -34,6 +34,7 @@ Bug fixes::
* core: fix cast of time_t (to "long long" instead of "long") (issue #1051)
* core: call the config hook when options are renamed or removed
+ * api: change type of arguments status/gnutls_rc/sock in hook_connect() callback from string to integer (in scripts)
* api: change type of argument fd in hook_fd() callback from string to integer (in scripts)
* buflist: fix crash in auto-scroll of bar when the buflist item is not the first item in the bar
* relay: fix send of "PART" command in backlog (irc protocol)
diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc
index bd030147a..247137dd8 100644
--- a/ReleaseNotes.adoc
+++ b/ReleaseNotes.adoc
@@ -20,6 +20,14 @@ https://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
[[v2.0]]
== Version 2.0 (under dev)
+[[v2.0_hook_connect]]
+=== Function hook_connect
+
+In scripts, the arguments _status_, _gnutls_rc_ and _sock_ sent to the callback
+of _hook_connect_ are now integers (they were strings in older releases). +
+To be compatible with all versions, it is recommended to convert the argument
+to integer before using it, for example in Python: `int(sock)`.
+
[[v2.0_hook_fd]]
=== Function hook_fd
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index dfcd28dc0..00cc4738a 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -8796,7 +8796,7 @@ hook3 = weechat.hook_process_hashtable("sh",
==== hook_connect
-_Updated in 1.5._
+_Updated in 1.5, 2.0._
Hook a connection (background connection to a remote host).
@@ -8879,6 +8879,12 @@ Return value:
* pointer to new hook, NULL if error occurred
+[IMPORTANT]
+In scripts, with WeeChat ≥ 2.0, the callback arguments _status_, _gnutls_rc_
+and _sock_ are integers (with WeeChat ≤ 1.9, they were strings). +
+To be compatible with all versions, it is recommended to convert the argument
+to integer before using it, for example in Python: `int(sock)`.
+
C example:
[source,C]
diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc
index 8badd6284..2d1e5572b 100644
--- a/doc/fr/weechat_plugin_api.fr.adoc
+++ b/doc/fr/weechat_plugin_api.fr.adoc
@@ -8961,7 +8961,7 @@ hook3 = weechat.hook_process_hashtable("sh",
==== hook_connect
-_Mis à jour dans la 1.5._
+_Mis à jour dans la 1.5, 2.0._
Accrocher une connexion (connexion à une machine distante en tâche de fond).
@@ -9050,6 +9050,13 @@ Valeur de retour :
* pointeur vers le nouveau "hook", NULL en cas d'erreur
+[IMPORTANT]
+Dans les scripts, avec WeeChat ≥ 2.0, les paramètres de la fonction de rappel
+_status_, _gnutls_rc_ et _sock_ sont des entiers (avec WeeChat ≤ 1.9, ils étaient
+des chaînes). +
+Pour être compatible avec toutes les versions, il est recommandé de convertir
+le paramètre avant de l'utiliser, par exemple en Python: `int(sock)`.
+
Exemple en C :
[source,C]
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc
index f74413ceb..de6a7d4a2 100644
--- a/doc/it/weechat_plugin_api.it.adoc
+++ b/doc/it/weechat_plugin_api.it.adoc
@@ -9064,7 +9064,7 @@ hook3 = weechat.hook_process_hashtable("sh",
==== hook_connect
// TRANSLATION MISSING
-_Updated in 1.5._
+_Updated in 1.5, 2.0._
Hook su una connessione (connessione in secondo piano ad un host remoto).
@@ -9152,6 +9152,13 @@ Valore restituito:
* puntatore al nuovo hook, NULL in caso di errore
+// TRANSLATION MISSING
+[IMPORTANT]
+In scripts, with WeeChat ≥ 2.0, the callback arguments _status_, _gnutls_rc_
+and _sock_ are integers (with WeeChat ≤ 1.9, they were strings). +
+To be compatible with all versions, it is recommended to convert the argument
+to integer before using it, for example in Python: `int(sock)`.
+
Esempio in C:
[source,C]
diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc
index d013f56aa..70034ed5d 100644
--- a/doc/ja/weechat_plugin_api.ja.adoc
+++ b/doc/ja/weechat_plugin_api.ja.adoc
@@ -8808,7 +8808,8 @@ hook3 = weechat.hook_process_hashtable("sh",
==== hook_connect
-_WeeChat バージョン 1.5 で更新。_
+// TRANSLATION MISSING
+_Updated in 1.5, 2.0._
接続をフックする (リモートホストへのバックグラウンド接続)。
@@ -8891,6 +8892,13 @@ struct t_hook *weechat_hook_connect (const char *proxy,
* 新しいフックへのポインタ、エラーが起きた場合は NULL
+// TRANSLATION MISSING
+[IMPORTANT]
+In scripts, with WeeChat ≥ 2.0, the callback arguments _status_, _gnutls_rc_
+and _sock_ are integers (with WeeChat ≤ 1.9, they were strings). +
+To be compatible with all versions, it is recommended to convert the argument
+to integer before using it, for example in Python: `int(sock)`.
+
C 言語での使用例:
[source,C]
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index 3f1182856..b9f2c9e9b 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -2388,7 +2388,6 @@ weechat_guile_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2398,21 +2397,17 @@ weechat_guile_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_guile_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 c41c613f9..ab3b9a2ee 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -2309,7 +2309,6 @@ weechat_js_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2319,21 +2318,17 @@ weechat_js_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *)weechat_js_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 9148bfb2c..144c8f7b4 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -2506,7 +2506,6 @@ weechat_lua_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2516,21 +2515,17 @@ weechat_lua_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_lua_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 982aeaba2..e6960c73a 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -2424,7 +2424,6 @@ weechat_perl_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2434,21 +2433,17 @@ weechat_perl_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_perl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 f3384bd4e..e3b4d93e5 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -2442,7 +2442,7 @@ weechat_python_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32], empty_arg[1] = { '\0' };
+ char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2451,21 +2451,17 @@ weechat_python_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_python_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 488ec9193..361901b01 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -2952,7 +2952,6 @@ weechat_ruby_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2962,21 +2961,17 @@ weechat_ruby_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_ruby_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", 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 90a21566d..28675b21e 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -2690,7 +2690,6 @@ weechat_tcl_api_hook_connect_cb (const void *pointer, void *data,
{
struct t_plugin_script *script;
void *func_argv[6];
- char str_status[32], str_gnutls_rc[32], str_sock[32];
char empty_arg[1] = { '\0' };
const char *ptr_function, *ptr_data;
int *rc, ret;
@@ -2700,21 +2699,17 @@ weechat_tcl_api_hook_connect_cb (const void *pointer, void *data,
if (ptr_function && ptr_function[0])
{
- snprintf (str_status, sizeof (str_status), "%d", status);
- snprintf (str_gnutls_rc, sizeof (str_gnutls_rc), "%d", gnutls_rc);
- snprintf (str_sock, sizeof (str_sock), "%d", sock);
-
func_argv[0] = (ptr_data) ? (char *)ptr_data : empty_arg;
- func_argv[1] = str_status;
- func_argv[2] = str_gnutls_rc;
- func_argv[3] = str_sock;
+ func_argv[1] = &status;
+ func_argv[2] = &gnutls_rc;
+ func_argv[3] = &sock;
func_argv[4] = (ip_address) ? (char *)ip_address : empty_arg;
func_argv[5] = (error) ? (char *)error : empty_arg;
rc = (int *) weechat_tcl_exec (script,
WEECHAT_SCRIPT_EXEC_INT,
ptr_function,
- "ssssss", func_argv);
+ "siiiss", func_argv);
if (!rc)
ret = WEECHAT_RC_ERROR;