summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-02-06 12:38:20 +0100
committerGitHub <noreply@github.com>2017-02-06 12:38:20 +0100
commit653c7fb05a67841acd4fcc12ce1fee3be9955453 (patch)
treeb012ff75f7ca87b7a2c235223a5bd5282ce2aa3f /src/core
parentff5dd3673ee6b60d95e89dd89aa3605c79a93ac1 (diff)
parent28df637055bc6f20f26ec40158f428ed4dac3c3d (diff)
downloadirssi-653c7fb05a67841acd4fcc12ce1fee3be9955453.zip
Merge pull request #622 from ailin-nemui/starttls
provide net_start_ssl api
Diffstat (limited to 'src/core')
-rw-r--r--src/core/network-openssl.c16
-rw-r--r--src/core/network.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c
index f193a61e..36b8d887 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"
@@ -718,6 +719,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);