diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-17 22:43:05 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-17 22:43:05 +0300 |
commit | 52c70f4d3213b82a19e42310f046abd1ebb21cc4 (patch) | |
tree | f19e72522a550643e7185b36417868f7c6e2c0b7 /protocols/ICQ-WIM/src/http.cpp | |
parent | a455e6fe10fb1f60bc37b0585b9a55fc25597931 (diff) |
merge with trunk
Diffstat (limited to 'protocols/ICQ-WIM/src/http.cpp')
-rw-r--r-- | protocols/ICQ-WIM/src/http.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/protocols/ICQ-WIM/src/http.cpp b/protocols/ICQ-WIM/src/http.cpp index e8b616fb46..d365b6e06e 100644 --- a/protocols/ICQ-WIM/src/http.cpp +++ b/protocols/ICQ-WIM/src/http.cpp @@ -114,8 +114,14 @@ AsyncHttpRequest::AsyncHttpRequest(IcqConnection conn, int iType, const char *sz void AsyncHttpRequest::ReplaceJsonParam(const JSONNode &n) { + auto *szNodeName = n.name(); + JSONNode root = JSONNode::parse(m_szParam); - root[n.name()] = n; + JSONNode& old = root.at(szNodeName); + if (old) + old = n; + else + root.push_back(n); m_szParam = root.write().c_str(); replaceStr(pData, nullptr); @@ -147,12 +153,12 @@ bool CIcqProto::ExecuteRequest(AsyncHttpRequest *pReq) delete pReq; return false; } - - pReq->ReplaceJsonParam(JSONNode("clientId", m_iRClientId)); - pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); - pReq->dataLength = pReq->m_szParam.GetLength(); - pReq->pData = mir_strdup(pReq->m_szParam); } + + pReq->ReplaceJsonParam(JSONNode("clientId", m_iRClientId)); + pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); + pReq->dataLength = pReq->m_szParam.GetLength(); + pReq->pData = mir_strdup(pReq->m_szParam); } debugLogA("Executing request %s:\n%s", pReq->m_reqId, pReq->szUrl); @@ -191,7 +197,6 @@ bool CIcqProto::ExecuteRequest(AsyncHttpRequest *pReq) return false; } - pReq->ReplaceJsonParam(JSONNode("authToken", m_szRToken)); Push(pReq); return true; } |