From 7d95e67308ee0abcce5c7bd66265146d3dfefd74 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Mar 2025 11:35:03 +0300 Subject: useful helper JsonReply moved to the core --- protocols/Discord/src/http.cpp | 19 ------------------- protocols/Discord/src/proto.h | 14 -------------- 2 files changed, 33 deletions(-) (limited to 'protocols/Discord/src') diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp index 32976d39cf..f6a912e9e4 100644 --- a/protocols/Discord/src/http.cpp +++ b/protocols/Discord/src/http.cpp @@ -74,25 +74,6 @@ AsyncHttpRequest::AsyncHttpRequest(CDiscordProto *ppro, int iRequestType, LPCSTR m_iReqNum = ::InterlockedIncrement(&g_reqNum); } -JsonReply::JsonReply(MHttpResponse *pReply) -{ - if (pReply == nullptr) { - m_errorCode = 500; - return; - } - - m_errorCode = pReply->resultCode; - - m_root = json_parse(pReply->body); - if (m_root == nullptr) - m_errorCode = 500; -} - -JsonReply::~JsonReply() -{ - json_delete(m_root); -} - ///////////////////////////////////////////////////////////////////////////////////////// void CDiscordProto::ServerThread(void*) diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index a147124a43..04fe34110b 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -71,20 +71,6 @@ struct AsyncHttpRequest : public MTHttpRequest MCONTACT hContact; }; -class JsonReply -{ - JSONNode *m_root = nullptr; - int m_errorCode = 0; - -public: - JsonReply(MHttpResponse *); - ~JsonReply(); - - __forceinline int error() const { return m_errorCode; } - __forceinline JSONNode& data() const { return *m_root; } - __forceinline operator bool() const { return m_errorCode == 200; } -}; - ///////////////////////////////////////////////////////////////////////////////////////// struct CDiscordRole : public MZeroedObject -- cgit v1.2.3