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
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
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
-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})
#include <QColor> // FIXME Dependency on QtGui!
#include "client.h"
-//#include "clientproxy.h"
#include "buffertreemodel.h"
#include "signalproxy.h"
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)));
}
#include "buffer.h"
#include "buffertreemodel.h"
-//#include "clientproxy.h"
#include "quasselui.h"
#include "signalproxy.h"
#include "util.h"
}
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;
}
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<QVariant> &, bool)), this, SLOT(recvBacklogData(BufferId, QList<QVariant>, 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 &)));
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 &)));
}
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());
}
return instance()->sessionData.keys();
}
-void Client::recvProxySignal(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
- if(clientMode == LocalCore) return;
- QList<QVariant> 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());
}
QVariant item;
if(readDataFromDevice(socket, blockSize, item)) {
emit recvPartialItem(1,1);
- //QList<QVariant> 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;
#include "buffer.h"
#include "message.h"
-#include "proxy_common.h"
class AbstractUi;
-class ClientProxy;
class BufferTreeModel;
class QtGui;
class SignalProxy;
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();
void disconnectFromLocalCore(); // defined in main.cpp
AbstractUi *mainUi;
- //ClientProxy *clientProxy;
SignalProxy *_signalProxy;
BufferTreeModel *_bufferModel;
+++ /dev/null
-/***************************************************************************
- * 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 <<arg1<<arg2<<arg3;
- switch(sig) {
- case CS_CORE_STATE: emit csCoreState(arg1); break;
- case CS_SERVER_STATE: emit csServerState(arg1.toString(), arg2.toMap()); break;
- case CS_SERVER_CONNECTED: emit csServerConnected(arg1.toString()); break;
- case CS_SERVER_DISCONNECTED: emit csServerDisconnected(arg1.toString()); break;
- case CS_SESSION_DATA_CHANGED: emit csSessionDataChanged(arg1.toString(), arg2); break;
- case CS_DISPLAY_MSG: emit csDisplayMsg(arg1.value<Message>()); 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<BufferId>(), arg2.toList(), arg3.toBool()); break;
- case CS_UPDATE_BUFFERID: emit csUpdateBufferId(arg1.value<BufferId>()); break;
-
- //default: qWarning() << "Unknown signal in ClientProxy::recv: " << sig;
- default: emit csGeneric(sig, arg1, arg2, arg3);
- }
-}
-
-//ClientProxy *guiProxy;
+++ /dev/null
-/***************************************************************************
- * 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 <QStringList>
-#include <QtDebug>
-
-#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<QVariant>, 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
#elif defined BUILD_QTGUI
#include <QApplication>
#include "client.h"
-//#include "clientproxy.h"
#include "qtgui.h"
#include "style.h"
#elif defined BUILD_MONO
#include <QApplication>
#include "client.h"
-//#include "clientproxy.h"
#include "core.h"
#include "coresession.h"
#include "qtgui.h"
+++ /dev/null
-/***************************************************************************
- * 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
-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})
}
void Core::destroy() {
- //instanceptr->deleteLater();
delete instanceptr;
instanceptr = 0;
}
}
Core::~Core() {
- //foreach(QTcpSocket *sock, validClients.keys()) {
- // delete sock;
- //}
qDeleteAll(sessions);
delete storage;
}
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;
}
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<QVariant> 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<QTcpSocket*>(sender());
blockSizes.remove(socket);
- validClients.remove(socket);
qDebug() << "Client disconnected.";
// TODO remove unneeded sessions - if necessary/possible...
}
// 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<QVariant> 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);
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<CoreSession*>(sender());
- Q_ASSERT(sess);
- UserId uid = sess->userId();
- QList<QVariant> 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));
- }
-}
-*/
static void disconnectLocalClient();
private slots:
- //void recvProxySignal(CoreSignal, QVariant, QVariant, QVariant);
bool startListening(uint port = DEFAULT_PORT);
void stopListening();
void incomingConnection();
Storage *storage;
QTcpServer server; // TODO: implement SSL
- QHash<QTcpSocket *, UserId> validClients;
QHash<QTcpSocket *, quint32> blockSizes;
};
+++ /dev/null
-/***************************************************************************
- * 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 <QtDebug>
-
-CoreProxy::CoreProxy() {
-
-}
-
-void CoreProxy::recv(ClientSignal sig, QVariant arg1, QVariant arg2, QVariant arg3) {
- //qDebug() << "[CORE] Received signal" << sig << ":" << arg1<<arg2<<arg3;
- switch(sig) {
- case GS_SESSION_DATA_CHANGED: emit gsSessionDataChanged(arg1.toString(), arg2); break;
- case GS_USER_INPUT: emit gsUserInput(arg1.value<BufferId>(), 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<BufferId>(), 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);
- }
-}
+++ /dev/null
-/***************************************************************************
- * 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 <QtCore>
-#include <QStringList>
-#include <QDebug>
-
-/** 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<QVariant> 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
}
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<QVariant>, bool)), coreProxy, SLOT(csBacklogData(BufferId, QList<QVariant>, 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()));
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));
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)));
void CoreSession::serverDisconnected(QString net) {
delete servers[net];
servers.remove(net);
- //coreProxy->csServerDisconnected(net);
signalProxy()->sendSignal(SIGNAL(networkDisconnected(QString)), net); // FIXME does this work?
}
#include <QString>
#include <QVariant>
-//#include "coreproxy.h"
#include "message.h"
class Server;
//! Retrieve a piece of session-wide data.
QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant());
- //CoreProxy *proxy();
SignalProxy *signalProxy() const;
public slots:
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);
private:
UserId user;
- //CoreProxy *coreProxy;
- SignalProxy *_signalProxy;
+ SignalProxy *_signalProxy;
Storage *storage;
QHash<QString, Server *> servers;
QVariantMap sessionData;
QMutex mutex;
-
};
#endif
#include <QtGui>
#include "coreconnectdlg.h"
-//#include "clientproxy.h"
#include "global.h"
#include "client.h"
#include "clientsettings.h"
#include "bufferview.h"
#include "chatline.h"
#include "client.h"
-//#include "clientproxy.h"
#include "coreconnectdlg.h"
#include "serverlist.h"
#include "settingsdlg.h"
}
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();
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()));
}
#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.
settings.endGroup();
- //connect(this, SIGNAL(requestConnect(QStringList)), ClientProxy::instance(), SLOT(gsRequestConnect(QStringList)));
Client::signalProxy()->attachSignal(this, SIGNAL(requestConnect(QString)));
// Autoconnect