aboutsummaryrefslogtreecommitdiff
path: root/room.h
diff options
context:
space:
mode:
Diffstat (limited to 'room.h')
-rw-r--r--room.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/room.h b/room.h
index 38435e95..79c765ba 100644
--- a/room.h
+++ b/room.h
@@ -32,6 +32,7 @@ namespace QMatrixClient
class Event;
class Connection;
class User;
+ class MemberSorter;
class Room: public QObject
{
@@ -92,6 +93,8 @@ namespace QMatrixClient
Q_INVOKABLE int highlightCount() const;
Q_INVOKABLE void resetHighlightCount();
+ MemberSorter memberSorter() const;
+
public slots:
void getPreviousContent();
void userRenamed(User* user, QString oldName);
@@ -138,6 +141,24 @@ namespace QMatrixClient
void setLastReadEvent(User* user, QString eventId);
};
+
+ class MemberSorter
+ {
+ public:
+ MemberSorter(const Room* r) : room(r) { }
+
+ bool operator()(User* u1, User* u2) const;
+
+ template <typename ContT>
+ typename ContT::size_type lowerBoundIndex(const ContT& c,
+ typename ContT::value_type v) const
+ {
+ return std::lower_bound(c.begin(), c.end(), v, *this) - c.begin();
+ }
+
+ private:
+ const Room* room;
+ };
}
#endif // QMATRIXCLIENT_ROOM_H