2018-01-01 23:54:54 +01:00
|
|
|
#pragma once
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2022-12-31 15:41:01 +01:00
|
|
|
#include "messages/LimitedQueueSnapshot.hpp"
|
2022-07-31 12:45:25 +02:00
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <IrcMessage>
|
|
|
|
|
2023-08-13 12:00:52 +02:00
|
|
|
#include <optional>
|
2022-07-31 12:45:25 +02:00
|
|
|
#include <vector>
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
namespace chatterino {
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2019-09-18 13:03:16 +02:00
|
|
|
class TwitchIrcServer;
|
2019-04-13 19:14:58 +02:00
|
|
|
class Channel;
|
2022-12-31 15:41:01 +01:00
|
|
|
using ChannelPtr = std::shared_ptr<Channel>;
|
|
|
|
struct Message;
|
|
|
|
using MessagePtr = std::shared_ptr<const Message>;
|
|
|
|
class TwitchChannel;
|
|
|
|
class TwitchMessageBuilder;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2023-08-13 12:00:52 +02:00
|
|
|
struct ClearChatMessage {
|
|
|
|
MessagePtr message;
|
|
|
|
bool disableAllMessages;
|
|
|
|
};
|
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
class IrcMessageHandler
|
|
|
|
{
|
2018-04-14 21:59:51 +02:00
|
|
|
IrcMessageHandler() = default;
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
public:
|
2019-10-07 22:42:34 +02:00
|
|
|
static IrcMessageHandler &instance();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2023-10-31 17:47:56 +01:00
|
|
|
/**
|
|
|
|
* Parse an IRC message into 0 or more Chatterino messages
|
|
|
|
* Takes previously loaded messages into consideration to add reply contexts
|
|
|
|
**/
|
|
|
|
static std::vector<MessagePtr> parseMessageWithReply(
|
2022-07-31 12:45:25 +02:00
|
|
|
Channel *channel, Communi::IrcMessage *message,
|
2023-08-13 12:00:52 +02:00
|
|
|
std::vector<MessagePtr> &otherLoaded);
|
2022-07-31 12:45:25 +02:00
|
|
|
|
2018-06-04 12:23:23 +02:00
|
|
|
void handlePrivMessage(Communi::IrcPrivateMessage *message,
|
2019-09-18 13:03:16 +02:00
|
|
|
TwitchIrcServer &server);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
void handleRoomStateMessage(Communi::IrcMessage *message);
|
|
|
|
void handleClearChatMessage(Communi::IrcMessage *message);
|
2019-04-19 22:44:02 +02:00
|
|
|
void handleClearMessageMessage(Communi::IrcMessage *message);
|
2018-01-01 23:54:54 +01:00
|
|
|
void handleUserStateMessage(Communi::IrcMessage *message);
|
2021-07-17 17:18:17 +02:00
|
|
|
void handleGlobalUserStateMessage(Communi::IrcMessage *message);
|
2023-10-31 17:47:56 +01:00
|
|
|
void handleWhisperMessage(Communi::IrcMessage *ircMessage);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-06-04 12:23:23 +02:00
|
|
|
void handleUserNoticeMessage(Communi::IrcMessage *message,
|
2019-09-18 13:03:16 +02:00
|
|
|
TwitchIrcServer &server);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
void handleNoticeMessage(Communi::IrcNoticeMessage *message);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-05-26 18:06:55 +02:00
|
|
|
void handleJoinMessage(Communi::IrcMessage *message);
|
|
|
|
void handlePartMessage(Communi::IrcMessage *message);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2023-11-08 18:14:48 +01:00
|
|
|
void addMessage(Communi::IrcMessage *message, const ChannelPtr &chan,
|
|
|
|
const QString &originalContent, TwitchIrcServer &server,
|
|
|
|
bool isSub, bool isAction);
|
|
|
|
|
2023-10-31 17:47:56 +01:00
|
|
|
private:
|
|
|
|
static float similarity(const MessagePtr &msg,
|
2020-02-02 14:31:37 +01:00
|
|
|
const LimitedQueueSnapshot<MessagePtr> &messages);
|
2023-10-31 17:47:56 +01:00
|
|
|
static void setSimilarityFlags(const MessagePtr &message,
|
|
|
|
const ChannelPtr &channel);
|
2018-01-01 23:54:54 +01:00
|
|
|
};
|
2019-09-08 22:27:57 +02:00
|
|
|
|
2018-02-05 15:11:50 +01:00
|
|
|
} // namespace chatterino
|