aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-04-06 20:32:09 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-04-06 20:32:09 +0900
commitedf6a717268d9751f58d256bfe21aab078dfb9f6 (patch)
treeac46f2a0b6272c59965069b9d4e900caabf75474 /lib
parent25e94244b4e08d6e5b6eb241076ca0f90816393f (diff)
downloadlibquotient-edf6a717268d9751f58d256bfe21aab078dfb9f6.tar.gz
libquotient-edf6a717268d9751f58d256bfe21aab078dfb9f6.zip
Room::processStateEvent: be more careful with signals handling at user renames
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);
}