/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#ifndef CLIENT_H_
#define CLIENT_H_
-#include <QAbstractSocket>
-#include <QTcpSocket>
#include <QList>
#include <QPointer>
#include "bufferinfo.h"
+#include "coreconnection.h"
+#include "quassel.h"
#include "types.h"
class Message;
class NetworkModel;
class BufferModel;
class BufferSyncer;
+class BufferViewOverlay;
+class ClientAliasManager;
class ClientBacklogManager;
+class ClientBufferViewManager;
+class ClientIgnoreListManager;
class ClientIrcListHelper;
-class ClientSyncer;
-class BufferViewManager;
+class ClientUserInputHandler;
+class CoreAccountModel;
+class CoreConnection;
class IrcUser;
class IrcChannel;
+class NetworkConfig;
class SignalProxy;
struct NetworkInfo;
RemoteCore
};
+ static bool instanceExists();
static Client *instance();
static void destroy();
static void init(AbstractUi *);
*/
static void removeIdentity(IdentityId id);
- static void createNetwork(const NetworkInfo &info);
+ static void createNetwork(const NetworkInfo &info, const QStringList &persistentChannels = QStringList());
static void updateNetwork(const NetworkInfo &info);
static void removeNetwork(NetworkId id);
static inline AbstractMessageProcessor *messageProcessor() { return instance()->_messageProcessor; }
static inline SignalProxy *signalProxy() { return instance()->_signalProxy; }
+ static inline ClientAliasManager *aliasManager() { return instance()->_aliasManager; }
static inline ClientBacklogManager *backlogManager() { return instance()->_backlogManager; }
static inline ClientIrcListHelper *ircListHelper() { return instance()->_ircListHelper; }
- static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; }
+ static inline ClientBufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; }
+ static inline BufferViewOverlay *bufferViewOverlay() { return instance()->_bufferViewOverlay; }
+ static inline ClientUserInputHandler *inputHandler() { return instance()->_inputHandler; }
+ static inline NetworkConfig *networkConfig() { return instance()->_networkConfig; }
+ static inline ClientIgnoreListManager *ignoreListManager() { return instance()->_ignoreListManager; }
- static AccountId currentCoreAccount();
+ static inline CoreAccountModel *coreAccountModel() { return instance()->_coreAccountModel; }
+ static inline CoreConnection *coreConnection() { return instance()->_coreConnection; }
+ static inline CoreAccount currentCoreAccount() { return coreConnection()->currentAccount(); }
+ static inline Quassel::Features coreFeatures() { return _coreFeatures; }
static bool isConnected();
- static bool isSynced();
+ static bool internalCore();
- static void userInput(BufferInfo bufferInfo, QString message);
+ static void userInput(const BufferInfo &bufferInfo, const QString &message);
static void setBufferLastSeenMsg(BufferId id, const MsgId &msgId); // this is synced to core and other clients
+ static void setMarkerLine(BufferId id, const MsgId &msgId); // this is synced to core and other clients
+ static MsgId markerLine(BufferId id);
+
static void removeBuffer(BufferId id);
static void renameBuffer(BufferId bufferId, const QString &newName);
+ static void mergeBuffersPermanently(BufferId bufferId1, BufferId bufferId2);
+ static void purgeKnownBufferIds();
static void logMessage(QtMsgType type, const char *msg);
static inline const QString &debugLog() { return instance()->_debugLogBuffer; }
signals:
- void sendInput(BufferInfo, QString message);
void requestNetworkStates();
void showConfigWizard(const QVariantMap &coredata);
void connected();
- void securedConnection();
void disconnected();
void coreConnectionStateChanged(bool);
void networkCreated(NetworkId id);
void networkRemoved(NetworkId id);
- void requestCreateNetwork(const NetworkInfo &info);
+ void requestCreateNetwork(const NetworkInfo &info, const QStringList &persistentChannels = QStringList());
void requestRemoveNetwork(NetworkId);
- void newClientSyncer(ClientSyncer *);
-
void logUpdated(const QString &msg);
-public slots:
- //void selectBuffer(Buffer *);
+ //! Emitted when a buffer has been marked as read
+ /** This is currently triggered by setting lastSeenMsg, either local or remote,
+ * or by bringing the window to front.
+ * \param id The buffer that has been marked as read
+ */
+ void bufferMarkedAsRead(BufferId id);
+public slots:
void disconnectFromCore();
void bufferRemoved(BufferId bufferId);
void bufferRenamed(BufferId bufferId, const QString &newName);
+ void buffersPermanentlyMerged(BufferId bufferId1, BufferId bufferId2);
+
+ void markBufferAsRead(BufferId id);
private slots:
- void disconnectedFromCore();
+ void setSyncedToCore();
+ void setDisconnectedFromCore();
+ void connectionStateChanged(CoreConnection::ConnectionState);
void recvMessage(const Message &message);
void recvStatusMsg(QString network, QString message);
void coreNetworkCreated(NetworkId);
void coreNetworkRemoved(NetworkId);
- void setConnectedToCore(AccountId id, QIODevice *socket = 0);
- void setSyncedToCore();
void requestInitialBacklog();
- void setSecuredConnection();
+ void sendBufferedUserInput();
private:
Client(QObject *parent = 0);
void init();
static void addNetwork(Network *);
- static void setCurrentCoreAccount(AccountId);
+ static void setCoreFeatures(Quassel::Features);
static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; }
static QPointer<Client> instanceptr;
NetworkModel * _networkModel;
BufferModel * _bufferModel;
BufferSyncer * _bufferSyncer;
+ ClientAliasManager *_aliasManager;
ClientBacklogManager *_backlogManager;
- BufferViewManager *_bufferViewManager;
+ ClientBufferViewManager *_bufferViewManager;
+ BufferViewOverlay *_bufferViewOverlay;
ClientIrcListHelper *_ircListHelper;
+ ClientUserInputHandler *_inputHandler;
+ NetworkConfig *_networkConfig;
+ ClientIgnoreListManager *_ignoreListManager;
MessageModel *_messageModel;
AbstractMessageProcessor *_messageProcessor;
- ClientMode clientMode;
+ CoreAccountModel *_coreAccountModel;
+ CoreConnection *_coreConnection;
- bool _connectedToCore, _syncedToCore;
+ ClientMode clientMode;
QHash<NetworkId, Network *> _networks;
QHash<IdentityId, Identity *> _identities;
- static AccountId _currentCoreAccount;
+ bool _connected;
+ static Quassel::Features _coreFeatures;
QString _debugLogBuffer;
QTextStream _debugLog;
- friend class ClientSyncer;
+ QList<QPair<BufferInfo, QString> > _userInputBuffer;
+
+ friend class CoreConnection;
};
#endif