1 /***************************************************************************
2 * Copyright (C) 2005-07 by the Quassel IRC Team *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef _CORESESSION_H_
22 #define _CORESESSION_H_
34 class CoreSession : public QObject {
38 CoreSession(UserId, Storage *, QObject *parent = 0);
39 virtual ~CoreSession();
41 NetworkId getNetworkId(const QString &network) const;
42 QList<BufferInfo> buffers() const;
43 UserId userId() const;
44 QVariant sessionState();
46 //! Retrieve a piece of session-wide data.
47 QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant());
49 SignalProxy *signalProxy() const;
51 void attachServer(Server *server);
53 //! Return necessary data for restoring the session after restarting the core
54 QVariant state() const;
55 void restoreState(const QVariant &previousState);
58 //! Store a piece session-wide data and distribute it to connected clients.
59 void storeSessionData(const QString &key, const QVariant &data);
61 void serverStateRequested();
63 void addClient(QIODevice *connection);
65 void connectToNetwork(QString, const QVariant &previousState = QVariant());
66 //void connectToNetwork(NetworkId);
68 //void processSignal(ClientSignal, QVariant, QVariant, QVariant);
69 void sendBacklog(BufferInfo, QVariant, QVariant);
70 void msgFromGui(BufferInfo, QString message);
73 void msgFromGui(uint netid, QString buf, QString message);
74 void displayMsg(Message message);
75 void displayStatusMsg(QString, QString);
77 void connectToIrc(QString net);
78 void disconnectFromIrc(QString net);
80 void backlogData(BufferInfo, QVariantList, bool done);
82 void bufferInfoUpdated(BufferInfo);
83 void sessionDataChanged(const QString &key);
84 void sessionDataChanged(const QString &key, const QVariant &data);
87 void recvStatusMsgFromServer(QString msg);
88 void recvMessageFromServer(Message::Type, QString target, QString text, QString sender = "", quint8 flags = Message::None);
89 void serverConnected(uint networkid);
90 void serverDisconnected(uint networkid);
95 SignalProxy *_signalProxy;
97 QHash<NetworkId, Server *> servers;
99 QVariantMap sessionData;