Adapt to newer API

TODO: There are some missing methods and I do not know what to do there
This commit is contained in:
Tomaz Canabrava
2024-04-19 10:04:13 +02:00
parent 11dd0ee151
commit 35f1ace458

View File

@@ -267,7 +267,7 @@ QVariantList NeoChatRoom::getUsersTyping() const
userVariants.append(QVariantMap{ userVariants.append(QVariantMap{
{"id"_ls, user->id()}, {"id"_ls, user->id()},
{"avatarMediaId"_ls, user->avatarMediaId(this)}, {"avatarMediaId"_ls, user->avatarMediaId(this)},
{"displayName"_ls, user->displayname(this)}, {"displayName"_ls, user->displayname()},
{"display"_ls, user->name()}, {"display"_ls, user->name()},
}); });
} }
@@ -451,11 +451,11 @@ QVariantMap NeoChatRoom::getUser(User *user) const
return QVariantMap{ return QVariantMap{
{QStringLiteral("isLocalUser"), user->id() == localMember().id()}, {QStringLiteral("isLocalUser"), user->id() == localMember().id()},
{QStringLiteral("id"), user->id()}, {QStringLiteral("id"), user->id()},
{QStringLiteral("displayName"), user->displayname(this)}, {QStringLiteral("displayName"), user->displayname()}, // TODO: Missing methods.
{QStringLiteral("escapedDisplayName"), htmlSafeMemberName(user->id())}, {QStringLiteral("escapedDisplayName"), user->displayname()}, // htmlSafeMemberName(user->id())},
{QStringLiteral("avatarSource"), avatarForMember(user)}, {QStringLiteral("avatarSource"), avatarForMember(user)},
{QStringLiteral("avatarMediaId"), user->avatarMediaId(this)}, {QStringLiteral("avatarMediaId"), user->avatarMediaId()},
{QStringLiteral("color"), Utils::getUserColor(user->hueF())}, {QStringLiteral("color"), QColor()}, // Utils::getUserColor(user->hueF())},
{QStringLiteral("object"), QVariant::fromValue(user)}, {QStringLiteral("object"), QVariant::fromValue(user)},
}; };
} }
@@ -467,7 +467,7 @@ QString NeoChatRoom::avatarMediaId() const
} }
// Use the first (excluding self) user's avatar for direct chats // Use the first (excluding self) user's avatar for direct chats
const auto dcUsers = directChatUsers(); const auto dcUsers = directChatMebers();
for (const auto u : dcUsers) { for (const auto u : dcUsers) {
if (u != localMember()) { if (u != localMember()) {
return u->avatarMediaId(this); return u->avatarMediaId(this);
@@ -1895,7 +1895,7 @@ int NeoChatRoom::maxRoomVersion() const
Quotient::User *NeoChatRoom::directChatRemoteUser() const Quotient::User *NeoChatRoom::directChatRemoteUser() const
{ {
auto users = connection()->directChatUsers(this); auto users = connection()->directChatMebers(this);
if (users.isEmpty()) { if (users.isEmpty()) {
return nullptr; return nullptr;
} }