summary refs log tree commit diff
path: root/src/ChatPage.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-14 12:08:16 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-14 12:08:16 +0300
commit73dbd3c8dd78b41c8d93392eac74231e5b4a20d5 (patch)
tree8f48775d63a917faacfff03a55b1767bfb75477a /src/ChatPage.cc
parentProperly display the bottom border on the TopRoomBar (diff)
downloadnheko-73dbd3c8dd78b41c8d93392eac74231e5b4a20d5.tar.xz
Re-enable groups
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc60
1 files changed, 18 insertions, 42 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc

index 336ea7c3..7f6306f6 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -501,31 +501,8 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) connect(room_list_, &RoomList::roomAvatarChanged, this, &ChatPage::updateTopBarAvatar); - // connect(http::client(), - // SIGNAL(getOwnCommunitiesResponse(QList<QString>)), - // this, - // SLOT(updateOwnCommunitiesInfo(QList<QString>))); - // connect(http::client(), - // &MatrixClient::communityProfileRetrieved, - // this, - // [this](QString communityId, QJsonObject profile) { - // communities_[communityId]->parseProfile(profile); - // }); - // connect(http::client(), - // &MatrixClient::communityRoomsRetrieved, - // this, - // [this](QString communityId, QJsonObject rooms) { - // communities_[communityId]->parseRooms(rooms); - - // if (communityId == current_community_) { - // if (communityId == "world") { - // room_list_->setFilterRooms(false); - // } else { - // room_list_->setRoomFilter( - // communities_[communityId]->getRoomList()); - // } - // } - // }); + connect( + this, &ChatPage::updateGroupsInfo, communitiesList_, &CommunitiesList::setCommunities); connect(this, &ChatPage::leftRoom, this, &ChatPage::removeRoom); connect(this, &ChatPage::notificationsRetrieved, this, &ChatPage::sendDesktopNotifications); @@ -533,13 +510,13 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent) connect(communitiesList_, &CommunitiesList::communityChanged, this, - [this](const QString &communityId) { - current_community_ = communityId; + [this](const QString &groupId) { + current_community_ = groupId; - if (communityId == "world") + if (groupId == "world") room_list_->setFilterRooms(false); else - room_list_->setRoomFilter(communities_[communityId]->getRoomList()); + room_list_->setRoomFilter(communitiesList_->roomList(groupId)); }); connect(&notificationsManager, @@ -759,18 +736,6 @@ ChatPage::updateTopBarAvatar(const QString &roomid, const QPixmap &img) } void -ChatPage::updateOwnCommunitiesInfo(const QList<QString> &own_communities) -{ - for (int i = 0; i < own_communities.size(); i++) { - QSharedPointer<Community> community = QSharedPointer<Community>(new Community()); - - communities_[own_communities[i]] = community; - } - - communitiesList_->setCommunities(communities_); -} - -void ChatPage::changeTopRoomInfo(const QString &room_id) { if (room_id.isEmpty()) { @@ -1335,7 +1300,18 @@ ChatPage::getProfileInfo() QImage::fromData(QByteArray(data.data(), data.size()))); }); }); - // TODO http::client()->getOwnCommunities(); + + http::v2::client()->joined_groups( + [this](const mtx::responses::JoinedGroups &res, mtx::http::RequestErr err) { + if (err) { + nhlog::net()->critical("failed to retrieve joined groups: {} {}", + static_cast<int>(err->status_code), + err->matrix_error.error); + return; + } + + emit updateGroupsInfo(res); + }); } void