diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 3134f820..3d3a3876 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -264,6 +264,10 @@ ChatPage::setOwnAvatar(const QPixmap &img) void ChatPage::syncFailed(const QString &msg) { + // Stop if sync is not active. e.g user is logged out. + if (client_->getHomeServer().isEmpty()) + return; + qWarning() << "Sync error:" << msg; sync_timer_->start(sync_interval_ * 5); } diff --git a/src/TimelineView.cc b/src/TimelineView.cc index cffc8601..542ab98e 100644 --- a/src/TimelineView.cc +++ b/src/TimelineView.cc @@ -34,6 +34,19 @@ namespace events = matrix::events; namespace msgs = matrix::events::messages; +static bool +isRedactedEvent(const QJsonObject &event) +{ + if (event.contains("redacted_because")) + return true; + + if (event.contains("unsigned") && + event.value("unsigned").toObject().contains("redacted_because")) + return true; + + return false; +} + TimelineView::TimelineView(const Timeline &timeline, QSharedPointer client, const QString &room_id, @@ -310,7 +323,11 @@ TimelineView::parseMessageEvent(const QJsonObject &event, TimelineDirection dire return createTimelineItem(emote, with_sender); } else if (msg_type == events::MessageEventType::Unknown) { - qWarning() << "Unknown message type" << event; + // TODO Handle redacted messages. + // Silenced for now. + if (!isRedactedEvent(event)) + qWarning() << "Unknown message type" << event; + return nullptr; } }