Skip to content
Snippets Groups Projects
Verified Commit 7cfb7dce authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Reduce allocations for presence states a bit

parent 497c3df5
No related branches found
No related tags found
No related merge requests found
......@@ -128,10 +128,17 @@ QString
TimelineViewManager::userPresence(QString id) const
{
if (id.isEmpty())
return QString();
return {};
else
return QString::fromStdString(
mtx::presence::to_string(cache::presenceState(id.toStdString())));
switch (cache::presenceState(id.toStdString())) {
case mtx::presence::PresenceState::offline:
return QStringLiteral("offline");
case mtx::presence::PresenceState::unavailable:
return QStringLiteral("unavailable");
case mtx::presence::PresenceState::online:
default:
return QStringLiteral("online");
}
}
QString
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment