From 74d542b903ac53443700394cc3207e1d2fb01f4a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Mar 2014 19:30:06 +0000 Subject: non-server delivery acks usage stopped in ICQ git-svn-id: http://svn.miranda-ng.org/main/trunk@8638 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/cookies.cpp | 3 +- protocols/IcqOscarJ/src/icq_constants.h | 1 - protocols/IcqOscarJ/src/icq_opts.cpp | 2 - protocols/IcqOscarJ/src/icq_proto.cpp | 119 ++++++++++---------------------- protocols/IcqOscarJ/src/resource.h | 1 - protocols/IcqOscarJ/src/version.h | 2 +- 6 files changed, 37 insertions(+), 91 deletions(-) (limited to 'protocols/IcqOscarJ/src') diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp index 1419a8f398..7ede14d96f 100644 --- a/protocols/IcqOscarJ/src/cookies.cpp +++ b/protocols/IcqOscarJ/src/cookies.cpp @@ -282,8 +282,7 @@ cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, MCONTACT BYTE bAckType; WORD wStatus = getContactStatus(hContact); - if (!getByte(hContact, "SlowSend", getByte("SlowSend", DEFAULT_SLOWSEND)) || - (!dwUin && wStatus == ID_STATUS_OFFLINE)) + if (!getByte(hContact, "SlowSend", getByte("SlowSend", DEFAULT_SLOWSEND)) || (!dwUin && wStatus == ID_STATUS_OFFLINE)) bAckType = ACKTYPE_NONE; else if (bUseSrvRelay) bAckType = ACKTYPE_CLIENT; diff --git a/protocols/IcqOscarJ/src/icq_constants.h b/protocols/IcqOscarJ/src/icq_constants.h index 85c0a90665..64121f0856 100644 --- a/protocols/IcqOscarJ/src/icq_constants.h +++ b/protocols/IcqOscarJ/src/icq_constants.h @@ -82,7 +82,6 @@ #define DEFAULT_KILLSPAM_ENABLED 1 #define DEFAULT_SLOWSEND 1 -#define DEFAULT_ONLYSERVERACKS 1 #define DEFAULT_POPUPS_ENABLED 1 #define DEFAULT_SPAM_POPUPS_ENABLED 1 diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 4458f5cffd..05a1d8b493 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -363,7 +363,6 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP icq_EnableMultipleControls(hwndDlg, icqUnicodeControls, SIZEOF(icqUnicodeControls), byData ? TRUE : FALSE); LoadDBCheckState(ppro, hwndDlg, IDC_TEMPVISIBLE, "TempVisListEnabled", DEFAULT_TEMPVIS_ENABLED); LoadDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend", DEFAULT_SLOWSEND); - LoadDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks", DEFAULT_ONLYSERVERACKS); byData = ppro->getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED); CheckDlgButton(hwndDlg, IDC_DCENABLE, byData ? TRUE : FALSE); CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData == 1 ? TRUE : FALSE); @@ -437,7 +436,6 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP ppro->m_bTempVisListEnabled = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TEMPVISIBLE); ppro->setByte("TempVisListEnabled", ppro->m_bTempVisListEnabled); StoreDBCheckState(ppro, hwndDlg, IDC_SLOWSEND, "SlowSend"); - StoreDBCheckState(ppro, hwndDlg, IDC_ONLYSERVERACKS, "OnlyServerAcks"); if (IsDlgButtonChecked(hwndDlg, IDC_DCENABLE)) ppro->m_bDCMsgEnabled = IsDlgButtonChecked(hwndDlg, IDC_DCPASSIVE) ? 1 : 2; else diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 25e216f21d..db08fe771c 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -1460,98 +1460,49 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) // on failure, fallback to send thru server } - if (!dwUin || !CheckContactCapabilities(hContact, CAPF_SRV_RELAY) || - wRecipientStatus == ID_STATUS_OFFLINE || wRecipientStatus == ID_STATUS_INVISIBLE || - getByte(hContact, "OnlyServerAcks", getByte("OnlyServerAcks", DEFAULT_ONLYSERVERACKS)) || - !getByte(hContact, "SlowSend", getByte("SlowSend", DEFAULT_SLOWSEND))) { - /// TODO: add support for RTL & user customizable font - { - char *mng = MangleXml(puszText, strlennull(puszText)); - int len = strlennull(mng); - mng = (char*)SAFE_REALLOC(mng, len + 28); - memmove(mng + 12, mng, len + 1); - memcpy(mng, "", 12); - strcat(mng, ""); - if (bNeedFreeU) SAFE_FREE(&puszText); - puszText = mng; - bNeedFreeU = 1; - } - - WCHAR *pwszText = plain_ascii ? NULL : make_unicode_string(puszText); - if ((plain_ascii ? strlennull(puszText) : strlennull(pwszText) * sizeof(WCHAR)) > MAX_MESSAGESNACSIZE) { // max length check // TLV(2) is currently limited to 0xA00 bytes in online mode - // only limit to not get disconnected, all other will be handled by error 0x0A - dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered, it is too long."); - - // free the buffers if alloced - SAFE_FREE((void**)&pwszText); - if (bNeedFreeU) SAFE_FREE(&puszText); - - return dwCookie; - } - // Rate check - if (IsServerOverRate(ICQ_MSG_FAMILY, ICQ_MSG_SRV_SEND, RML_LIMIT)) { // rate is too high, the message will not go thru... - dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered. You are sending too fast. Wait a while and try again."); - - // free the buffers if alloced - SAFE_FREE((void**)&pwszText); - if (bNeedFreeU) SAFE_FREE(&puszText); - - return dwCookie; - } - - pCookieData = CreateMessageCookieData(MTYPE_PLAIN, hContact, dwUin, FALSE); - - if (plain_ascii) - dwCookie = icq_SendChannel1Message(dwUin, szUID, hContact, puszText, pCookieData); - else - dwCookie = icq_SendChannel1MessageW(dwUin, szUID, hContact, pwszText, pCookieData); - // free the unicode message - SAFE_FREE((void**)&pwszText); + /// TODO: add support for RTL & user customizable font + { + char *mng = MangleXml(puszText, strlennull(puszText)); + int len = strlennull(mng); + mng = (char*)SAFE_REALLOC(mng, len + 28); + memmove(mng + 12, mng, len + 1); + memcpy(mng, "", 12); + strcat(mng, ""); + if (bNeedFreeU) SAFE_FREE(&puszText); + puszText = mng; + bNeedFreeU = 1; } - else { - WORD wPriority; - - char *srv_msg = puszText; - char *srv_cap = plain_ascii ? NULL : CAP_UTF8MSGS; - char *szUserAnsi = NULL; - - if (!plain_ascii && oldAnsi) { - szUserAnsi = ConvertMsgToUserSpecificAnsi(hContact, puszText); - if (szUserAnsi) { - srv_msg = szUserAnsi; - srv_cap = NULL; - } - } - if (wRecipientStatus == ID_STATUS_ONLINE || wRecipientStatus == ID_STATUS_FREECHAT) - wPriority = 0x0001; - else - wPriority = 0x0021; + WCHAR *pwszText = plain_ascii ? NULL : make_unicode_string(puszText); + if ((plain_ascii ? strlennull(puszText) : strlennull(pwszText) * sizeof(WCHAR)) > MAX_MESSAGESNACSIZE) { // max length check // TLV(2) is currently limited to 0xA00 bytes in online mode + // only limit to not get disconnected, all other will be handled by error 0x0A + dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered, it is too long."); - if (strlennull(srv_msg) + (!oldAnsi ? 144 : 102) > MAX_MESSAGESNACSIZE) { // max length check - dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered, it is too long."); + // free the buffers if alloced + SAFE_FREE((void**)&pwszText); + if (bNeedFreeU) SAFE_FREE(&puszText); - SAFE_FREE(&szUserAnsi); - // free the buffers if alloced - if (bNeedFreeU) SAFE_FREE(&puszText); + return dwCookie; + } + // Rate check + if (IsServerOverRate(ICQ_MSG_FAMILY, ICQ_MSG_SRV_SEND, RML_LIMIT)) { // rate is too high, the message will not go thru... + dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered. You are sending too fast. Wait a while and try again."); - return dwCookie; - } - // Rate check - if (IsServerOverRate(ICQ_MSG_FAMILY, ICQ_MSG_SRV_SEND, RML_LIMIT)) { // rate is too high, the message will not go thru... - dwCookie = ReportGenericSendError(hContact, ACKTYPE_MESSAGE, "The message could not be delivered. You are sending too fast. Wait a while and try again."); + // free the buffers if alloced + SAFE_FREE((void**)&pwszText); + if (bNeedFreeU) SAFE_FREE(&puszText); - SAFE_FREE(&szUserAnsi); - // free the buffers if alloced - if (bNeedFreeU) SAFE_FREE(&puszText); + return dwCookie; + } - return dwCookie; - } + pCookieData = CreateMessageCookieData(MTYPE_PLAIN, hContact, dwUin, FALSE); - pCookieData = CreateMessageCookieData(MTYPE_PLAIN, hContact, dwUin, TRUE); - dwCookie = icq_SendChannel2Message(dwUin, hContact, srv_msg, strlennull(srv_msg), wPriority, pCookieData, srv_cap); - SAFE_FREE(&szUserAnsi); - } + if (plain_ascii) + dwCookie = icq_SendChannel1Message(dwUin, szUID, hContact, puszText, pCookieData); + else + dwCookie = icq_SendChannel1MessageW(dwUin, szUID, hContact, pwszText, pCookieData); + // free the unicode message + SAFE_FREE((void**)&pwszText); // This will stop the message dialog from waiting for the real message delivery ack if (pCookieData && pCookieData->nAckType == ACKTYPE_NONE) { diff --git a/protocols/IcqOscarJ/src/resource.h b/protocols/IcqOscarJ/src/resource.h index 34b265104e..e2c589d526 100644 --- a/protocols/IcqOscarJ/src/resource.h +++ b/protocols/IcqOscarJ/src/resource.h @@ -105,7 +105,6 @@ #define IDC_IDLETIME 1254 #define IDC_STATUS 1255 #define IDC_SLOWSEND 1301 -#define IDC_ONLYSERVERACKS 1302 #define IDC_LOGLEVEL 1331 #define IDC_LEVELDESCR 1332 #define IDC_NOERRMULTI 1333 diff --git a/protocols/IcqOscarJ/src/version.h b/protocols/IcqOscarJ/src/version.h index 315857efd6..6ff89f2517 100644 --- a/protocols/IcqOscarJ/src/version.h +++ b/protocols/IcqOscarJ/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 11 #define __RELEASE_NUM 2 -#define __BUILD_NUM 0 +#define __BUILD_NUM 1 #include -- cgit v1.2.3