2017-01-05 16:07:20 +01:00
|
|
|
#ifndef MESSAGE_H
|
|
|
|
#define MESSAGE_H
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
#include "messages/word.h"
|
|
|
|
#include "messages/wordpart.h"
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 01:08:20 +01:00
|
|
|
#include <IrcMessage>
|
|
|
|
#include <QVector>
|
2017-03-11 11:32:19 +01:00
|
|
|
|
2017-01-11 01:08:20 +01:00
|
|
|
#include <chrono>
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
2017-03-11 11:32:19 +01:00
|
|
|
|
|
|
|
class Channel;
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace messages {
|
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
class Message
|
|
|
|
{
|
|
|
|
public:
|
2017-01-11 18:52:09 +01:00
|
|
|
Message(const QString &text);
|
2017-02-02 20:35:12 +01:00
|
|
|
Message(const IrcPrivateMessage &ircMessage, Channel &channel,
|
2017-01-11 18:52:09 +01:00
|
|
|
bool enablePingSound = true, bool isReceivedWhisper = false,
|
|
|
|
bool isSentWhisper = false, bool includeChannel = false);
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
~Message()
|
|
|
|
{
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
2017-01-18 04:33:30 +01:00
|
|
|
getCanHighlightTab() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return highlightTab;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getTimeoutUser() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return timeoutUser;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getTimeoutCount() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return timeoutCount;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getUserName() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return userName;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getDisplayName() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return displayName;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-11 11:32:19 +01:00
|
|
|
inline const QString &
|
|
|
|
getContent() const
|
|
|
|
{
|
|
|
|
return this->content;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const std::chrono::time_point<std::chrono::system_clock> &
|
|
|
|
getParseTime() const
|
|
|
|
{
|
|
|
|
return this->parseTime;
|
|
|
|
}
|
|
|
|
|
2017-02-02 22:15:09 +01:00
|
|
|
std::vector<Word> &
|
|
|
|
getWords()
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return words;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
bool
|
2017-01-18 04:33:30 +01:00
|
|
|
getDisabled() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return disabled;
|
2017-01-05 16:07:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getId() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return id;
|
2017-01-05 20:49:33 +01:00
|
|
|
}
|
|
|
|
|
2017-01-05 16:07:20 +01:00
|
|
|
private:
|
2017-01-11 18:52:09 +01:00
|
|
|
static LazyLoadedImage *badgeStaff;
|
|
|
|
static LazyLoadedImage *badgeAdmin;
|
|
|
|
static LazyLoadedImage *badgeGlobalmod;
|
|
|
|
static LazyLoadedImage *badgeModerator;
|
|
|
|
static LazyLoadedImage *badgeTurbo;
|
|
|
|
static LazyLoadedImage *badgeBroadcaster;
|
|
|
|
static LazyLoadedImage *badgePremium;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static QRegularExpression *cheerRegex;
|
2017-01-07 20:43:55 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
bool highlightTab = false;
|
|
|
|
QString timeoutUser = "";
|
|
|
|
int timeoutCount = 0;
|
|
|
|
bool disabled = false;
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> parseTime;
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
QString userName = "";
|
|
|
|
QString displayName = "";
|
2017-03-11 11:32:19 +01:00
|
|
|
QString content;
|
2017-01-18 04:33:30 +01:00
|
|
|
QString id = "";
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
std::vector<Word> words;
|
2017-01-28 20:29:02 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static QString matchLink(const QString &string);
|
2017-01-07 20:43:55 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static bool sortTwitchEmotes(
|
|
|
|
const std::pair<long int, LazyLoadedImage *> &a,
|
|
|
|
const std::pair<long int, LazyLoadedImage *> &b);
|
2017-01-05 16:07:20 +01:00
|
|
|
};
|
2017-01-28 20:29:02 +01:00
|
|
|
|
|
|
|
} // namespace messages
|
|
|
|
} // namespace chatterino
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // MESSAGE_H
|