diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-05 19:19:04 +0200 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-05 19:19:04 +0200 |
commit | 86bc8a74779efe7eeb306a14bd2191e11bb27583 (patch) | |
tree | b134692a811980294868e80c66dcbc3f2591535a /protocols | |
parent | a8bea2884b7f75e22c2e13137c9e8658f7c7f44e (diff) |
icq10:
- fixes #1725 (when slow send is disabled, messages are duplicated after restart)
- "Slow send" option removed, because it's not compatible with dups
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Icq10/res/resources.rc | 2 | ||||
-rw-r--r-- | protocols/Icq10/src/options.cpp | 7 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.cpp | 26 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Icq10/src/resource.h | 1 | ||||
-rw-r--r-- | protocols/Icq10/src/server.cpp | 35 |
6 files changed, 20 insertions, 53 deletions
diff --git a/protocols/Icq10/res/resources.rc b/protocols/Icq10/res/resources.rc index 9f11066965..8b3c0683f2 100644 --- a/protocols/Icq10/res/resources.rc +++ b/protocols/Icq10/res/resources.rc @@ -105,8 +105,6 @@ BEGIN EDITTEXT IDC_UIN,68,12,106,12,ES_AUTOHSCROLL RTEXT "Password:",IDC_STATIC,12,28,51,8 EDITTEXT IDC_PASSWORD,68,26,106,12,ES_PASSWORD | ES_AUTOHSCROLL - CONTROL "Send messages slower, but with full acknowledgment",IDC_SLOWSEND, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,43,285,10 PUSHBUTTON "Create a new ICQ account",IDC_REGISTER,183,61,122,14 END diff --git a/protocols/Icq10/src/options.cpp b/protocols/Icq10/src/options.cpp index 90be6522e5..57ef15c9b2 100644 --- a/protocols/Icq10/src/options.cpp +++ b/protocols/Icq10/src/options.cpp @@ -156,7 +156,6 @@ void CIcqProto::OnLoginViaPhone(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto> { CCtrlEdit edtUin, edtPassword; - CCtrlCheck chkSlowSend; CCtrlButton btnCreate; CMStringW wszOldPass; @@ -165,17 +164,13 @@ public: CProtoDlgBase<CIcqProto>(ppro, iDlgID), edtUin(this, IDC_UIN), btnCreate(this, IDC_REGISTER), - edtPassword(this, IDC_PASSWORD), - chkSlowSend(this, IDC_SLOWSEND) + edtPassword(this, IDC_PASSWORD) { btnCreate.OnClick = Callback(this, &CIcqOptionsDlg::onClick_Register); CreateLink(edtUin, ppro->m_dwUin); CreateLink(edtPassword, ppro->m_szPassword); - if (bFullDlg) - CreateLink(chkSlowSend, ppro->m_bSlowSend); - wszOldPass = ppro->m_szPassword; } diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp index 00fbb1d260..78d1961d46 100644 --- a/protocols/Icq10/src/proto.cpp +++ b/protocols/Icq10/src/proto.cpp @@ -40,8 +40,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : m_arCache(20, NumericKeySortT), m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)), m_dwUin(this, DB_KEY_UIN, 0), - m_szPassword(this, "Password"), - m_bSlowSend(this, "SlowSend", false) + m_szPassword(this, "Password") { // services CreateProtoService(PS_CREATEACCMGRUI, &CIcqProto::CreateAccMgrUI); @@ -264,25 +263,6 @@ HANDLE CIcqProto::SendFile(MCONTACT hContact, const wchar_t* szDescription, wcha //////////////////////////////////////////////////////////////////////////////////////// // PS_SendMessage - sends a message -struct TFakeAckParams -{ - TFakeAckParams(MCONTACT _cc, int _id) : - hContact(_cc), - msgId(_id) - {} - - MCONTACT hContact; - int msgId; -}; - -void __cdecl CIcqProto::SendAckThread(void *p) -{ - ::Sleep(100); - TFakeAckParams *param = (TFakeAckParams*)p; - ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)param->msgId); - delete param; -} - int CIcqProto::SendMsg(MCONTACT hContact, int, const char *pszSrc) { DWORD dwUin = getDword(hContact, DB_KEY_UIN); @@ -300,10 +280,6 @@ int CIcqProto::SendMsg(MCONTACT hContact, int, const char *pszSrc) << 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); - - if (!m_bSlowSend) - ForkThread(&CIcqProto::SendAckThread, new TFakeAckParams(hContact, id)); - return id; } diff --git a/protocols/Icq10/src/proto.h b/protocols/Icq10/src/proto.h index e90138fdf3..da724224d8 100644 --- a/protocols/Icq10/src/proto.h +++ b/protocols/Icq10/src/proto.h @@ -70,6 +70,7 @@ class CIcqProto : public PROTO<CIcqProto> void CheckAvatarChange(MCONTACT hContact, const JSONNode&); void CheckLastId(MCONTACT hContact, const JSONNode&); void CheckNickChange(MCONTACT hContact, const JSONNode&); + MCONTACT CheckOwnMessage(const CMStringA &reqId, const CMStringA &msgId, bool bRemove); void CheckPassword(void); void ConnectionFailed(int iReason); void OnLoggedIn(void); @@ -213,7 +214,6 @@ public: CMOption<DWORD> m_dwUin; CMOption<wchar_t*> m_szPassword; - CMOption<BYTE> m_bSlowSend; }; struct CMPlugin : public ACCPROTOPLUGIN<CIcqProto> diff --git a/protocols/Icq10/src/resource.h b/protocols/Icq10/src/resource.h index 77e27cc815..f32dc59f5f 100644 --- a/protocols/Icq10/src/resource.h +++ b/protocols/Icq10/src/resource.h @@ -7,7 +7,6 @@ #define IDD_REGISTER 105 #define IDC_PASSWORD 1001 #define IDC_UIN 1002 -#define IDC_SLOWSEND 1003 #define IDC_REGISTER 1005 #define IDC_PHONE 1006 #define IDC_SENDSMS 1008 diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index 2df4d8bd1f..835b0aac16 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -55,6 +55,20 @@ void CIcqProto::CheckNickChange(MCONTACT hContact, const JSONNode &ev) setWString(hContact, "Nick", wszNick); } +MCONTACT CIcqProto::CheckOwnMessage(const CMStringA &reqId, const CMStringA &msgId, bool bRemove) +{ + for (auto &own: m_arOwnIds) { + if (!mir_strcmp(reqId, own->m_guid)) { + ProtoBroadcastAck(own->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)own->m_msgid, (LPARAM)msgId.c_str()); + MCONTACT ret = own->m_hContact; + if (bRemove) + m_arOwnIds.remove(m_arOwnIds.indexOf(&own)); + return ret; + } + } + return 0; +} + void CIcqProto::CheckPassword() { char mirVer[100]; @@ -186,18 +200,8 @@ void CIcqProto::ParseMessage(MCONTACT hContact, const JSONNode &it) return; // skip own messages, just set the server msgid - bool bSkipped = false; CMStringA reqId(it["reqId"].as_mstring()); - for (auto &ownMsg : m_arOwnIds) - if (!mir_strcmp(reqId, ownMsg->m_guid)) { - bSkipped = true; - if (m_bSlowSend) - ProtoBroadcastAck(ownMsg->m_hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)ownMsg->m_msgid, (LPARAM)msgId.c_str()); - m_arOwnIds.remove(m_arOwnIds.indexOf(&ownMsg)); - break; - } - - if (bSkipped) + if (CheckOwnMessage(reqId, msgId, true)) return; bool bIsOutgoing = it["outgoing"].as_bool(); @@ -653,14 +657,9 @@ void CIcqProto::ProcessImState(const JSONNode &ev) if (it["state"].as_mstring() != L"sent") continue; - MCONTACT hContact = 0; CMStringA reqId(it["sendReqId"].as_mstring()); - for (auto &own : m_arOwnIds) - if (reqId == own->m_guid) { - hContact = own->m_hContact; - break; - } - + CMStringA msgId(it["histMsgId"].as_mstring()); + MCONTACT hContact = CheckOwnMessage(reqId, msgId, false); if (hContact) CheckLastId(hContact, ev); } |