summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-12-26 21:42:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-12-26 21:42:30 +0300
commitbe77f747e64b695328b1dc529d93846165f8f487 (patch)
tree0a9367b1e064be22f67392db345658e61c3e5f65
parentc6e113731519bb85e0a79196ad32986e8b077e07 (diff)
icq10: fix for message sending timeout
-rw-r--r--protocols/Icq10/src/proto.cpp7
-rw-r--r--protocols/Icq10/src/server.cpp14
2 files changed, 12 insertions, 9 deletions
diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp
index e731f2d488..e22a123a12 100644
--- a/protocols/Icq10/src/proto.cpp
+++ b/protocols/Icq10/src/proto.cpp
@@ -275,10 +275,13 @@ int CIcqProto::SendMsg(MCONTACT hContact, int, const char *pszSrc)
int id = InterlockedIncrement(&m_msgId);
auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_POST, ICQ_API_SERVER "/im/sendIM", &CIcqProto::OnSendMessage);
- pReq->pUserInfo = new IcqOwnMessage(hContact, id, pReq->m_reqId);
+
+ auto *pOwn = new IcqOwnMessage(hContact, id, pReq->m_reqId);
+ pReq->pUserInfo = pOwn;
+ m_arOwnIds.insert(pOwn);
pReq << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("aimsid", m_aimsid) << CHAR_PARAM("f", "json") << CHAR_PARAM("k", ICQ_APP_ID)
- << CHAR_PARAM("mentions", "") << CHAR_PARAM("message", pszSrc) << CHAR_PARAM("nonce", pReq->m_reqId) << CHAR_PARAM("offlineIM", "true")
+ << CHAR_PARAM("mentions", "") << CHAR_PARAM("message", pszSrc) << CHAR_PARAM("offlineIM", "true") << CHAR_PARAM("r", pReq->m_reqId)
<< INT_PARAM("t", dwUin) << INT_PARAM("ts", time(0));
Push(pReq);
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp
index 6ad4897cd8..7b154ba4c7 100644
--- a/protocols/Icq10/src/server.cpp
+++ b/protocols/Icq10/src/server.cpp
@@ -208,14 +208,13 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
JsonReply root(pReply);
if (root.error() != 200) {
ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)ownMsg->m_msgid, 0);
- delete ownMsg;
- return;
+ for (auto &it : m_arOwnIds) {
+ if (it == ownMsg) {
+ m_arOwnIds.remove(m_arOwnIds.indexOf(&it));
+ break;
+ }
+ }
}
-
- JSONNode &data = root.data();
- CMStringA msgId(data["msgId"].as_mstring());
- strncpy_s(ownMsg->m_guid, msgId, _TRUNCATE);
- m_arOwnIds.insert(ownMsg);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -322,6 +321,7 @@ void CIcqProto::ProcessHistData(const JSONNode &ev)
if (!mir_strcmp(reqId, ownMsg->m_guid)) {
bSkipped = true;
ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)ownMsg->m_msgid, (LPARAM)msgId.c_str());
+ m_arOwnIds.remove(m_arOwnIds.indexOf(&ownMsg));
break;
}