2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IrcMessage>
|
|
|
|
#include "messages/Message.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2019-09-18 13:03:16 +02:00
|
|
|
class TwitchIrcServer;
|
2019-09-08 22:27:57 +02:00
|
|
|
class Channel;
|
|
|
|
|
|
|
|
class IrcMessageHandler
|
|
|
|
{
|
|
|
|
IrcMessageHandler() = default;
|
|
|
|
|
|
|
|
public:
|
2019-10-07 22:42:34 +02:00
|
|
|
static IrcMessageHandler &instance();
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
// parseMessage parses a single IRC message into 0+ Chatterino messages
|
|
|
|
std::vector<MessagePtr> parseMessage(Channel *channel,
|
|
|
|
Communi::IrcMessage *message);
|
|
|
|
|
|
|
|
// parsePrivMessage arses a single IRC PRIVMSG into 0-1 Chatterino messages
|
|
|
|
std::vector<MessagePtr> parsePrivMessage(
|
|
|
|
Channel *channel, Communi::IrcPrivateMessage *message);
|
|
|
|
void handlePrivMessage(Communi::IrcPrivateMessage *message,
|
2019-09-18 13:03:16 +02:00
|
|
|
TwitchIrcServer &server);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
void handleRoomStateMessage(Communi::IrcMessage *message);
|
|
|
|
void handleClearChatMessage(Communi::IrcMessage *message);
|
|
|
|
void handleClearMessageMessage(Communi::IrcMessage *message);
|
|
|
|
void handleUserStateMessage(Communi::IrcMessage *message);
|
|
|
|
void handleWhisperMessage(Communi::IrcMessage *message);
|
|
|
|
|
|
|
|
// parseUserNoticeMessage parses a single IRC USERNOTICE message into 0+
|
|
|
|
// chatterino messages
|
|
|
|
std::vector<MessagePtr> parseUserNoticeMessage(
|
|
|
|
Channel *channel, Communi::IrcMessage *message);
|
|
|
|
void handleUserNoticeMessage(Communi::IrcMessage *message,
|
2019-09-18 13:03:16 +02:00
|
|
|
TwitchIrcServer &server);
|
2019-09-08 22:27:57 +02:00
|
|
|
|
|
|
|
void handleModeMessage(Communi::IrcMessage *message);
|
|
|
|
|
|
|
|
// parseNoticeMessage parses a single IRC NOTICE message into 0+ chatterino
|
|
|
|
// messages
|
|
|
|
std::vector<MessagePtr> parseNoticeMessage(
|
|
|
|
Communi::IrcNoticeMessage *message);
|
|
|
|
void handleNoticeMessage(Communi::IrcNoticeMessage *message);
|
|
|
|
|
|
|
|
void handleJoinMessage(Communi::IrcMessage *message);
|
|
|
|
void handlePartMessage(Communi::IrcMessage *message);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void addMessage(Communi::IrcMessage *message, const QString &target,
|
2019-09-18 13:03:16 +02:00
|
|
|
const QString &content, TwitchIrcServer &server,
|
|
|
|
bool isResub, bool isAction);
|
2019-09-08 22:27:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|