X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=b17fa28ae0fc8a230984b02b31aea896264e8b9d;hp=9611f71b28fede4fa986d37c752db9bd378cdb76;hb=0d49f7e83bd1055711e66aa880f3a0d62f7eefc9;hpb=6efa7d5a4cd38bc21ecfafd04d25a6c952d1e097 diff --git a/src/client/client.cpp b/src/client/client.cpp index 9611f71b..b17fa28a 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -65,7 +65,6 @@ void Client::init(AbstractUi *ui) { Client::Client(QObject *parent) : QObject(parent), - socket(0), _signalProxy(new SignalProxy(SignalProxy::Client, this)), mainUi(0), _networkModel(0), @@ -116,7 +115,7 @@ void Client::init() { p->attachSlot(SIGNAL(networkCreated(NetworkId)), this, SLOT(coreNetworkCreated(NetworkId))); p->attachSlot(SIGNAL(networkRemoved(NetworkId)), this, SLOT(coreNetworkRemoved(NetworkId))); - connect(p, SIGNAL(disconnected()), this, SLOT(disconnectFromCore())); + connect(p, SIGNAL(disconnected()), this, SLOT(disconnectedFromCore())); //connect(mainUi, SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &))); connect(mainUi, SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore())); @@ -252,13 +251,20 @@ void Client::userInput(BufferInfo bufferInfo, QString message) { /*** core connection stuff ***/ -void Client::setConnectedToCore(QIODevice *sock, AccountId id) { - socket = sock; +void Client::setConnectedToCore(QIODevice *socket, AccountId id) { + // if the socket is an orphan, the signalProxy adopts it. + // -> we don't need to care about it anymore + socket->setParent(0); signalProxy()->addPeer(socket); _connectedToCore = true; setCurrentCoreAccount(id); } +void Client::setConnectedToInternalCore() { + _connectedToCore = true; + setCurrentCoreAccount(AccountId()); +} + void Client::setSyncedToCore() { // create buffersyncer Q_ASSERT(!_bufferSyncer); @@ -286,12 +292,12 @@ void Client::setSecuredConnection() { void Client::disconnectFromCore() { if(!isConnected()) return; - _connectedToCore = false; - if(socket) { - socket->close(); - socket->deleteLater(); - } + signalProxy()->removeAllPeers(); +} + +void Client::disconnectedFromCore() { + _connectedToCore = false; _syncedToCore = false; emit disconnected(); emit coreConnectionStateChanged(false); @@ -336,10 +342,6 @@ void Client::disconnectFromCore() { } -void Client::setCoreConfiguration(const QVariantMap &settings) { - SignalProxy::writeDataToDevice(socket, settings); -} - /*** ***/ void Client::networkDestroyed() {