putting it all together: core is now capable to connect to ircservers using a proxy...
[quassel.git] / src / core / corenetwork.cpp
index b3cbfc0..0fd68b1 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "core.h"
 #include "coresession.h"
-#include "identity.h"
+#include "coreidentity.h"
 
 #include "ircserverhandler.h"
 #include "userinputhandler.h"
@@ -133,7 +133,7 @@ void CoreNetwork::connectToIrc(bool reconnecting) {
     qWarning() << "Server list empty, ignoring connect request!";
     return;
   }
-  Identity *identity = identityPtr();
+  CoreIdentity *identity = identityPtr();
   if(!identity) {
     qWarning() << "Invalid identity configures, ignoring connect request!";
     return;
@@ -163,10 +163,16 @@ void CoreNetwork::connectToIrc(bool reconnecting) {
 
 #ifdef HAVE_SSL
   socket.setProtocol((QSsl::SslProtocol)server.sslVersion);
-  if(server.useSsl)
+  if(server.useSsl) {
+    CoreIdentity *identity = identityPtr();
+    if(identity) {
+      socket.setLocalCertificate(identity->sslCert());
+      socket.setPrivateKey(identity->sslKey());
+    }
     socket.connectToHostEncrypted(server.host, server.port);
-  else
+  } else {
     socket.connectToHost(server.host, server.port);
+  }
 #else
   socket.connectToHost(server.host, server.port);
 #endif
@@ -285,7 +291,7 @@ void CoreNetwork::socketInitialized() {
     return;
 #endif
 
-  Identity *identity = identityPtr();
+  CoreIdentity *identity = identityPtr();
   if(!identity) {
     qCritical() << "Identity invalid!";
     disconnectFromIrc();