mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Stop sync timer after logout
Silence errors from redacted events
This commit is contained in:
parent
4c00e64f3f
commit
b9521b0809
2 changed files with 22 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue