diff options
-rw-r--r-- | lib/connection.cpp | 12 | ||||
-rw-r--r-- | lib/connection.h | 1 | ||||
-rw-r--r-- | lib/room.cpp | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index cd4c9838..6ed116c4 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -837,7 +837,6 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents) qCDebug(E2EE) << "Unsupported algorithm" << event.id() << "for event" << event.algorithm(); return; } - qWarning() << event.fullJson(); const auto decryptedEvent = sessionDecryptMessage(event); if(!decryptedEvent) { qCWarning(E2EE) << "Failed to decrypt event" << event.id(); @@ -2062,3 +2061,14 @@ QString Connection::e2eeDataDir() const dir.mkpath(path); return path; } + +QJsonObject Connection::decryptNotification(const QJsonObject ¬ification) +{ + auto room = provideRoom(notification["room_id"].toString()); + auto event = makeEvent<EncryptedEvent>(notification["event"].toObject()); + auto decrypted = room->decryptMessage(*event); + if(!decrypted) { + return QJsonObject(); + } + return decrypted->fullJson(); +} diff --git a/lib/connection.h b/lib/connection.h index d1e3a992..824c7fb4 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -664,6 +664,7 @@ public Q_SLOTS: #ifdef Quotient_E2EE_ENABLED void encryptionUpdate(Room *room); PicklingMode picklingMode() const; + QJsonObject decryptNotification(const QJsonObject ¬ification); #endif Q_SIGNALS: /// \brief Initial server resolution has failed diff --git a/lib/room.cpp b/lib/room.cpp index 963b9f88..d755f8eb 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1599,7 +1599,6 @@ void Room::handleRoomKeyEvent(const RoomKeyEvent& roomKeyEvent, if (auto encryptedEvent = d->timeline[i].viewAs<EncryptedEvent>()) { auto decrypted = decryptMessage(*encryptedEvent); if(decrypted) { - qWarning() << "decrypted" << decrypted->fullJson(); auto oldEvent = d->timeline[i].replaceEvent(std::move(decrypted)); emit replacedEvent(d->timeline[i].event(), rawPtr(oldEvent)); } |