mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add support for Emoji in IRC. (#3354)
This commit is contained in:
parent
c19fd0d332
commit
6ac15adf45
|
@ -32,6 +32,7 @@
|
||||||
- Minor: IRC now parses/displays links like Twitch chat. (#3334)
|
- Minor: IRC now parses/displays links like Twitch chat. (#3334)
|
||||||
- Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335)
|
- Minor: Added button & label for copying login name of user instead of display name in the user info popout. (#3335)
|
||||||
- Minor: Make `/delete` errors a bit more verbose (#3350)
|
- Minor: Make `/delete` errors a bit more verbose (#3350)
|
||||||
|
- Minor: Add support for Emoji in IRC (#3354)
|
||||||
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
|
- Bugfix: Fixed colored usernames sometimes not working. (#3170)
|
||||||
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166)
|
- Bugfix: Restored ability to send duplicate `/me` messages. (#3166)
|
||||||
- Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121)
|
- Bugfix: Notifications for moderators about other moderators deleting messages can now be disabled. (#3121)
|
||||||
|
|
|
@ -109,8 +109,7 @@ void IrcMessageBuilder::addWords(const QStringList &words)
|
||||||
|
|
||||||
if (!i.hasNext())
|
if (!i.hasNext())
|
||||||
{
|
{
|
||||||
this->emplace<TextElement>(string, MessageElementFlag::Text,
|
this->addText(string, textColor);
|
||||||
textColor);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,10 +131,9 @@ void IrcMessageBuilder::addWords(const QStringList &words)
|
||||||
{
|
{
|
||||||
textColor = defaultColor;
|
textColor = defaultColor;
|
||||||
}
|
}
|
||||||
this->emplace<TextElement>(
|
this->addText(
|
||||||
string.mid(lastPos, match.capturedStart() - lastPos),
|
string.mid(lastPos, match.capturedStart() - lastPos),
|
||||||
MessageElementFlag::Text, textColor)
|
textColor, false);
|
||||||
->setTrailingSpace(false);
|
|
||||||
lastPos = match.capturedStart() + match.capturedLength();
|
lastPos = match.capturedStart() + match.capturedLength();
|
||||||
}
|
}
|
||||||
if (!match.captured(1).isEmpty())
|
if (!match.captured(1).isEmpty())
|
||||||
|
@ -173,13 +171,30 @@ void IrcMessageBuilder::addWords(const QStringList &words)
|
||||||
{
|
{
|
||||||
textColor = defaultColor;
|
textColor = defaultColor;
|
||||||
}
|
}
|
||||||
this->emplace<TextElement>(string.mid(lastPos),
|
this->addText(string.mid(lastPos), textColor);
|
||||||
MessageElementFlag::Text, textColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->message().elements.back()->setTrailingSpace(false);
|
this->message().elements.back()->setTrailingSpace(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IrcMessageBuilder::addText(const QString &text, const QColor &color,
|
||||||
|
bool addSpace)
|
||||||
|
{
|
||||||
|
this->textColor_ = color;
|
||||||
|
for (auto &variant : getApp()->emotes->emojis.parse(text))
|
||||||
|
{
|
||||||
|
boost::apply_visitor(
|
||||||
|
[&](auto &&arg) {
|
||||||
|
this->addTextOrEmoji(arg);
|
||||||
|
},
|
||||||
|
variant);
|
||||||
|
if (!addSpace)
|
||||||
|
{
|
||||||
|
this->message().elements.back()->setTrailingSpace(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IrcMessageBuilder::appendUsername()
|
void IrcMessageBuilder::appendUsername()
|
||||||
{
|
{
|
||||||
QString username = this->userName;
|
QString username = this->userName;
|
||||||
|
|
|
@ -36,6 +36,8 @@ private:
|
||||||
void appendUsername();
|
void appendUsername();
|
||||||
|
|
||||||
void addWords(const QStringList &words);
|
void addWords(const QStringList &words);
|
||||||
|
void addText(const QString &text, const QColor &color,
|
||||||
|
bool addSpace = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
Loading…
Reference in a new issue