Fix rainbow replies and add rainbowme

This commit is contained in:
Nicolas Werner 2021-04-01 17:51:10 +02:00
parent 6cf3d97ebd
commit 8719d59e22
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
2 changed files with 9 additions and 7 deletions

View File

@ -306,9 +306,9 @@ InputBar::message(QString msg, MarkdownOverride useMarkdown, bool rainbowify)
if ((ChatPage::instance()->userSettings()->markdown() &&
useMarkdown == MarkdownOverride::NOT_SPECIFIED) ||
useMarkdown == MarkdownOverride::ON)
text.formatted_body =
utils::getFormattedQuoteBody(related, utils::markdownToHtml(msg))
.toStdString();
text.formatted_body = utils::getFormattedQuoteBody(
related, utils::markdownToHtml(msg, rainbowify))
.toStdString();
else
text.formatted_body =
utils::getFormattedQuoteBody(related, msg.toHtmlEscaped()).toStdString();
@ -321,9 +321,9 @@ InputBar::message(QString msg, MarkdownOverride useMarkdown, bool rainbowify)
}
void
InputBar::emote(QString msg)
InputBar::emote(QString msg, bool rainbowify)
{
auto html = utils::markdownToHtml(msg);
auto html = utils::markdownToHtml(msg, rainbowify);
mtx::events::msg::Emote emote;
emote.body = msg.trimmed().toStdString();
@ -475,7 +475,7 @@ void
InputBar::command(QString command, QString args)
{
if (command == "me") {
emote(args);
emote(args, false);
} else if (command == "react") {
auto eventId = room->reply();
if (!eventId.isEmpty())
@ -529,6 +529,8 @@ InputBar::command(QString command, QString args)
message(args, MarkdownOverride::OFF);
} else if (command == "rainbow") {
message(args, MarkdownOverride::ON, true);
} else if (command == "rainbowme") {
emote(args, true);
}
}

View File

@ -67,7 +67,7 @@ signals:
void uploadingChanged(bool value);
private:
void emote(QString body);
void emote(QString body, bool rainbowify);
void command(QString name, QString args);
void image(const QString &filename,
const std::optional<mtx::crypto::EncryptedFile> &file,