diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-29 19:24:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-29 19:24:20 +0300 |
commit | da9ecac3bd7d49c880363d16a059873191008f1b (patch) | |
tree | bf403f08042bec3be47f8e043caf43bd07e2f98f | |
parent | 602868cc63cc1fd77a5d6e6a685a06f2ee8a3932 (diff) |
fixes #1689 (ICQ10: Add option to not wait delivery confirmation)
-rw-r--r-- | protocols/Icq10/res/resources.rc | 49 | ||||
-rw-r--r-- | protocols/Icq10/src/options.cpp | 7 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.cpp | 27 | ||||
-rw-r--r-- | protocols/Icq10/src/proto.h | 3 | ||||
-rw-r--r-- | protocols/Icq10/src/resource.h | 9 | ||||
-rw-r--r-- | protocols/Icq10/src/server.cpp | 3 |
6 files changed, 84 insertions, 14 deletions
diff --git a/protocols/Icq10/res/resources.rc b/protocols/Icq10/res/resources.rc index 5a845f575e..65786c9b11 100644 --- a/protocols/Icq10/res/resources.rc +++ b/protocols/Icq10/res/resources.rc @@ -34,22 +34,20 @@ BEGIN EDITTEXT IDC_PASSWORD,54,16,131,12,ES_PASSWORD | ES_AUTOHSCROLL END -IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 234 +IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 62 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "ICQ",IDC_STATIC,4,0,302,93 + GROUPBOX "ICQ",IDC_STATIC,4,0,302,58 RTEXT "ICQ number:",IDC_STATIC,12,14,51,8 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 END -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -75,5 +73,44 @@ END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPTIONS_FULL, DIALOG + BEGIN + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPTIONS_FULL AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/protocols/Icq10/src/options.cpp b/protocols/Icq10/src/options.cpp index 4dc2175a13..e4d09dcc12 100644 --- a/protocols/Icq10/src/options.cpp +++ b/protocols/Icq10/src/options.cpp @@ -23,15 +23,20 @@ class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto> { CCtrlEdit edtUin, edtPassword; + CCtrlCheck chkSlowSend; public: CIcqOptionsDlg(CIcqProto *ppro, int iDlgID, bool bFullDlg) : CProtoDlgBase<CIcqProto>(ppro, iDlgID), edtUin(this, IDC_UIN), - edtPassword(this, IDC_PASSWORD) + edtPassword(this, IDC_PASSWORD), + chkSlowSend(this, IDC_SLOWSEND) { CreateLink(edtUin, ppro->m_dwUin); CreateLink(edtPassword, ppro->m_szPassword); + + if (bFullDlg) + CreateLink(chkSlowSend, ppro->m_bSlowSend); } }; diff --git a/protocols/Icq10/src/proto.cpp b/protocols/Icq10/src/proto.cpp index f539f3ef40..9ab7455e08 100644 --- a/protocols/Icq10/src/proto.cpp +++ b/protocols/Icq10/src/proto.cpp @@ -40,7 +40,8 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : m_arCache(20, NumericKeySortT), m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)), m_dwUin(this, "UIN", 0), - m_szPassword(this, "Password") + m_szPassword(this, "Password"), + m_bSlowSend(this, "SlowSend", false) { // services CreateProtoService(PS_CREATEACCMGRUI, &CIcqProto::CreateAccMgrUI); @@ -257,6 +258,25 @@ 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, "UIN"); @@ -273,8 +293,11 @@ int CIcqProto::SendMsg(MCONTACT hContact, int, const char *pszSrc) 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("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 bfc6e82d28..2f34bdc739 100644 --- a/protocols/Icq10/src/proto.h +++ b/protocols/Icq10/src/proto.h @@ -136,6 +136,8 @@ class CIcqProto : public PROTO<CIcqProto> HANDLE m_hPollThread; void __cdecl PollThread(void*); + void __cdecl SendAckThread(void*); + //////////////////////////////////////////////////////////////////////////////////////// // services @@ -195,6 +197,7 @@ 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 f44743d95f..cdd4695b7e 100644 --- a/protocols/Icq10/src/resource.h +++ b/protocols/Icq10/src/resource.h @@ -1,19 +1,20 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by D:\miranda-ng\protocols\IcqOscarJ\res\resources.rc - +// Used by w:\miranda-ng\protocols\Icq10\res\resources.rc +// #define IDD_OPTIONS_FULL 101 #define IDD_OPTIONS_ACCMGR 102 #define IDC_PASSWORD 1001 #define IDC_UIN 1002 +#define IDC_SLOWSEND 1003 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_RESOURCE_VALUE 104 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1003 +#define _APS_NEXT_CONTROL_VALUE 1004 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index 66681913e2..b3edc38b04 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -494,7 +494,8 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) for (auto &ownMsg : m_arOwnIds) 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()); + 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; } |