+ static AccountId currentCoreAccount();
+
+ static bool isConnected();
+ static bool isSynced();
+
+ static void userInput(BufferInfo bufferInfo, QString message);
+
+ static void setBufferLastSeenMsg(BufferId id, const MsgId &msgId); // this is synced to core and other clients
+ static void removeBuffer(BufferId id);
+
+signals:
+ void sendInput(BufferInfo, QString message);
+ void showBuffer(Buffer *);
+ void bufferUpdated(BufferInfo bufferInfo);
+ void backlogReceived(Buffer *, QList<Message>);
+ void requestBacklog(BufferInfo, QVariant, QVariant);
+ void requestNetworkStates();
+
+ void showConfigWizard(const QVariantMap &coredata);
+
+ void connected();
+ void securedConnection();
+ void disconnected();
+ void coreConnectionStateChanged(bool);
+
+ //! The identity with the given ID has been newly created in core and client.
+ /** \param id The ID of the newly created identity.
+ */
+ void identityCreated(IdentityId id);
+
+ //! The identity with the given ID has been removed.
+ /** Upon emitting this signal, the identity is already gone from the core, and it will
+ * be deleted from the client immediately afterwards, so connected slots need to clean
+ * up their stuff.
+ * \param id The ID of the identity about to be removed.
+ */
+ void identityRemoved(IdentityId id);
+
+ //! Sent to the core when an identity shall be created. Should not be used elsewhere.
+ void requestCreateIdentity(const Identity &);
+ //! Sent to the core when an identity shall be updated. Should not be used elsewhere.
+ void requestUpdateIdentity(const Identity &);
+ //! Sent to the core when an identity shall be removed. Should not be used elsewhere.
+ void requestRemoveIdentity(IdentityId);
+
+ void networkCreated(NetworkId id);
+ void networkRemoved(NetworkId id);
+
+ void requestCreateNetwork(const NetworkInfo &info);
+ void requestUpdateNetwork(const NetworkInfo &info);
+ void requestRemoveNetwork(NetworkId);
+
+public slots:
+ //void selectBuffer(Buffer *);
+
+ void disconnectFromCore();
+
+ void setCoreConfiguration(const QVariantMap &settings);
+
+ void bufferRemoved(BufferId bufferId);
+ void bufferRenamed(BufferId bufferId, const QString &newName);
+
+private slots:
+ //void coreSocketError(QAbstractSocket::SocketError);
+
+ //void networkConnected(NetworkId);
+ //void networkDisconnected(NetworkId);
+
+ void recvMessage(const Message &message);
+ void recvStatusMsg(QString network, QString message);
+ void receiveBacklog(BufferId bufferId, const QVariantList &msgs);
+ void updateBufferInfo(BufferInfo);
+ void updateLastSeenMsg(BufferId id, const MsgId &msgId);
+
+ void bufferDestroyed();
+ void networkDestroyed();
+ void coreIdentityCreated(const Identity &);
+ void coreIdentityRemoved(IdentityId);
+ void coreNetworkCreated(NetworkId);
+ void coreNetworkRemoved(NetworkId);
+
+ void setConnectedToCore(QIODevice *socket, AccountId id);
+ void setSyncedToCore();
+ void setSecuredConnection();
+
+
+private:
+ Client(QObject *parent = 0);
+ virtual ~Client();
+ void init();
+
+ static void addNetwork(Network *);
+ static void setCurrentCoreAccount(AccountId);
+ static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; }
+
+ Buffer *statusBuffer(const NetworkId &networkid) const;
+
+ static QPointer<Client> instanceptr;
+
+ QPointer<QIODevice> socket;
+
+ SignalProxy * _signalProxy;
+ AbstractUi * mainUi;
+ NetworkModel * _networkModel;
+ BufferModel * _bufferModel;
+ BufferSyncer * _bufferSyncer;
+ ClientBacklogManager *_backlogManager;
+ BufferViewManager *_bufferViewManager;
+ ClientIrcListHelper *_ircListHelper;
+
+ MessageModel *_messageModel;
+ AbstractMessageProcessor *_messageProcessor;
+
+ ClientMode clientMode;
+
+ bool _connectedToCore, _syncedToCore;
+
+ QHash<BufferId, Buffer *> _buffers;
+ QHash<NetworkId, Buffer *> _statusBuffers; // fast lookup
+ QHash<NetworkId, Network *> _networks;
+ QHash<IdentityId, Identity *> _identities;
+
+ Buffer *_monitorBuffer;
+
+ static AccountId _currentCoreAccount;