aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp9
-rw-r--r--lib/room.h6
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 6777732b..4bd96fc3 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -25,7 +25,6 @@
#include "csapi/receipts.h"
#include "csapi/redaction.h"
#include "csapi/account-data.h"
-#include "csapi/message_pagination.h"
#include "csapi/room_state.h"
#include "csapi/room_send.h"
#include "csapi/tags.h"
@@ -975,6 +974,11 @@ bool Room::usesEncryption() const
return !d->getCurrentState<EncryptionEvent>()->algorithm().isEmpty();
}
+GetRoomEventsJob* Room::eventsHistoryJob() const
+{
+ return d->eventsHistoryJob;
+}
+
void Room::Private::insertMemberIntoMap(User *u)
{
const auto userName = u->name(q);
@@ -1393,10 +1397,13 @@ void Room::Private::getPreviousContent(int limit)
{
eventsHistoryJob =
connection->callApi<GetRoomEventsJob>(id, prevBatch, "b", "", limit);
+ emit q->eventsHistoryJobChanged();
connect( eventsHistoryJob, &BaseJob::success, q, [=] {
prevBatch = eventsHistoryJob->end();
addHistoricalMessageEvents(eventsHistoryJob->chunk());
});
+ connect( eventsHistoryJob, &QObject::destroyed,
+ q, &Room::eventsHistoryJobChanged);
}
}
diff --git a/lib/room.h b/lib/room.h
index 0a0eb878..633d19dd 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -19,6 +19,7 @@
#pragma once
#include "jobs/syncjob.h"
+#include "csapi/message_pagination.h"
#include "events/roommessageevent.h"
#include "events/accountdataevents.h"
#include "eventitem.h"
@@ -95,6 +96,8 @@ namespace QMatrixClient
Q_PROPERTY(bool isFavourite READ isFavourite NOTIFY tagsChanged)
Q_PROPERTY(bool isLowPriority READ isLowPriority NOTIFY tagsChanged)
+ Q_PROPERTY(GetRoomEventsJob* eventsHistoryJob READ eventsHistoryJob NOTIFY eventsHistoryJobChanged)
+
public:
using Timeline = std::deque<TimelineItem>;
using PendingEvents = std::vector<PendingEventItem>;
@@ -126,6 +129,8 @@ namespace QMatrixClient
int timelineSize() const;
bool usesEncryption() const;
+ GetRoomEventsJob* eventsHistoryJob() const;
+
/**
* Returns a square room avatar with the given size and requests it
* from the network if needed
@@ -364,6 +369,7 @@ namespace QMatrixClient
void markAllMessagesAsRead();
signals:
+ void eventsHistoryJobChanged();
void aboutToAddHistoricalMessages(RoomEventsRange events);
void aboutToAddNewMessages(RoomEventsRange events);
void addedMessages(int fromIndex, int toIndex);