Reduce allocations for presence states a bit
This commit is contained in:
parent
497c3df50e
commit
7cfb7dcea4
@ -128,10 +128,17 @@ QString
|
|||||||
TimelineViewManager::userPresence(QString id) const
|
TimelineViewManager::userPresence(QString id) const
|
||||||
{
|
{
|
||||||
if (id.isEmpty())
|
if (id.isEmpty())
|
||||||
return QString();
|
return {};
|
||||||
else
|
else
|
||||||
return QString::fromStdString(
|
switch (cache::presenceState(id.toStdString())) {
|
||||||
mtx::presence::to_string(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
|
QString
|
||||||
|
Loading…
Reference in New Issue
Block a user