From 48151f63e7f953bf07828be39ba314095c472c74 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 29 Aug 2007 21:04:01 +0000 Subject: [PATCH] clean++ obsolete-- --- Quassel.kdevelop.filelist | 5 -- src/client/CMakeLists.txt | 4 +- src/client/buffertreemodel.cpp | 3 -- src/client/client.cpp | 47 ------------------- src/client/client.h | 4 -- src/client/clientproxy.cpp | 68 ---------------------------- src/client/clientproxy.h | 79 -------------------------------- src/common/main.cpp | 2 - src/common/proxy_common.h | 36 --------------- src/core/CMakeLists.txt | 4 +- src/core/core.cpp | 57 ++++++----------------- src/core/core.h | 2 - src/core/coreproxy.cpp | 40 ---------------- src/core/coreproxy.h | 83 ---------------------------------- src/core/coresession.cpp | 36 --------------- src/core/coresession.h | 8 +--- src/qtgui/coreconnectdlg.cpp | 1 - src/qtgui/mainwin.cpp | 3 -- src/qtgui/serverlist.cpp | 2 - 19 files changed, 18 insertions(+), 466 deletions(-) delete mode 100644 src/client/clientproxy.cpp delete mode 100644 src/client/clientproxy.h delete mode 100644 src/common/proxy_common.h delete mode 100644 src/core/coreproxy.cpp delete mode 100644 src/core/coreproxy.h diff --git a/Quassel.kdevelop.filelist b/Quassel.kdevelop.filelist index 584525a4..2458e69f 100644 --- a/Quassel.kdevelop.filelist +++ b/Quassel.kdevelop.filelist @@ -7,8 +7,6 @@ src/client/buffertreemodel.cpp src/client/buffertreemodel.h src/client/client.cpp src/client/client.h -src/client/clientproxy.cpp -src/client/clientproxy.h src/client/CMakeLists.txt src/client/treemodel.cpp src/client/treemodel.h @@ -25,7 +23,6 @@ src/common/logger.h src/common/main.cpp src/common/message.cpp src/common/message.h -src/common/proxy_common.h src/common/quasselui.h src/common/settings.cpp src/common/settings.h @@ -35,8 +32,6 @@ src/core src/core/CMakeLists.txt src/core/core.cpp src/core/core.h -src/core/coreproxy.cpp -src/core/coreproxy.h src/core/coresession.cpp src/core/coresession.h src/core/server.cpp diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index d35378e9..5f3d1f54 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -1,6 +1,6 @@ -SET(client_SRCS buffer.cpp buffertreemodel.cpp client.cpp clientproxy.cpp clientsettings.cpp treemodel.cpp) +SET(client_SRCS buffer.cpp buffertreemodel.cpp client.cpp clientsettings.cpp treemodel.cpp) SET(client_HDRS ) -SET(client_MOCS buffer.h buffertreemodel.h client.h clientproxy.h clientsettings.h treemodel.h) +SET(client_MOCS buffer.h buffertreemodel.h client.h clientsettings.h treemodel.h) QT4_WRAP_CPP(_MOC ${client_MOCS}) diff --git a/src/client/buffertreemodel.cpp b/src/client/buffertreemodel.cpp index c6fb9964..ecc56c3d 100644 --- a/src/client/buffertreemodel.cpp +++ b/src/client/buffertreemodel.cpp @@ -21,7 +21,6 @@ #include // FIXME Dependency on QtGui! #include "client.h" -//#include "clientproxy.h" #include "buffertreemodel.h" #include "signalproxy.h" @@ -118,8 +117,6 @@ Qt::ItemFlags NetworkTreeItem::flags() const { BufferTreeModel::BufferTreeModel(QObject *parent) : TreeModel(BufferTreeModel::defaultHeader(), parent) { - //connect(this, SIGNAL(fakeUserInput(BufferId, QString)), - // ClientProxy::instance(), SLOT(gsUserInput(BufferId, QString))); Client::signalProxy()->attachSignal(this, SIGNAL(fakeUserInput(BufferId, QString)), SIGNAL(sendInput(BufferId, QString))); } diff --git a/src/client/client.cpp b/src/client/client.cpp index 3cb067b9..2b8e96e1 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -22,7 +22,6 @@ #include "buffer.h" #include "buffertreemodel.h" -//#include "clientproxy.h" #include "quasselui.h" #include "signalproxy.h" #include "util.h" @@ -51,12 +50,8 @@ void Client::destroy() { } Client::Client() { - //clientProxy = ClientProxy::instance(); _signalProxy = new SignalProxy(SignalProxy::Client, 0, this); - // TODO: make this configurable (allow monolithic client to connect to remote cores) - //if(Global::runMode == Global::Monolithic) clientMode = LocalCore; - //else clientMode = RemoteCore; connectedToCore = false; socket = 0; } @@ -75,33 +70,6 @@ void Client::init() { connect(this, SIGNAL(bufferUpdated(Buffer *)), _bufferModel, SLOT(bufferUpdated(Buffer *))); connect(this, SIGNAL(bufferActivity(Buffer::ActivityLevel, Buffer *)), _bufferModel, SLOT(bufferActivity(Buffer::ActivityLevel, Buffer *))); - //connect(&socket, SIGNAL(readyRead()), this, SLOT(serverHasData())); - //connect(&socket, SIGNAL(connected()), this, SLOT(coreSocketConnected())); - //connect(&socket, SIGNAL(disconnected()), this, SLOT(coreSocketDisconnected())); - //connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(serverError(QAbstractSocket::SocketError))); - - //connect(this, SIGNAL(sendSessionData(const QString &, const QVariant &)), clientProxy, SLOT(gsSessionDataChanged(const QString &, const QVariant &))); - //connect(clientProxy, SIGNAL(csSessionDataChanged(const QString &, const QVariant &)), this, SLOT(recvSessionData(const QString &, const QVariant &))); - - //connect(clientProxy, SIGNAL(send(ClientSignal, QVariant, QVariant, QVariant)), this, SLOT(recvProxySignal(ClientSignal, QVariant, QVariant, QVariant))); - //connect(clientProxy, SIGNAL(csCoreState(QVariant)), this, SLOT(recvCoreState(const QVariant &))); - //connect(clientProxy, SIGNAL(csServerState(QString, QVariant)), this, SLOT(recvNetworkState(QString, QVariant))); - //connect(clientProxy, SIGNAL(csServerConnected(QString)), this, SLOT(networkConnected(QString))); - //connect(clientProxy, SIGNAL(csServerDisconnected(QString)), this, SLOT(networkDisconnected(QString))); - //connect(clientProxy, SIGNAL(csDisplayMsg(Message)), this, SLOT(recvMessage(const Message &))); - //connect(clientProxy, SIGNAL(csDisplayStatusMsg(QString, QString)), this, SLOT(recvStatusMsg(QString, QString))); - //connect(clientProxy, SIGNAL(csTopicSet(QString, QString, QString)), this, SLOT(setTopic(QString, QString, QString))); - //connect(clientProxy, SIGNAL(csNickAdded(QString, QString, QVariantMap)), this, SLOT(addNick(QString, QString, QVariantMap))); - //connect(clientProxy, SIGNAL(csNickRemoved(QString, QString)), this, SLOT(removeNick(QString, QString))); - //connect(clientProxy, SIGNAL(csNickRenamed(QString, QString, QString)), this, SLOT(renameNick(QString, QString, QString))); - //connect(clientProxy, SIGNAL(csNickUpdated(QString, QString, QVariantMap)), this, SLOT(updateNick(QString, QString, QVariantMap))); - //connect(clientProxy, SIGNAL(csOwnNickSet(QString, QString)), this, SLOT(setOwnNick(QString, QString))); - //connect(clientProxy, SIGNAL(csBacklogData(BufferId, const QList &, bool)), this, SLOT(recvBacklogData(BufferId, QList, bool))); - //connect(clientProxy, SIGNAL(csUpdateBufferId(BufferId)), this, SLOT(updateBufferId(BufferId))); - //connect(this, SIGNAL(sendInput(BufferId, QString)), clientProxy, SLOT(gsUserInput(BufferId, QString))); - //connect(this, SIGNAL(requestBacklog(BufferId, QVariant, QVariant)), clientProxy, SLOT(gsRequestBacklog(BufferId, QVariant, QVariant))); - //connect(this, SIGNAL(requestNetworkStates()), clientProxy, SLOT(gsRequestNetworkStates())); - SignalProxy *p = signalProxy(); p->attachSignal(this, SIGNAL(sendSessionData(const QString &, const QVariant &)), SIGNAL(clientSessionDataChanged(const QString &, const QVariant &))); p->attachSlot(SIGNAL(coreSessionDataChanged(const QString &, const QVariant &)), this, SLOT(recvSessionData(const QString &, const QVariant &))); @@ -120,7 +88,6 @@ void Client::init() { p->attachSlot(SIGNAL(backlogData(BufferId, const QVariantList &, bool)), this, SLOT(recvBacklogData(BufferId, const QVariantList &, bool))); p->attachSlot(SIGNAL(bufferIdUpdated(BufferId)), this, SLOT(updateBufferId(BufferId))); p->attachSignal(this, SIGNAL(sendInput(BufferId, QString))); - //p->attachSignal(this, SIGNAL(requestBacklog(BufferId, QVariant, QVariant)), "requestBacklog"); p->attachSignal(this, SIGNAL(requestNetworkStates())); connect(mainUi, SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &))); @@ -136,10 +103,7 @@ void Client::init() { } Client::~Client() { - //delete mainUi; - //delete _bufferModel; foreach(Buffer *buf, buffers.values()) delete buf; // this is done by disconnectFromCore()! FIXME? - //ClientProxy::destroy(); Q_ASSERT(!buffers.count()); } @@ -296,14 +260,6 @@ QStringList Client::sessionDataKeys() { return instance()->sessionData.keys(); } -void Client::recvProxySignal(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - if(clientMode == LocalCore) return; - QList sigdata; - sigdata.append(sig); sigdata.append(arg1); sigdata.append(arg2); sigdata.append(arg3); - //qDebug() << "Sending signal: " << sigdata; - writeDataToDevice(socket, QVariant(sigdata)); -} - void Client::coreSocketError(QAbstractSocket::SocketError) { emit coreConnectionError(socket->errorString()); } @@ -312,9 +268,6 @@ void Client::coreHasData() { QVariant item; if(readDataFromDevice(socket, blockSize, item)) { emit recvPartialItem(1,1); - //QList sigdata = item.toList(); - //Q_ASSERT(sigdata.size() == 4); - //ClientProxy::instance()->recv((CoreSignal)sigdata[0].toInt(), sigdata[1], sigdata[2], sigdata[3]); recvCoreState(item); blockSize = 0; return; diff --git a/src/client/client.h b/src/client/client.h index 9d7df3ee..011601f5 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -28,10 +28,8 @@ #include "buffer.h" #include "message.h" -#include "proxy_common.h" class AbstractUi; -class ClientProxy; class BufferTreeModel; class QtGui; class SignalProxy; @@ -97,7 +95,6 @@ class Client : public QObject { private slots: void recvCoreState(const QVariant &state); void recvSessionData(const QString &key, const QVariant &data); - void recvProxySignal(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3); void coreSocketError(QAbstractSocket::SocketError); void coreHasData(); @@ -135,7 +132,6 @@ class Client : public QObject { void disconnectFromLocalCore(); // defined in main.cpp AbstractUi *mainUi; - //ClientProxy *clientProxy; SignalProxy *_signalProxy; BufferTreeModel *_bufferModel; diff --git a/src/client/clientproxy.cpp b/src/client/clientproxy.cpp deleted file mode 100644 index 1d65351b..00000000 --- a/src/client/clientproxy.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "clientproxy.h" -#include "util.h" -#include "message.h" - -ClientProxy *ClientProxy::instanceptr = 0; - -ClientProxy *ClientProxy::instance() { - if(instanceptr) return instanceptr; - else return instanceptr = new ClientProxy(); -} - -void ClientProxy::destroy() { - delete instanceptr; - instanceptr = 0; -} - -ClientProxy::ClientProxy() { - - -} - -void ClientProxy::recv(CoreSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - //qDebug() << "[GUI] Received signal:" << sig <()); break; - case CS_DISPLAY_STATUS_MSG: emit csDisplayStatusMsg(arg1.toString(), arg2.toString()); break; - case CS_MODE_SET: emit csModeSet(arg1.toString(), arg2.toString(), arg3.toString()); break; - case CS_TOPIC_SET: emit csTopicSet(arg1.toString(), arg2.toString(), arg3.toString()); break; - case CS_NICK_ADDED: emit csNickAdded(arg1.toString(), arg2.toString(), arg3.toMap()); break; - case CS_NICK_REMOVED: emit csNickRemoved(arg1.toString(), arg2.toString()); break; - case CS_NICK_RENAMED: emit csNickRenamed(arg1.toString(), arg2.toString(), arg3.toString()); break; - case CS_NICK_UPDATED: emit csNickUpdated(arg1.toString(), arg2.toString(), arg3.toMap()); break; - case CS_OWN_NICK_SET: emit csOwnNickSet(arg1.toString(), arg2.toString()); break; - case CS_QUERY_REQUESTED: emit csQueryRequested(arg1.toString(), arg2.toString()); break; - case CS_BACKLOG_DATA: emit csBacklogData(arg1.value(), arg2.toList(), arg3.toBool()); break; - case CS_UPDATE_BUFFERID: emit csUpdateBufferId(arg1.value()); break; - - //default: qWarning() << "Unknown signal in ClientProxy::recv: " << sig; - default: emit csGeneric(sig, arg1, arg2, arg3); - } -} - -//ClientProxy *guiProxy; diff --git a/src/client/clientproxy.h b/src/client/clientproxy.h deleted file mode 100644 index e579e121..00000000 --- a/src/client/clientproxy.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _CLIENTPROXY_H_ -#define _CLIENTPROXY_H_ - -#include -#include - -#include "proxy_common.h" -#include "message.h" -#include "global.h" - -class ClientProxy : public QObject { - Q_OBJECT - - public: - static ClientProxy *instance(); - static void destroy(); - - public slots: - inline void gsSessionDataChanged(const QString &key, const QVariant &data) { send(GS_SESSION_DATA_CHANGED, key, data); } - inline void gsUserInput(BufferId id, QString msg) { send(GS_USER_INPUT, QVariant::fromValue(id), msg); } - inline void gsRequestConnect(QStringList networks) { send(GS_REQUEST_CONNECT, networks); } - inline void gsImportBacklog() { send(GS_IMPORT_BACKLOG); } - inline void gsRequestBacklog(BufferId id, QVariant v1, QVariant v2) { send(GS_REQUEST_BACKLOG, QVariant::fromValue(id), v1, v2); } - inline void gsRequestNetworkStates() { send(GS_REQUEST_NETWORK_STATES); } - - inline void gsGeneric(ClientSignal sig, QVariant v1 = QVariant(), QVariant v2 = QVariant(), QVariant v3 = QVariant()) { send(sig, v1, v2, v3); } - - signals: - void csCoreState(QVariant); - void csServerState(QString, QVariant); - void csServerConnected(QString); - void csServerDisconnected(QString); - void csDisplayMsg(Message); - void csDisplayStatusMsg(QString, QString); - void csSessionDataChanged(const QString &key, const QVariant &data); - void csModeSet(QString, QString, QString); - void csTopicSet(QString, QString, QString); - void csNickAdded(QString, QString, QVariantMap); - void csNickRemoved(QString, QString); - void csNickRenamed(QString, QString, QString); - void csNickUpdated(QString, QString, QVariantMap); - void csOwnNickSet(QString, QString); - void csQueryRequested(QString, QString); - void csBacklogData(BufferId, QList, bool); - void csUpdateBufferId(BufferId); - - void csGeneric(CoreSignal, QVariant, QVariant, QVariant); - - void send(ClientSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant()); - - public slots: - void recv(CoreSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant()); - - private: - ClientProxy(); - static ClientProxy *instanceptr; -}; - -#endif diff --git a/src/common/main.cpp b/src/common/main.cpp index 4b99a39e..18503f25 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -30,14 +30,12 @@ #elif defined BUILD_QTGUI #include #include "client.h" -//#include "clientproxy.h" #include "qtgui.h" #include "style.h" #elif defined BUILD_MONO #include #include "client.h" -//#include "clientproxy.h" #include "core.h" #include "coresession.h" #include "qtgui.h" diff --git a/src/common/proxy_common.h b/src/common/proxy_common.h deleted file mode 100644 index 97437b61..00000000 --- a/src/common/proxy_common.h +++ /dev/null @@ -1,36 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _PROXY_COMMON_H_ -#define _PROXY_COMMON_H_ - -enum ClientSignal { GS_CLIENT_INIT, GS_USER_INPUT, GS_REQUEST_CONNECT, GS_IMPORT_BACKLOG, - GS_REQUEST_BACKLOG, GS_REQUEST_NETWORK_STATES, GS_SESSION_DATA_CHANGED - -}; - -enum CoreSignal { CS_CORE_STATE, CS_SERVER_CONNECTED, CS_SERVER_DISCONNECTED, CS_SERVER_STATE, - CS_DISPLAY_MSG, CS_DISPLAY_STATUS_MSG, CS_SESSION_DATA_CHANGED, - CS_MODE_SET, CS_TOPIC_SET, CS_SET_NICKS, CS_NICK_ADDED, CS_NICK_REMOVED, CS_NICK_RENAMED, CS_NICK_UPDATED, - CS_OWN_NICK_SET, CS_QUERY_REQUESTED, CS_BACKLOG_DATA, CS_UPDATE_BUFFERID - -}; - -#endif diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index b7d3be82..cc12ff7c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,6 +1,6 @@ -SET(core_SRCS core.cpp coreproxy.cpp coresession.cpp server.cpp serverinfo.cpp sqlitestorage.cpp storage.cpp) +SET(core_SRCS core.cpp coresession.cpp server.cpp serverinfo.cpp sqlitestorage.cpp storage.cpp) SET(core_HDRS ) -SET(core_MOCS core.h coreproxy.h coresession.h server.h serverinfo.h sqlitestorage.h storage.h) +SET(core_MOCS core.h coresession.h server.h serverinfo.h sqlitestorage.h storage.h) QT4_WRAP_CPP(_MOC ${core_MOCS}) ADD_LIBRARY(core ${core_SRCS} ${_MOC}) diff --git a/src/core/core.cpp b/src/core/core.cpp index dfaa1b72..d6330385 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -33,7 +33,6 @@ Core * Core::instance() { } void Core::destroy() { - //instanceptr->deleteLater(); delete instanceptr; instanceptr = 0; } @@ -54,9 +53,6 @@ void Core::init() { } Core::~Core() { - //foreach(QTcpSocket *sock, validClients.keys()) { - // delete sock; - //} qDeleteAll(sessions); delete storage; } @@ -78,7 +74,6 @@ CoreSession *Core::createSession(UserId uid) { Q_ASSERT(!core->sessions.contains(uid)); CoreSession *sess = new CoreSession(uid, core->storage); core->sessions[uid] = sess; - //connect(sess, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant)), core, SLOT(recvProxySignal(CoreSignal, QVariant, QVariant, QVariant))); return sess; } @@ -112,34 +107,26 @@ void Core::clientHasData() { quint32 bsize = blockSizes.value(socket); QVariant item; if(readDataFromDevice(socket, bsize, item)) { - /* this is probably obsolete now */ - if(validClients.contains(socket)) { - Q_ASSERT(false); - //QList sigdata = item.toList(); - //sessions[validClients[socket]]->processSignal((ClientSignal)sigdata[0].toInt(), sigdata[1], sigdata[2], sigdata[3]); - } else { - // we need to auth the client - try { - processClientInit(socket, item); - } catch(Storage::AuthError) { - qWarning() << "Authentification error!"; // FIXME - socket->close(); - return; - } catch(Exception e) { - qWarning() << "Client init error:" << e.msg(); - socket->close(); - return; - } + // we need to auth the client + try { + processClientInit(socket, item); + } catch(Storage::AuthError) { + qWarning() << "Authentification error!"; // FIXME + socket->close(); + return; + } catch(Exception e) { + qWarning() << "Client init error:" << e.msg(); + socket->close(); + return; } - blockSizes[socket] = bsize = 0; // FIXME blockSizes aufräum0rn! } - blockSizes[socket] = bsize; + blockSizes[socket] = bsize = 0; // FIXME blockSizes aufräum0rn! } +// FIXME: no longer called, since connection handling is now in SignalProxy void Core::clientDisconnected() { QTcpSocket *socket = dynamic_cast(sender()); blockSizes.remove(socket); - validClients.remove(socket); qDebug() << "Client disconnected."; // TODO remove unneeded sessions - if necessary/possible... } @@ -166,9 +153,6 @@ void Core::processClientInit(QTcpSocket *socket, const QVariant &v) { // Auth UserId uid = storage->validateUser(msg["User"].toString(), msg["Password"].toString()); // throws exception if this failed QVariant reply = initSession(uid); - validClients[socket] = uid; // still needed? FIXME - //QList sigdata; - //sigdata.append(CS_CORE_STATE); sigdata.append(reply); sigdata.append(QVariant()); sigdata.append(QVariant()); disconnect(socket, 0, this, 0); sessions[uid]->addClient(socket); writeDataToDevice(socket, reply); @@ -180,23 +164,8 @@ QVariant Core::initSession(UserId uid) { if(sessions.contains(uid)) sess = sessions[uid]; else { sess = createSession(uid); - //validClients[socket] = uid; } QVariantMap reply; reply["SessionState"] = sess->sessionState(); return reply; } - -/* -void Core::recvProxySignal(CoreSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - CoreSession *sess = qobject_cast(sender()); - Q_ASSERT(sess); - UserId uid = sess->userId(); - QList sigdata; - sigdata.append(sig); sigdata.append(arg1); sigdata.append(arg2); sigdata.append(arg3); - //qDebug() << "Sending signal: " << sigdata; - foreach(QTcpSocket *socket, validClients.keys()) { - if(validClients[socket] == uid) writeDataToDevice(socket, QVariant(sigdata)); - } -} -*/ diff --git a/src/core/core.h b/src/core/core.h index eef6a2f0..5e73b7c8 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -46,7 +46,6 @@ class Core : public QObject { static void disconnectLocalClient(); private slots: - //void recvProxySignal(CoreSignal, QVariant, QVariant, QVariant); bool startListening(uint port = DEFAULT_PORT); void stopListening(); void incomingConnection(); @@ -73,7 +72,6 @@ class Core : public QObject { Storage *storage; QTcpServer server; // TODO: implement SSL - QHash validClients; QHash blockSizes; }; diff --git a/src/core/coreproxy.cpp b/src/core/coreproxy.cpp deleted file mode 100644 index 580c7b14..00000000 --- a/src/core/coreproxy.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include "coreproxy.h" -#include - -CoreProxy::CoreProxy() { - -} - -void CoreProxy::recv(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - //qDebug() << "[CORE] Received signal" << sig << ":" << arg1<(), arg2.toString()); break; - case GS_REQUEST_CONNECT: emit gsRequestConnect(arg1.toStringList()); break; - case GS_IMPORT_BACKLOG: emit gsImportBacklog(); break; - case GS_REQUEST_BACKLOG: emit gsRequestBacklog(arg1.value(), arg2, arg3); break; - case GS_REQUEST_NETWORK_STATES: emit gsRequestNetworkStates(); break; - //default: qWarning() << "Unknown signal in CoreProxy::recv: " << sig; - default: emit gsGeneric(sig, arg1, arg2, arg3); - } -} diff --git a/src/core/coreproxy.h b/src/core/coreproxy.h deleted file mode 100644 index e8c8e63c..00000000 --- a/src/core/coreproxy.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * - * devel@quassel-irc.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef _COREPROXY_H_ -#define _COREPROXY_H_ - -#include "proxy_common.h" -#include "message.h" -#include "global.h" - -//#include -#include -#include - -/** This class is the Core side of the proxy. The Core connects its signals and slots to it, - * and the calls are marshalled and sent to (or received and unmarshalled from) the GuiProxy. - * The connection functions are defined in main/main_core.cpp or main/main_mono.cpp. - */ -class CoreProxy : public QObject { - Q_OBJECT - - public: - CoreProxy(); - - public slots: - inline void csSessionDataChanged(const QString &key, const QVariant &data) { send(CS_SESSION_DATA_CHANGED, key, data); } - inline void csServerConnected(QString net) { send(CS_SERVER_CONNECTED, net); } - inline void csServerDisconnected(QString net) { send(CS_SERVER_DISCONNECTED, net); } - inline void csServerState(QString net, QVariantMap data) { send(CS_SERVER_STATE, net, data); } - inline void csDisplayMsg(Message msg) { send(CS_DISPLAY_MSG, QVariant::fromValue(msg));} - inline void csDisplayStatusMsg(QString net, QString msg) { send(CS_DISPLAY_STATUS_MSG, net, msg); } - inline void csModeSet(QString net, QString target, QString mode) { send(CS_MODE_SET, net, target, mode); } - inline void csTopicSet(QString net, QString buf, QString topic) { send(CS_TOPIC_SET, net, buf, topic); } - inline void csNickAdded(QString net, QString nick, QVariantMap props) { send(CS_NICK_ADDED, net, nick, props); } - inline void csNickRemoved(QString net, QString nick) { send(CS_NICK_REMOVED, net, nick); } - inline void csNickRenamed(QString net, QString oldn, QString newn) { send(CS_NICK_RENAMED, net, oldn, newn); } - inline void csNickUpdated(QString net, QString nick, QVariantMap props) { send(CS_NICK_UPDATED, net, nick, props); } - inline void csOwnNickSet(QString net, QString nick) { send(CS_OWN_NICK_SET, net, nick); } - inline void csQueryRequested(QString net, QString nick) { send(CS_QUERY_REQUESTED, net, nick); } - inline void csBacklogData(BufferId id, QList msg, bool done) { send(CS_BACKLOG_DATA, QVariant::fromValue(id), msg, done); } - inline void csUpdateBufferId(BufferId id) { send(CS_UPDATE_BUFFERID, QVariant::fromValue(id)); } - - inline void csGeneric(CoreSignal sig, QVariant v1 = QVariant(), QVariant v2 = QVariant(), QVariant v3 = QVariant()) { send(sig, v1, v2, v3); } - - signals: - void gsSessionDataChanged(const QString &, const QVariant &); - void gsUserInput(BufferId, QString); - void gsRequestConnect(QStringList networks); - void gsImportBacklog(); - void gsRequestBacklog(BufferId, QVariant, QVariant); - void gsRequestNetworkStates(); - - void gsGeneric(ClientSignal, QVariant, QVariant, QVariant); - - void requestServerStates(); - - void send(CoreSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant()); - - public: - void recv(ClientSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant()); - - -}; - - -#endif diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index da8e3c51..34ae160c 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -35,21 +35,6 @@ CoreSession::CoreSession(UserId uid, Storage *_storage, QObject *parent) : QObje } mutex.unlock(); - //connect(coreProxy, SIGNAL(send(CoreSignal, QVariant, QVariant, QVariant)), this, SIGNAL(proxySignal(CoreSignal, QVariant, QVariant, QVariant))); - //connect(coreProxy, SIGNAL(requestServerStates()), this, SIGNAL(serverStateRequested())); - //connect(coreProxy, SIGNAL(gsRequestConnect(QStringList)), this, SLOT(connectToIrc(QStringList))); - //connect(coreProxy, SIGNAL(gsUserInput(BufferId, QString)), this, SLOT(msgFromGui(BufferId, QString))); - //connect(coreProxy, SIGNAL(gsImportBacklog()), storage, SLOT(importOldBacklog())); - //connect(coreProxy, SIGNAL(gsRequestBacklog(BufferId, QVariant, QVariant)), this, SLOT(sendBacklog(BufferId, QVariant, QVariant))); - //connect(coreProxy, SIGNAL(gsRequestNetworkStates()), this, SLOT(sendServerStates())); - //connect(this, SIGNAL(displayMsg(Message)), coreProxy, SLOT(csDisplayMsg(Message))); - //connect(this, SIGNAL(displayStatusMsg(QString, QString)), coreProxy, SLOT(csDisplayStatusMsg(QString, QString))); - //connect(this, SIGNAL(backlogData(BufferId, QList, bool)), coreProxy, SLOT(csBacklogData(BufferId, QList, bool))); - //connect(this, SIGNAL(bufferIdUpdated(BufferId)), coreProxy, SLOT(csUpdateBufferId(BufferId))); - //connect(storage, SIGNAL(bufferIdUpdated(BufferId)), coreProxy, SLOT(csUpdateBufferId(BufferId))); - //connect(this, SIGNAL(sessionDataChanged(const QString &, const QVariant &)), coreProxy, SLOT(csSessionDataChanged(const QString &, const QVariant &))); - //connect(coreProxy, SIGNAL(gsSessionDataChanged(const QString &, const QVariant &)), this, SLOT(storeSessionData(const QString &, const QVariant &))); - SignalProxy *p = signalProxy(); p->attachSlot(SIGNAL(requestNetworkStates()), this, SIGNAL(serverStateRequested())); @@ -86,12 +71,6 @@ UserId CoreSession::userId() const { return user; } -/* -void CoreSession::processSignal(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) { - coreProxy->recv(sig, arg1, arg2, arg3); -} -*/ - void CoreSession::storeSessionData(const QString &key, const QVariant &data) { QSettings s; s.beginGroup(QString("SessionData/%1").arg(user)); @@ -127,22 +106,8 @@ void CoreSession::connectToNetwork(QString network) { connect(server, SIGNAL(connected(QString)), this, SLOT(serverConnected(QString))); connect(server, SIGNAL(disconnected(QString)), this, SLOT(serverDisconnected(QString))); - - //connect(server, SIGNAL(serverState(QString, QVariantMap)), coreProxy, SLOT(csServerState(QString, QVariantMap))); - ////connect(server, SIGNAL(displayMsg(Message)), this, SLOT(recvMessageFromServer(Message))); connect(server, SIGNAL(displayMsg(Message::Type, QString, QString, QString, quint8)), this, SLOT(recvMessageFromServer(Message::Type, QString, QString, QString, quint8))); connect(server, SIGNAL(displayStatusMsg(QString)), this, SLOT(recvStatusMsgFromServer(QString))); - //connect(server, SIGNAL(modeSet(QString, QString, QString)), coreProxy, SLOT(csModeSet(QString, QString, QString))); - //connect(server, SIGNAL(topicSet(QString, QString, QString)), coreProxy, SLOT(csTopicSet(QString, QString, QString))); - //connect(server, SIGNAL(nickAdded(QString, QString, QVariantMap)), coreProxy, SLOT(csNickAdded(QString, QString, QVariantMap))); - //connect(server, SIGNAL(nickRenamed(QString, QString, QString)), coreProxy, SLOT(csNickRenamed(QString, QString, QString))); - //connect(server, SIGNAL(nickRemoved(QString, QString)), coreProxy, SLOT(csNickRemoved(QString, QString))); - //connect(server, SIGNAL(nickUpdated(QString, QString, QVariantMap)), coreProxy, SLOT(csNickUpdated(QString, QString, QVariantMap))); - //connect(server, SIGNAL(ownNickSet(QString, QString)), coreProxy, SLOT(csOwnNickSet(QString, QString))); - //connect(server, SIGNAL(queryRequested(QString, QString)), coreProxy, SLOT(csQueryRequested(QString, QString))); - //// TODO add error handling - //connect(server, SIGNAL(connected(QString)), coreProxy, SLOT(csServerConnected(QString))); - //connect(server, SIGNAL(disconnected(QString)), coreProxy, SLOT(csServerDisconnected(QString))); SignalProxy *p = signalProxy(); p->attachSignal(server, SIGNAL(serverState(QString, QVariantMap)), SIGNAL(networkState(QString, QVariantMap))); @@ -179,7 +144,6 @@ void CoreSession::serverConnected(QString net) { void CoreSession::serverDisconnected(QString net) { delete servers[net]; servers.remove(net); - //coreProxy->csServerDisconnected(net); signalProxy()->sendSignal(SIGNAL(networkDisconnected(QString)), net); // FIXME does this work? } diff --git a/src/core/coresession.h b/src/core/coresession.h index 73204f64..66e27354 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -25,7 +25,6 @@ #include #include -//#include "coreproxy.h" #include "message.h" class Server; @@ -53,7 +52,6 @@ class CoreSession : public QObject { //! Retrieve a piece of session-wide data. QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant()); - //CoreProxy *proxy(); SignalProxy *signalProxy() const; public slots: @@ -64,8 +62,6 @@ class CoreSession : public QObject { void sendServerStates(); signals: - //void proxySignal(CoreSignal, QVariant arg1 = QVariant(), QVariant arg2 = QVariant(), QVariant arg3 = QVariant()); - void msgFromGui(QString net, QString buf, QString message); void displayMsg(Message message); void displayStatusMsg(QString, QString); @@ -89,14 +85,12 @@ class CoreSession : public QObject { private: UserId user; - //CoreProxy *coreProxy; - SignalProxy *_signalProxy; + SignalProxy *_signalProxy; Storage *storage; QHash servers; QVariantMap sessionData; QMutex mutex; - }; #endif diff --git a/src/qtgui/coreconnectdlg.cpp b/src/qtgui/coreconnectdlg.cpp index 9992496c..a3326a4e 100644 --- a/src/qtgui/coreconnectdlg.cpp +++ b/src/qtgui/coreconnectdlg.cpp @@ -20,7 +20,6 @@ #include #include "coreconnectdlg.h" -//#include "clientproxy.h" #include "global.h" #include "client.h" #include "clientsettings.h" diff --git a/src/qtgui/mainwin.cpp b/src/qtgui/mainwin.cpp index ef96c2a0..61073a71 100644 --- a/src/qtgui/mainwin.cpp +++ b/src/qtgui/mainwin.cpp @@ -23,7 +23,6 @@ #include "bufferview.h" #include "chatline.h" #include "client.h" -//#include "clientproxy.h" #include "coreconnectdlg.h" #include "serverlist.h" #include "settingsdlg.h" @@ -42,7 +41,6 @@ MainWin::MainWin(QtGui *_gui, QWidget *parent) : QMainWindow(parent), gui(_gui) } void MainWin::init() { - //connect(this, SIGNAL(requestBacklog(BufferId, QVariant, QVariant)), ClientProxy::instance(), SLOT(gsRequestBacklog(BufferId, QVariant, QVariant))); Client::signalProxy()->attachSignal(this, SIGNAL(requestBacklog(BufferId, QVariant, QVariant))); ui.bufferWidget->init(); @@ -110,7 +108,6 @@ void MainWin::setupMenus() { connect(ui.actionAboutQt, SIGNAL(triggered()), QApplication::instance(), SLOT(aboutQt())); // for debugging connect(ui.actionImportBacklog, SIGNAL(triggered()), this, SLOT(importBacklog())); - //connect(this, SIGNAL(importOldBacklog()), ClientProxy::instance(), SLOT(gsImportBacklog())); Client::signalProxy()->attachSignal(this, SIGNAL(importOldBacklog())); } diff --git a/src/qtgui/serverlist.cpp b/src/qtgui/serverlist.cpp index 99265f1c..8a076948 100644 --- a/src/qtgui/serverlist.cpp +++ b/src/qtgui/serverlist.cpp @@ -21,7 +21,6 @@ #include "serverlist.h" #include "identities.h" #include "client.h" -//#include "clientproxy.h" #include "signalproxy.h" /* NOTE: This dialog holds not only the server list, but also the identities. @@ -42,7 +41,6 @@ ServerListDlg::ServerListDlg(QWidget *parent) : QDialog(parent) { settings.endGroup(); - //connect(this, SIGNAL(requestConnect(QStringList)), ClientProxy::instance(), SLOT(gsRequestConnect(QStringList))); Client::signalProxy()->attachSignal(this, SIGNAL(requestConnect(QString))); // Autoconnect -- 2.20.1