mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Reduce allocations for presence states a bit
This commit is contained in:
parent
497c3df50e
commit
7cfb7dcea4
1 changed files with 10 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue