Skip to content
Snippets Groups Projects
Commit b9521b08 authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Stop sync timer after logout

Silence errors from redacted events
parent 4c00e64f
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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<MatrixClient> 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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment