X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.h;h=83e8786418bf02a9d57ac28c2237f04a19b27ab2;hb=df38a9238d603ec8d2040619befa50980d994916;hp=b8da03c513f23f3cd22e724edff904d4dd420088;hpb=c1cf157116de7fc3da96203aa6f03c38c7ebb650;p=quassel.git diff --git a/src/core/coresession.h b/src/core/coresession.h index b8da03c5..83e87864 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -21,6 +21,7 @@ #pragma once #include +#include #include #include @@ -32,6 +33,7 @@ #include "coreignorelistmanager.h" #include "coreinfo.h" #include "message.h" +#include "metricsserver.h" #include "peer.h" #include "protocol.h" #include "storage.h" @@ -52,14 +54,11 @@ class EventStringifier; class InternalPeer; class IrcParser; class MessageEvent; -class NetworkConnection; class RemotePeer; class SignalProxy; struct NetworkInfo; -class QScriptEngine; - class CoreSession : public QObject { Q_OBJECT @@ -67,7 +66,7 @@ class CoreSession : public QObject public: CoreSession(UserId, bool restoreState, bool strictIdentEnabled, QObject* parent = nullptr); - QList buffers() const; + std::vector buffers() const; inline UserId user() const { return _user; } CoreNetwork* network(NetworkId) const; CoreIdentity* identity(IdentityId) const; @@ -83,7 +82,6 @@ public: const QString strictCompliantIdent(const CoreIdentity* identity); inline CoreNetworkConfig* networkConfig() const { return _networkConfig; } - NetworkConnection* networkConnection(NetworkId) const; Protocol::SessionState sessionState() const; @@ -164,7 +162,7 @@ public slots: * @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); + void globalAway(const QString& msg = QString(), bool skipFormatting = false); signals: void initialized(); @@ -174,8 +172,6 @@ signals: void displayMsg(Message message); void displayStatusMsg(QString, QString); - void scriptResult(QString result); - //! Identity has been created. /** This signal is propagated to the clients to tell them that the given identity has been created. * \param identity The new identity. @@ -203,18 +199,10 @@ private slots: 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); + void recvMessageFromServer(RawMessage msg); void destroyNetwork(NetworkId); - void scriptRequest(QString script); - void clientsConnected(); void clientsDisconnected(); @@ -228,7 +216,6 @@ private: void processMessages(); void loadSettings(); - void initScriptEngine(); /// Hook for converting events to the old displayMsg() handlers Q_INVOKABLE void processMessageEvent(MessageEvent* event); @@ -260,8 +247,6 @@ private: CtcpParser* _ctcpParser; IrcParser* _ircParser; - 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. @@ -287,10 +272,35 @@ private: bool _processMessages; CoreIgnoreListManager _ignoreListManager; CoreHighlightRuleManager _highlightRuleManager; + MetricsServer* _metricsServer{nullptr}; +}; + +struct NetworkInternalMessage +{ + Message::Type type; + BufferInfo::Type bufferType; + QString target; + QString text; + QString sender; + Message::Flags flags; + NetworkInternalMessage(Message::Type type, + BufferInfo::Type bufferType, + QString target, + QString text, + QString sender = "", + Message::Flags flags = Message::None) + : type(type) + , bufferType(bufferType) + , target(std::move(target)) + , text(std::move(text)) + , sender(std::move(sender)) + , flags(flags) + {} }; struct RawMessage { + QDateTime timestamp; NetworkId networkId; Message::Type type; BufferInfo::Type bufferType; @@ -298,9 +308,17 @@ struct RawMessage QString text; QString sender; Message::Flags flags; - RawMessage( - NetworkId networkId, Message::Type type, BufferInfo::Type bufferType, QString target, QString text, QString sender, Message::Flags flags) - : networkId(networkId) + + RawMessage(QDateTime timestamp, + NetworkId networkId, + Message::Type type, + BufferInfo::Type bufferType, + QString target, + QString text, + QString sender, + Message::Flags flags) + : timestamp(std::move(timestamp)) + , networkId(networkId) , type(type) , bufferType(bufferType) , target(std::move(target)) @@ -308,4 +326,16 @@ struct RawMessage , sender(std::move(sender)) , flags(flags) {} + + RawMessage(NetworkId networkId, + const NetworkInternalMessage& msg) + : timestamp(QDateTime::currentDateTimeUtc()) + , networkId(networkId) + , type(msg.type) + , bufferType(msg.bufferType) + , target(msg.target) + , text(msg.text) + , sender(msg.sender) + , flags(msg.flags) + {} };