aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index caeeb499..9e7ff8d2 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1209,7 +1209,6 @@ void Room::Private::renameMember(User* u, const QString& oldName)
removeMemberFromMap(oldName, u);
insertMemberIntoMap(u);
}
- emit q->memberRenamed(u);
}
void Room::Private::removeMemberFromMap(const QString& username, User* u)
@@ -2230,6 +2229,8 @@ Room::Changes Room::processStateEvent(const RoomEvent& e)
<< evt;
if (evt.membership() != prevMembership)
{
+ disconnect(u, &User::nameAboutToChange, this, nullptr);
+ disconnect(u, &User::nameChanged, this, nullptr);
d->removeMemberFromMap(u->name(this), u);
emit userRemoved(u);
}
@@ -2257,7 +2258,10 @@ Room::Changes Room::processStateEvent(const RoomEvent& e)
connect(u, &User::nameChanged, this,
[=] (QString, QString oldName, const Room* context) {
if (context == this)
+ {
d->renameMember(u, oldName);
+ emit memberRenamed(u);
+ }
});
emit userAdded(u);
}