Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasFella committed Sep 11, 2023
1 parent 5ea8be5 commit af10f50
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ void Connection::sync(int timeout)
if (slidingSync) {
job = d->slidingSyncJob = callApi<SlidingSyncJob>(BackgroundRequest, generateTxnId(), d->nextPos);
connect(job, &SyncJob::success, this, [this, job] {
qWarning() << job->jsonData();
onSlidingSyncSuccess(static_cast<SlidingSyncJob *>(job)->takeData());
d->slidingSyncJob = nullptr;
qWarning() << "slidingsyncdone";
emit syncDone();
});
} else {
Expand Down Expand Up @@ -608,7 +608,7 @@ void Connection::Private::consumeSlidingRoomData(SlidingRoomsData&& roomData)
<< terse << roomData.joinState
<< "state - suspiciously fast turnaround";
}*/
if (auto* r = q->provideRoom(room.id, JoinState::Join)) { // TODO joinstate?
if (auto r = q->provideRoom(room.id, JoinState::Join)) { // TODO joinstate?
pendingStateRoomIds.removeOne(room.id);
r->updateSlidingData(std::move(room));
}
Expand Down
2 changes: 1 addition & 1 deletion Quotient/jobs/basejob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ QNetworkRequest BaseJob::Private::prepareRequest() const
//TODO make this less hacked in
QNetworkRequest req;
if (QString::fromLatin1(apiEndpoint).contains("sync"_ls)) {
req = QNetworkRequest { makeRequestUrl(QUrl("https://slidingsync.lab.matrix.org"_ls), "/_matrix/client/unstable/org.matrix.msc3575/sync", requestQuery) };
req = QNetworkRequest { makeRequestUrl(QUrl("https://kde.modular.im"_ls), "/_matrix/client/unstable/org.matrix.msc3575/sync", requestQuery) };
} else {
req = QNetworkRequest { makeRequestUrl(connection->baseUrl(), apiEndpoint,
requestQuery) };
Expand Down
3 changes: 1 addition & 2 deletions Quotient/jobs/slidingsyncjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SlidingSyncJob::SlidingSyncJob(const QString& txnId, QString pos)
"/_matrix/client/unstable/org.matrix.msc3575/sync")
{
QUrlQuery query;
if (pos > -1)
if (pos != ""_ls)
query.addQueryItem("pos"_ls, pos);
setRequestQuery(query);

Expand All @@ -43,7 +43,6 @@ SlidingSyncJob::SlidingSyncJob(const QString& txnId, QString pos)
{"unsubscribe_rooms"_ls, QJsonArray{}},
{"extensions"_ls, QJsonObject{}},
};
qWarning() << requestData;

auto request = QStringLiteral("{\"lists\":{\"0\":{\"ranges\":[[0,20]],\"filters\":{\"is_dm\":true},\"required_state\":[[\"m.room.avatar\",\"\"],[\"m.room.tombstone\",\"\"]],\"timeline_limit\":1,\"sort\":[\"by_highlight_count\",\"by_notification_count\",\"by_recency\"]},\"1\":{\"ranges\":[[0,20]],\"filters\":{\"is_dm\":false},\"required_state\":[[\"m.room.avatar\",\"\"],[\"m.room.tombstone\",\"\"]],\"timeline_limit\":1,\"sort\":[\"by_highlight_count\",\"by_notification_count\",\"by_recency\"]}}}");
requestData = QJsonDocument::fromJson(request.toLatin1()).object();
Expand Down
3 changes: 2 additions & 1 deletion Quotient/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ void Room::updateSlidingData(SlidingSyncRoom&& data)
Changes roomChanges {};
// The order of calculation is important - don't merge the lines!
roomChanges |= d->updateStateFrom(std::move(data.requiredState));
//roomChanges |= d->setSummary(std::move(data.summary));
//roomChanges |= d->setSummary(std::move(data.summary)); //TODO remove probably
roomChanges |= d->addNewMessageEvents(std::move(data.timeline));

const auto oldName = d->slidingName;
Expand Down Expand Up @@ -2469,6 +2469,7 @@ void Room::getPreviousContent(int limit, const QString& filter)

void Room::Private::getPreviousContent(int limit, const QString& filter)
{
return; //TODO
if (!prevBatch || isJobPending(eventsHistoryJob))
return;

Expand Down
2 changes: 1 addition & 1 deletion Quotient/room.h
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ public Q_SLOTS:
{}
virtual QJsonObject toJson() const;
virtual void updateData(SyncRoomData&& data, bool fromCache = false);
virtual void updateSlidingData(SlidingSyncRoom&& data);
void updateSlidingData(SlidingSyncRoom&& data);
virtual Notification checkForNotifications(const TimelineItem& ti);

private:
Expand Down
1 change: 0 additions & 1 deletion Quotient/slidingsyncdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ void SlidingSyncData::parseJson(const QJsonObject &data)
for (const auto &key : data["lists"_ls].toObject().keys()) {
lists[key] = SlidingSyncLists::fromJson(data["lists"_ls][key].toObject());
}
qWarning() << data["rooms"_ls].toObject().keys().count();
for (const auto &key : data["rooms"_ls].toObject().keys()) {
rooms.push_back(std::move(SlidingSyncRoom(data["rooms"_ls][key].toObject(), key)));
}
Expand Down

0 comments on commit af10f50

Please sign in to comment.