aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-04 08:34:18 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-04 08:34:18 +0900
commit2d39b1e51e500fa17788630cd0e6a57a451eb475 (patch)
treee04b67569c7fc4093b1514724b080b5efa313c59 /lib
parent0378e830c40a1d7302a8108d460940b6cd15201e (diff)
downloadlibquotient-2d39b1e51e500fa17788630cd0e6a57a451eb475.tar.gz
libquotient-2d39b1e51e500fa17788630cd0e6a57a451eb475.zip
Room::allHistoryLoaded
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp5
-rw-r--r--lib/room.h9
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index e363767a..2ce37acc 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -370,6 +370,11 @@ const Room::PendingEvents& Room::pendingEvents() const
return d->unsyncedEvents;
}
+bool Room::allHistoryLoaded() const
+{
+ return !d->timeline.empty() && is<RoomCreateEvent>(*d->timeline.front());
+}
+
QString Room::name() const
{
return d->getCurrentState<RoomNameEvent>()->name();
diff --git a/lib/room.h b/lib/room.h
index db4336ea..055da3da 100644
--- a/lib/room.h
+++ b/lib/room.h
@@ -110,6 +110,7 @@ namespace QMatrixClient
Q_PROPERTY(int unreadCount READ unreadCount NOTIFY unreadMessagesChanged)
Q_PROPERTY(int highlightCount READ highlightCount NOTIFY highlightCountChanged RESET resetHighlightCount)
Q_PROPERTY(int notificationCount READ notificationCount NOTIFY notificationCountChanged RESET resetNotificationCount)
+ Q_PROPERTY(bool allHistoryLoaded READ allHistoryLoaded NOTIFY addedMessages STORED false)
Q_PROPERTY(QStringList tagNames READ tagNames NOTIFY tagsChanged)
Q_PROPERTY(bool isFavourite READ isFavourite NOTIFY tagsChanged)
Q_PROPERTY(bool isLowPriority READ isLowPriority NOTIFY tagsChanged)
@@ -228,6 +229,14 @@ namespace QMatrixClient
const Timeline& messageEvents() const;
const PendingEvents& pendingEvents() const;
+
+ /// Check whether all historical messages are already loaded
+ /**
+ * \return true if the "oldest" event in the timeline is
+ * a room creation event and there's no further history
+ * to load; false otherwise
+ */
+ bool allHistoryLoaded() const;
/**
* A convenience method returning the read marker to the position
* before the "oldest" event; same as messageEvents().crend()