diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-10-05 14:30:45 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2016-10-05 14:30:45 +0900 |
commit | ab45e1aee912cf242caea2d762b2b27c83a0e972 (patch) | |
tree | a81dfed53fe1ae5ea3220ae3700e536dd942d3a1 | |
parent | f112ce9b54d57c84fde2f858833b497a3c71984b (diff) | |
download | libquotient-ab45e1aee912cf242caea2d762b2b27c83a0e972.tar.gz libquotient-ab45e1aee912cf242caea2d762b2b27c83a0e972.zip |
Check there are no non-members "typing" or "having read" messages
Normally, this shouldn't happen anyway - just a double-check,
-rw-r--r-- | room.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -452,6 +452,7 @@ void Room::processStateEvents(const Events& events) if( event->type() == EventType::RoomMember ) { RoomMemberEvent* memberEvent = static_cast<RoomMemberEvent*>(event); + // Can't use d->member() below because the user may be not a member (yet) User* u = d->connection->user(memberEvent->userId()); u->processEvent(event); if( memberEvent->membership() == MembershipType::Join ) @@ -472,9 +473,10 @@ void Room::processEphemeralEvent(Event* event) { TypingEvent* typingEvent = static_cast<TypingEvent*>(event); d->usersTyping.clear(); - for( const QString& user: typingEvent->users() ) + for( const QString& userId: typingEvent->users() ) { - d->usersTyping.append(d->connection->user(user)); + if (auto m = d->member(userId)) + d->usersTyping.append(m); } emit typingChanged(); } @@ -486,7 +488,8 @@ void Room::processEphemeralEvent(Event* event) const auto receipts = receiptEvent->receiptsForEvent(eventId); for( const Receipt& r: receipts ) { - d->lastReadEvent.insert(d->connection->user(r.userId), eventId); + if (auto m = d->member(r.userId)) + d->lastReadEvent.insert(m, eventId); } } } |