From 27f7142cd86a46d1b13d99a6b86c126892fa86ca Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Thu, 13 Apr 2017 04:11:22 +0300 Subject: 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. --- src/ChatPage.cc | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'src/ChatPage.cc') 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 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 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 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); -- cgit 1.5.1