refactor: make a single MessageBuilder (#5548)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user