refactor: make a single MessageBuilder (#5548)

This commit is contained in:
pajlada
2024-08-24 12:18:27 +02:00
committed by GitHub
parent 5170085d7c
commit 175afa8b16
33 changed files with 2819 additions and 3014 deletions
+1
View File
@@ -6,6 +6,7 @@
#include <cmath>
#include <optional>
#include <utility>
#include <vector>
namespace chatterino {
+13
View File
@@ -97,4 +97,17 @@ inline QDateTime calculateMessageTime(const Communi::IrcMessage *message)
return QDateTime::currentDateTime();
}
// "foo/bar/baz,tri/hard" can be a valid badge-info tag
// In that case, valid map content should be 'split by slash' only once:
// {"foo": "bar/baz", "tri": "hard"}
inline std::pair<QString, QString> slashKeyValue(const QString &kvStr)
{
return {
// part before first slash (index 0 of section)
kvStr.section('/', 0, 0),
// part after first slash (index 1 of section)
kvStr.section('/', 1, -1),
};
}
} // namespace chatterino