mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-12-04 16:18:48 +03:00
Limit status messages to 255 bytes
This commit is contained in:
parent
048af42780
commit
db68281a28
1 changed files with 8 additions and 2 deletions
|
@ -37,8 +37,14 @@ static CacheEntry *
|
||||||
pullPresence(const QString &id)
|
pullPresence(const QString &id)
|
||||||
{
|
{
|
||||||
auto p = cache::presence(id.toStdString());
|
auto p = cache::presence(id.toStdString());
|
||||||
auto c = new CacheEntry{
|
|
||||||
utils::replaceEmoji(QString::fromStdString(p.status_msg).toHtmlEscaped()), p.presence};
|
auto statusMsg = QString::fromStdString(p.status_msg);
|
||||||
|
if (statusMsg.size() > 255) {
|
||||||
|
statusMsg.truncate(255);
|
||||||
|
statusMsg.append(u'…');
|
||||||
|
}
|
||||||
|
|
||||||
|
auto c = new CacheEntry{utils::replaceEmoji(std::move(statusMsg).toHtmlEscaped()), p.presence};
|
||||||
presences.insert(id, c);
|
presences.insert(id, c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue