fixes #1304 emote.name eating the .name

This commit is contained in:
fourtf 2019-09-15 19:05:04 +02:00
parent 04f8875c4d
commit 84b1efcd24

View file

@ -355,7 +355,7 @@ void TwitchMessageBuilder::addWords(
auto i = int(); auto i = int();
auto currentTwitchEmote = twitchEmotes.begin(); auto currentTwitchEmote = twitchEmotes.begin();
for (const auto &word : words) for (auto word : words)
{ {
// check if it's a twitch emote twitch emote // check if it's a twitch emote twitch emote
while (currentTwitchEmote != twitchEmotes.end() && while (currentTwitchEmote != twitchEmotes.end() &&
@ -376,10 +376,20 @@ void TwitchMessageBuilder::addWords(
MessageElementFlag::TwitchEmote); MessageElementFlag::TwitchEmote);
i += word.length() + 1; i += word.length() + 1;
int len = std::get<2>(*currentTwitchEmote).string.length();
currentTwitchEmote++; currentTwitchEmote++;
if (len < word.length())
{
word = word.mid(len);
this->message().elements.back()->setTrailingSpace(false);
}
else
{
continue; continue;
} }
}
// split words // split words
for (auto &variant : getApp()->emotes->emojis.parse(word)) for (auto &variant : getApp()->emotes->emojis.parse(word))