X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=020950f6de73ee110f10f1ba6ed4da3d65023848;hb=4d97c55d7f8864041b891b2d2f13c909f8b548f8;hp=ded76eff0c7d302cf69cebfa4df9c310c86c08cc;hpb=5c35ac3ee6f951d39cc052925aa224debfa148a8;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index ded76eff..020950f6 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -229,11 +229,13 @@ void CoreSession::disconnectFromNetwork(NetworkId id) { void CoreSession::networkStateRequested() { } -void CoreSession::addClient(QObject *dev) { // this is QObject* so we can use it in signal connections - QIODevice *device = qobject_cast(dev); +void CoreSession::addClient(QIODevice *device) { if(!device) { quError() << "Invoking CoreSession::addClient with a QObject that is not a QIODevice!"; } else { + // if the socket is an orphan, the signalProxy adopts it. + // -> we don't need to care about it anymore + device->setParent(0); signalProxy()->addPeer(device); QVariantMap reply; reply["MsgType"] = "SessionInit"; @@ -242,11 +244,15 @@ void CoreSession::addClient(QObject *dev) { // this is QObject* so we can use it } } +void CoreSession::addClient(SignalProxy *proxy) { + signalProxy()->addPeer(proxy); + emit sessionState(sessionState()); +} + void CoreSession::removeClient(QIODevice *iodev) { QTcpSocket *socket = qobject_cast(iodev); if(socket) quInfo() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); - iodev->deleteLater(); } SignalProxy *CoreSession::signalProxy() const {