/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QString>
#include <QVariant>
-#include "corecoreinfo.h"
+#include "coreinfo.h"
#include "corealiasmanager.h"
+#include "corehighlightrulemanager.h"
#include "coreignorelistmanager.h"
+#include "peer.h"
+#include "protocol.h"
#include "message.h"
-#include "signalproxy.h"
#include "storage.h"
class CoreBacklogManager;
class CoreBufferSyncer;
class CoreBufferViewManager;
+class CoreDccConfig;
class CoreIdentity;
class CoreIrcListHelper;
class CoreNetwork;
class CoreNetworkConfig;
class CoreSessionEventProcessor;
+class CoreTransferManager;
class CtcpParser;
class EventManager;
class EventStringifier;
-class InternalConnection;
+class InternalPeer;
class IrcParser;
class MessageEvent;
class NetworkConnection;
-class RemoteConnection;
+class RemotePeer;
+class SignalProxy;
struct NetworkInfo;
Q_OBJECT
public:
- CoreSession(UserId, bool restoreState, QObject *parent = 0);
+ CoreSession(UserId, bool restoreState, bool strictIdentEnabled, QObject *parent = 0);
~CoreSession();
QList<BufferInfo> buffers() const;
inline UserId user() const { return _user; }
CoreNetwork *network(NetworkId) const;
CoreIdentity *identity(IdentityId) const;
+
+ /**
+ * Returns the optionally strict-compliant ident for the given user identity
+ *
+ * If strict mode is enabled, this will return the user's Quassel username for any identity,
+ * otherwise this will return the given identity's ident, whatever it may be.
+ *
+ * @return The user's ident, compliant with strict mode (when enabled)
+ */
+ const QString strictCompliantIdent(const CoreIdentity *identity);
+
inline CoreNetworkConfig *networkConfig() const { return _networkConfig; }
NetworkConnection *networkConnection(NetworkId) const;
- QVariant sessionState();
+ Protocol::SessionState sessionState() const;
inline SignalProxy *signalProxy() const { return _signalProxy; }
inline CoreIrcListHelper *ircListHelper() const { return _ircListHelper; }
inline CoreIgnoreListManager *ignoreListManager() { return &_ignoreListManager; }
+ inline HighlightRuleManager *highlightRuleManager() { return &_highlightRuleManager; }
+ inline CoreTransferManager *transferManager() const { return _transferManager; }
+ inline CoreDccConfig *dccConfig() const { return _dccConfig; }
+
// void attachNetworkConnection(NetworkConnection *conn);
//! Return necessary data for restoring the session after restarting the core
void restoreSessionState();
public slots:
- void addClient(RemoteConnection *connection);
- void addClient(InternalConnection *connection);
+ void addClient(RemotePeer *peer);
+ void addClient(InternalPeer *peer);
void msgFromClient(BufferInfo, QString message);
*/
void renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName);
+ void changePassword(PeerPtr peer, const QString &userName, const QString &oldPassword, const QString &newPassword);
+
+ void kickClient(int peerId);
+
QHash<QString, QString> persistentChannels(NetworkId) const;
- //! Marks us away (or unaway) on all networks
- void globalAway(const QString &msg = QString());
+ QHash<QString, QByteArray> bufferCiphers(NetworkId id) const;
+ void setBufferCipher(NetworkId id, const QString &bufferName, const QByteArray &cipher) const;
+
+ /**
+ * Marks us away (or unaway) on all networks
+ *
+ * @param[in] msg Away message, or blank to set unaway
+ * @param[in] skipFormatting If true, skip timestamp formatting codes (e.g. if already done)
+ */
+ void globalAway(const QString &msg = QString(), const bool skipFormatting = false);
signals:
void initialized();
- void sessionState(const QVariant &);
+ void sessionState(const Protocol::SessionState &sessionState);
//void msgFromGui(uint netid, QString buf, QString message);
void displayMsg(Message message);
void networkRemoved(NetworkId);
void networkDisconnected(NetworkId);
+ void passwordChanged(PeerPtr peer, bool success);
+
+ void disconnectFromCore();
+
protected:
virtual void customEvent(QEvent *event);
private slots:
- void removeClient(SignalProxy::AbstractPeer *peer);
+ void removeClient(Peer *peer);
void recvStatusMsgFromServer(QString msg);
void recvMessageFromServer(NetworkId networkId, Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None);
UserId _user;
+ /// Whether or not strict ident mode is enabled, locking users' idents to Quassel username
+ bool _strictIdentEnabled;
+
SignalProxy *_signalProxy;
CoreAliasManager _aliasManager;
// QHash<NetworkId, NetworkConnection *> _connections;
CoreBufferSyncer *_bufferSyncer;
CoreBacklogManager *_backlogManager;
CoreBufferViewManager *_bufferViewManager;
+ CoreDccConfig *_dccConfig;
CoreIrcListHelper *_ircListHelper;
CoreNetworkConfig *_networkConfig;
- CoreCoreInfo _coreInfo;
+ CoreInfo *_coreInfo;
+ CoreTransferManager *_transferManager;
EventManager *_eventManager;
EventStringifier *_eventStringifier; // should eventually move into client
QScriptEngine *scriptEngine;
+ /**
+ * This method obtains the prefixes of the message's sender within a channel, by looking up their channelmodes, and
+ * processing them to prefixes based on the network's settings.
+ * @param sender The hostmask of the sender
+ * @param bufferInfo The BufferInfo object of the buffer
+ */
+ QString senderPrefixes(const QString &sender, const BufferInfo &bufferInfo) const;
+
+ /**
+ * This method obtains the realname of the message's sender.
+ * @param sender The hostmask of the sender
+ * @param networkId The network the user is on
+ */
+ QString realName(const QString &sender, NetworkId networkId) const;
+
+ /**
+ * This method obtains the avatar of the message's sender.
+ * @param sender The hostmask of the sender
+ * @param networkId The network the user is on
+ */
+ QString avatarUrl(const QString &sender, NetworkId networkId) const;
QList<RawMessage> _messageQueue;
bool _processMessages;
CoreIgnoreListManager _ignoreListManager;
+ CoreHighlightRuleManager _highlightRuleManager;
};