summary refs log tree commit diff
path: root/src/ChatPage.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-10 23:59:50 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-12-10 23:59:50 +0200
commitef0b0f68795786751b04615451d42dbd7b3d7a5d (patch)
treea04f4677032d054d803e0a67929fbfe4d46eb87a /src/ChatPage.cc
parentAdd gui option for joining rooms (#25) (diff)
downloadnheko-ef0b0f68795786751b04615451d42dbd7b3d7a5d.tar.xz
Add menu to invite users
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc
index 25b8fe66..dfae487d 100644
--- a/src/ChatPage.cc
+++ b/src/ChatPage.cc
@@ -109,6 +109,13 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
 
         connect(
           top_bar_, &TopRoomBar::leaveRoom, this, [=]() { client_->leaveRoom(current_room_); });
+        connect(top_bar_, &TopRoomBar::inviteUsers, this, [=](QStringList users) {
+                for (int ii = 0; ii < users.size(); ++ii) {
+                        QTimer::singleShot(ii * 1000, this, [=]() {
+                                client_->inviteUser(current_room_, users.at(ii));
+                        });
+                }
+        });
 
         connect(room_list_, &RoomList::roomChanged, this, [=](const QString &roomid) {
                 QStringList users;
@@ -258,6 +265,9 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
         connect(client_.data(), &MatrixClient::joinedRoom, this, [=]() {
                 emit showNotification("You joined the room.");
         });
+        connect(client_.data(), &MatrixClient::invitedUser, this, [=](QString, QString user) {
+                emit showNotification(QString("Invited user %1").arg(user));
+        });
         connect(client_.data(), &MatrixClient::leftRoom, this, &ChatPage::removeRoom);
 
         showContentTimer_ = new QTimer(this);