X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=020950f6de73ee110f10f1ba6ed4da3d65023848;hp=5bdfefe570a1e7e536a2d7e9d4940acd735e7c0d;hb=0d49f7e83bd1055711e66aa880f3a0d62f7eefc9;hpb=c2718511214289f58a02207f7988876c420e8c7e diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 5bdfefe5..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,15 +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) { - // no checks for validity check - privateslot... QTcpSocket *socket = qobject_cast(iodev); if(socket) quInfo() << qPrintable(tr("Client")) << qPrintable(socket->peerAddress().toString()) << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); - else - quInfo() << "Local client disconnedted."; - disconnect(socket, 0, this, 0); - socket->deleteLater(); } SignalProxy *CoreSession::signalProxy() const {