2018-01-01 23:54:54 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <IrcMessage>
|
2019-04-13 19:14:58 +02:00
|
|
|
#include "messages/Message.hpp"
|
2018-01-01 23:54:54 +01:00
|
|
|
|
|
|
|
namespace chatterino {
|
2018-03-25 11:37:57 +02:00
|
|
|
|
2018-06-04 12:23:23 +02:00
|
|
|
class TwitchServer;
|
2019-04-13 19:14:58 +02:00
|
|
|
class Channel;
|
2018-06-04 12:23:23 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
class IrcMessageHandler
|
|
|
|
{
|
2018-04-14 21:59:51 +02:00
|
|
|
IrcMessageHandler() = default;
|
2018-01-01 23:54:54 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
static IrcMessageHandler &getInstance();
|
|
|
|
|
2019-04-13 19:14:58 +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);
|
2018-08-06 21:17:03 +02:00
|
|
|
void handlePrivMessage(Communi::IrcPrivateMessage *message,
|
|
|
|
TwitchServer &server);
|
2018-06-04 12:23:23 +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);
|
|
|
|
void handleWhisperMessage(Communi::IrcMessage *message);
|
2019-04-13 19:14:58 +02:00
|
|
|
|
|
|
|
// parseUserNoticeMessage parses a single IRC USERNOTICE message into 0+
|
|
|
|
// chatterino messages
|
|
|
|
std::vector<MessagePtr> parseUserNoticeMessage(
|
|
|
|
Channel *channel, Communi::IrcMessage *message);
|
2018-08-06 21:17:03 +02:00
|
|
|
void handleUserNoticeMessage(Communi::IrcMessage *message,
|
|
|
|
TwitchServer &server);
|
2019-04-13 19:14:58 +02:00
|
|
|
|
2018-01-01 23:54:54 +01:00
|
|
|
void handleModeMessage(Communi::IrcMessage *message);
|
2019-04-13 19:14:58 +02:00
|
|
|
|
|
|
|
// parseNoticeMessage parses a single IRC NOTICE message into 0+ chatterino
|
|
|
|
// messages
|
|
|
|
std::vector<MessagePtr> parseNoticeMessage(
|
|
|
|
Communi::IrcNoticeMessage *message);
|
2018-01-01 23:54:54 +01:00
|
|
|
void handleNoticeMessage(Communi::IrcNoticeMessage *message);
|
2019-04-13 19:14:58 +02:00
|
|
|
|
2018-05-26 18:06:55 +02:00
|
|
|
void handleJoinMessage(Communi::IrcMessage *message);
|
|
|
|
void handlePartMessage(Communi::IrcMessage *message);
|
2018-06-04 12:23:23 +02:00
|
|
|
|
|
|
|
private:
|
2018-08-06 21:17:03 +02:00
|
|
|
void addMessage(Communi::IrcMessage *message, const QString &target,
|
|
|
|
const QString &content, TwitchServer &server, bool isResub,
|
|
|
|
bool isAction);
|
2018-01-01 23:54:54 +01:00
|
|
|
};
|
2018-03-25 11:37:57 +02:00
|
|
|
|
2018-02-05 15:11:50 +01:00
|
|
|
} // namespace chatterino
|