X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=94cf39eb8fa8bb2a62f4024f74c8b2f099e478cc;hb=9de382b2b2a352bad4a076249f07ae84da94c420;hp=c93324b61a0a4587f830d1f2ef4e94d4d4e76c34;hpb=8ec76e512d20ce5d1dc76de556bb98a06b75d695;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index c93324b6..94cf39eb 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -27,6 +27,7 @@ #include "signalproxy.h" #include "buffersyncer.h" #include "corebacklogmanager.h" +#include "corebufferviewmanager.h" #include "storage.h" #include "network.h" @@ -43,11 +44,13 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _signalProxy(new SignalProxy(SignalProxy::Server, 0, this)), _bufferSyncer(new BufferSyncer(this)), _backlogManager(new CoreBacklogManager(this)), + _bufferViewManager(new CoreBufferViewManager(_signalProxy, this)), scriptEngine(new QScriptEngine(this)) { SignalProxy *p = signalProxy(); - + connect(p, SIGNAL(peerRemoved(QIODevice *)), this, SLOT(removeClient(QIODevice *))); + //p->attachSlot(SIGNAL(disconnectFromNetwork(NetworkId)), this, SLOT(disconnectFromNetwork(NetworkId))); // FIXME p->attachSlot(SIGNAL(sendInput(BufferInfo, QString)), this, SLOT(msgFromClient(BufferInfo, QString))); p->attachSignal(this, SIGNAL(displayMsg(Message))); @@ -222,6 +225,17 @@ void CoreSession::addClient(QObject *dev) { // this is QObject* so we can use it } } +void CoreSession::removeClient(QIODevice *iodev) { + // no checks for validity check - privateslot... + QTcpSocket *socket = qobject_cast(iodev); + if(socket) + qDebug() << qPrintable(tr("Client %1 disconnected (UserId: %2).").arg(socket->peerAddress().toString()).arg(user().toInt())); + else + qDebug() << "Local client disconnedted."; + disconnect(socket, 0, this, 0); + socket->deleteLater(); +} + SignalProxy *CoreSession::signalProxy() const { return _signalProxy; } @@ -258,7 +272,7 @@ void CoreSession::msgFromClient(BufferInfo bufinfo, QString msg) { if(conn) { conn->userInput(bufinfo, msg); } else { - qWarning() << "Trying to send to unconnected network!"; + qWarning() << "Trying to send to unconnected network:" << msg; } }