From b47323e12660e2e96dac515f609f0778225a4536 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 14 Dec 2014 19:26:22 +0000 Subject: ICQ: warning level 4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11421 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/icqoscar8_12.vcxproj | 8 +- protocols/IcqOscarJ/src/UI/askauthentication.cpp | 4 +- protocols/IcqOscarJ/src/chan_01login.cpp | 2 +- protocols/IcqOscarJ/src/chan_03error.cpp | 2 +- protocols/IcqOscarJ/src/chan_05ping.cpp | 2 +- protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp | 2 +- protocols/IcqOscarJ/src/directpackets.cpp | 2 +- protocols/IcqOscarJ/src/fam_01service.cpp | 2 +- protocols/IcqOscarJ/src/fam_03buddy.cpp | 19 +- protocols/IcqOscarJ/src/fam_04message.cpp | 309 +++++++++++------------ protocols/IcqOscarJ/src/fam_13servclist.cpp | 64 ++--- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 18 +- protocols/IcqOscarJ/src/icq_advsearch.cpp | 2 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 26 +- protocols/IcqOscarJ/src/icq_avatar.h | 2 +- protocols/IcqOscarJ/src/icq_clients.cpp | 11 +- protocols/IcqOscarJ/src/icq_direct.cpp | 7 +- protocols/IcqOscarJ/src/icq_directmsg.cpp | 16 +- protocols/IcqOscarJ/src/icq_filerequests.cpp | 8 +- protocols/IcqOscarJ/src/icq_filetransfer.cpp | 3 + protocols/IcqOscarJ/src/icq_firstrun.cpp | 2 +- protocols/IcqOscarJ/src/icq_http.cpp | 4 +- protocols/IcqOscarJ/src/icq_menu.cpp | 4 +- protocols/IcqOscarJ/src/icq_proto.cpp | 29 +-- protocols/IcqOscarJ/src/icq_proto.h | 72 +++--- protocols/IcqOscarJ/src/icq_servlist.cpp | 29 +-- protocols/IcqOscarJ/src/icq_uploadui.cpp | 2 - protocols/IcqOscarJ/src/icq_xstatus.cpp | 12 +- protocols/IcqOscarJ/src/icq_xtraz.cpp | 17 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 24 +- protocols/IcqOscarJ/src/init.cpp | 6 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 5 +- protocols/IcqOscarJ/src/tlv.cpp | 4 +- 33 files changed, 346 insertions(+), 373 deletions(-) (limited to 'protocols') diff --git a/protocols/IcqOscarJ/icqoscar8_12.vcxproj b/protocols/IcqOscarJ/icqoscar8_12.vcxproj index 663d7d5388..df91bcdaa0 100644 --- a/protocols/IcqOscarJ/icqoscar8_12.vcxproj +++ b/protocols/IcqOscarJ/icqoscar8_12.vcxproj @@ -83,7 +83,7 @@ true Use icqoscar.h - Level3 + Level4 EditAndContinue 4996;%(DisableSpecificWarnings) @@ -113,7 +113,7 @@ true Use icqoscar.h - Level3 + Level4 4996;%(DisableSpecificWarnings) @@ -145,7 +145,7 @@ Fast Use icqoscar.h - Level3 + Level4 4996;%(DisableSpecificWarnings) @@ -179,7 +179,7 @@ Fast Use icqoscar.h - Level3 + Level4 4996;%(DisableSpecificWarnings) diff --git a/protocols/IcqOscarJ/src/UI/askauthentication.cpp b/protocols/IcqOscarJ/src/UI/askauthentication.cpp index 80605c9c9e..508478801f 100644 --- a/protocols/IcqOscarJ/src/UI/askauthentication.cpp +++ b/protocols/IcqOscarJ/src/UI/askauthentication.cpp @@ -63,7 +63,7 @@ static INT_PTR CALLBACK AskAuthProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // auth bug fix (thx Bio) if (dat->ppro->m_bSsiEnabled && dwUin) - dat->ppro->resetServContactAuthState(dat->hContact, dwUin); + dat->ppro->resetServContactAuthState(dat->hContact); EndDialog(hwndDlg, 0); } @@ -84,7 +84,7 @@ static INT_PTR CALLBACK AskAuthProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return FALSE; } -INT_PTR CIcqProto::RequestAuthorization(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::RequestAuthorization(WPARAM wParam, LPARAM) { AskAuthParam param = { this, wParam }; DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ASKAUTH), NULL, AskAuthProc, (LPARAM)¶m); diff --git a/protocols/IcqOscarJ/src/chan_01login.cpp b/protocols/IcqOscarJ/src/chan_01login.cpp index 061212d70a..fe221e93a1 100644 --- a/protocols/IcqOscarJ/src/chan_01login.cpp +++ b/protocols/IcqOscarJ/src/chan_01login.cpp @@ -25,7 +25,7 @@ #include "icqoscar.h" -void CIcqProto::handleLoginChannel(BYTE *buf, size_t datalen, serverthread_info *info) +void CIcqProto::handleLoginChannel(BYTE*, size_t, serverthread_info *info) { icq_packet packet; diff --git a/protocols/IcqOscarJ/src/chan_03error.cpp b/protocols/IcqOscarJ/src/chan_03error.cpp index 2e73d6eb07..1c2d4d62eb 100644 --- a/protocols/IcqOscarJ/src/chan_03error.cpp +++ b/protocols/IcqOscarJ/src/chan_03error.cpp @@ -24,7 +24,7 @@ #include "icqoscar.h" -void CIcqProto::handleErrorChannel(unsigned char* buf, size_t datalen) +void CIcqProto::handleErrorChannel(unsigned char*, size_t) { debugLogA("Ignoring server packet on ERROR channel"); } diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index c3bc72c62d..61aaf61138 100644 --- a/protocols/IcqOscarJ/src/chan_05ping.cpp +++ b/protocols/IcqOscarJ/src/chan_05ping.cpp @@ -24,7 +24,7 @@ #include "icqoscar.h" -void CIcqProto::handlePingChannel(BYTE *buf, size_t datalen) +void CIcqProto::handlePingChannel(BYTE*, size_t) { debugLogA("Warning: Ignoring server packet on PING channel"); } diff --git a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp index 3ee7618b02..ae11819142 100644 --- a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp @@ -142,7 +142,7 @@ void ChangeInfoData::PaintItemSetting(HDC hdc, RECT *rc, int i, UINT itemState) DrawTextUtf(hdc, text, rc, DT_END_ELLIPSIS | DT_LEFT | DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER, NULL); } -static int ChangeInfoDlg_Resize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) +static int ChangeInfoDlg_Resize(HWND, LPARAM, UTILRESIZECONTROL *urc) { switch (urc->wId) { case IDC_LIST: diff --git a/protocols/IcqOscarJ/src/directpackets.cpp b/protocols/IcqOscarJ/src/directpackets.cpp index 0e91b4fd2f..2f63211283 100644 --- a/protocols/IcqOscarJ/src/directpackets.cpp +++ b/protocols/IcqOscarJ/src/directpackets.cpp @@ -219,7 +219,7 @@ int CIcqProto::icq_sendFileSendDirectv8(filetransfer *ft, const char *pszFiles) } -DWORD CIcqProto::icq_SendDirectMessage(MCONTACT hContact, const char *szMessage, size_t nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap) +DWORD CIcqProto::icq_SendDirectMessage(MCONTACT hContact, const char *szMessage, size_t nBodyLength, cookie_message_data *pCookieData, char *szCap) { DWORD dwCookie = AllocateCookie(CKT_MESSAGE, 0, hContact, (void*)pCookieData); diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 0e25f56b21..014845ece3 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -419,7 +419,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade break; } // process owner avatar hash changed notification - handleAvatarOwnerHash(itemType, itemFlags, pBuffer, itemLen + 4); + handleAvatarOwnerHash(itemFlags, pBuffer, itemLen + 4); } else if (itemType == 0x02) { debugLogA("Status message item recognized"); diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 8b20642221..621f502c12 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -150,7 +150,7 @@ int unpackSessionDataItem(oscar_tlv_chain *pChain, WORD wItemType, BYTE **ppItem // TLV(2F) unknown key // TLV(30) unknown timestamp -void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info *info) +void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info*) { DWORD dwPort = 0; DWORD dwRealIP = 0; @@ -372,7 +372,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info *info char *szCurrentClient = wOldStatus == ID_STATUS_OFFLINE ? NULL : getSettingStringUtf(hContact, "MirVer", NULL); - szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, szCurrentClient, wVersion, dwFT1, dwFT2, dwFT3, nTCPFlag, dwDirectConnCookie, dwWebPort, capBuf, capLen, &bClientId, szStrBuf); + szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, szCurrentClient, wVersion, dwFT1, dwFT2, dwFT3, dwDirectConnCookie, dwWebPort, capBuf, capLen, &bClientId, szStrBuf); // Check if the client changed, if not do not change if (szCurrentClient && !strcmpnull(szCurrentClient, szClient)) szClient = (const char*)-1; @@ -385,7 +385,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info *info // no capability debugLogA("No capability info TLVs"); - szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, NULL, wVersion, dwFT1, dwFT2, dwFT3, nTCPFlag, dwDirectConnCookie, dwWebPort, NULL, capLen, &bClientId, szStrBuf); + szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, NULL, wVersion, dwFT1, dwFT2, dwFT3, dwDirectConnCookie, dwWebPort, NULL, capLen, &bClientId, szStrBuf); } else // Capabilities not present in update packet, do not touch szClient = (const char*)-1; // we don't want to client be overwritten @@ -432,9 +432,9 @@ void CIcqProto::handleUserOnline(BYTE *buf, size_t wLen, serverthread_info *info // Process Avatar Hash pTLV = pChain->getTLV(0x1D, 1); if (pTLV) - handleAvatarContactHash(dwUIN, szUID, hContact, pTLV->pData, pTLV->wLen, wOldStatus); + handleAvatarContactHash(dwUIN, szUID, hContact, pTLV->pData, pTLV->wLen); else - handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0, wOldStatus); + handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0); // Process Status Note parseStatusNote(dwUIN, szUID, hContact, pChain); @@ -526,9 +526,6 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) do { oscar_tlv_chain *pChain = NULL; - WORD wTLVCount; - DWORD dwAwaySince; - // Unpack the sender's user ID if (!unpackUID(&buf, &wLen, &dwUIN, &szUID)) return; @@ -536,10 +533,12 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) buf += 2; // TLV Count + WORD wTLVCount; unpackWord(&buf, &wTLVCount); wLen -= 4; // Skip the TLV chain + DWORD dwAwaySince = 0; while (wTLVCount && wLen >= 4) { WORD wTLVType; WORD wTLVLen; @@ -581,9 +580,9 @@ void CIcqProto::handleUserOffline(BYTE *buf, size_t wLen) // Process Avatar Hash oscar_tlv *pAvatarTLV = pChain ? pChain->getTLV(0x1D, 1) : NULL; if (pAvatarTLV) - handleAvatarContactHash(dwUIN, szUID, hContact, pAvatarTLV->pData, pAvatarTLV->wLen, wOldStatus); + handleAvatarContactHash(dwUIN, szUID, hContact, pAvatarTLV->pData, pAvatarTLV->wLen); else - handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0, wOldStatus); + handleAvatarContactHash(dwUIN, szUID, hContact, NULL, 0); // Process Status Note (offline status note) parseStatusNote(dwUIN, szUID, hContact, pChain); diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index fb91e8eafc..c2b7563bf2 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -33,35 +33,35 @@ void CIcqProto::handleMsgFam(BYTE *pBuffer, size_t wBufferLength, snac_header *p { switch (pSnacHeader->wSubtype) { case ICQ_MSG_SRV_ERROR: // SNAC(4, 0x01) - handleRecvServMsgError(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleRecvServMsgError(pBuffer, wBufferLength, pSnacHeader->dwRef); break; case ICQ_MSG_SRV_REPLYICBM: // SNAC(4, 0x05) SRV_REPLYICBM - handleReplyICBM(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleReplyICBM(); break; case ICQ_MSG_SRV_RECV: // SNAC(4, 0x07) - handleRecvServMsg(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleRecvServMsg(pBuffer, wBufferLength, pSnacHeader->dwRef); break; case ICQ_MSG_SRV_MISSED_MESSAGE: // SNAC(4, 0x0A) - handleMissedMsg(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleMissedMsg(pBuffer, wBufferLength); break; case ICQ_MSG_RESPONSE: // SNAC(4, 0x0B) - handleRecvMsgResponse(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleRecvMsgResponse(pBuffer, wBufferLength); break; case ICQ_MSG_SRV_ACK: // SNAC(4, 0x0C) Server acknowledgements - handleServerAck(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleServerAck(pBuffer, wBufferLength, pSnacHeader->dwRef); break; case ICQ_MSG_MTN: // SNAC(4, 0x14) Typing notifications - handleTypingNotification(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleTypingNotification(pBuffer, wBufferLength); break; case ICQ_MSG_SRV_OFFLINE_REPLY: // SNAC(4, 0x17) Offline Messages response - handleOffineMessagesReply(pBuffer, wBufferLength, pSnacHeader->wFlags, pSnacHeader->dwRef); + handleOffineMessagesReply(pSnacHeader->dwRef); break; default: @@ -87,21 +87,22 @@ static void setMsgChannelParams(CIcqProto *ppro, WORD wChan, DWORD dwFlags) ppro->sendServPacket(&packet); } -void CIcqProto::handleReplyICBM(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) -{ // we don't care about the stuff, just change the params +void CIcqProto::handleReplyICBM() +{ + // we don't care about the stuff, just change the params DWORD dwFlags = 0x00000303; -#ifdef DBG_CAPHTML - dwFlags |= 0x00000400; -#endif -#ifdef DBG_CAPMTN - dwFlags |= 0x00000008; -#endif + #ifdef DBG_CAPHTML + dwFlags |= 0x00000400; + #endif + #ifdef DBG_CAPMTN + dwFlags |= 0x00000008; + #endif // Set message parameters for all channels (imitate ICQ 6) setMsgChannelParams(this, 0x0000, dwFlags); } -void CIcqProto::handleRecvServMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) +void CIcqProto::handleRecvServMsg(BYTE *buf, size_t wLen, DWORD dwRef) { DWORD dwUin; DWORD dwMsgID1; @@ -172,11 +173,11 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwR switch (wMessageFormat) { case 1: // Simple message format - handleRecvServMsgType1(buf, wLen, dwUin, szUID, dwMsgID1, dwMsgID2, dwRef); + handleRecvServMsgType1(buf, wLen, dwUin, szUID, dwMsgID1, dwRef); break; case 2: // Encapsulated messages - handleRecvServMsgType2(buf, wLen, dwUin, szUID, dwMsgID1, dwMsgID2, dwRef); + handleRecvServMsgType2(buf, wLen, dwUin, szUID, dwMsgID1, dwMsgID2); break; case 4: // Typed messages @@ -200,7 +201,7 @@ char* CIcqProto::convertMsgToUserSpecificUtf(MCONTACT hContact, const char *szMs return usMsg; } -void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, DWORD dwRef) +void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwRef) { WORD wTLVType; size_t wTLVLen; @@ -229,7 +230,6 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char oscar_tlv *pCapabilityTLV = pChain->getTLV(0x0501, 1); if (pCapabilityTLV && (pCapabilityTLV->wLen > 0)) { WORD wDataLen = pCapabilityTLV->wLen; - BYTE *pDataBuf = pCapabilityTLV->pData; if (wDataLen > 0) debugLogA("Message (format 1) - Message has %d caps.", wDataLen); } @@ -376,7 +376,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char SAFE_FREE((void**)&pMsgTLV); } -void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, DWORD dwRef) +void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2) { WORD wTLVType; size_t wTLVLen; @@ -507,7 +507,6 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char return; } - WORD wAckType = chain->getWord(0x0A, 1); // Parse the next message level if (tlv = chain->getTLV(0x2711, 1)) { if (tlv->wLen == 0x1B) { @@ -664,10 +663,10 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContac if (wAckType == 0 || wAckType == 1) // File requests 7 - handleFileRequest(pDataBuf, wLen, dwUin, wCookie, dwMsgID1, dwMsgID2, szMsg, 7, FALSE); + handleFileRequest(pDataBuf, dwUin, wCookie, dwMsgID1, dwMsgID2, szMsg, 7, FALSE); else if (wAckType == 2) // File reply 7 - handleFileAck(pDataBuf, wLen, dwUin, wCookie, wStatus, szMsg); + handleFileAck(pDataBuf, wLen, dwUin, wCookie, wStatus); else debugLogA("Ignored strange file message"); } @@ -685,7 +684,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContac return; } - parseServRelayPluginData(pDataBuf + wMsgLen, wLen - wMsgLen, hContact, dwUin, szUID, dwMsgID1, dwMsgID2, wAckType, bFlags, wStatus, wCookie, wVersion); + parseServRelayPluginData(pDataBuf + wMsgLen, wLen - wMsgLen, dwUin, szUID, dwMsgID1, dwMsgID2, wAckType, bFlags, wStatus, wCookie, wVersion); break; // Everything else @@ -776,7 +775,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContac else debugLogA("Unknown wId1 (%u) in message (format 2)", wId); } -void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, MCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion) +void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion) { int nTypeId; WORD wFunction; @@ -812,7 +811,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, MCONTACT h pDataBuf += dwDataLen; wLen -= dwDataLen; - handleFileAck(pDataBuf, wLen, dwUin, wCookie, wStatus, szMsg); + handleFileAck(pDataBuf, wLen, dwUin, wCookie, wStatus); } else if (nTypeId == MTYPE_FILEREQ && wAckType == 1) { if (!dwUin) { // AIM cannot send this, just sanity @@ -827,7 +826,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, MCONTACT h pDataBuf += dwDataLen; wLen -= dwDataLen; - handleFileRequest(pDataBuf, wLen, dwUin, wCookie, dwMsgID1, dwMsgID2, szMsg, 8, FALSE); + handleFileRequest(pDataBuf, dwUin, wCookie, dwMsgID1, dwMsgID2, szMsg, 8, FALSE); } else if (nTypeId == MTYPE_CHAT && wAckType == 1) { // TODO: this is deprecated if (!dwUin) { // AIM cannot send this, just sanity @@ -1415,7 +1414,7 @@ void packPluginTypeId(icq_packet *packet, int nTypeID) } -void CIcqProto::handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags) +void CIcqProto::handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg) { if (hContact == INVALID_CONTACT_ID) { debugLogA("%sIgnoring status message from unknown contact %u", szPrefix, dwUin); @@ -1441,7 +1440,7 @@ void CIcqProto::handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DW } -HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD wVersion, int type, size_t wMsgLen, PBYTE buf, BYTE bFlags, int nMsgFlags) +HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD wVersion, int type, PBYTE buf, BYTE bFlags) { if (bFlags == 3) { MCONTACT hCookieContact; @@ -1464,7 +1463,7 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD } ReleaseCookie(wCookie); - handleStatusMsgReply("handleMessageAck: ", hContact, dwUin, wVersion, type, wCookie, (char*)buf, nMsgFlags); + handleStatusMsgReply("handleMessageAck: ", hContact, dwUin, wVersion, type, wCookie, (char*)buf); } else // Should not happen debugLogA("%sIgnored type %u ack message (this should not happen)", "handleMessageAck: ", type); @@ -1505,7 +1504,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, } if (wAckType == 2) { - handleMessageAck(dwUin, szUID, wCookie, wVersion, type, wMsgLen, (LPBYTE)pMsg, (BYTE)flags, nMsgFlags); + handleMessageAck(dwUin, szUID, wCookie, wVersion, type, (LPBYTE)pMsg, (BYTE)flags); return; } @@ -1810,13 +1809,13 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, case MTYPE_SCRIPT_INVITATION: /* it's a xtraz invitation to session */ NetLog_Uni(bThruDC, "Received %s from %u", "Xtraz Invitation", dwUin); - handleXtrazInvitation(dwUin, dwMsgID, dwMsgID2, wCookie, szMsg, wMsgLen, bThruDC); + handleXtrazInvitation(dwUin, szMsg, bThruDC); break; case MTYPE_SCRIPT_DATA: /* it's a xtraz data packet */ NetLog_Uni(bThruDC, "Received %s from %u", "Xtraz data packet", dwUin); - handleXtrazData(dwUin, dwMsgID, dwMsgID2, wCookie, szMsg, wMsgLen, bThruDC); + handleXtrazData(dwUin, szMsg, bThruDC); break; case MTYPE_AUTOONLINE: @@ -1900,22 +1899,18 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, SAFE_FREE(&szMsg); } - -void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) +void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen) { - DWORD dwUin; - uid_str szUid; DWORD dwCookie; WORD wMessageFormat; WORD wStatus; WORD bMsgType = 0; BYTE bFlags; WORD wLength; - DWORD dwMsgID1, dwMsgID2; WORD wVersion = 0; cookie_message_data *pCookieData = NULL; - + DWORD dwMsgID1, dwMsgID2; unpackLEDWord(&buf, &dwMsgID1); // Message ID unpackLEDWord(&buf, &dwMsgID2); wLen -= 8; @@ -1927,7 +1922,10 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD return; } - if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) return; + DWORD dwUin; + uid_str szUid; + if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) + return; MCONTACT hContact = HContactFromUID(dwUin, szUid, NULL); @@ -1961,13 +1959,12 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD if (wLength == 0x1b && pCookieData->bMessageType != MTYPE_REVERSE_REQUEST) { // this can be v8 greeting message reply - WORD wCookie; - unpackLEWord(&buf, &wVersion); buf += 27; /* unknowns from the msg we sent */ wLen -= 29; // Message sequence (SEQ2) + WORD wCookie; unpackLEWord(&buf, &wCookie); wLen -= 2; @@ -2016,6 +2013,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD else { bMsgType = pCookieData->bMessageType; bFlags = 0; + wStatus = 0; } if (hCookieContact != hContact) { @@ -2025,7 +2023,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD } if (bFlags == 3) // A status message reply - handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, bMsgType, dwCookie, (char*)(buf + 2), 0); + handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, bMsgType, dwCookie, (char*)(buf + 2)); else { // An ack of some kind int ackType; @@ -2036,37 +2034,27 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD return; } + WORD wMsgLen; switch (bMsgType) { case MTYPE_FILEREQ: - { - char* szMsg; - WORD wMsgLen; - // Message length unpackLEWord(&buf, &wMsgLen); wLen -= 2; - szMsg = (char *)_alloca(wMsgLen + 1); - szMsg[wMsgLen] = '\0'; - if (wMsgLen > 0) { - memcpy(szMsg, buf, wMsgLen); - buf += wMsgLen; - wLen -= wMsgLen; + { + char *szMsg = (char *)_alloca(wMsgLen + 1); + szMsg[wMsgLen] = '\0'; + if (wMsgLen > 0) { + memcpy(szMsg, buf, wMsgLen); + buf += wMsgLen; + wLen -= wMsgLen; + } + handleFileAck(buf, wLen, dwUin, dwCookie, wStatus); + // No success protoack will be sent here, since all file requests + // will have been 'sent' when the server returns its ack } - handleFileAck(buf, wLen, dwUin, dwCookie, wStatus, szMsg); - // No success protoack will be sent here, since all file requests - // will have been 'sent' when the server returns its ack return; - } case MTYPE_PLUGIN: - { - WORD wMsgLen; - DWORD dwLengthToEnd; - DWORD dwDataLen; - int typeId; - WORD wFunctionId; - - if (wLength != 0x1B) { debugLogA("Invalid Greeting %s", "message response"); @@ -2087,105 +2075,109 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD ReleaseCookie(dwCookie); return; } + { + WORD wFunctionId; + int typeId; + if (!unpackPluginTypeId(&buf, &wLen, &typeId, &wFunctionId, FALSE)) { + ReleaseCookie(dwCookie); + return; + } - if (!unpackPluginTypeId(&buf, &wLen, &typeId, &wFunctionId, FALSE)) { - ReleaseCookie(dwCookie); - return; - } - - if (wLen < 4) { - debugLogA("Error: Invalid greeting %s", "message response"); - ReleaseCookie(dwCookie); - return; - } - - // Length of remaining data - unpackLEDWord(&buf, &dwLengthToEnd); - wLen -= 4; - - if (wLen >= 4 && dwLengthToEnd > 0) - unpackLEDWord(&buf, &dwDataLen); // Length of message - else - dwDataLen = 0; - - switch (typeId) { - case MTYPE_PLAIN: - if (pCookieData && pCookieData->bMessageType == MTYPE_AUTOAWAY && dwLengthToEnd >= 4) { - // ICQ 6 invented this - char *szMsg = (char*)_alloca(dwDataLen + 1); - - if (dwDataLen > 0) - memcpy(szMsg, buf, dwDataLen); - szMsg[dwDataLen] = '\0'; - handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, pCookieData->nAckType, dwCookie, szMsg, 0); - + if (wLen < 4) { + debugLogA("Error: Invalid greeting %s", "message response"); ReleaseCookie(dwCookie); return; } - ackType = ACKTYPE_MESSAGE; - break; - case MTYPE_URL: - ackType = ACKTYPE_URL; - break; + // Length of remaining data + DWORD dwLengthToEnd; + unpackLEDWord(&buf, &dwLengthToEnd); + wLen -= 4; - case MTYPE_CONTACTS: - ackType = ACKTYPE_CONTACTS; - break; + DWORD dwDataLen; + if (wLen >= 4 && dwLengthToEnd > 0) + unpackLEDWord(&buf, &dwDataLen); // Length of message + else + dwDataLen = 0; - case MTYPE_FILEREQ: - debugLogA("This is file ack"); - { - char *szMsg = (char *)_alloca(dwDataLen + 1); + switch (typeId) { + case MTYPE_PLAIN: + if (pCookieData && pCookieData->bMessageType == MTYPE_AUTOAWAY && dwLengthToEnd >= 4) { + // ICQ 6 invented this + char *szMsg = (char*)_alloca(dwDataLen + 1); - if (dwDataLen > 0) - memcpy(szMsg, buf, dwDataLen); - szMsg[dwDataLen] = '\0'; - buf += dwDataLen; - wLen -= dwDataLen; + if (dwDataLen > 0) + memcpy(szMsg, buf, dwDataLen); + szMsg[dwDataLen] = '\0'; + handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, pCookieData->nAckType, dwCookie, szMsg); - handleFileAck(buf, wLen, dwUin, dwCookie, wStatus, szMsg); - // No success protoack will be sent here, since all file requests - // will have been 'sent' when the server returns its ack - } - return; + ReleaseCookie(dwCookie); + return; + } + ackType = ACKTYPE_MESSAGE; + break; - case MTYPE_SCRIPT_NOTIFY: - { - char *szMsg = (char*)_alloca(dwDataLen + 1); + case MTYPE_URL: + ackType = ACKTYPE_URL; + break; - if (dwDataLen > 0) - memcpy(szMsg, buf, dwDataLen); - szMsg[dwDataLen] = '\0'; + case MTYPE_CONTACTS: + ackType = ACKTYPE_CONTACTS; + break; - handleXtrazNotifyResponse(dwUin, hContact, (WORD)dwCookie, szMsg, dwDataLen); + case MTYPE_FILEREQ: + debugLogA("This is file ack"); + { + char *szMsg = (char *)_alloca(dwDataLen + 1); + + if (dwDataLen > 0) + memcpy(szMsg, buf, dwDataLen); + szMsg[dwDataLen] = '\0'; + buf += dwDataLen; + wLen -= dwDataLen; + + handleFileAck(buf, wLen, dwUin, dwCookie, wStatus); + // No success protoack will be sent here, since all file requests + // will have been 'sent' when the server returns its ack + } + return; - ReleaseCookie(dwCookie); - } - return; + case MTYPE_SCRIPT_NOTIFY: + { + char *szMsg = (char*)_alloca(dwDataLen + 1); - case MTYPE_STATUSMSGEXT: - { // handle Away Message response (ICQ 6) - char *szMsg = (char*)SAFE_MALLOC(dwDataLen + 1); + if (dwDataLen > 0) + memcpy(szMsg, buf, dwDataLen); + szMsg[dwDataLen] = '\0'; - if (dwDataLen > 0) - memcpy(szMsg, buf, dwDataLen); - szMsg[dwDataLen] = '\0'; - szMsg = EliminateHtml(szMsg, dwDataLen); + handleXtrazNotifyResponse(hContact, (WORD)dwCookie, szMsg); - handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, pCookieData->nAckType, (WORD)dwCookie, szMsg, MTF_PLUGIN | MTF_STATUS_EXTENDED); + ReleaseCookie(dwCookie); + } + return; - SAFE_FREE(&szMsg); + case MTYPE_STATUSMSGEXT: + { // handle Away Message response (ICQ 6) + char *szMsg = (char*)SAFE_MALLOC(dwDataLen + 1); - ReleaseCookie(dwCookie); - } - return; + if (dwDataLen > 0) + memcpy(szMsg, buf, dwDataLen); + szMsg[dwDataLen] = '\0'; + szMsg = EliminateHtml(szMsg, dwDataLen); - default: - debugLogA("Error: Unknown plugin message response, type %d.", typeId); - return; + handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, pCookieData->nAckType, (WORD)dwCookie, szMsg); + + SAFE_FREE(&szMsg); + + ReleaseCookie(dwCookie); + } + return; + + default: + debugLogA("Error: Unknown plugin message response, type %d.", typeId); + return; + } } - } break; case MTYPE_PLAIN: @@ -2240,7 +2232,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD } // A response to a CLI_SENDMSG -void CIcqProto::handleRecvServMsgError(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwSequence) +void CIcqProto::handleRecvServMsgError(BYTE *buf, size_t wLen, DWORD dwSequence) { WORD wError; char *pszErrorMessage; @@ -2345,9 +2337,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, size_t wLen, WORD wFlags, DWOR break; } - switch (pCookieData->bMessageType) { - case MTYPE_PLAIN: nMessageType = ACKTYPE_MESSAGE; break; @@ -2390,7 +2380,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, size_t wLen, WORD wFlags, DWOR } -void CIcqProto::handleServerAck(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwSequence) +void CIcqProto::handleServerAck(BYTE *buf, size_t wLen, DWORD dwSequence) { DWORD dwUin; uid_str szUID; @@ -2465,7 +2455,7 @@ void CIcqProto::handleServerAck(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwSeq } -void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) +void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen) { DWORD dwUin; uid_str szUid; @@ -2540,7 +2530,7 @@ void CIcqProto::handleMissedMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef } -void CIcqProto::handleOffineMessagesReply(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) +void CIcqProto::handleOffineMessagesReply(DWORD dwRef) { cookie_offline_messages *cookie; @@ -2574,13 +2564,8 @@ void CIcqProto::handleOffineMessagesReply(BYTE *buf, size_t wLen, WORD wFlags, D } -void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef) +void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen) { - DWORD dwUin; - uid_str szUid; - WORD wChannel; - WORD wNotification; - if (wLen < 14) { debugLogA("Ignoring SNAC(4.x11) Packet to short"); return; @@ -2591,17 +2576,22 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DW wLen -= 8; // Message channel, unused? + WORD wChannel; unpackWord(&buf, &wChannel); wLen -= 2; // Sender - if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) return; + DWORD dwUin; + uid_str szUid; + if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) + return; MCONTACT hContact = HContactFromUID(dwUin, szUid, NULL); if (hContact == INVALID_CONTACT_ID) return; // Typing notification code + WORD wNotification; unpackWord(&buf, &wNotification); wLen -= 2; @@ -2609,7 +2599,6 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DW // Notify user switch (wNotification) { - case MTN_FINISHED: case MTN_TYPED: CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF); diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 109c58cb79..948592dae4 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -157,31 +157,32 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea // process item change if (pSnacHeader->wSubtype == ICQ_LISTS_ADDTOLIST) - handleServerCListItemAdd(szRecordName, wGroupId, wItemId, wItemType, pChain); + handleServerCListItemAdd(wItemId, wItemType, pChain); else if (pSnacHeader->wSubtype == ICQ_LISTS_UPDATEGROUP) - handleServerCListItemUpdate(szRecordName, wGroupId, wItemId, wItemType, pChain); + handleServerCListItemUpdate(szRecordName, wItemType, pChain); else if (pSnacHeader->wSubtype == ICQ_LISTS_REMOVEFROMLIST) - handleServerCListItemDelete(szRecordName, wGroupId, wItemId, wItemType, pChain); + handleServerCListItemDelete(szRecordName, wItemId, wItemType); // release memory disposeChain(&pChain); } } - { - // log packet basics - char *szChange; - - if (pSnacHeader->wSubtype == ICQ_LISTS_ADDTOLIST) - szChange = "Server added %u item(s) to list"; - else if (pSnacHeader->wSubtype == ICQ_LISTS_UPDATEGROUP) - szChange = "Server updated %u item(s) on list"; - else if (pSnacHeader->wSubtype == ICQ_LISTS_REMOVEFROMLIST) - szChange = "Server removed %u item(s) from list"; - - char szLogText[MAX_PATH]; - mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems); - debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText); - } + + // log packet basics + char *szChange; + + if (pSnacHeader->wSubtype == ICQ_LISTS_ADDTOLIST) + szChange = "Server added %u item(s) to list"; + else if (pSnacHeader->wSubtype == ICQ_LISTS_UPDATEGROUP) + szChange = "Server updated %u item(s) on list"; + else if (pSnacHeader->wSubtype == ICQ_LISTS_REMOVEFROMLIST) + szChange = "Server removed %u item(s) from list"; + else + break; + + char szLogText[MAX_PATH]; + mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems); + debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText); } break; @@ -1216,7 +1217,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serv else debugLogA("Waiting for more packets"); } -void CIcqProto::handleServerCListItemAdd(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) +void CIcqProto::handleServerCListItemAdd(WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) { if (wItemType == SSI_ITEM_IMPORTTIME) { if (pItemData) { @@ -1232,7 +1233,7 @@ void CIcqProto::handleServerCListItemAdd(const char *szRecordName, WORD wGroupId ReserveServerID(wItemId, wItemType == SSI_ITEM_GROUP ? SSIT_GROUP : SSIT_ITEM, SSIF_UNHANDLED); } -void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) +void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItemType, oscar_tlv_chain *pItemData) { MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; @@ -1333,7 +1334,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou debugLogA("Server updated our group \"%s\" on list", szRecordName); } -void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) +void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wItemId, WORD wItemType) { MCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; @@ -1442,24 +1443,25 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, size_t wLen) void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen) { - DWORD dwUin; - uid_str szUid; PBYTE pBlob, pCurBlob; - int bAdded; - char* szNick; DBVARIANT dbv = { 0 }; - if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) return; + DWORD dwUin; + uid_str szUid; + if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) + return; if (dwUin && IsOnSpammerList(dwUin)) { debugLogA("Ignored Message from known Spammer"); return; } + int bAdded; MCONTACT hContact = HContactFromUID(dwUin, szUid, &bAdded); size_t nNickLen, cbBlob = sizeof(DWORD) * 2 + 4; + char *szNick = NULL; if (dwUin) { if (getString(hContact, "Nick", &dbv)) nNickLen = 0; @@ -1475,7 +1477,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen) pCurBlob = pBlob = (PBYTE)_alloca(cbBlob); /*blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) */ *(DWORD*)pCurBlob = dwUin; pCurBlob += sizeof(DWORD); - *(DWORD*)pCurBlob = DWORD(hContact); pCurBlob += sizeof(DWORD); + *(DWORD*)pCurBlob = hContact; pCurBlob += sizeof(DWORD); if (nNickLen && dwUin) { // if we have nick we add it, otherwise keep trailing zero memcpy(pCurBlob, szNick, nNickLen); pCurBlob += nNickLen; @@ -1484,10 +1486,10 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, size_t wLen) memcpy(pCurBlob, szUid, nNickLen); pCurBlob += nNickLen; } - *(char *)pCurBlob = 0; pCurBlob++; - *(char *)pCurBlob = 0; pCurBlob++; - *(char *)pCurBlob = 0; pCurBlob++; - *(char *)pCurBlob = 0; + *(char*)pCurBlob = 0; pCurBlob++; + *(char*)pCurBlob = 0; pCurBlob++; + *(char*)pCurBlob = 0; pCurBlob++; + *(char*)pCurBlob = 0; // TODO: Change for new auth system AddEvent(NULL, EVENTTYPE_ADDED, time(NULL), 0, cbBlob, pBlob); diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 73e3ee06e6..8db067a21e 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -180,7 +180,7 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, size_t wPacketLen, WO switch (wReplySubtype) { case META_SET_PASSWORD_ACK: - parseUserInfoUpdateAck(databuf, wPacketLen, wCookie, wReplySubtype, bResultCode); + parseUserInfoUpdateAck(wCookie, wReplySubtype, bResultCode); break; case SRV_RANDOM_FOUND: @@ -245,7 +245,7 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, size_t wPacketLen, WO case META_DIRECTORY_UPDATE_ACK: if (bResultCode == 0x0A) - handleDirectoryUpdateResponse(databuf, wPacketLen, wCookie, wReplySubtype); + handleDirectoryUpdateResponse(databuf, wPacketLen, wCookie); else debugLogA("Error: Directory request failed, code %u", bResultCode); break; @@ -442,7 +442,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WO } } -void CIcqProto::parseUserInfoUpdateAck(unsigned char *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype, BYTE bResultCode) +void CIcqProto::parseUserInfoUpdateAck(WORD wCookie, WORD wReplySubtype, BYTE bResultCode) { switch (wReplySubtype) { case META_SET_PASSWORD_ACK: // Set user password server ack @@ -689,7 +689,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, size_t wPacketLen, W if (pDirectoryData) { switch (pCookieData->bRequestType) { case DIRECTORYREQUEST_INFOOWNER: - parseDirectoryUserDetailsData(NULL, pDirectoryData, wCookie, pCookieData, wReplySubtype); + parseDirectoryUserDetailsData(NULL, pDirectoryData, pCookieData, wReplySubtype); break; case DIRECTORYREQUEST_INFOUSER: @@ -713,11 +713,11 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, size_t wPacketLen, W } case DIRECTORYREQUEST_INFOMULTI: - parseDirectoryUserDetailsData(hContact, pDirectoryData, wCookie, pCookieData, wReplySubtype); + parseDirectoryUserDetailsData(hContact, pDirectoryData, pCookieData, wReplySubtype); break; case DIRECTORYREQUEST_SEARCH: - parseDirectorySearchData(pDirectoryData, wCookie, pCookieData, wReplySubtype); + parseDirectorySearchData(pDirectoryData, wCookie, wReplySubtype); break; default: @@ -750,7 +750,7 @@ static int calcAgeFromBirthDate(double dDate) return 0; } -void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType) +void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain *cDetails, cookie_directory_data *pCookieData, WORD wReplySubType) { if (pCookieData->bRequestType == DIRECTORYREQUEST_INFOMULTI && !hContact) { DWORD dwUin = 0; @@ -924,7 +924,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain } -void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType) +void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCookie, WORD wReplySubType) { char *szUid = cDetails->getString(0x32, 1); // User ID @@ -1009,7 +1009,7 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook } -void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype) +void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, size_t wPacketLen, WORD wCookie) { WORD wBytesRemaining = 0; snac_header requestSnac = { 0 }; diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index c50d7dcc8b..dfbe51a6d4 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -43,7 +43,7 @@ static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names) } } -INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg, UINT message, WPARAM, LPARAM) { switch(message) { case WM_INITDIALOG: diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index e5aa5d9657..96020d9437 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -251,7 +251,7 @@ void CIcqProto::StopAvatarThread() } // handle Owner's avatar hash changes -void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, size_t nDataLen) +void CIcqProto::handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen) { if (nDataLen < 0x14 || !m_bAvatarsEnabled) return; @@ -371,14 +371,14 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, si } // handle Contact's avatar hash -void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *pHash, size_t nHashLen, WORD wOldStatus) +void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *pHash, size_t nHashLen) { int bJob = FALSE; BOOL avatarInfoPresent = FALSE; int avatarType = -1; BYTE *pAvatarHash = NULL; - size_t cbAvatarHash; - BYTE emptyItem[0x10] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + size_t cbAvatarHash = 0; + BYTE emptyItem[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (!m_bAvatarsEnabled || nHashLen < 4) return; // only if enabled @@ -386,7 +386,6 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hCont while (nHashLen >= 4) { // parse online message items one by one WORD itemType = pHash[0] << 8 | pHash[1]; size_t itemLen = pHash[3]; - BYTE itemFlags = pHash[2]; // just some validity check if (itemLen + 4 > nHashLen) @@ -551,12 +550,9 @@ int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, m_avatarsMutex->Enter(); - if (m_avatarsConnection && m_avatarsConnection->isReady()) // check if we are ready - { // check if requests for this user are not blocked - DWORD dwNow = GetTickCount(); - avatars_request *ar = m_avatarsQueue; - - while (ar) { + if (m_avatarsConnection && m_avatarsConnection->isReady()) { // check if we are ready + // check if requests for this user are not blocked + for (avatars_request *ar = m_avatarsQueue; ar; ar = ar->pNext) { if (ar->hContact == hContact && ar->type == ART_BLOCK) { // found a block item if (GetTickCount() > ar->timeOut) { // remove timeouted block ar = ReleaseAvatarRequestInQueue(ar); @@ -566,11 +562,9 @@ int CIcqProto::GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, debugLogA("Avatars: Requests for %s avatar are blocked.", strUID(dwUin, pszUid)); return 0; } - ar = ar->pNext; } avatars_server_connection *pConnection = m_avatarsConnection; - pConnection->_Lock(); m_avatarsMutex->Leave(); @@ -657,8 +651,6 @@ int CIcqProto::SetAvatarData(MCONTACT hContact, WORD wRef, const BYTE *data, siz // we failed to send request, or avatar thread not ready // check if any request for this user is not already in the queue - int bYet = 0; - avatars_request *ar = m_avatarsQueue; while (ar) { if (ar->hContact == hContact && ar->type == ART_UPLOAD) { // we found it, return error @@ -1072,7 +1064,7 @@ int avatars_server_connection::handleServerPackets(BYTE *buf, size_t buflen) switch (channel) { case ICQ_LOGIN_CHAN: - handleLoginChannel(buf, datalen); + handleLoginChannel(buf); break; case ICQ_DATA_CHAN: @@ -1093,7 +1085,7 @@ int avatars_server_connection::handleServerPackets(BYTE *buf, size_t buflen) return (int)bytesUsed; } -void avatars_server_connection::handleLoginChannel(BYTE *buf, size_t datalen) +void avatars_server_connection::handleLoginChannel(BYTE *buf) { if (*(DWORD*)buf == 0x1000000) { // here check if we received SRV_HELLO wLocalSequence = generate_flap_sequence(); diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index f776b0f3b9..63e2658bae 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -59,7 +59,7 @@ protected: int handleServerPackets(BYTE *buf, size_t buflen); - void handleLoginChannel(BYTE *buf, size_t datalen); + void handleLoginChannel(BYTE *buf); void handleDataChannel(BYTE *buf, size_t datalen); void handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_header *pSnacHeader); diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index c69a4c81aa..51d3385d84 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -186,11 +186,12 @@ const char* cliQip = "QIP %s"; const char* cliIM2 = "IM2"; const char* cliSpamBot = "Spam Bot"; -const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, - WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, BYTE bDirectFlag, DWORD dwDirectCookie, DWORD dwWebPort, /* ICQ specific */ - BYTE *caps, size_t wLen, /* Client capabilities */ - BYTE *bClientId, /* Output: detected client-type */ - char *szClientBuf) +const char* CIcqProto::detectUserClient( + MCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, + WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, DWORD dwDirectCookie, DWORD dwWebPort, /* ICQ specific */ + BYTE *caps, size_t wLen, /* Client capabilities */ + BYTE *bClientId, /* Output: detected client-type */ + char *szClientBuf) { LPCSTR szClient = NULL; int bMirandaIM = FALSE; diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 959b986015..e034de40f0 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -159,7 +159,7 @@ BOOL CIcqProto::IsDirectConnectionOpen(MCONTACT hContact, int type, int bPassive // This function is called from the Netlib when someone is connecting to // one of our incomming DC ports -void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra) +void icq_newConnectionReceived(HANDLE hNewConnection, DWORD, void *pExtra) { // Start a new thread for the incomming connection CIcqProto* ppro = (CIcqProto*)pExtra; @@ -197,8 +197,7 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) HANDLE hPacketRecver; BOOL bFirstPacket = TRUE; size_t nSkipPacketBytes = 0; - DWORD dwReqMsgID1; - DWORD dwReqMsgID2; + DWORD dwReqMsgID1 = 0, dwReqMsgID2 = 0; srand(time(NULL)); { @@ -515,7 +514,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, size_t wLen) DWORD dwUin; DWORD dwPort; DWORD dwCookie; - MCONTACT hContact; + MCONTACT hContact = 0; if (wLen != 0x30) { NetLog_Direct("Error: Received malformed PEER_INIT"); diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp index 26206cf6d3..52b68a7ca6 100644 --- a/protocols/IcqOscarJ/src/icq_directmsg.cpp +++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp @@ -105,7 +105,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) if (wCommand == DIRECT_MESSAGE) { switch (bMsgType) { case MTYPE_FILEREQ: // File inits - handleFileRequest(buf, wLen, dc->dwRemoteUin, wCookie, 0, 0, pszText, 7, TRUE); + handleFileRequest(buf, dc->dwRemoteUin, wCookie, 0, 0, pszText, 7, TRUE); break; case MTYPE_AUTOAWAY: @@ -121,7 +121,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) break; case MTYPE_PLUGIN: // Greeting - handleDirectGreetingMessage(dc, buf, wLen, wCommand, wCookie, bMsgType, bMsgFlags, wStatus, wFlags, pszText); + handleDirectGreetingMessage(dc, buf, wLen, wCommand, wCookie, bMsgType, bMsgFlags, wStatus, wFlags); break; default: @@ -174,11 +174,11 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) break; case MTYPE_FILEREQ: // File acks - handleFileAck(buf, wLen, dc->dwRemoteUin, wCookie, wStatus, pszText); + handleFileAck(buf, wLen, dc->dwRemoteUin, wCookie, wStatus); break; case MTYPE_PLUGIN: // Greeting - handleDirectGreetingMessage(dc, buf, wLen, wCommand, wCookie, bMsgType, bMsgFlags, wStatus, wFlags, pszText); + handleDirectGreetingMessage(dc, buf, wLen, wCommand, wCookie, bMsgType, bMsgFlags, wStatus, wFlags); break; default: @@ -198,7 +198,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen) NetLog_Direct("Unknown wCommand, packet skipped"); } -void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t wLen, WORD wCommand, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, WORD wStatus, WORD wFlags, char* pszText) +void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t wLen, WORD wCommand, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, WORD wStatus, WORD wFlags) { NetLog_Direct("Handling PEER_MSG_GREETING, command %u, cookie %u, messagetype %u, messageflags %u, status %u, flags %u", wCommand, wCookie, bMsgType, bMsgFlags, wStatus, wFlags); @@ -231,7 +231,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t szMsg[dwDataLength] = '\0'; wLen -= dwDataLength; - handleFileRequest(buf, wLen, dc->dwRemoteUin, wCookie, 0, 0, szMsg, 8, TRUE); + handleFileRequest(buf, dc->dwRemoteUin, wCookie, 0, 0, szMsg, 8, TRUE); } else if (typeId == MTYPE_FILEREQ && wCommand == DIRECT_ACK) { NetLog_Direct("This is file ack"); @@ -241,7 +241,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t wLen -= dwDataLength; // 50 - file request granted/refused - handleFileAck(buf, wLen, dc->dwRemoteUin, wCookie, wStatus, szMsg); + handleFileAck(buf, wLen, dc->dwRemoteUin, wCookie, wStatus); } else if (typeId && wCommand == DIRECT_MESSAGE) { uid_str szUID; @@ -294,7 +294,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t memcpy(szMsg, buf, dwDataLength); szMsg[dwDataLength] = '\0'; - handleXtrazNotifyResponse(dc->dwRemoteUin, dc->hContact, wCookie, szMsg, dwDataLength); + handleXtrazNotifyResponse(dc->hContact, wCookie, szMsg); } break; diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index b357356640..6a757ce248 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -25,7 +25,7 @@ #include "icqoscar.h" -void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus, char* pszText) +void CIcqProto::handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus) { char* pszFileName = NULL; DWORD dwFileSize; @@ -109,7 +109,7 @@ filetransfer* CIcqProto::CreateFileTransfer(MCONTACT hContact, DWORD dwUin, int // pszDescription points to a string with the reason // buf points to the first data after the string -void CIcqProto::handleFileRequest(PBYTE buf, size_t cbLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC) +void CIcqProto::handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC) { BOOL bEmptyDesc = FALSE; if (mir_strlen(pszDescription) == 0) { @@ -167,14 +167,14 @@ void CIcqProto::handleFileRequest(PBYTE buf, size_t cbLen, DWORD dwUin, DWORD dw mir_free(ptszFileName); } -void CIcqProto::handleDirectCancel(directconnect *dc, PBYTE buf, size_t wLen, WORD wCommand, DWORD dwCookie, WORD wMessageType, WORD wStatus, WORD wFlags, char* pszText) +void CIcqProto::handleDirectCancel() { NetLog_Direct("handleDirectCancel: Unhandled cancel"); } // ******************************************************************************* -void CIcqProto::icq_CancelFileTransfer(MCONTACT hContact, filetransfer* ft) +void CIcqProto::icq_CancelFileTransfer(filetransfer* ft) { DWORD dwCookie; if (FindCookieByData(ft, &dwCookie, NULL)) diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 6afa3fef6f..54b11af724 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -233,6 +233,9 @@ void CIcqProto::icq_sendFileResume(filetransfer *ft, int action, const char *szF ft->szThisFile = null_strdup(szFilename); ft->dwFileBytesDone = 0; break; + + default: + openFlags = 0; } ft->fileId = OpenFileUtf(ft->szThisFile, openFlags, _S_IREAD | _S_IWRITE); diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 24da49beb2..34e1ff3b01 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -104,7 +104,7 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE; } -INT_PTR CIcqProto::OnCreateAccMgrUI(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::OnCreateAccMgrUI(WPARAM, LPARAM lParam) { return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ICQACCOUNT), (HWND)lParam, icq_FirstRunDlgProc, LPARAM(this)); } diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 0855bc5cd7..9deb69ceb0 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -29,7 +29,7 @@ #include "icqoscar.h" -int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr) +int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *nlhr) { // initial response from ICQ http gateway size_t wLen, wVersion, wType; @@ -139,7 +139,7 @@ int icq_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDA -PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST* nlhr, PBYTE buf, int len, int* outBufLen, void *(*NetlibRealloc)(void *, size_t)) +PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST*, PBYTE buf, int len, int* outBufLen, void *(*)(void *, size_t)) { size_t wLen, wType; DWORD dwPackSeq; diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 11aa521a24..b1930d519f 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -173,7 +173,7 @@ void g_MenuUninit(void) } -INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM lParam) +INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM) { DWORD dwUin = getContactUin(hContact); char url[256]; @@ -223,7 +223,7 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // OnPreBuildStatusMenu event -int CIcqProto::OnPreBuildStatusMenu(WPARAM wParam, LPARAM lParam) +int CIcqProto::OnPreBuildStatusMenu(WPARAM, LPARAM) { InitXStatusItems(TRUE); return 0; diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index b2965b9888..0227dd5ed1 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -265,7 +265,7 @@ CIcqProto::~CIcqProto() //////////////////////////////////////////////////////////////////////////////////////// // OnModulesLoadedEx - performs hook registration -int CIcqProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam) +int CIcqProto::OnModulesLoaded(WPARAM, LPARAM) { char pszP2PName[MAX_PATH]; char pszGroupsName[MAX_PATH]; @@ -298,7 +298,7 @@ int CIcqProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -int CIcqProto::OnPreShutdown(WPARAM wParam, LPARAM lParam) +int CIcqProto::OnPreShutdown(WPARAM, LPARAM) { // signal info update thread to stop icq_InfoUpdateCleanup(); @@ -551,8 +551,7 @@ int __cdecl CIcqProto::FileCancel(MCONTACT hContact, HANDLE hTransfer) return 1; // Invalid transfer if (dwUin && ft->ft_magic == FT_MAGIC_ICQ) { // cancel old fashioned file transfer - filetransfer * ft = (filetransfer*)hTransfer; - icq_CancelFileTransfer(hContact, ft); + icq_CancelFileTransfer((filetransfer*)hTransfer); return 0; // Success } else if (ft->ft_magic == FT_MAGIC_OSCAR) { // cancel oscar file transfer @@ -983,7 +982,7 @@ int __cdecl CIcqProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CIcqProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) +int __cdecl CIcqProto::RecvUrl(MCONTACT, PROTORECVEVENT*) { return 1; } @@ -992,7 +991,7 @@ int __cdecl CIcqProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) +int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int, int nContacts, MCONTACT *hContactsList) { if (hContact && hContactsList) { int i; @@ -1164,7 +1163,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int flags, int nContacts, char *pBody, *pBuffer = pBody = (char *)SAFE_MALLOC(nBodyLength); null_strcpy(pBuffer, szCount, nBodyLength - 1); pBuffer += mir_strlen(pBuffer); - *pBuffer++ = (char)0xFE; + *pBuffer++ = char(0xFE); for (i = 0; i < nContacts; i++) { if (contacts[i].uin) { _itoa(contacts[i].uin, szContactUin, 10); @@ -1173,10 +1172,10 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int flags, int nContacts, else strcpy(pBuffer, contacts[i].uid); pBuffer += mir_strlen(pBuffer); - *pBuffer++ = (char)0xFE; + *pBuffer++ = char(0xFE); strcpy(pBuffer, contacts[i].szNick); pBuffer += mir_strlen(pBuffer); - *pBuffer++ = (char)0xFE; + *pBuffer++ = char(0xFE); } for (i = 0; i < nContacts; i++) { // release memory @@ -1188,7 +1187,7 @@ int __cdecl CIcqProto::SendContacts(MCONTACT hContact, int flags, int nContacts, cookie_message_data *pCookieData = CreateMessageCookieData(MTYPE_CONTACTS, hContact, dwUin, TRUE); if (m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0)) { - int iRes = icq_SendDirectMessage(hContact, pBody, nBodyLength, 1, pCookieData, NULL); + int iRes = icq_SendDirectMessage(hContact, pBody, nBodyLength, pCookieData, NULL); if (iRes) { SAFE_FREE((void**)&pBody); @@ -1401,7 +1400,7 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) // Set up the ack type pCookieData = CreateMessageCookieData(MTYPE_PLAIN, hContact, dwUin, TRUE); pCookieData->nAckType = ACKTYPE_CLIENT; - dwCookie = icq_SendDirectMessage(hContact, dc_msg, mir_strlen(dc_msg), 1, pCookieData, dc_cap); + dwCookie = icq_SendDirectMessage(hContact, dc_msg, mir_strlen(dc_msg), pCookieData, dc_cap); SAFE_FREE(&szUserAnsi); if (dwCookie) { // free the buffers if alloced @@ -1474,7 +1473,7 @@ int __cdecl CIcqProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc) //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int flags, const char* url) +int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int, const char* url) { if (hContact == NULL || url == NULL) return 0; @@ -1501,11 +1500,11 @@ int __cdecl CIcqProto::SendUrl(MCONTACT hContact, int flags, const char* url) size_t nBodyLen = nUrlLen + nDescLen + 2; char *szBody = (char *)_alloca(nBodyLen); strcpy(szBody, szDesc); - szBody[nDescLen] = (char)0xFE; // Separator + szBody[nDescLen] = char(0xFE); // Separator strcpy(szBody + nDescLen + 1, url); if (m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0)) { - int iRes = icq_SendDirectMessage(hContact, szBody, nBodyLen, 1, pCookieData, NULL); + int iRes = icq_SendDirectMessage(hContact, szBody, nBodyLen, pCookieData, NULL); if (iRes) return iRes; // we succeded, return } @@ -1840,7 +1839,7 @@ HANDLE __cdecl CIcqProto::GetAwayMsg(MCONTACT hContact) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG - processes received status mode message -int __cdecl CIcqProto::RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt) +int __cdecl CIcqProto::RecvAwayMsg(MCONTACT hContact, int, PROTORECVEVENT* evt) { if (evt->flags & PREF_UTF) { setStatusMsgVar(hContact, evt->szMessage, false); diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 82712c208e..cd51336809 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -254,7 +254,7 @@ struct CIcqProto : public PROTO void icq_sendFileDenyDirect(MCONTACT hContact, filetransfer *ft, const char *szReason); int icq_sendFileSendDirectv7(filetransfer *ft, const char *pszFiles); int icq_sendFileSendDirectv8(filetransfer *ft, const char *pszFiles); - DWORD icq_SendDirectMessage(MCONTACT hContact, const char *szMessage, size_t nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap); + DWORD icq_SendDirectMessage(MCONTACT hContact, const char *szMessage, size_t nBodyLength, cookie_message_data *pCookieData, char *szCap); void icq_sendXtrazRequestDirect(MCONTACT hContact, DWORD dwCookie, char* szBody, size_t nBodyLen, WORD wType); void icq_sendXtrazResponseDirect(MCONTACT hContact, WORD wCookie, char* szBody, size_t nBodyLen, WORD wType); @@ -284,25 +284,25 @@ struct CIcqProto : public PROTO void handleMsgFam(BYTE *pBuffer, size_t wBufferLength, snac_header *pSnacHeader); - void handleReplyICBM(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleRecvServMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, DWORD dwRef); - void handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, DWORD dwRef); + void handleReplyICBM(); + void handleRecvServMsg(BYTE *buf, size_t wLen, DWORD dwRef); + void handleRecvServMsgType1(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwRef); + void handleRecvServMsgType2(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2); void handleRecvServMsgType4(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, DWORD dwRef); - void handleRecvServMsgError(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleRecvMsgResponse(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleServerAck(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags); - void handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleMissedMsg(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); - void handleOffineMessagesReply(BYTE *buf, size_t wLen, WORD wFlags, DWORD dwRef); + void handleRecvServMsgError(BYTE *buf, size_t wLen, DWORD dwRef); + void handleRecvMsgResponse(BYTE *buf, size_t wLen); + void handleServerAck(BYTE *buf, size_t wLen, DWORD dwRef); + void handleStatusMsgReply(const char *szPrefix, MCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg); + void handleTypingNotification(BYTE *buf, size_t wLen); + void handleMissedMsg(BYTE *buf, size_t wLen); + void handleOffineMessagesReply(DWORD dwRef); void handleRecvServMsgContacts(BYTE *buf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand); void handleRuntimeError(WORD wError); void parseServRelayData(BYTE *pDataBuf, size_t wLen, MCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType); - void parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, MCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion); + void parseServRelayPluginData(BYTE *pDataBuf, size_t wLen, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion); - HANDLE handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD wVersion, int type, size_t wMsgLen, PBYTE buf, BYTE bFlags, int nMsgFlags); + HANDLE handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD wVersion, int type, PBYTE buf, BYTE bFlags); void handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, DWORD dwMsgID, DWORD dwMsgID2, WORD wCookie, WORD wVersion, int type, int flags, WORD wAckType, size_t dwDataLen, size_t wMsgLen, char *pMsg, int nMsgFlags, message_ack_params *pAckParams); void sendMessageTypesAck(MCONTACT hContact, int bUnicode, message_ack_params *pArgs); void sendTypingNotification(MCONTACT hContact, WORD wMTNCode); @@ -336,9 +336,9 @@ struct CIcqProto : public PROTO void handleServerCListRightsReply(BYTE *buf, size_t wLen); void handleServerCListAck(cookie_servlist_action* sc, WORD wError); void handleServerCListReply(BYTE *buf, size_t wLen, WORD wFlags, serverthread_info *info); - void handleServerCListItemAdd(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData); - void handleServerCListItemUpdate(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData); - void handleServerCListItemDelete(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData); + void handleServerCListItemAdd(WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData); + void handleServerCListItemUpdate(const char *szRecordName, WORD wItemType, oscar_tlv_chain *pItemData); + void handleServerCListItemDelete(const char *szRecordName, WORD wItemId, WORD wItemType); void handleRecvAuthRequest(BYTE *buf, size_t wLen); void handleRecvAuthResponse(BYTE *buf, size_t wLen); void handleRecvAdded(BYTE *buf, size_t wLen); @@ -366,13 +366,13 @@ struct CIcqProto : public PROTO int parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfoRecordItem pRecordDef[], int nRecordDef, int nMaxRecords); void handleDirectoryQueryResponse(BYTE *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype, WORD wFlags); - void handleDirectoryUpdateResponse(BYTE *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype); + void handleDirectoryUpdateResponse(BYTE *databuf, size_t wPacketLen, WORD wCookie); - void parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType); - void parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType); + void parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain *cDetails, cookie_directory_data *pCookieData, WORD wReplySubType); + void parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCookie, WORD wReplySubType); void parseSearchReplies(unsigned char *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype, BYTE bResultCode); - void parseUserInfoUpdateAck(unsigned char *databuf, size_t wPacketLen, WORD wCookie, WORD wReplySubtype, BYTE bResultCode); + void parseUserInfoUpdateAck(WORD wCookie, WORD wReplySubtype, BYTE bResultCode); void ReleaseSearchCookie(DWORD dwCookie, cookie_search *pCookie); @@ -392,8 +392,8 @@ struct CIcqProto : public PROTO void requestAvatarConnection(); void __cdecl AvatarThread(avatars_server_connection *pInfo); - void handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, size_t nDataLen); - void handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *pHash, size_t nHashLen, WORD wOldStatus); + void handleAvatarOwnerHash(BYTE bFlags, BYTE *pData, size_t nDataLen); + void handleAvatarContactHash(DWORD dwUIN, char *szUID, MCONTACT hContact, BYTE *pHash, size_t nHashLen); avatars_request *ReleaseAvatarRequestInQueue(avatars_request *request); @@ -409,7 +409,7 @@ struct CIcqProto : public PROTO void StopAvatarThread(); //----| icq_clients.cpp |------------------------------------------------------------- - const char* detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, BYTE bDirectFlag, DWORD dwDirectCookie, DWORD dwWebPort, BYTE *caps, size_t wLen, BYTE *bClientId, char *szClientBuf); + const char* detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, DWORD dwDirectCookie, DWORD dwWebPort, BYTE *caps, size_t wLen, BYTE *bClientId, char *szClientBuf); //----| icq_db.cpp |------------------------------------------------------------------ HANDLE AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob); @@ -456,16 +456,16 @@ struct CIcqProto : public PROTO //----| icq_directmsg.cpp |----------------------------------------------------------- void handleDirectMessage(directconnect* dc, PBYTE buf, size_t wLen); - void handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t wLen, WORD wCommand, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, WORD wStatus, WORD wFlags, char* pszText); + void handleDirectGreetingMessage(directconnect* dc, PBYTE buf, size_t wLen, WORD wCommand, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, WORD wStatus, WORD wFlags); //----| icq_filerequests.cpp |-------------------------------------------------------- filetransfer* CreateFileTransfer(MCONTACT hContact, DWORD dwUin, int nVersion); - void handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus, char* pszText); - void handleFileRequest(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC); - void handleDirectCancel(directconnect *dc, PBYTE buf, size_t wLen, WORD wCommand, DWORD dwCookie, WORD wMessageType, WORD wStatus, WORD wFlags, char* pszText); + void handleFileAck(PBYTE buf, size_t wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus); + void handleFileRequest(PBYTE buf, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC); + void handleDirectCancel(void); - void icq_CancelFileTransfer(MCONTACT hContact, filetransfer* ft); + void icq_CancelFileTransfer(filetransfer* ft); //----| icq_filetransfer.cpp |-------------------------------------------------------- void icq_AcceptFileTransfer(MCONTACT hContact, filetransfer *ft); @@ -664,7 +664,7 @@ struct CIcqProto : public PROTO void removeGroupPathLinks(WORD wGroupID); int getServListGroupLevel(WORD wGroupId); - void resetServContactAuthState(MCONTACT hContact, DWORD dwUin); + void resetServContactAuthState(MCONTACT hContact); void FlushSrvGroupsCache(); int getCListGroupExists(const char *szGroup); @@ -790,14 +790,14 @@ struct CIcqProto : public PROTO void updateServerCustomStatus(int fullUpdate); //----| icq_xtraz.cpp |--------------------------------------------------------------- - void handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, size_t nMsgLen, BOOL bThruDC); - void handleXtrazNotifyResponse(DWORD dwUin, MCONTACT hContact, WORD wCookie, char* szMsg, size_t nMsgLen); + void handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char *szMsg, size_t nMsgLen, BOOL bThruDC); + void handleXtrazNotifyResponse(MCONTACT hContact, WORD wCookie, char* szMsg); - void handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, size_t nMsgLen, BOOL bThruDC); - void handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, size_t nMsgLen, BOOL bThruDC); + void handleXtrazInvitation(DWORD dwUin, char *szMsg, BOOL bThruDC); + void handleXtrazData(DWORD dwUin, char *szMsg, BOOL bThruDC); - DWORD SendXtrazNotifyRequest(MCONTACT hContact, char* szQuery, char* szNotify, int bForced); - void SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szResponse, size_t nResponseLen, BOOL bThruDC); + DWORD SendXtrazNotifyRequest(MCONTACT hContact, char *szQuery, char *szNotify, int bForced); + void SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char *szResponse, size_t nResponseLen, BOOL bThruDC); //----| init.cpp |-------------------------------------------------------------------- void UpdateGlobalSettings(); diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 93bf040dee..d0f0f1b442 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -77,7 +77,6 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) WORD wItemAction; icq_packet groupPacket = { 0 }; icq_packet groupPacket2 = { 0 }; - cookie_servlist_action* pGroupCookie = NULL; int nEndOperations; // first check if the state is calm @@ -1658,7 +1657,7 @@ int CIcqProto::servlistCreateGroup_gotParentGroup(const char *szGroup, WORD wGro } -int CIcqProto::servlistCreateGroup_Ready(const char *szGroup, WORD groupID, LPARAM param, int nResult) +int CIcqProto::servlistCreateGroup_Ready(const char *szGroup, WORD groupID, LPARAM, int nResult) { WORD wGroupID = 0; @@ -1690,17 +1689,12 @@ int CIcqProto::servlistCreateGroup_Ready(const char *szGroup, WORD groupID, LPAR } } else { // this is a sub-group - char* szSub = null_strdup(szGroup); // create subgroup, recursive, event-driven, possibly relocate - cookie_servlist_action* ack; - char *szLast; - - if (strstrnull(szSub, "\\")) { // determine parent group - szLast = strrchr(szSub, '\\') + 1; + char *szSub = null_strdup(szGroup); // create subgroup, recursive, event-driven, possibly relocate + char *szLast = strrchr(szSub, '\\') + 1; + szLast[-1] = '\0'; - szLast[-1] = '\0'; - } // make parent group id - ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)); + cookie_servlist_action *ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)); if (ack) { ack->szGroupName = null_strdup(szLast); // groupname servlistCreateGroup(szSub, (LPARAM)ack, &CIcqProto::servlistCreateGroup_gotParentGroup); @@ -1722,7 +1716,8 @@ void CIcqProto::servlistCreateGroup(const char *szGroupPath, LPARAM param, PENDI { char *szGroup = (char*)szGroupPath; - if (!mir_strlen(szGroup)) szGroup = DEFAULT_SS_GROUP; + if (!mir_strlen(szGroup)) + szGroup = DEFAULT_SS_GROUP; servlistPendingAddGroup(szGroup, 0, 0, &CIcqProto::servlistCreateGroup_Ready, TRUE, param, callback); } @@ -1733,7 +1728,7 @@ void CIcqProto::servlistCreateGroup(const char *szGroupPath, LPARAM param, PENDI * */ -int CIcqProto::servlistAddContact_gotGroup(const char *szGroup, WORD wGroupID, LPARAM lParam, int nResult) +int CIcqProto::servlistAddContact_gotGroup(const char*, WORD wGroupID, LPARAM lParam, int nResult) { cookie_servlist_action* ack = (cookie_servlist_action*)lParam; if (ack) @@ -1774,7 +1769,7 @@ int CIcqProto::servlistAddContact_gotGroup(const char *szGroup, WORD wGroupID, L } // Need to be called when Pending Contact is active -int CIcqProto::servlistAddContact_Ready(MCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM lParam, int nResult) +int CIcqProto::servlistAddContact_Ready(MCONTACT hContact, WORD, WORD, LPARAM lParam, int nResult) { cookie_servlist_action* ack = (cookie_servlist_action*)lParam; @@ -1944,7 +1939,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew return CALLBACK_RESULT_CONTINUE; } -int CIcqProto::servlistMoveContact_Ready(MCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) +int CIcqProto::servlistMoveContact_Ready(MCONTACT, WORD contactID, WORD groupID, LPARAM lParam, int nResult) { cookie_servlist_action *ack = (cookie_servlist_action*)lParam; @@ -2237,7 +2232,7 @@ void CIcqProto::servlistRemoveGroup(const char *szGroup, WORD wGroupId) servlistPendingAddGroup(szGroup, wGroupId, (LPARAM)ack, &CIcqProto::servlistRemoveGroup_Ready, TRUE); } -void CIcqProto::resetServContactAuthState(MCONTACT hContact, DWORD dwUin) +void CIcqProto::resetServContactAuthState(MCONTACT hContact) { WORD wContactId = getWord(hContact, DBSETTING_SERVLIST_ID, 0); WORD wGroupId = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); @@ -2301,7 +2296,7 @@ int CIcqProto::ServListDbSettingChanged(WPARAM hContact, LPARAM lParam) } -int CIcqProto::ServListDbContactDeleted(WPARAM hContact, LPARAM lParam) +int CIcqProto::ServListDbContactDeleted(WPARAM hContact, LPARAM) { DeleteFromContactsCache(hContact); diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index bbbb5c00d6..43cd5eba33 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -624,10 +624,8 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa // we have a group the contact should be in, move it if (wNewGroupId && (wNewGroupId != wCurrentGroupId)) { WORD wCurrentContactId = ppro->getWord(hContact, DBSETTING_SERVLIST_ID, 0); - BYTE bAuth = ppro->getByte(hContact, "Auth", 0); pszNick = ppro->getSettingStringUtf(hContact, "CList", "MyHandle", NULL); - if (pszNick) AppendToUploadLog(hwndDlg, ICQTranslateUtfStatic(LPGEN("Moving %s to group \"%s\"..."), str, MAX_PATH), pszNick, pszGroup); else diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index d56b9ee957..af99fd5ec2 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -35,7 +35,7 @@ static HANDLE hXStatusIcons[XSTATUS_COUNT]; static int hXStatusCListIcons[XSTATUS_COUNT]; static BOOL bXStatusCListIconsValid[XSTATUS_COUNT]; -int OnReloadIcons(WPARAM wParam, LPARAM lParam) +int OnReloadIcons(WPARAM, LPARAM) { memset(bXStatusCListIconsValid, 0, sizeof(bXStatusCListIconsValid)); return 0; @@ -829,7 +829,7 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) } } -INT_PTR CIcqProto::menuXStatus(WPARAM wParam,LPARAM lParam,LPARAM fParam) +INT_PTR CIcqProto::menuXStatus(WPARAM, LPARAM, LPARAM fParam) { setXStatusEx((BYTE)fParam, 0); return 0; @@ -906,7 +906,7 @@ void InitXStatusIcons() memset(hXStatusCListIcons, -1, sizeof(hXStatusCListIcons)); } -INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM lParam) +INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM) { InitXStatusData init; init.ppro = this; @@ -917,7 +917,7 @@ INT_PTR CIcqProto::ShowXStatusDetails(WPARAM hContact, LPARAM lParam) return 0; } -INT_PTR CIcqProto::SetXStatusEx(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::SetXStatusEx(WPARAM, LPARAM lParam) { CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam; @@ -1085,7 +1085,7 @@ INT_PTR CIcqProto::GetXStatusIcon(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CIcqProto::RequestXStatusDetails(WPARAM hContact, LPARAM lParam) +INT_PTR CIcqProto::RequestXStatusDetails(WPARAM hContact, LPARAM) { if (!m_bXStatusEnabled) return 0; @@ -1097,7 +1097,7 @@ INT_PTR CIcqProto::RequestXStatusDetails(WPARAM hContact, LPARAM lParam) return 0; } -INT_PTR CIcqProto::RequestAdvStatusIconIdx(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::RequestAdvStatusIconIdx(WPARAM wParam, LPARAM) { if (!m_bXStatusEnabled && !m_bMoodsEnabled) return -1; diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index 0e2d4199e4..b5c31adfb3 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -167,7 +167,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w else debugLogA("Error: Invalid Xtraz Notify message"); } -void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, MCONTACT hContact, WORD wCookie, char* szMsg, size_t nMsgLen) +void CIcqProto::handleXtrazNotifyResponse(MCONTACT hContact, WORD wCookie, char* szMsg) { char *szMem, *szRes, *szEnd; size_t nResLen; @@ -263,7 +263,7 @@ void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, MCONTACT hContact, WORD w else debugLogA("Error: Invalid Xtraz Notify response"); } -static char* getXmlPidItem(const char* szData, size_t nLen) +static char* getXmlPidItem(const char* szData) { const char *szPid = strstrnull(szData, ""); const char *szEnd = strstrnull(szData, ""); @@ -276,13 +276,13 @@ static char* getXmlPidItem(const char* szData, size_t nLen) } -void CIcqProto::handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, size_t nMsgLen, BOOL bThruDC) +void CIcqProto::handleXtrazInvitation(DWORD dwUin, char* szMsg, BOOL bThruDC) { MCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact) // user sent us xtraz, he supports it SetContactCapabilities(hContact, CAPF_XTRAZ); - char *szPluginID = getXmlPidItem(szMsg, nMsgLen); + char *szPluginID = getXmlPidItem(szMsg); if (!strcmpnull(szPluginID, "ICQChatRecv")) // it is a invitation to multi-user chat ; else @@ -292,16 +292,13 @@ void CIcqProto::handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WO } -void CIcqProto::handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, size_t nMsgLen, BOOL bThruDC) +void CIcqProto::handleXtrazData(DWORD dwUin, char* szMsg, BOOL bThruDC) { - MCONTACT hContact; - char* szPluginID; - - hContact = HContactFromUIN(dwUin, NULL); + MCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact) // user sent us xtraz, he supports it SetContactCapabilities(hContact, CAPF_XTRAZ); - szPluginID = getXmlPidItem(szMsg, nMsgLen); + char *szPluginID = getXmlPidItem(szMsg); if (!strcmpnull(szPluginID, "viewCard")) { // it is a greeting card char *szWork, *szEnd, *szUrl, *szNum; diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 7f64de8f3a..bc2e768e80 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -29,19 +29,19 @@ #include "icqoscar.h" -INT_PTR CIcqProto::AddServerContact(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::AddServerContact(WPARAM hContact, LPARAM) { if (!m_bSsiEnabled) return 0; // Does this contact have a UID? DWORD dwUin; uid_str szUid; - if (!getContactUid(wParam, &dwUin, &szUid) && !getWord(wParam, DBSETTING_SERVLIST_ID, 0) && !getWord(wParam, DBSETTING_SERVLIST_IGNORE, 0)) { + if (!getContactUid(hContact, &dwUin, &szUid) && !getWord(hContact, DBSETTING_SERVLIST_ID, 0) && !getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0)) { /// TODO: remove possible 0x6A TLV in contact server-list data!!! // Read group from DB - char *pszGroup = getContactCListGroup(wParam); + char *pszGroup = getContactCListGroup(hContact); - servlistAddContact(wParam, pszGroup); + servlistAddContact(hContact, pszGroup); SAFE_FREE((void**)&pszGroup); } return 0; @@ -151,7 +151,7 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM hContact, LPARAM lParam) return rc; } -INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::ChangeInfoEx(WPARAM wParam, LPARAM) { if (!icqOnline() || !wParam) return 0; @@ -401,7 +401,7 @@ INT_PTR CIcqProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) } -INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM) { if (icqOnline() && wParam != 0) { DWORD dwUin; @@ -418,7 +418,7 @@ INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM lParam) return 0; } -int CIcqProto::OnIdleChanged(WPARAM wParam, LPARAM lParam) +int CIcqProto::OnIdleChanged(WPARAM, LPARAM lParam) { int bIdle = (lParam & IDF_ISIDLE); int bPrivacy = (lParam & IDF_PRIVACY); @@ -434,7 +434,7 @@ int CIcqProto::OnIdleChanged(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR CIcqProto::RevokeAuthorization(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::RevokeAuthorization(WPARAM wParam, LPARAM) { if (icqOnline() && wParam != 0) { DWORD dwUin; @@ -460,7 +460,7 @@ INT_PTR CIcqProto::SendSms(WPARAM wParam, LPARAM lParam) return 0; // Failure } -INT_PTR CIcqProto::SendYouWereAdded(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::SendYouWereAdded(WPARAM, LPARAM lParam) { if (lParam && icqOnline()) { CCSDATA* ccs = (CCSDATA*)lParam; @@ -482,7 +482,7 @@ INT_PTR CIcqProto::SendYouWereAdded(WPARAM wParam, LPARAM lParam) return 1; // Failure } -INT_PTR CIcqProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) +INT_PTR CIcqProto::SetMyAvatar(WPARAM, LPARAM lParam) { TCHAR* tszFile = (TCHAR*)lParam; int iRet = -1; @@ -610,7 +610,7 @@ void CIcqProto::ICQAddRecvEvent(MCONTACT hContact, WORD wType, PROTORECVEVENT* p AddEvent(hContact, wType, pre->timestamp, flags, cbBlob, pBlob); } -INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM wParam, LPARAM lParam) +INT_PTR __cdecl CIcqProto::IcqAddCapability(WPARAM, LPARAM lParam) { ICQ_CUSTOMCAP *icqCustomCapIn = (ICQ_CUSTOMCAP*)lParam; ICQ_CUSTOMCAP *icqCustomCap = new ICQ_CUSTOMCAP; @@ -638,7 +638,7 @@ INT_PTR __cdecl CIcqProto::IcqCheckCapability(WPARAM hContact, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -INT_PTR icq_getEventTextMissedMessage(WPARAM wParam, LPARAM lParam) +INT_PTR icq_getEventTextMissedMessage(WPARAM, LPARAM lParam) { DBEVENTGETTEXT *pEvent = (DBEVENTGETTEXT *)lParam; diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index f021d6ee6c..c980609206 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -50,14 +50,14 @@ PLUGININFOEX pluginInfo = { { 0x73a9615c, 0x7d4e, 0x4555, { 0xba, 0xdb, 0xee, 0x5, 0xdc, 0x92, 0x8e, 0xff } } // {73A9615C-7D4E-4555-BADB-EE05DC928EFF} }; -extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" PLUGININFOEX __declspec(dllexport) *MirandaPluginInfoEx(DWORD) { return &pluginInfo; } extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; @@ -79,7 +79,7 @@ static int icqProtoUninit(PROTO_INTERFACE* ppro) return 0; } -int ModuleLoad(WPARAM wParam, LPARAM lParam) +int ModuleLoad(WPARAM, LPARAM) { bPopupService = ServiceExists(MS_POPUP_ADDPOPUPT); return 0; diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 455b45ef4e..727c279d2c 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -251,7 +251,6 @@ DWORD oft_calc_checksum(int offset, const BYTE *buffer, int len, DWORD dwChecksu for (int i = 0; i < len; i++) { WORD val = buffer[i]; - DWORD oldchecksum = checksum; if (((i + offset) & 1) == 0) val = val << 8; @@ -696,7 +695,7 @@ static void oft_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, v static char* oftGetFileContainer(oscar_filetransfer* oft, const char** files, int iFile) { char szPath[MAX_PATH]; - char* szFileName = FindFilePathContainer(files, iFile, szPath); + FindFilePathContainer(files, iFile, szPath); char *szPathUtf = ansi_to_utf8(szPath); int i; @@ -887,7 +886,7 @@ HANDLE CIcqProto::oftFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR return hTransfer; // Success } -DWORD CIcqProto::oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason) +DWORD CIcqProto::oftFileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR*) { oscar_filetransfer *ft = (oscar_filetransfer*)hTransfer; DWORD dwUin; diff --git a/protocols/IcqOscarJ/src/tlv.cpp b/protocols/IcqOscarJ/src/tlv.cpp index 33fe38f7cd..d928e01205 100644 --- a/protocols/IcqOscarJ/src/tlv.cpp +++ b/protocols/IcqOscarJ/src/tlv.cpp @@ -32,7 +32,7 @@ /* set maxTlvs<=0 to get all TLVs in length, or a positive integer to get at most the first n */ oscar_tlv_chain* readIntoTLVChain(BYTE **buf, size_t wLen, int maxTlvs) { - oscar_tlv_chain *now, *last, *chain = NULL; + oscar_tlv_chain *now, *last = NULL, *chain = NULL; WORD now_tlv_len; if (!buf || !wLen) @@ -280,7 +280,7 @@ void disposeChain(oscar_tlv_chain **chain) oscar_tlv_record_list* readIntoTLVRecordList(BYTE **buf, size_t wLen, int nCount) { - oscar_tlv_record_list *list = NULL, *last; + oscar_tlv_record_list *list = NULL, *last = NULL; while (wLen >= 2) { WORD wRecordSize; -- cgit v1.2.3