summary refs log tree commit diff
path: root/src/timeline/RoomlistModel.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-09-06 21:45:55 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2021-09-11 19:35:31 -0400
commit87bff3493d9c884eff09d5653e5df29b3489616d (patch)
treeb365bbfaeda169f0d32e000c19ae4813f720c534 /src/timeline/RoomlistModel.cpp
parentUse better jdenticon codes/id settings (diff)
downloadnheko-87bff3493d9c884eff09d5653e5df29b3489616d.tar.xz
Add direct chat handling for previews and invites
Diffstat (limited to 'src/timeline/RoomlistModel.cpp')
-rw-r--r--src/timeline/RoomlistModel.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/timeline/RoomlistModel.cpp b/src/timeline/RoomlistModel.cpp

index 094b0df6..a423090c 100644 --- a/src/timeline/RoomlistModel.cpp +++ b/src/timeline/RoomlistModel.cpp
@@ -164,6 +164,13 @@ RoomlistModel::data(const QModelIndex &index, int role) const return false; case Roles::Tags: return QStringList(); + case Roles::IsDirect: + return room.member_count == 1; + case Roles::DirectChatOtherUserId: + // if this is a direct chat, the front member is correct; otherwise, + // it won't be used anyway + return QString::fromStdString( + cache::roomMembers(roomid.toStdString()).front()); default: return {}; } @@ -196,6 +203,11 @@ RoomlistModel::data(const QModelIndex &index, int role) const return true; case Roles::Tags: return QStringList(); + case Roles::IsDirect: + return room.member_count == 1; + case Roles::DirectChatOtherUserId: + return QString::fromStdString( + cache::roomMembers(roomid.toStdString()).front()); default: return {}; }