- InternalConnection *conn = new InternalConnection();
- Client::instance()->signalProxy()->addPeer(conn); // sigproxy will take ownership
- emit connectToInternalCore(conn);
-
- return;
- }
-
- CoreAccountSettings s;
-
- Q_ASSERT(!_socket);
-#ifdef HAVE_SSL
- QSslSocket *sock = new QSslSocket(this);
- // make sure the warning is shown if we happen to connect without SSL support later
- s.setAccountValue("ShowNoClientSslWarning", true);
-#else
- if (_account.useSsl()) {
- if (s.accountValue("ShowNoClientSslWarning", true).toBool()) {
- bool accepted = false;
- emit handleNoSslInClient(&accepted);
- if (!accepted) {
- emit connectionError(tr("Unencrypted connection canceled"));
- return;
- }
- s.setAccountValue("ShowNoClientSslWarning", false);
- }
- }
- QTcpSocket *sock = new QTcpSocket(this);
-#endif
-
-#ifndef QT_NO_NETWORKPROXY
- if (_account.useProxy()) {
- QNetworkProxy proxy(_account.proxyType(), _account.proxyHostName(), _account.proxyPort(), _account.proxyUser(), _account.proxyPassword());
- sock->setProxy(proxy);
- }
-#endif
-
- _socket = sock;
- connect(sock, SIGNAL(connected()), SLOT(coreSocketConnected()));
- connect(sock, SIGNAL(disconnected()), SLOT(coreSocketDisconnected()));
- connect(sock, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(coreSocketError(QAbstractSocket::SocketError)));
- connect(sock, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(socketStateChanged(QAbstractSocket::SocketState)));
-
- emit connectionMsg(tr("Connecting to %1...").arg(currentAccount().accountName()));
- sock->connectToHost(_account.hostName(), _account.port());
-}
-
-
-void CoreConnection::coreSocketConnected()
-{
- // Create the connection which will handle the incoming data
- Q_ASSERT(!_connection);
- _connection = new LegacyConnection(_socket, this);
- connect(_connection, SIGNAL(dataReceived(QVariant)), SLOT(coreHasData(QVariant)));
- connect(_connection, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int)));
-
- // Phase One: Send client info and wait for core info
-
- emit connectionMsg(tr("Synchronizing to core..."));