aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-09-05 18:49:22 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-09-05 18:49:22 +0900
commit8a8d68f2893a389d1073a86a3d10a1dd64afadce (patch)
tree3cbb7c3f7f818d6892cab6bfa257ab0335138f9b
parentcb56a6aa547307e33caf43173f628ea855a4366d (diff)
parentc0bd6c511b54eb9154e8f42427a62f5ac202cb4a (diff)
downloadlibquotient-8a8d68f2893a389d1073a86a3d10a1dd64afadce.tar.gz
libquotient-8a8d68f2893a389d1073a86a3d10a1dd64afadce.zip
Merge branch 'master' into kitsune-apigen
-rw-r--r--connection.cpp5
-rw-r--r--connection.h1
-rw-r--r--room.cpp12
-rw-r--r--room.h1
4 files changed, 14 insertions, 5 deletions
diff --git a/connection.cpp b/connection.cpp
index f9f1490c..7920125d 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -207,7 +207,10 @@ JoinRoomJob* Connection::joinRoom(const QString& roomAlias)
void Connection::leaveRoom(Room* room)
{
- callApi<LeaveRoomJob>(room->id());
+ auto job = callApi<LeaveRoomJob>(room->id());
+ connect( job, &BaseJob::success, [=] () {
+ emit leftRoom(room);
+ });
}
RoomMessagesJob* Connection::getMessages(Room* room, const QString& from) const
diff --git a/connection.h b/connection.h
index e3f33155..0b8500b9 100644
--- a/connection.h
+++ b/connection.h
@@ -105,6 +105,7 @@ namespace QMatrixClient
void syncDone();
void newRoom(Room* room);
void joinedRoom(Room* room);
+ void leftRoom(Room* room);
void loginError(QString error);
void networkError(size_t nextAttempt, int inMilliseconds);
diff --git a/room.cpp b/room.cpp
index 992411c0..547b74c4 100644
--- a/room.cpp
+++ b/room.cpp
@@ -371,16 +371,20 @@ QList< User* > Room::users() const
return d->membersMap.values();
}
-QStringList Room::memberNames() const {
+QStringList Room::memberNames() const
+{
QStringList res;
-
- for (auto u : d->membersMap.values()) {
+ for (auto u : d->membersMap)
res.append( this->roomMembername(u) );
- }
return res;
}
+int Room::memberCount() const
+{
+ return d->membersMap.size();
+}
+
void Room::Private::insertMemberIntoMap(User *u)
{
auto namesakes = membersMap.values(u->name());
diff --git a/room.h b/room.h
index a3eb189c..23a1412d 100644
--- a/room.h
+++ b/room.h
@@ -94,6 +94,7 @@ namespace QMatrixClient
Q_INVOKABLE QList<User*> users() const;
Q_INVOKABLE QStringList memberNames() const;
+ Q_INVOKABLE int memberCount() const;
/**
* @brief Produces a disambiguated name for a given user in