diff options
Diffstat (limited to 'lib/syncdata.h')
-rw-r--r-- | lib/syncdata.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/syncdata.h b/lib/syncdata.h index 81a91ffc..663553bc 100644 --- a/lib/syncdata.h +++ b/lib/syncdata.h @@ -22,15 +22,26 @@ #include "events/stateevent.h" namespace QMatrixClient { + /// Room summary, as defined in MSC688 + /** + * Every member of this structure is an Omittable; as per the MSC, only + * changed values are sent from the server so if nothing is in the payload + * the respective member will be omitted. In particular, `heroes.omitted()` + * means that nothing has come from the server; heroes.value().isEmpty() + * means a peculiar case of a room with the only member - the current user. + */ struct RoomSummary { - int joinedMemberCount = 0; - int invitedMemberCount = 0; - QStringList heroes; //< mxids of users to take part in the room name + Omittable<int> joinedMemberCount; + Omittable<int> invitedMemberCount; + Omittable<QStringList> heroes; //< mxids of users to take part in the room name - bool operator==(const RoomSummary& other) const; - bool operator!=(const RoomSummary& other) const - { return !(*this == other); } + bool isEmpty() const; + /// Merge the contents of another RoomSummary object into this one + /// \return true, if the current object has changed; false otherwise + bool merge(const RoomSummary& other); + + friend QDebug operator<<(QDebug dbg, const RoomSummary& rs); }; template <> |