From deb6c1141af445de6f3f1fd5afc83ed2ac4def4b Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 27 Jul 2022 20:10:03 +0200 Subject: Fix Connection::accountData<>() The template version has never worked, to the point where instantiating it would immediately lead to FTBFS. The new version returns an event pointer as a simpler fix that would make it usable - in particular, there's no more need to have separate Connection::Private::unpackAccountData(). To simplify the fix, eventCast() has been made more tolerating - passing nullptr to it is processed in an expected (no-op) way now. --- lib/connection.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'lib/connection.cpp') diff --git a/lib/connection.cpp b/lib/connection.cpp index 6e04883e..9e4444df 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -175,15 +175,6 @@ public: void consumeToDeviceEvents(Events&& toDeviceEvents); void consumeDevicesList(DevicesList&& devicesList); - template - EventT* unpackAccountData() const - { - const auto& eventIt = accountData.find(EventT::matrixTypeId()); - return eventIt == accountData.end() - ? nullptr - : weakPtrCast(eventIt->second); - } - void packAndSendAccountData(EventPtr&& event) { const auto eventType = event->matrixType(); @@ -1665,7 +1656,7 @@ bool Connection::isIgnored(const User* user) const IgnoredUsersList Connection::ignoredUsers() const { - const auto* event = d->unpackAccountData(); + const auto* event = accountData(); return event ? event->ignored_users() : IgnoredUsersList(); } -- cgit v1.2.3