summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/hunspell/src/htypes.hxx6
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp5
-rw-r--r--protocols/ICQ-WIM/src/proto.h35
-rw-r--r--protocols/ICQ-WIM/src/server.cpp15
-rw-r--r--src/mir_app/src/netlib_http.cpp6
5 files changed, 38 insertions, 29 deletions
diff --git a/libs/hunspell/src/htypes.hxx b/libs/hunspell/src/htypes.hxx
index 2b896fb7bb..001874eeef 100644
--- a/libs/hunspell/src/htypes.hxx
+++ b/libs/hunspell/src/htypes.hxx
@@ -55,11 +55,7 @@
// approx. number of user defined words
#define USERWORD 1000
-#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
-# define HUNSPELL_THREAD_LOCAL thread_local
-#else
-# define HUNSPELL_THREAD_LOCAL static
-#endif
+#define HUNSPELL_THREAD_LOCAL static
struct hentry {
unsigned short blen; // word length in bytes
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 63c7c7418c..e3181190e4 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -177,10 +177,13 @@ void CIcqProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *ft)
}
}
-void CIcqProto::OnSendOfflineFile(DB::EventInfo &, DB::FILE_BLOB &blob, void *hTransfer)
+void CIcqProto::OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *hTransfer)
{
auto *ft = (IcqFileTransfer *)hTransfer;
+ if (!ft->m_szMsgId.IsEmpty())
+ dbei.szId = ft->m_szMsgId;
+
auto *p = wcsrchr(ft->m_wszFileName, '\\');
if (p == nullptr)
p = ft->m_wszFileName;
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index b3826be1d4..05e8fca0f5 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -121,22 +121,6 @@ struct IcqUser : public MZeroedObject
time_t m_timer1, m_timer2;
};
-struct IcqOwnMessage
-{
- IcqOwnMessage(MCONTACT _hContact, int _msgid, const char *guid, const char *pszText) :
- m_msgid(_msgid),
- m_hContact(_hContact),
- m_szText(mir_strdup(pszText))
- {
- strncpy_s(m_guid, guid, _TRUNCATE);
- }
-
- MCONTACT m_hContact;
- int m_msgid;
- char m_guid[50];
- ptrA m_szText;
-};
-
struct IcqConn
{
HNETLIBCONN s;
@@ -147,7 +131,7 @@ struct IcqFileTransfer : public MZeroedObject
{
bool m_bCanceled = false, m_bStarted = false;
int m_fileId = -1;
- CMStringA m_szHost;
+ CMStringA m_szHost, m_szMsgId;
CMStringW m_wszFileName, m_wszDescr;
const wchar_t *m_wszShortName;
PROTOFILETRANSFERSTATUS pfts;
@@ -160,6 +144,23 @@ struct IcqFileTransfer : public MZeroedObject
void FillHeaders(AsyncHttpRequest *pReq);
};
+struct IcqOwnMessage
+{
+ IcqOwnMessage(MCONTACT _hContact, int _msgid, const char *guid, const char *pszText) :
+ m_msgid(_msgid),
+ m_hContact(_hContact),
+ m_szText(mir_strdup(pszText))
+ {
+ strncpy_s(m_guid, guid, _TRUNCATE);
+ }
+
+ MCONTACT m_hContact;
+ int m_msgid;
+ char m_guid[50];
+ ptrA m_szText;
+ IcqFileTransfer *pTransfer = nullptr;
+};
+
class CIcqProto : public PROTO<CIcqProto>
{
friend struct AsyncRapiRequest;
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index 29f3e8ed86..d85bcc3365 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -75,7 +75,14 @@ MCONTACT CIcqProto::CheckOwnMessage(const CMStringA &reqId, const CMStringA &msg
MCONTACT ret = pOwn->m_hContact;
- if (!Contact::IsGroupChat(ret))
+ if (pOwn->pTransfer) {
+ if (bRemove) {
+ pOwn->pTransfer->m_szMsgId = msgId;
+ ProtoBroadcastAck(pOwn->m_hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, pOwn->pTransfer);
+ delete pOwn->pTransfer;
+ }
+ }
+ else if (!Contact::IsGroupChat(ret))
ProtoBroadcastAck(ret, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pOwn->m_msgid, (LPARAM)msgId.c_str());
else {
T2Utf szOwnId(m_szOwnId);
@@ -965,8 +972,6 @@ LBL_Error:
if (root.error() != 200)
goto LBL_Error;
- ProtoBroadcastAck(pTransfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, pTransfer);
-
const JSONNode &data = root.data();
CMStringW wszUrl(data["static_url"].as_mstring());
@@ -982,6 +987,7 @@ LBL_Error:
auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_POST, "/im/sendIM", &CIcqProto::OnSendMessage);
auto *pOwn = new IcqOwnMessage(pTransfer->pfts.hContact, id, pReq->m_reqId, T2Utf(wszUrl));
+ pOwn->pTransfer = pTransfer;
pReq->pUserInfo = pOwn;
{
mir_cslock lck(m_csOwnIds);
@@ -991,8 +997,6 @@ LBL_Error:
pReq << AIMSID(this) << CHAR_PARAM("a", m_szAToken) << CHAR_PARAM("k", appId()) << CHAR_PARAM("mentions", "") << WCHAR_PARAM("message", wszUrl)
<< CHAR_PARAM("offlineIM", "true") << WCHAR_PARAM("parts", wszParts) << WCHAR_PARAM("t", GetUserId(pTransfer->pfts.hContact)) << INT_PARAM("ts", TS());
Push(pReq);
-
- delete pTransfer;
return;
}
@@ -1228,6 +1232,7 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
mir_cslock lck(m_csOwnIds);
m_arOwnIds.remove(ownMsg);
+ return;
}
if (g_bMessageState)
diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp
index de6cf39c91..a03dd20341 100644
--- a/src/mir_app/src/netlib_http.cpp
+++ b/src/mir_app/src/netlib_http.cpp
@@ -292,7 +292,9 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTi
if ((peol = strchr(buffer, '\n')) != nullptr)
break;
- if ((int)mir_strlen(buffer) < bytesPeeked) {
+ int iLen = (int)mir_strlen(buffer);
+ if (iLen < bytesPeeked) {
+ Netlib_Logf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", iLen, bytesPeeked);
SetLastError(ERROR_BAD_FORMAT);
return 0;
}
@@ -306,6 +308,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTi
}
if (peol == buffer) {
+ Netlib_Logf(nlc->nlu, "%s %d: %s Failed", __FILE__, __LINE__, "HttpPeekFirstResponseLine");
SetLastError(ERROR_BAD_FORMAT);
return 0;
}
@@ -313,6 +316,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTi
*peol = '\0';
if (_strnicmp(buffer, "HTTP/", 5)) {
+ Netlib_Logf(nlc->nlu, "%s %d: %s Failed", __FILE__, __LINE__, "HttpPeekFirstResponseLine");
SetLastError(ERROR_BAD_FORMAT);
return 0;
}