diff --git a/saoriaccount.cpp b/saoriaccount.cpp index 80b77ad..0b7d683 100644 --- a/saoriaccount.cpp +++ b/saoriaccount.cpp @@ -165,7 +165,7 @@ auto *reply = SaoriApplication::saori()->manager->post(request,QByteArray()); connect(reply,&QNetworkReply::finished,[=](){ if (reply->error() == QNetworkReply::NoError) { - emit updateStatus(id); + emit updateStatus(id,reply->readAll()); } reply->deleteLater(); }); @@ -182,7 +182,7 @@ auto *reply = SaoriApplication::saori()->manager->post(request,QByteArray()); connect(reply,&QNetworkReply::finished,[=](){ if (reply->error() == QNetworkReply::NoError) { - emit updateStatus(id); + emit updateStatus(id,reply->readAll()); } reply->deleteLater(); }); diff --git a/saoriaccount.h b/saoriaccount.h index 4079e53..2873b6f 100644 --- a/saoriaccount.h +++ b/saoriaccount.h @@ -73,7 +73,7 @@ void accountInfomationChanged(); void apiData(const QString timeline,const QByteArray data,const QByteArray link); void posted(const QString timeline,int result); - void updateStatus(qlonglong id); + void updateStatus(qlonglong id,const QByteArray data); void relationship(qlonglong id,QJsonObject relationship); public slots: diff --git a/saoriview.cpp b/saoriview.cpp index d03b700..fb79a0b 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -85,6 +85,18 @@ auto saoriaccount = SaoriApplication::saori()->findAccount(m_account); if (saoriaccount) { connect(saoriaccount,&SaoriAccount::apiData,this,&SaoriView::recived); + connect(saoriaccount,&SaoriAccount::updateStatus,this,[=](qlonglong id,const QByteArray data){ + for(auto v:m_entries) { + if (v->id() == id) { + QJsonObject j = QJsonDocument::fromJson(data).object(); + bool cw = !j["spoiler_text"].toString().isEmpty(); + if (!j["reblog"].isNull()) + cw = !j["reblog"].toObject()["spoiler_text"].toString().isEmpty(); + v->setContent(statusParser(j),cw); + break; + } + } + }); if (view.left(9) == "accounts:") { QStringList t = view.split(':'); if (t.count() >= 2) {