Merge pull request #1833 from Integral-Tech/refactor-string-conversion

refactor: use fmt lib to avoid back-and-forth conversion
This commit is contained in:
DeepBlueV7.X 2024-10-30 01:10:07 +00:00 committed by GitHub
commit 1a00d91316
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,8 @@
#include <QVideoFrame> #include <QVideoFrame>
#include <QVideoSink> #include <QVideoSink>
#include <fmt/format.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <mtx/responses/common.hpp> #include <mtx/responses/common.hpp>
@ -578,8 +580,7 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
} }
} }
text.body = text.body = fmt::format("{}\n{}", body.toStdString(), text.body);
QStringLiteral("%1\n%2").arg(body, QString::fromStdString(text.body)).toStdString();
// NOTE(Nico): rich replies always need a formatted_body! // NOTE(Nico): rich replies always need a formatted_body!
text.format = "org.matrix.custom.html"; text.format = "org.matrix.custom.html";