summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-server.c67
-rw-r--r--src/plugins/jabber/jabber-server.c67
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c8
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c7
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c7
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c7
-rw-r--r--src/plugins/scripts/script-api.c4
-rw-r--r--src/plugins/scripts/script-api.h1
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c7
-rw-r--r--src/plugins/weechat-plugin.h1
10 files changed, 158 insertions, 18 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index ff8692347..6f6918c4d 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1847,7 +1847,8 @@ irc_server_switch_address (struct t_irc_server *server)
*/
int
-irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
+irc_server_connect_cb (void *arg_server, int status, const char *error,
+ const char *ip_address)
{
struct t_irc_server *server;
const char *proxy;
@@ -1885,6 +1886,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME,
server->addresses_array[server->index_current_address]);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_switch_address (server);
break;
@@ -1895,6 +1904,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: IP address not found"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_switch_address (server);
break;
@@ -1905,6 +1922,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: connection refused"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_switch_address (server);
break;
@@ -1917,6 +1942,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
"proxy)"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_switch_address (server);
break;
@@ -1925,6 +1958,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: unable to set local hostname/IP"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
@@ -1933,6 +1974,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: TLS init error"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
@@ -1941,6 +1990,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: TLS handshake failed"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_switch_address (server);
break;
@@ -1949,6 +2006,14 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: not enough memory"),
irc_buffer_get_server_prefix (server, "error"),
IRC_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ irc_buffer_get_server_prefix (server, "error"),
+ IRC_PLUGIN_NAME,
+ error);
+ }
irc_server_close_connection (server);
irc_server_reconnect_schedule (server);
break;
diff --git a/src/plugins/jabber/jabber-server.c b/src/plugins/jabber/jabber-server.c
index 7c09f2500..bb2053e0c 100644
--- a/src/plugins/jabber/jabber-server.c
+++ b/src/plugins/jabber/jabber-server.c
@@ -539,7 +539,8 @@ jabber_server_login (struct t_jabber_server *server)
*/
int
-jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
+jabber_server_connect_cb (void *arg_server, int status, const char *error,
+ const char *ip_address)
{
struct t_jabber_server *server;
const char *proxy;
@@ -577,6 +578,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME,
server->address);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -587,6 +596,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: IP address not found"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -597,6 +614,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: connection refused"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -609,6 +634,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
"proxy)"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -617,6 +650,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: unable to set local hostname/IP"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -625,6 +666,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: GnuTLS init error"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -633,6 +682,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: GnuTLS handshake failed"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
@@ -641,6 +698,14 @@ jabber_server_connect_cb (void *arg_server, int status, const char *ip_address)
_("%s%s: not enough memory"),
jabber_buffer_get_server_prefix (server, "error"),
JABBER_PLUGIN_NAME);
+ if (error && error[0])
+ {
+ weechat_printf (server->buffer,
+ _("%s%s: error: %s"),
+ jabber_buffer_get_server_prefix (server, "error"),
+ JABBER_PLUGIN_NAME,
+ error);
+ }
jabber_server_close_connection (server);
jabber_server_reconnect_schedule (server);
break;
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 9271d9ce4..7808cdc74 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -3424,10 +3424,11 @@ weechat_lua_api_hook_process (lua_State *L)
*/
int
-weechat_lua_api_hook_connect_cb (void *data, int status, const char *ip_address)
+weechat_lua_api_hook_connect_cb (void *data, int status,
+ const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- char *lua_argv[3], str_status[32], empty_arg[1] = { '\0' };
+ char *lua_argv[4], str_status[32], empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -3438,7 +3439,8 @@ weechat_lua_api_hook_connect_cb (void *data, int status, const char *ip_address)
lua_argv[0] = str_status;
lua_argv[1] = (ip_address) ? (char *)ip_address : empty_arg;
- lua_argv[2] = NULL;
+ lua_argv[2] = (error) ? (char *)error : empty_arg;
+ lua_argv[3] = NULL;
rc = (int *) weechat_lua_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 2a3ef2815..dfeb36686 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2862,10 +2862,10 @@ static XS (XS_weechat_api_hook_process)
int
weechat_perl_api_hook_connect_cb (void *data, int status,
- const char *ip_address)
+ const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- char *perl_argv[3], str_status[32], empty_arg[1] = { '\0' };
+ char *perl_argv[4], str_status[32], empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -2876,7 +2876,8 @@ weechat_perl_api_hook_connect_cb (void *data, int status,
perl_argv[0] = str_status;
perl_argv[1] = (ip_address) ? (char *)ip_address : empty_arg;
- perl_argv[2] = NULL;
+ perl_argv[2] = (error) ? (char *)error : empty_arg;
+ perl_argv[3] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 4f0d3a8d5..e42cbbbb4 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -3054,10 +3054,10 @@ weechat_python_api_hook_process (PyObject *self, PyObject *args)
int
weechat_python_api_hook_connect_cb (void *data, int status,
- const char *ip_address)
+ const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- char *python_argv[3], str_status[32], empty_arg[1] = { '\0' };
+ char *python_argv[4], str_status[32], empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -3068,7 +3068,8 @@ weechat_python_api_hook_connect_cb (void *data, int status,
python_argv[0] = str_status;
python_argv[1] = (ip_address) ? (char *)ip_address : empty_arg;
- python_argv[2] = NULL;
+ python_argv[2] = (error) ? (char *)error : empty_arg;
+ python_argv[3] = NULL;
rc = (int *) weechat_python_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index bf150363a..dd6b5fe6a 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3494,10 +3494,10 @@ weechat_ruby_api_hook_process (VALUE class, VALUE command, VALUE timeout,
int
weechat_ruby_api_hook_connect_cb (void *data, int status,
- const char *ip_address)
+ const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- char *ruby_argv[3], str_status[32], empty_arg[1] = { '\0' };
+ char *ruby_argv[4], str_status[32], empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -3508,7 +3508,8 @@ weechat_ruby_api_hook_connect_cb (void *data, int status,
ruby_argv[0] = str_status;
ruby_argv[1] = (ip_address) ? (char *)ip_address : empty_arg;
- ruby_argv[2] = NULL;
+ ruby_argv[2] = (error) ? (char *)error : empty_arg;
+ ruby_argv[3] = NULL;
rc = (int *) weechat_ruby_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 8784fba3e..99266a04f 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -917,7 +917,9 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
const char *proxy, const char *address, int port,
int sock, int ipv6, void *gnutls_sess,
const char *local_hostname,
- int (*callback)(void *data, int status, const char *ip_address),
+ int (*callback)(void *data, int status,
+ const char *error,
+ const char *ip_address),
const char *function)
{
struct t_script_callback *new_script_callback;
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 1bb20f0e5..6f6959a62 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -159,6 +159,7 @@ extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_
const char *local_hostname,
int (*callback)(void *data,
int status,
+ const char *error,
const char *ip_address),
const char *function);
extern struct t_hook *script_api_hook_print (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 790122dad..99fb5282a 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -3274,10 +3274,10 @@ weechat_tcl_api_hook_process (ClientData clientData, Tcl_Interp *interp,
int
weechat_tcl_api_hook_connect_cb (void *data, int status,
- const char *ip_address)
+ const char *error, const char *ip_address)
{
struct t_script_callback *script_callback;
- char *tcl_argv[3], str_status[32], empty_arg[1] = { '\0' };
+ char *tcl_argv[4], str_status[32], empty_arg[1] = { '\0' };
int *rc, ret;
script_callback = (struct t_script_callback *)data;
@@ -3288,7 +3288,8 @@ weechat_tcl_api_hook_connect_cb (void *data, int status,
tcl_argv[0] = str_status;
tcl_argv[1] = (ip_address) ? (char *)ip_address : empty_arg;
- tcl_argv[2] = NULL;
+ tcl_argv[2] = (error) ? (char *)error : empty_arg;
+ tcl_argv[3] = NULL;
rc = (int *) weechat_tcl_exec (script_callback->script,
WEECHAT_SCRIPT_EXEC_INT,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 880fd45bb..92885cd45 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -393,6 +393,7 @@ struct t_weechat_plugin
const char *local_hostname,
int (*callback)(void *data,
int status,
+ const char *error,
const char *ip_address),
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,