requestDirectChat

Use Quotient::connection::requestDirectChat directly as it can already handle all the conditions.
This commit is contained in:
James Graham
2024-10-04 16:52:05 +00:00
parent a314e56425
commit e26392ce94
7 changed files with 15 additions and 43 deletions

View File

@@ -399,29 +399,6 @@ bool NeoChatConnection::directChatExists(Quotient::User *user)
return directChats().contains(user);
}
void NeoChatConnection::openOrCreateDirectChat(const QString &userId)
{
if (auto user = this->user(userId)) {
openOrCreateDirectChat(user);
} else {
qWarning() << "openOrCreateDirectChat: Couldn't get user object for ID " << userId << ", unable to open/request direct chat.";
}
}
void NeoChatConnection::openOrCreateDirectChat(User *user)
{
const auto existing = directChats();
if (existing.contains(user)) {
const auto room = this->room(existing.value(user));
if (room) {
RoomManager::instance().resolveResource(room->id());
return;
}
}
requestDirectChat(user->id());
}
qsizetype NeoChatConnection::directChatNotifications() const
{
qsizetype notifications = 0;