feat(eventsub): implement automod message hold (#6005)

This commit is contained in:
nerix
2025-03-01 08:32:50 +01:00
committed by GitHub
parent 95b97f42e6
commit 8f1f07d672
17 changed files with 1769 additions and 19 deletions
+35
View File
@@ -333,4 +333,39 @@ QDateTime chronoToQDateTime(std::chrono::system_clock::time_point time)
return dt;
}
QStringView codepointSlice(QStringView str, qsizetype begin, qsizetype end)
{
if (end <= begin || begin < 0)
{
return {};
}
qsizetype n = 0;
const QChar *pos = str.begin();
const QChar *endPos = str.end();
const QChar *sliceBegin = nullptr;
while (n < end)
{
if (pos >= endPos)
{
return {};
}
if (n == begin)
{
sliceBegin = pos;
}
QChar cur = *pos++;
if (cur.isHighSurrogate() && pos < endPos && pos->isLowSurrogate())
{
pos++;
}
n++;
}
assert(pos <= endPos);
return {sliceBegin, pos};
}
} // namespace chatterino