mirror-chatterino2/message.h

88 lines
2 KiB
C
Raw Normal View History

2017-01-05 16:07:20 +01:00
#ifndef MESSAGE_H
#define MESSAGE_H
#include "IrcMessage"
#include "word.h"
#include "chrono"
#include "channel.h"
class Message
{
public:
// enum Badges : char {
// None = 0,
// Mod = 1,
// Turbo = 2,
// Sub = 4,
// Staff = 8,
// GlobalMod = 16,
// Admin = 32,
// Broadcaster = 64,
// };
Message(const QString& text);
2017-01-05 20:49:33 +01:00
Message(const IrcPrivateMessage& ircMessage, const Channel& Channel, bool enablePingSound = true,
bool isReceivedWhisper = false, bool isSentWhisper = false, bool includeChannel = false);
2017-01-05 16:07:20 +01:00
2017-01-07 20:43:55 +01:00
bool canHighlightTab() const {
2017-01-05 16:07:20 +01:00
return m_highlightTab;
}
2017-01-07 20:43:55 +01:00
const QString& timeoutUser() const {
2017-01-05 16:07:20 +01:00
return m_timeoutUser;
}
2017-01-07 20:43:55 +01:00
int timeoutCount() const {
2017-01-05 16:07:20 +01:00
return m_timeoutCount;
}
2017-01-07 20:43:55 +01:00
const QString& userName() const {
2017-01-05 16:07:20 +01:00
return m_userName;
}
2017-01-07 20:43:55 +01:00
const QString& displayName() const {
2017-01-05 16:07:20 +01:00
return m_displayName;
}
2017-01-07 20:43:55 +01:00
QList<Word> words() const {
2017-01-05 16:07:20 +01:00
return m_words;
}
2017-01-07 20:43:55 +01:00
bool disabled() const {
2017-01-05 16:07:20 +01:00
return m_disabled;
}
2017-01-07 20:43:55 +01:00
const QString& id() const {
2017-01-05 20:49:33 +01:00
return m_id;
}
2017-01-05 16:07:20 +01:00
private:
static LazyLoadedImage* badgeStaff;
static LazyLoadedImage* badgeAdmin;
static LazyLoadedImage* badgeGlobalmod;
static LazyLoadedImage* badgeModerator;
static LazyLoadedImage* badgeTurbo;
static LazyLoadedImage* badgeBroadcaster;
static LazyLoadedImage* badgePremium;
2017-01-07 20:43:55 +01:00
static QRegularExpression* cheerRegex;
2017-01-05 16:07:20 +01:00
bool m_highlightTab = false;
QString m_timeoutUser = "";
int m_timeoutCount = 0;
bool m_disabled = false;
std::chrono::time_point<std::chrono::system_clock> m_parseTime;
QString m_userName = "";
QString m_displayName = "";
2017-01-05 20:49:33 +01:00
QString m_id = "";
2017-01-05 16:07:20 +01:00
QList<Word> m_words;
2017-01-06 23:28:48 +01:00
2017-01-07 20:43:55 +01:00
static QString matchLink(const QString& string);
2017-01-06 23:28:48 +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
};
#endif // MESSAGE_H