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
+1 -1
View File
@@ -37,7 +37,7 @@ void Channel::append(std::shared_ptr<messages::Message> message)
str.append('['); str.append('[');
str.append(now.toString("HH:mm:ss")); str.append(now.toString("HH:mm:ss"));
str.append("] "); str.append("] ");
str.append(message->getUserName()); str.append(message->username);
str.append(": "); str.append(": ");
str.append(message->getContent()); str.append(message->getContent());
str.append('\n'); str.append('\n');
-5
View File
@@ -36,11 +36,6 @@ int Message::getTimeoutCount() const
return this->timeoutCount; return this->timeoutCount;
} }
const QString &Message::getUserName() const
{
return this->userName;
}
const QString &Message::getDisplayName() const const QString &Message::getDisplayName() const
{ {
return this->displayName; return this->displayName;
+2 -2
View File
@@ -22,7 +22,6 @@ public:
void setHighlight(bool value); void setHighlight(bool value);
const QString &getTimeoutUser() const; const QString &getTimeoutUser() const;
int getTimeoutCount() const; int getTimeoutCount() const;
const QString &getUserName() const;
const QString &getDisplayName() const; const QString &getDisplayName() const;
const QString &getContent() const; const QString &getContent() const;
const std::chrono::time_point<std::chrono::system_clock> &getParseTime() const; const std::chrono::time_point<std::chrono::system_clock> &getParseTime() const;
@@ -30,6 +29,8 @@ public:
bool isDisabled() const; bool isDisabled() const;
const QString &getId() const; const QString &getId() const;
QString username;
const QString text; const QString text;
bool centered = false; bool centered = false;
@@ -57,7 +58,6 @@ private:
bool disabled = false; bool disabled = false;
std::chrono::time_point<std::chrono::system_clock> parseTime; std::chrono::time_point<std::chrono::system_clock> parseTime;
QString userName = "";
QString displayName = ""; QString displayName = "";
QString content; QString content;
QString id = ""; QString id = "";
+3 -1
View File
@@ -26,8 +26,10 @@ public:
QString originalMessage; QString originalMessage;
private: protected:
std::shared_ptr<messages::Message> message; std::shared_ptr<messages::Message> message;
private:
std::vector<Word> _words; std::vector<Word> _words;
bool highlight = false; bool highlight = false;
std::chrono::time_point<std::chrono::system_clock> _parseTime; std::chrono::time_point<std::chrono::system_clock> _parseTime;
+2
View File
@@ -287,6 +287,8 @@ void TwitchMessageBuilder::parseUsername()
if (this->userName.isEmpty()) { if (this->userName.isEmpty()) {
this->userName = this->tags.value(QLatin1String("login")).toString(); this->userName = this->tags.value(QLatin1String("login")).toString();
} }
this->message->username = this->userName;
} }
void TwitchMessageBuilder::appendUsername() void TwitchMessageBuilder::appendUsername()