From 8cdfbf9391be01be8e52c7747482b336cefdfb27 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 17 Jun 2022 22:03:54 +0200 Subject: Get rid of 'using json = nlohmann::json' --- src/encryption/Olm.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/encryption/Olm.cpp') diff --git a/src/encryption/Olm.cpp b/src/encryption/Olm.cpp index 5387d215..8bf2222f 100644 --- a/src/encryption/Olm.cpp +++ b/src/encryption/Olm.cpp @@ -116,7 +116,7 @@ handle_to_device_messages(const std::vectorwarn("received message with no type field: {}", j_msg.dump(2)); continue; @@ -295,8 +295,8 @@ handle_olm_message(const OlmMessage &msg, const UserKeyCache &otherUserDeviceKey } { - std::string msg_type = payload["type"].get(); - json event_array = json::array(); + std::string msg_type = payload["type"].get(); + nlohmann::json event_array = nlohmann::json::array(); event_array.push_back(payload); std::vector temp_events; @@ -456,7 +456,7 @@ handle_pre_key_olm_message(const std::string &sender, return {}; } - auto plaintext = json::parse(std::string((char *)output.data(), output.size())); + auto plaintext = nlohmann::json::parse(std::string((char *)output.data(), output.size())); nhlog::crypto()->debug("decrypted message: \n {}", plaintext.dump(2)); try { @@ -716,8 +716,8 @@ try_olm_decryption(const std::string &sender_key, const mtx::events::msg::OlmCip } try { - return json::parse(std::string_view((char *)text.data(), text.size())); - } catch (const json::exception &e) { + return nlohmann::json::parse(std::string_view((char *)text.data(), text.size())); + } catch (const nlohmann::json::exception &e) { nhlog::crypto()->critical("failed to parse the decrypted session msg: {} {}", e.what(), std::string_view((char *)text.data(), text.size())); @@ -980,7 +980,7 @@ send_key_request_for(mtx::events::EncryptedEvent e, request.request_id = request_id; request.requesting_device_id = http::client()->device_id(); - nhlog::crypto()->debug("m.room_key_request: {}", json(request).dump(2)); + nhlog::crypto()->debug("m.room_key_request: {}", nlohmann::json(request).dump(2)); std::map> body; body[mtx::identifiers::parse(e.sender)]["*"] = request; @@ -1171,7 +1171,7 @@ decryptEvent(const MegolmSessionIndex &index, try { // Add missing fields for the event. - json body = json::parse(msg_str); + nlohmann::json body = nlohmann::json::parse(msg_str); body["event_id"] = event.event_id; body["sender"] = event.sender; body["origin_server_ts"] = event.origin_server_ts; @@ -1212,7 +1212,7 @@ send_encrypted_to_device_messages(const std::map, qint64> rateLimit; - nlohmann::json ev_json = std::visit([](const auto &e) { return json(e); }, event); + nlohmann::json ev_json = std::visit([](const auto &e) { return nlohmann::json(e); }, event); std::map> keysToQuery; mtx::requests::ClaimKeys claims; @@ -1450,10 +1450,10 @@ send_encrypted_to_device_messages(const std::mapwarn("failed to verify identity keys: {}", - json(dev.second).dump(2)); + nlohmann::json(dev.second).dump(2)); continue; } - } catch (const json::exception &e) { + } catch (const nlohmann::json::exception &e) { nhlog::crypto()->warn("failed to parse device key json: {}", e.what()); continue; } catch (const mtx::crypto::olm_exception &e) { -- cgit 1.5.1