summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2024-10-08 16:55:07 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2024-10-08 16:55:07 +0200
commitdb68281a28c5137591bd6f3b0a96ac475ba23cf6 (patch)
tree75bf0225c200fff7dda4e999418f3a55ef7b50f3
parent048af42780af7177bc57cc1d83cf48ef09ca1e1e (diff)
Limit status messages to 255 bytes
-rw-r--r--src/timeline/PresenceEmitter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/timeline/PresenceEmitter.cpp b/src/timeline/PresenceEmitter.cpp
index da03f9bf..6fd36e8b 100644
--- a/src/timeline/PresenceEmitter.cpp
+++ b/src/timeline/PresenceEmitter.cpp
@@ -37,8 +37,14 @@ static CacheEntry *
pullPresence(const QString &id)
{
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);
return c;
}