#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 ClientAliasManager;
class ClientBacklogManager;
class ClientBufferViewManager;
+class ClientIgnoreListManager;
class ClientIrcListHelper;
-class ClientSyncer;
class ClientUserInputHandler;
+class CoreAccountModel;
+class CoreConnection;
class IrcUser;
class IrcChannel;
+class NetworkConfig;
class SignalProxy;
struct NetworkInfo;
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 inline bool internalCore() { return instance()->_internalCore; }
+ static bool internalCore();
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 logMessage(QtMsgType type, const char *msg);
static inline const QString &debugLog() { return instance()->_debugLogBuffer; }
- static inline void registerClientSyncer(ClientSyncer *syncer) { emit instance()->newClientSyncer(syncer); }
-
signals:
void requestNetworkStates();
void requestCreateNetwork(const NetworkInfo &info, const QStringList &persistentChannels = QStringList());
void requestRemoveNetwork(NetworkId);
- void newClientSyncer(ClientSyncer *);
-
void logUpdated(const QString &msg);
+ //! 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 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 createDefaultBufferView();
void sendBufferedUserInput();
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;
BufferViewOverlay *_bufferViewOverlay;
ClientIrcListHelper *_ircListHelper;
ClientUserInputHandler *_inputHandler;
+ NetworkConfig *_networkConfig;
+ ClientIgnoreListManager *_ignoreListManager;
MessageModel *_messageModel;
AbstractMessageProcessor *_messageProcessor;
- ClientMode clientMode;
+ CoreAccountModel *_coreAccountModel;
+ CoreConnection *_coreConnection;
- bool _connectedToCore, _syncedToCore;
- bool _internalCore;
+ ClientMode clientMode;
QHash<NetworkId, Network *> _networks;
QHash<IdentityId, Identity *> _identities;
- static AccountId _currentCoreAccount;
+ bool _connected;
+ static Quassel::Features _coreFeatures;
QString _debugLogBuffer;
QTextStream _debugLog;
QList<QPair<BufferInfo, QString> > _userInputBuffer;
- friend class ClientSyncer;
+ friend class CoreConnection;
};
#endif