diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 20:32:22 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-07-15 20:32:22 +0300 |
commit | 31d09dbd68f9fbc127c78fdedae9d446c5a8db60 (patch) | |
tree | 0323a22ac8d576b68c08fffcc51bfc423601a857 /src/timeline | |
parent | Use the http link for video messages (diff) | |
download | nheko-31d09dbd68f9fbc127c78fdedae9d446c5a8db60.tar.xz |
De-duplicate the m.room.encryption event
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineView.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc index 0204bbd2..207844e4 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc @@ -221,9 +221,15 @@ TimelineView::parseMessageEvent(const mtx::events::collections::TimelineEvents & return nullptr; } else if (mpark::holds_alternative<StateEvent<state::Encryption>>(event)) { - auto msg = mpark::get<StateEvent<state::Encryption>>(event); + auto msg = mpark::get<StateEvent<state::Encryption>>(event); + auto event_id = QString::fromStdString(msg.event_id); + + if (eventIds_.contains(event_id)) + return nullptr; + auto item = new InfoMessage(tr("Encryption is enabled"), this); item->saveDatetime(QDateTime::fromMSecsSinceEpoch(msg.origin_server_ts)); + eventIds_[event_id] = item; return item; } else if (mpark::holds_alternative<RoomEvent<msg::Audio>>(event)) { @@ -993,7 +999,7 @@ TimelineView::removeEvent(const QString &event_id) } QWidget * -TimelineView::relativeWidget(TimelineItem *item, int dt) const +TimelineView::relativeWidget(QWidget *item, int dt) const { int pos = scroll_layout_->indexOf(item); |