diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-03 19:27:44 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-05-03 21:23:06 +0900 |
commit | d304c1b9ac7a86096899b459eba8e36ed310b6ce (patch) | |
tree | fd18b483d6c05e670588c5ccdd1e2bb3c7fec711 | |
parent | 853fda2e7942ffb3bc8051e6411faa23cff6f3c2 (diff) | |
download | libquotient-d304c1b9ac7a86096899b459eba8e36ed310b6ce.tar.gz libquotient-d304c1b9ac7a86096899b459eba8e36ed310b6ce.zip |
Room::Private::processRedaction: minor refactoring
-rw-r--r-- | lib/room.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index a4cfadb4..5771c51d 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -205,7 +205,7 @@ class Room::Private * Tries to find an event in the timeline and redact it; deletes the * redaction event whether the redacted event was found or not. */ - void processRedaction(RoomEventPtr&& redactionEvent); + void processRedaction(event_ptr_tt<RedactionEvent>&& redaction); void broadcastTagUpdates() { @@ -1287,11 +1287,8 @@ inline bool isRedaction(const RoomEventPtr& e) return e->type() == EventType::Redaction; } -void Room::Private::processRedaction(RoomEventPtr&& redactionEvent) +void Room::Private::processRedaction(event_ptr_tt<RedactionEvent>&& redaction) { - Q_ASSERT(redactionEvent && isRedaction(redactionEvent)); - const auto& redaction = ptrCast<RedactionEvent>(move(redactionEvent)); - const auto pIdx = eventsIndex.find(redaction->redactedEvent()); if (pIdx == eventsIndex.end()) { @@ -1385,7 +1382,7 @@ void Room::Private::addNewMessageEvents(RoomEvents&& events) const auto normalsBegin = stable_partition(events.begin(), events.end(), isRedaction); RoomEventsRange redactions { events.begin(), normalsBegin }, - normalEvents { normalsBegin, events.end() }; + normalEvents { normalsBegin, events.end() }; if (!normalEvents.empty()) emit q->aboutToAddNewMessages(normalEvents); @@ -1399,7 +1396,10 @@ void Room::Private::addNewMessageEvents(RoomEvents&& events) q->onAddNewTimelineEvents(from); } for (auto&& r: redactions) - processRedaction(move(r)); + { + Q_ASSERT(isRedaction(r)); + processRedaction(ptrCast<RedactionEvent>(move(r))); + } if (insertedSize > 0) { emit q->addedMessages(); |