From 3bfaba2d953cc20195fa872e7ba4b5aec970e2f5 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 12 Aug 2017 13:18:48 +0200 Subject: [PATCH] Split `parseUsername` into `parseUsername` and `apendUsername` --- src/twitch/twitchmessagebuilder.cpp | 9 +++++++-- src/twitch/twitchmessagebuilder.hpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp index 7581bd351..c5427bd47 100644 --- a/src/twitch/twitchmessagebuilder.cpp +++ b/src/twitch/twitchmessagebuilder.cpp @@ -38,6 +38,8 @@ SharedMessage TwitchMessageBuilder::parse() this->originalMessage = this->ircMessage->content(); + this->parseUsername(); + // The timestamp is always appended to the builder // Whether or not will be rendered is decided/checked later this->appendTimestamp(); @@ -54,7 +56,7 @@ SharedMessage TwitchMessageBuilder::parse() this->parseChannelName(); } - this->parseUsername(); + this->appendUsername(); // highlights if (settings.enableHighlights.get()) { @@ -282,11 +284,14 @@ void TwitchMessageBuilder::parseUsername() if (this->userName.isEmpty()) { this->userName = this->tags.value(QLatin1String("login")).toString(); } +} +void TwitchMessageBuilder::appendUsername() +{ QString username = this->userName; QString localizedName; - iterator = this->tags.find("display-name"); + auto iterator = this->tags.find("display-name"); if (iterator != this->tags.end()) { QString displayName = iterator.value().toString(); diff --git a/src/twitch/twitchmessagebuilder.hpp b/src/twitch/twitchmessagebuilder.hpp index b7271cf79..d1b49051c 100644 --- a/src/twitch/twitchmessagebuilder.hpp +++ b/src/twitch/twitchmessagebuilder.hpp @@ -59,6 +59,7 @@ private: void parseRoomID(); void parseChannelName(); void parseUsername(); + void appendUsername(); void parseHighlights(); void appendModerationButtons();