summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-01-16 20:04:11 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2017-02-05 23:08:42 +0100
commit28df637055bc6f20f26ec40158f428ed4dac3c3d (patch)
treeafeb61ed478e9a7460c1c4a1ee3176fc1f9284d6 /src
parent7fd3c1f50a1842152a8a9ca652154c5350f6aed8 (diff)
downloadirssi-28df637055bc6f20f26ec40158f428ed4dac3c3d.zip
provide net_start_ssl api
fixes #615
Diffstat (limited to 'src')
-rw-r--r--src/common.h2
-rw-r--r--src/core/network-openssl.c16
-rw-r--r--src/core/network.h3
3 files changed, 20 insertions, 1 deletions
diff --git a/src/common.h b/src/common.h
index 43596580..646b7e1a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
-#define IRSSI_ABI_VERSION 7
+#define IRSSI_ABI_VERSION 8
#define DEFAULT_SERVER_ADD_PORT 6667
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c
index 1eb85341..aab9176d 100644
--- a/src/core/network-openssl.c
+++ b/src/core/network-openssl.c
@@ -20,6 +20,7 @@
#include "module.h"
#include "network.h"
+#include "net-sendbuffer.h"
#include "misc.h"
#include "servers.h"
#include "signals.h"
@@ -701,6 +702,21 @@ GIOChannel *net_connect_ip_ssl(IPADDR *ip, int port, IPADDR *my_ip, SERVER_REC *
return ssl_handle;
}
+GIOChannel *net_start_ssl(SERVER_REC *server)
+{
+ GIOChannel *handle, *ssl_handle;
+
+ g_return_val_if_fail(server != NULL, NULL);
+
+ handle = net_sendbuffer_handle(server->handle);
+ if (handle == NULL)
+ return NULL;
+
+ ssl_handle = irssi_ssl_get_iochannel(handle, server->connrec->port, server);
+ return ssl_handle;
+}
+
+
int irssi_ssl_handshake(GIOChannel *handle)
{
GIOSSLChannel *chan = (GIOSSLChannel *)handle;
diff --git a/src/core/network.h b/src/core/network.h
index 03f3b813..8757f78c 100644
--- a/src/core/network.h
+++ b/src/core/network.h
@@ -40,6 +40,9 @@ int net_ip_compare(IPADDR *ip1, IPADDR *ip2);
GIOChannel *net_connect(const char *addr, int port, IPADDR *my_ip) G_GNUC_DEPRECATED;
/* Connect to socket with ip address and SSL*/
GIOChannel *net_connect_ip_ssl(IPADDR *ip, int port, IPADDR *my_ip, SERVER_REC *server);
+/* Start TLS */
+GIOChannel *net_start_ssl(SERVER_REC *server);
+
int irssi_ssl_handshake(GIOChannel *handle);
/* Connect to socket with ip address */
GIOChannel *net_connect_ip(IPADDR *ip, int port, IPADDR *my_ip);