summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/icq_proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-16 19:30:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-16 19:30:06 +0000
commit74d542b903ac53443700394cc3207e1d2fb01f4a (patch)
treebccfb8e3cfebd0a352a09827e85635d1a60585df /protocols/IcqOscarJ/src/icq_proto.cpp
parenta66b6fac2aa59f9860d6205904e15b27e7710bb3 (diff)
non-server delivery acks usage stopped in ICQ
git-svn-id: http://svn.miranda-ng.org/main/trunk@8638 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/icq_proto.cpp')
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp119
1 files changed, 35 insertions, 84 deletions
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, "<HTML><BODY>", 12);
- strcat(mng, "</BODY></HTML>");
- 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, "<HTML><BODY>", 12);
+ strcat(mng, "</BODY></HTML>");
+ 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) {