summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-config.c36
-rw-r--r--src/plugins/irc/irc-display.c24
-rw-r--r--src/plugins/irc/irc-server.c255
-rw-r--r--src/plugins/irc/irc-server.h5
-rw-r--r--src/plugins/plugin.c1
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c2
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c2
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c2
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c2
-rw-r--r--src/plugins/scripts/script-api.c4
-rw-r--r--src/plugins/scripts/script-api.h3
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c2
-rw-r--r--src/plugins/weechat-plugin.h14
13 files changed, 340 insertions, 12 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 37b2a8edc..89d841363 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -806,6 +806,42 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change, callback_change_data,
NULL, NULL);
break;
+ case IRC_SERVER_OPTION_SSL_CERT:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ N_("ssl certificate file used to automatically identify your nick"),
+ NULL, 0, 0,
+ default_value, value,
+ null_value_allowed,
+ NULL, NULL,
+ callback_change, callback_change_data,
+ NULL, NULL);
+ break;
+ case IRC_SERVER_OPTION_SSL_DHKEY_SIZE:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "integer",
+ N_("size of the key used during the Diffie-Hellman Key Exchange"),
+ NULL, 0, INT_MAX,
+ default_value, value,
+ null_value_allowed,
+ NULL, NULL,
+ callback_change, callback_change_data,
+ NULL, NULL);
+ break;
+ case IRC_SERVER_OPTION_SSL_VERIFY:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "boolean",
+ N_("check that the ssl connection is fully trusted"),
+ NULL, 0, 0,
+ default_value, value,
+ null_value_allowed,
+ NULL, NULL,
+ callback_change, callback_change_data,
+ NULL, NULL);
+ break;
case IRC_SERVER_OPTION_PASSWORD:
new_option = weechat_config_new_option (
config_file, section,
diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c
index aa2e9d78c..ce84997b7 100644
--- a/src/plugins/irc/irc-display.c
+++ b/src/plugins/irc/irc-display.c
@@ -205,6 +205,30 @@ irc_display_server (struct t_irc_server *server, int with_detail)
IRC_COLOR_CHAT_VALUE,
weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL]) ?
_("on") : _("off"));
+
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_CERT]))
+ weechat_printf (NULL, " ssl_cert . . . . . . : ('%s')",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT));
+ else
+ weechat_printf (NULL, " ssl_cert . . . . . . : %s'%s'",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_string (server->options[IRC_SERVER_OPTION_SSL_CERT]));
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE]))
+ weechat_printf (NULL, " ssl_dhkey_size . . . : (%d)",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE));
+ else
+ weechat_printf (NULL, " ssl_dhkey_size . . . : %s%d",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_integer (server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE]));
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL_VERIFY]))
+ weechat_printf (NULL, " ssl_verify . . . . . : (%s)",
+ (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY)) ?
+ _("on") : _("off"));
+ else
+ weechat_printf (NULL, " ssl_verify . . . . . : %s%s",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL_VERIFY]) ?
+ _("on") : _("off"));
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PASSWORD]))
weechat_printf (NULL, " password . . . . . . : %s",
_("(hidden)"));
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 8ccaf67db..2d3fbb14d 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -35,6 +35,7 @@
#ifdef HAVE_GNUTLS
#include <gnutls/gnutls.h>
+#include <gnutls/x509.h>
#endif
#include "../weechat-plugin.h"
@@ -59,12 +60,13 @@ struct t_irc_message *irc_msgq_last_msg = NULL;
char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] =
{ "addresses", "proxy", "ipv6", "ssl", "password", "autoconnect",
"autoreconnect", "autoreconnect_delay", "nicks", "username", "realname",
- "local_hostname", "command", "command_delay", "autojoin", "autorejoin"
+ "local_hostname", "command", "command_delay", "autojoin", "autorejoin",
+ "ssl_cert", "ssl_dhkey_size", "ssl_verify",
};
char *irc_server_option_default[IRC_SERVER_NUM_OPTIONS] =
-{ "", "", "off", "off", "", "off", "on", "30", "", "", "", "", "", "0", "",
- "off"
+{ "", "", "off", "off", "", "off", "on", "30", "",
+ "", "", "", "", "0", "", "off", "", "2048", "on",
};
@@ -2106,6 +2108,219 @@ irc_server_create_buffer (struct t_irc_server *server)
return server->buffer;
}
+#ifdef HAVE_GNUTLS
+/*
+ * irc_server_gnutls_callback: gnutls callback called during handshake
+ *
+ */
+int
+irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
+ const gnutls_datum_t *req_ca, int nreq,
+ const gnutls_pk_algorithm_t *pk_algos,
+ int pk_algos_len, gnutls_retr_st *answer)
+{
+ struct t_irc_server *server;
+ gnutls_retr_st tls_struct;
+ gnutls_x509_crt_t tls_cert;
+ gnutls_x509_privkey_t tls_cert_key;
+ gnutls_x509_crt_t cert_temp;
+ const gnutls_datum_t *cert_list;
+ gnutls_datum_t filedatum, cinfo;
+ unsigned int cert_list_len, status;
+ time_t cert_time;
+ char *cert_path0, *cert_path1, *cert_path2, *cert_str, *hostname;
+ const char *weechat_dir;
+ int rc, i, j, rinfo, hostname_match;
+
+ /* make C compiler happy */
+ (void) req_ca;
+ (void) nreq;
+ (void) pk_algos;
+ (void) pk_algos_len;
+
+ if (!data)
+ return -1;
+
+ server = (struct t_irc_server *) data;
+ hostname = server->addresses_array[server->index_current_address];
+ hostname_match = 0;
+
+ weechat_printf (server->buffer,
+ _("gnutls: connected using %d-bit Diffie-Hellman shared "
+ "secret exchange"),
+ IRC_SERVER_OPTION_INTEGER (server,
+ IRC_SERVER_OPTION_SSL_DHKEY_SIZE));
+ if (gnutls_certificate_verify_peers2 (tls_session, &status) < 0)
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: error while checking peer's certificate"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+ else
+ {
+ /* some checks */
+ if (status & GNUTLS_CERT_INVALID)
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: peer's certificate is NOT trusted"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+ else
+ {
+ weechat_printf (server->buffer,
+ _("gnutls: peer's certificate is trusted"));
+ }
+ if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: peer's certificate issuer is unknown"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+ if (status & GNUTLS_CERT_REVOKED)
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: the certificate has been revoked"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+
+ /* check certificates */
+ if (gnutls_x509_crt_init (&cert_temp) >= 0)
+ {
+ cert_list = gnutls_certificate_get_peers (tls_session, &cert_list_len);
+ if (cert_list)
+ {
+ weechat_printf (server->buffer,
+ NG_("gnutls: receiving %d certificate",
+ "gnutls: receiving %d certificates",
+ cert_list_len),
+ cert_list_len);
+ for (i = 0, j = (int) cert_list_len; i < j; i++)
+ {
+ if (gnutls_x509_crt_import (cert_temp, &cert_list[i], GNUTLS_X509_FMT_DER) >= 0)
+ {
+ /* checking if hostname matches in the first certificate */
+ if (i == 0 && gnutls_x509_crt_check_hostname (cert_temp, hostname) != 0)
+ {
+ hostname_match = 1;
+ }
+ /* displaying infos about certificate */
+ rinfo = gnutls_x509_crt_print (cert_temp, GNUTLS_CRT_PRINT_ONELINE, &cinfo);
+ if (rinfo == 0)
+ {
+ weechat_printf (server->buffer,
+ _(" - certificate[%d] info:"), i + 1);
+ weechat_printf (server->buffer,
+ " - %s", cinfo.data);
+ gnutls_free (cinfo.data);
+ }
+ /* check expiration date */
+ cert_time = gnutls_x509_crt_get_expiration_time (cert_temp);
+ if (cert_time < time(NULL))
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: certificate has expired"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+ /* check expiration date */
+ cert_time = gnutls_x509_crt_get_activation_time (cert_temp);
+ if (cert_time > time(NULL))
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: certificate is not yet activated"),
+ weechat_prefix ("error"));
+ rc = -1;
+ }
+ }
+ }
+ if (hostname_match == 0)
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: the hostname in the "
+ "certificate does NOT match \"%s\""),
+ weechat_prefix ("error"), hostname);
+ rc = -1;
+ }
+ }
+ }
+ }
+
+ /* using client certificate if it exists */
+ cert_path0 = (char *) IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT);
+ if (cert_path0 && cert_path0[0])
+ {
+ weechat_dir = weechat_info_get ("weechat_dir", "");
+ cert_path1 = weechat_string_replace (cert_path0, "%h", weechat_dir);
+ cert_path2 = (cert_path1) ?
+ weechat_string_replace (cert_path1, "~", getenv ("HOME")) : NULL;
+
+ if (cert_path2)
+ {
+ cert_str = weechat_file_get_content (cert_path2);
+ if (cert_str)
+ {
+ weechat_printf (server->buffer,
+ _("gnutls: sending one certificate"));
+
+ filedatum.data = (unsigned char *) cert_str;
+ filedatum.size = strlen (cert_str);
+
+ /* certificate */
+ gnutls_x509_crt_init (&tls_cert);
+ gnutls_x509_crt_import (tls_cert, &filedatum, GNUTLS_X509_FMT_PEM);
+
+ /* key */
+ gnutls_x509_privkey_init (&tls_cert_key);
+ gnutls_x509_privkey_import (tls_cert_key, &filedatum, GNUTLS_X509_FMT_PEM);
+
+ tls_struct.type = GNUTLS_CRT_X509;
+ tls_struct.ncerts = 1;
+ tls_struct.deinit_all = 0;
+ tls_struct.cert.x509 = &tls_cert;
+ tls_struct.key.x509 = tls_cert_key;
+
+ /* client certificate info */
+ rinfo = gnutls_x509_crt_print (tls_cert, GNUTLS_CRT_PRINT_ONELINE, &cinfo);
+ if (rinfo == 0)
+ {
+ weechat_printf (server->buffer,
+ _(" - client certificate info (%s):"), cert_path2);
+ weechat_printf (server->buffer, " - %s", cinfo.data);
+ gnutls_free (cinfo.data);
+ }
+
+ memcpy(answer, &tls_struct, sizeof (gnutls_retr_st));
+ free (cert_str);
+ }
+ else
+ {
+ weechat_printf (server->buffer,
+ _("%sgnutls: unable to read certifcate \"%s\""),
+ weechat_prefix ("error"), cert_path2);
+ }
+ }
+
+ if (cert_path1)
+ free (cert_path1);
+ if (cert_path2)
+ free (cert_path2);
+ }
+
+ /* an error should stop the handshake unless the user doesn't care */
+ if ((rc == -1)
+ && (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY) == 0))
+ {
+ rc = 0;
+ }
+
+ return rc;
+}
+#endif
+
/*
* irc_server_connect: connect to an IRC server
* Return: 1 if ok
@@ -2313,6 +2528,7 @@ irc_server_connect (struct t_irc_server *server)
server->ssl_connected = 1;
#endif
+
server->hook_connect = weechat_hook_connect (proxy,
server->addresses_array[server->index_current_address],
server->ports_array[server->index_current_address],
@@ -2320,8 +2536,10 @@ irc_server_connect (struct t_irc_server *server)
IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6),
#ifdef HAVE_GNUTLS
(server->ssl_connected) ? &server->gnutls_sess : NULL,
+ (server->ssl_connected) ? irc_server_gnutls_callback : NULL,
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE),
#else
- NULL,
+ NULL, NULL, 0,
#endif
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
&irc_server_connect_cb,
@@ -2917,6 +3135,15 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_integer (ptr_item, "ssl",
IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)))
return 0;
+ if (!weechat_infolist_new_var_string (ptr_item, "ssl_cert",
+ IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT)))
+ return 0;
+ if (!weechat_infolist_new_var_integer (ptr_item, "ssl_dhkey_size",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE)))
+ return 0;
+ if (!weechat_infolist_new_var_integer (ptr_item, "ssl_verify",
+ IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY)))
+ return 0;
if (!weechat_infolist_new_var_string (ptr_item, "password",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD)))
return 0;
@@ -3043,6 +3270,26 @@ irc_server_print_log ()
weechat_log_printf (" ssl. . . . . . . . . : %s",
weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL]) ?
"on" : "off");
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT]))
+ weechat_log_printf (" ssl_cert . . . . . . : null ('%s')",
+ IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_SSL_CERT));
+ else
+ weechat_log_printf (" ssl_cert . . . . . . : '%s'",
+ weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_SSL_CERT]));
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE]))
+ weechat_log_printf (" ssl_dhkey_size . . . : null ('%d')",
+ IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE));
+ else
+ weechat_log_printf (" ssl_dhkey_size . . . : '%d'",
+ weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_SSL_DHKEY_SIZE]));
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY]))
+ weechat_log_printf (" ssl_verify . . . . . : null (%s)",
+ (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_SSL_VERIFY)) ?
+ "on" : "off");
+ else
+ weechat_log_printf (" ssl_verify . . . . . : %s",
+ weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL_VERIFY]) ?
+ "on" : "off");
if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_PASSWORD]))
weechat_log_printf (" password . . . . . . : null");
else
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index a0445fec2..137278e38 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -49,6 +49,9 @@ enum t_irc_server_option
IRC_SERVER_OPTION_COMMAND_DELAY, /* delay after execution of command */
IRC_SERVER_OPTION_AUTOJOIN, /* channels to automatically join */
IRC_SERVER_OPTION_AUTOREJOIN, /* auto rejoin channels when kicked */
+ IRC_SERVER_OPTION_SSL_CERT, /* client ssl certificate file */
+ IRC_SERVER_OPTION_SSL_DHKEY_SIZE, /* Diffie Hellman key size */
+ IRC_SERVER_OPTION_SSL_VERIFY, /* check if the connection is trusted */
/* number of server options */
IRC_SERVER_NUM_OPTIONS,
};
@@ -111,9 +114,7 @@ struct t_irc_server
struct t_hook *hook_fd; /* hook for server socket */
int is_connected; /* 1 if WeeChat is connected to server */
int ssl_connected; /* = 1 if connected with SSL */
-#ifdef HAVE_GNUTLS
gnutls_session_t gnutls_sess; /* gnutls session (only if SSL is used) */
-#endif
char *unterminated_message; /* beginning of a message in input buf */
int nicks_count; /* number of nicknames */
char **nicks_array; /* nicknames (after split) */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 4fc0a2ed4..b5fc5c5a8 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -407,6 +407,7 @@ plugin_load (const char *filename)
new_plugin->mkdir = &util_mkdir;
new_plugin->mkdir_parents = &util_mkdir_parents;
new_plugin->exec_on_files = &util_exec_on_files;
+ new_plugin->file_get_content = &util_file_get_content;
new_plugin->timeval_cmp = &util_timeval_cmp;
new_plugin->timeval_diff = &util_timeval_diff;
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index df5d07cd4..85968d721 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -3615,6 +3615,8 @@ weechat_lua_api_hook_connect (lua_State *L)
sock,
ipv6,
NULL, /* gnutls session */
+ NULL, /* gnutls callback */
+ 0, /* gnutls DH key size */
local_hostname,
&weechat_lua_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index e5e528dca..4b12fff25 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -3044,6 +3044,8 @@ XS (XS_weechat_api_hook_connect)
SvIV (ST (3)), /* sock */
SvIV (ST (4)), /* ipv6 */
NULL, /* gnutls session */
+ NULL, /* gnutls callback */
+ 0, /* gnutls DH key size */
local_hostname,
&weechat_perl_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 2c77a00db..a839093a0 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -3217,6 +3217,8 @@ weechat_python_api_hook_connect (PyObject *self, PyObject *args)
sock,
ipv6,
NULL, /* gnutls session */
+ NULL, /* gnutls callback */
+ 0, /* gnutls DH key size */
local_hostname,
&weechat_python_api_hook_connect_cb,
function,
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 71183fd2b..31d4490cc 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3724,6 +3724,8 @@ weechat_ruby_api_hook_connect (VALUE class, VALUE proxy, VALUE address,
c_sock,
c_ipv6,
NULL, /* gnutls session */
+ NULL, /* gnutls callback */
+ 0, /* gnutls DH key size */
c_local_hostname,
&weechat_ruby_api_hook_connect_cb,
c_function,
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index d9b25f0f6..2eaabeefc 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -926,6 +926,7 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *proxy, const char *address, int port,
int sock, int ipv6, void *gnutls_sess,
+ void *gnutls_cb, int gnutls_dhkey_size,
const char *local_hostname,
int (*callback)(void *data, int status,
const char *error,
@@ -941,7 +942,8 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
return NULL;
new_hook = weechat_hook_connect (proxy, address, port, sock, ipv6,
- gnutls_sess, local_hostname, callback,
+ gnutls_sess, gnutls_cb, gnutls_dhkey_size,
+ local_hostname, callback,
new_script_callback);
if (!new_hook)
{
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 2e5445100..434660f7f 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -169,7 +169,8 @@ extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_
int port,
int sock,
int ipv6,
- void *gnutls_sess,
+ void *gnutls_sess, void *gnutls_cb,
+ int gnutls_dhkey_size,
const char *local_hostname,
int (*callback)(void *data,
int status,
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index f7acb8ae0..04a654475 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -3462,6 +3462,8 @@ weechat_tcl_api_hook_connect (ClientData clientData, Tcl_Interp *interp,
sock,
ipv6,
NULL, /* gnutls session */
+ NULL, /* gnutls callback */
+ 0, /* gnutls DH key size */
local_hostname,
&weechat_tcl_api_hook_connect_cb,
function,
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index 7d6d54093..9a3e79c0a 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -34,7 +34,7 @@ struct t_weelist;
struct timeval;
/* API version (used to check that plugin has same API and can be loaded) */
-#define WEECHAT_PLUGIN_API_VERSION "20090614-02"
+#define WEECHAT_PLUGIN_API_VERSION "20091107-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -190,12 +190,13 @@ struct t_weechat_plugin
int (*utf8_pos) (const char *string, int real_pos);
char *(*utf8_strndup) (const char *string, int length);
- /* directories */
+ /* directories/files */
int (*mkdir_home) (const char *directory, int mode);
int (*mkdir) (const char *directory, int mode);
int (*mkdir_parents) (const char *directory, int mode);
void (*exec_on_files) (const char *directory, int hidden_files, void *data,
void (*callback)(void *data, const char *filename));
+ char *(*file_get_content) (const char *filename);
/* util */
int (*timeval_cmp) (struct timeval *tv1, struct timeval *tv2);
@@ -395,7 +396,8 @@ struct t_weechat_plugin
int port,
int sock,
int ipv6,
- void *gnutls_sess,
+ void *gnutls_sess, void *gnutls_cb,
+ int gnutls_dhkey_size,
const char *local_hostname,
int (*callback)(void *data,
int status,
@@ -758,6 +760,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__callback) \
weechat_plugin->exec_on_files(__directory, __hidden_files, __data, \
__callback)
+#define weechat_file_get_content(__filename) \
+ weechat_plugin->file_get_content(__filename)
/* util */
#define weechat_timeval_cmp(__time1, __time2) \
@@ -972,10 +976,12 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->hook_process(weechat_plugin, __command, __timeout, \
__callback, __callback_data)
#define weechat_hook_connect(__proxy, __address, __port, __sock, \
- __ipv6, __gnutls_sess, __local_hostname, \
+ __ipv6, __gnutls_sess, __gnutls_cb, \
+ __gnutls_dhkey_size, __local_hostname, \
__callback, __data) \
weechat_plugin->hook_connect(weechat_plugin, __proxy, __address, \
__port, __sock, __ipv6, __gnutls_sess, \
+ __gnutls_cb, __gnutls_dhkey_size, \
__local_hostname, __callback, __data)
#define weechat_hook_print(__buffer, __tags, __msg, __strip__colors, \
__callback, __data) \