summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-28 17:38:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-28 17:38:49 +0000
commit5e9e63c45e37917ffb0acd83832d0d8f99d01883 (patch)
tree1b674b85b1f582a13bd2a57ec73377b8989141bc /protocols/IcqOscarJ
parent7105dcf75bdd939ca52ba045bc29c536c3f7ba49 (diff)
new macroses for MS_PROTO_CHAINRECV: ProtoChainRecv, ProtoChainRecvMsg & ProtoChainRecvFile
git-svn-id: http://svn.miranda-ng.org/main/trunk@2540 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r--protocols/IcqOscarJ/src/fam_02location.cpp21
-rw-r--r--protocols/IcqOscarJ/src/fam_04message.cpp82
-rw-r--r--protocols/IcqOscarJ/src/fam_13servclist.cpp14
-rw-r--r--protocols/IcqOscarJ/src/icq_filerequests.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_xtraz.cpp23
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp8
6 files changed, 38 insertions, 118 deletions
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp
index 2398cf18c6..a4b8601e78 100644
--- a/protocols/IcqOscarJ/src/fam_02location.cpp
+++ b/protocols/IcqOscarJ/src/fam_02location.cpp
@@ -249,8 +249,6 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
oscar_tlv* pTLV;
BYTE *tmp;
char *szMsg = NULL;
- CCSDATA ccs;
- PROTORECVEVENT pre;
// Syntax check
if (wLen < 4)
@@ -266,22 +264,19 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
wLen -= (buf - tmp);
// Get extra chain
- if (pChain = readIntoTLVChain(&buf, wLen, 2))
- {
+ if (pChain = readIntoTLVChain(&buf, wLen, 2)) {
char* szEncoding = NULL;
// Get Away encoding TLV
pTLV = pChain->getTLV(0x03, 1);
- if (pTLV && (pTLV->wLen >= 1))
- {
+ if (pTLV && (pTLV->wLen >= 1)) {
szEncoding = (char*)_alloca(pTLV->wLen + 1);
memcpy(szEncoding, pTLV->pData, pTLV->wLen);
szEncoding[pTLV->wLen] = '\0';
}
// Get Away info TLV
pTLV = pChain->getTLV(0x04, 1);
- if (pTLV && (pTLV->wLen >= 1))
- {
+ if (pTLV && (pTLV->wLen >= 1)) {
szMsg = (char*)SAFE_MALLOC(pTLV->wLen + 2);
memcpy(szMsg, pTLV->pData, pTLV->wLen);
szMsg[pTLV->wLen] = '\0';
@@ -293,16 +288,12 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie
disposeChain(&pChain);
}
- ccs.szProtoService = PSR_AWAYMSG;
- ccs.hContact = hContact;
- ccs.wParam = status;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre;
pre.flags = 0;
- pre.szMessage = szMsg?szMsg:(char *)"";
+ pre.szMessage = szMsg ? szMsg : (char *)"";
pre.timestamp = time(NULL);
pre.lParam = dwCookie;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
SAFE_FREE((void**)&szMsg);
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp
index 7d1bc6a829..2a4766d1a8 100644
--- a/protocols/IcqOscarJ/src/fam_04message.cpp
+++ b/protocols/IcqOscarJ/src/fam_04message.cpp
@@ -265,7 +265,6 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char *
// different encodings (just like the new format of Offline Messages).
DWORD dwRecvTime;
char* szMsg = NULL;
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
int bAdded;
@@ -392,21 +391,16 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char *
}
}
// Create and send the message event
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwRecvTime;
pre.szMessage = (char *)szMsg;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
NetLog_Server("Message (format 1) received");
// Save tick value
- setSettingDword(ccs.hContact, "TickTS", time(NULL) - (dwMsgID1/1000));
+ setSettingDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000));
}
- else
- NetLog_Server("Message (format %u) - Ignoring empty message", 1);
+ else NetLog_Server("Message (format %u) - Ignoring empty message", 1);
SAFE_FREE(&szMsg);
}
@@ -1203,23 +1197,17 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha
else
{
int bAdded;
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
-
hContact = HContactFromUID(dwUin, szUID, &bAdded);
// ack the message
icq_sendContactsAck(dwUin, szUID, dwID1, dwID2);
- ccs.szProtoService = PSR_CONTACTS;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp = (DWORD)time(NULL);
pre.szMessage = (char *)contacts;
pre.lParam = nContacts;
pre.flags = PREF_TCHAR;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
}
for (int i = 0; i < iContact; i++)
@@ -1636,37 +1624,27 @@ void packPluginTypeId(icq_packet *packet, int nTypeID)
void CIcqProto::handleStatusMsgReply(const char *szPrefix, HANDLE hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags)
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
-
- if (hContact == INVALID_HANDLE_VALUE)
- {
+ if (hContact == INVALID_HANDLE_VALUE) {
NetLog_Server("%sIgnoring status message from unknown contact %u", szPrefix, dwUin);
return;
}
int status = AwayMsgTypeToStatus(bMsgType);
- if (status == ID_STATUS_OFFLINE)
- {
+ if (status == ID_STATUS_OFFLINE) {
NetLog_Server("%sIgnoring unknown status message from %u", szPrefix, dwUin);
return;
}
// it is probably UTF-8 status reply
+ PROTORECVEVENT pre = {0};
if (wVersion == 9 || (nMsgFlags & MTF_PLUGIN) && wVersion == 10)
- {
- if (UTF8_IsValid(szMsg)) pre.flags |= PREF_UTF;
- }
+ if (UTF8_IsValid(szMsg))
+ pre.flags |= PREF_UTF;
- ccs.szProtoService = PSR_AWAYMSG;
- ccs.hContact = hContact;
- ccs.wParam = status;
- ccs.lParam = (LPARAM)&pre;
pre.szMessage = (char*)szMsg;
pre.timestamp = time(NULL);
pre.lParam = wCookie;
-
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AWAYMSG, status, (LPARAM)&pre);
}
@@ -1783,7 +1761,6 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_PLAIN: /* plain message */
{
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
// Check if this message is marked as UTF8 encoded
@@ -1852,20 +1829,14 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
}
}
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)szMsg;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
}
break;
case MTYPE_URL:
{
- CCSDATA ccs;
PROTORECVEVENT pre = {0};
if (nMsgFields < 2)
@@ -1890,15 +1861,10 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
SAFE_FREE(&szDataDescr);
SAFE_FREE(&szDataUrl);
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)szBlob;
pre.flags = PREF_UTF;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvMsg(hContact, &pre);
SAFE_FREE(&szBlob);
}
@@ -1907,22 +1873,15 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_AUTHREQ: /* auth request */
/* format: nick FE first FE last FE email FE unk-char FE msg 00 */
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
char* szBlob;
char* pCurBlob;
-
- if (nMsgFields < 6)
- {
+ if (nMsgFields < 6) {
NetLog_Server("Malformed '%s' message", "auth req");
break;
}
- ccs.szProtoService=PSR_AUTH;
- ccs.hContact=hContact=HContactFromUIN(dwUin, &bAdded);
- ccs.wParam=0;
- ccs.lParam=(LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp=dwTimestamp;
pre.lParam=sizeof(DWORD)+sizeof(HANDLE)+strlennull(pszMsgField[0])+strlennull(pszMsgField[1])+strlennull(pszMsgField[2])+strlennull(pszMsgField[3])+strlennull(pszMsgField[5])+5;
@@ -1937,7 +1896,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
strcpy((char *)pCurBlob,pszMsgField[5]);
pre.szMessage=(char *)szBlob;
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
break;
@@ -1971,8 +1930,6 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
case MTYPE_CONTACTS:
{
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
char* pszNContactsEnd;
int nContacts;
int i;
@@ -2018,15 +1975,12 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp,
hContact = HContactFromUIN(dwUin, &bAdded);
sendMessageTypesAck(hContact, 0, pAckParams);
- ccs.szProtoService = PSR_CONTACTS;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre = {0};
pre.timestamp = dwTimestamp;
pre.szMessage = (char *)isrList;
pre.lParam = nContacts;
pre.flags = PREF_TCHAR;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&pre);
}
for (i = 0; i < nContacts; i++)
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp
index 5df30ee5ec..8afbe40c13 100644
--- a/protocols/IcqOscarJ/src/fam_13servclist.cpp
+++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp
@@ -1633,13 +1633,8 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
return;
HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded);
- CCSDATA ccs;
- PROTORECVEVENT pre;
- ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
+ PROTORECVEVENT pre;
pre.flags = 0;
pre.timestamp = time(NULL);
pre.lParam = sizeof(DWORD) + sizeof(HANDLE) + 5;
@@ -1675,7 +1670,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
pre.lParam += nNickLen + nReasonLen;
- setSettingByte(ccs.hContact, "Grant", 1);
+ setSettingByte(hContact, "Grant", 1);
/*blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)*/
char *szBlob = (char *)_alloca(pre.lParam);
@@ -1691,8 +1686,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
*pCurBlob = 0; pCurBlob++; // FirstName
*pCurBlob = 0; pCurBlob++; // LastName
*pCurBlob = 0; pCurBlob++; // email
- if (nReasonLen)
- {
+ if (nReasonLen) {
memcpy(pCurBlob, szReason, nReasonLen);
pCurBlob += nReasonLen;
}
@@ -1700,7 +1694,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen)
pre.szMessage = szBlob;
// TODO: Change for new auth system, include all known informations
- CallService(MS_PROTO_CHAINRECV,0,(LPARAM)&ccs);
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
SAFE_FREE(&szNick);
SAFE_FREE(&szReason);
diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp
index d85de72580..d466aaa0c6 100644
--- a/protocols/IcqOscarJ/src/icq_filerequests.cpp
+++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp
@@ -178,13 +178,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCoo
pre.tszDescription = mir_utf8decodeT(pszDescription);
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(ptszFileName);
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp
index f712cf6f87..be851f35d6 100644
--- a/protocols/IcqOscarJ/src/icq_xtraz.cpp
+++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp
@@ -371,21 +371,14 @@ void CIcqProto::handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCo
strcat(szWork, szNum);
// Create message to notify user
- {
- CCSDATA ccs;
- PROTORECVEVENT pre = {0};
- int bAdded;
-
- ccs.szProtoService = PSR_MESSAGE;
- ccs.hContact = HContactFromUIN(dwUin, &bAdded);
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- pre.timestamp = time(NULL);
- pre.szMessage = szWork;
- pre.flags = PREF_UTF;
-
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
- }
+ PROTORECVEVENT pre = {0};
+ pre.timestamp = time(NULL);
+ pre.szMessage = szWork;
+ pre.flags = PREF_UTF;
+
+ int bAdded;
+ ProtoChainRecvMsg( HContactFromUIN(dwUin, &bAdded), &pre);
+
SAFE_FREE(&szWork);
}
else
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 9630abc070..d6723ded10 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -574,13 +574,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz
pre.tszDescription = mir_utf8decodeT(pszDescription);
pre.ptszFiles = &ptszFileName;
pre.lParam = (LPARAM)ft;
-
- CCSDATA ccs;
- ccs.szProtoService = PSR_FILE;
- ccs.hContact = hContact;
- ccs.wParam = 0;
- ccs.lParam = (LPARAM)&pre;
- CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs);
+ ProtoChainRecvFile(hContact, &pre);
mir_free(pre.tszDescription);
mir_free(ptszFileName);