diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-13 04:11:22 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-04-13 04:11:22 +0300 |
commit | 27f7142cd86a46d1b13d99a6b86c126892fa86ca (patch) | |
tree | f52d2ecf2ec2893cea67551b7c7fdde2fe39fe72 /src/ChatPage.cc | |
parent | Don't use icons as room avatars (diff) | |
download | nheko-27f7142cd86a46d1b13d99a6b86c126892fa86ca.tar.xz |
Initial implementation for local echo
Each HistoryView maintains a list of pending events. Each pending message is validated from the homeserver with either the returned EventId or the body of the message. Currently there is no support to remove invalid messages. Also some small refactoring: - ChatPage doesn't know about the message being sent. The message delivery is solely handled by HistoryViewManager. - Nick coloring function moved to HistoryViewManager.
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r-- | src/ChatPage.cc | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 33f98af3..dfe1505e 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -39,7 +39,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) top_bar_ = new TopRoomBar(this); ui->topBarLayout->addWidget(top_bar_); - view_manager_ = new HistoryViewManager(this); + view_manager_ = new HistoryViewManager(client, this); ui->mainContentLayout->addWidget(view_manager_); text_input_ = new TextInputWidget(this); @@ -66,7 +66,7 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) connect(text_input_, SIGNAL(sendTextMessage(const QString &)), - this, + view_manager_, SLOT(sendTextMessage(const QString &))); connect(client_.data(), @@ -94,10 +94,6 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client, QWidget *parent) SIGNAL(ownAvatarRetrieved(const QPixmap &)), this, SLOT(setOwnAvatar(const QPixmap &))); - connect(client_.data(), - SIGNAL(messageSent(QString, int)), - this, - SLOT(messageSent(QString, int))); } void ChatPage::logout() @@ -123,20 +119,6 @@ void ChatPage::logout() emit close(); } -void ChatPage::messageSent(QString event_id, int txn_id) -{ - Q_UNUSED(event_id); - - QSettings settings; - settings.setValue("client/transaction_id", txn_id + 1); -} - -void ChatPage::sendTextMessage(const QString &msg) -{ - auto room = current_room_; - client_->sendTextMessage(current_room_.id(), msg); -} - void ChatPage::bootstrap(QString userid, QString homeserver, QString token) { Q_UNUSED(userid); |