summary refs log tree commit diff
path: root/src/ChatPage.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-08 22:38:38 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-08 22:38:38 +0300
commit76ddfb792b8e99a14b2adae23cfc221314e98f00 (patch)
tree4993dc88208393f4bad801eff5cda637c838b63d /src/ChatPage.cc
parentAdd snackbar (diff)
downloadnheko-76ddfb792b8e99a14b2adae23cfc221314e98f00.tar.xz
Add /join command support
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc
index 5648a830..92692fc1 100644
--- a/src/ChatPage.cc
+++ b/src/ChatPage.cc
@@ -166,10 +166,16 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
                 view_manager_,
                 SLOT(sendEmoteMessage(const QString &)));
 
+        connect(text_input_,
+                &TextInputWidget::sendJoinRoomRequest,
+                client_.data(),
+                &MatrixClient::joinRoom);
+
         connect(text_input_, &TextInputWidget::uploadImage, this, [=](QString filename) {
                 client_->uploadImage(current_room_, filename);
         });
 
+        connect(client_.data(), &MatrixClient::joinFailed, this, &ChatPage::showNotification);
         connect(client_.data(),
                 &MatrixClient::imageUploaded,
                 this,
@@ -203,10 +209,9 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent)
                 SIGNAL(ownAvatarRetrieved(const QPixmap &)),
                 this,
                 SLOT(setOwnAvatar(const QPixmap &)));
-        connect(client_.data(),
-                SIGNAL(joinedRoom(const QString &)),
-                this,
-                SLOT(addRoom(const QString &)));
+        connect(client_.data(), &MatrixClient::joinedRoom, this, [=]() {
+                emit showNotification("You joined the room.");
+        });
         connect(client_.data(),
                 SIGNAL(leftRoom(const QString &)),
                 this,
@@ -636,9 +641,9 @@ ChatPage::addRoom(const QString &room_id)
                                         QSharedPointer<RoomSettings>(new RoomSettings(room_id)));
 
                 room_list_->addRoom(settingsManager_[room_id], state_manager_[room_id], room_id);
-
-                this->changeTopRoomInfo(room_id);
                 room_list_->highlightSelectedRoom(room_id);
+
+                changeTopRoomInfo(room_id);
         }
 }