Split parseUsername into parseUsername and apendUsername

This commit is contained in:
Rasmus Karlsson 2017-08-12 13:18:48 +02:00
parent 7ce1458348
commit 3bfaba2d95
2 changed files with 8 additions and 2 deletions

View file

@ -38,6 +38,8 @@ SharedMessage TwitchMessageBuilder::parse()
this->originalMessage = this->ircMessage->content(); this->originalMessage = this->ircMessage->content();
this->parseUsername();
// The timestamp is always appended to the builder // The timestamp is always appended to the builder
// Whether or not will be rendered is decided/checked later // Whether or not will be rendered is decided/checked later
this->appendTimestamp(); this->appendTimestamp();
@ -54,7 +56,7 @@ SharedMessage TwitchMessageBuilder::parse()
this->parseChannelName(); this->parseChannelName();
} }
this->parseUsername(); this->appendUsername();
// highlights // highlights
if (settings.enableHighlights.get()) { if (settings.enableHighlights.get()) {
@ -282,11 +284,14 @@ 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();
} }
}
void TwitchMessageBuilder::appendUsername()
{
QString username = this->userName; QString username = this->userName;
QString localizedName; QString localizedName;
iterator = this->tags.find("display-name"); auto iterator = this->tags.find("display-name");
if (iterator != this->tags.end()) { if (iterator != this->tags.end()) {
QString displayName = iterator.value().toString(); QString displayName = iterator.value().toString();

View file

@ -59,6 +59,7 @@ private:
void parseRoomID(); void parseRoomID();
void parseChannelName(); void parseChannelName();
void parseUsername(); void parseUsername();
void appendUsername();
void parseHighlights(); void parseHighlights();
void appendModerationButtons(); void appendModerationButtons();