add username to message (simple)

This commit is contained in:
Rasmus Karlsson 2017-12-17 17:48:46 +01:00
parent f7318a26e3
commit 5839b9f522
5 changed files with 8 additions and 9 deletions

View file

@ -37,7 +37,7 @@ void Channel::append(std::shared_ptr<messages::Message> message)
str.append('[');
str.append(now.toString("HH:mm:ss"));
str.append("] ");
str.append(message->getUserName());
str.append(message->username);
str.append(": ");
str.append(message->getContent());
str.append('\n');

View file

@ -36,11 +36,6 @@ int Message::getTimeoutCount() const
return this->timeoutCount;
}
const QString &Message::getUserName() const
{
return this->userName;
}
const QString &Message::getDisplayName() const
{
return this->displayName;

View file

@ -22,7 +22,6 @@ public:
void setHighlight(bool value);
const QString &getTimeoutUser() const;
int getTimeoutCount() const;
const QString &getUserName() const;
const QString &getDisplayName() const;
const QString &getContent() const;
const std::chrono::time_point<std::chrono::system_clock> &getParseTime() const;
@ -30,6 +29,8 @@ public:
bool isDisabled() const;
const QString &getId() const;
QString username;
const QString text;
bool centered = false;
@ -57,7 +58,6 @@ private:
bool disabled = false;
std::chrono::time_point<std::chrono::system_clock> parseTime;
QString userName = "";
QString displayName = "";
QString content;
QString id = "";

View file

@ -26,8 +26,10 @@ public:
QString originalMessage;
private:
protected:
std::shared_ptr<messages::Message> message;
private:
std::vector<Word> _words;
bool highlight = false;
std::chrono::time_point<std::chrono::system_clock> _parseTime;

View file

@ -287,6 +287,8 @@ void TwitchMessageBuilder::parseUsername()
if (this->userName.isEmpty()) {
this->userName = this->tags.value(QLatin1String("login")).toString();
}
this->message->username = this->userName;
}
void TwitchMessageBuilder::appendUsername()