From 33953cc6a0fab6a91af293c6838f8a46dd7922da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 14:42:51 +0000 Subject: HCONTACT, part 3 git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/AimOscar/src/proto.cpp | 2 +- protocols/AimOscar/src/services.cpp | 2 +- protocols/FacebookRM/src/messages.cpp | 2 -- protocols/FacebookRM/src/proto.cpp | 16 ++++++------ protocols/FacebookRM/src/theme.cpp | 6 ++--- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 6 ++--- protocols/Gadu-Gadu/src/gg_proto.cpp | 10 ++++---- protocols/Gadu-Gadu/src/oauth.cpp | 2 +- protocols/IRCG/src/input.cpp | 2 +- protocols/IRCG/src/ircproto.cpp | 4 +-- protocols/JabberG/src/jabber_archive.cpp | 4 +-- protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 2 +- protocols/MSN/src/msn_commands.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 14 +++++----- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/Omegle/src/chat.cpp | 2 +- protocols/Omegle/src/proto.h | 2 +- protocols/SkypeClassic/src/skype.cpp | 32 +++++++++++------------ protocols/SkypeClassic/src/skypeapi.cpp | 5 ++-- protocols/SkypeClassic/src/voiceservice.cpp | 10 +++----- protocols/Tlen/src/tlen_misc.cpp | 2 +- protocols/Tlen/src/tlen_svc.cpp | 12 ++++----- protocols/Twitter/src/theme.cpp | 4 +-- protocols/Xfire/src/Xfire_avatar_loader.cpp | 3 ++- protocols/Xfire/src/Xfire_avatar_loader.h | 4 +-- protocols/Xfire/src/main.cpp | 13 +++++----- protocols/Xfire/src/recvremovebuddypacket.h | 40 ++++++++++++++--------------- protocols/Xfire/src/userdetails.cpp | 4 +-- protocols/Yahoo/src/im.cpp | 10 ++++---- protocols/Yahoo/src/proto.cpp | 4 +-- protocols/Yahoo/src/yahoo.cpp | 20 +++++++-------- 34 files changed, 123 insertions(+), 126 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index d47a759b62..c7001071cc 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -733,7 +733,7 @@ HANDLE __cdecl CAimProto::GetAwayMsg(HCONTACT hContact) switch (status) { case ID_STATUS_AWAY: case ID_STATUS_ONLINE: - ForkThread(&CAimProto::get_online_msg_thread, hContact); + ForkThread(&CAimProto::get_online_msg_thread, (void*)hContact); break; default: diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 3a484527b3..f2646551c0 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -392,7 +392,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (state == 1) { - ForkThread(&CAimProto::avatar_request_thread, AI->hContact); + ForkThread(&CAimProto::avatar_request_thread, (void*)AI->hContact); return GAIR_WAITFOR; } diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index a06efacc46..0efbe5ea1c 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -35,8 +35,6 @@ void FacebookProto::SendMsgWorker(void *p) if(p == NULL) return; -// ScopedLock s(facy.send_message_lock_, 500); - send_direct *data = static_cast(p); DBVARIANT dbv; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 2bb3659f87..ea869c4830 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -287,7 +287,7 @@ int FacebookProto::Authorize(HANDLE hDbEvent) return 1; HCONTACT hContact = HContactFromAuthEvent(hDbEvent); - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; return ApproveFriendship((WPARAM)hContact, NULL); @@ -299,7 +299,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) return 1; HCONTACT hContact = HContactFromAuthEvent(hDbEvent); - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; // TODO: hide from facebook requests list @@ -450,7 +450,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam) if (!isOnline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); wall_data *wall = new wall_data(); wall->user_id = ptrA(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -504,7 +504,7 @@ INT_PTR FacebookProto::RefreshBuddyList(WPARAM, LPARAM) INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); std::string url = FACEBOOK_URL_PROFILE; @@ -527,7 +527,7 @@ INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) INT_PTR FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); if (wParam == 0 || !IsMyContact(hContact)) return 1; @@ -547,7 +547,7 @@ INT_PTR FacebookProto::Poke(WPARAM wParam,LPARAM lParam) if (wParam == NULL || isOffline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) @@ -564,7 +564,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) bool deleting = (lParam == 1); - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); // Ignore groupchats and, if deleting, also not-friends if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) != CONTACT_FRIEND)) @@ -601,7 +601,7 @@ INT_PTR FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) if (wParam == NULL || isOffline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index e0b7fd134e..61025d53d3 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -69,7 +69,7 @@ static FacebookProto * GetInstanceByHContact(HCONTACT hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - FacebookProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + FacebookProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? (proto->*Fcn)(wParam,lParam) : 0; } @@ -78,7 +78,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) for (size_t i=0; i(wParam)); + FacebookProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } @@ -152,7 +152,7 @@ void UninitContactMenus() int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); bool bIsChatroom = isChatRoom(hContact); Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 562468c5e9..2c210c57a7 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1035,7 +1035,7 @@ retry: { struct gg_dcc7 *dcc7 = e->event.dcc7_new; debugLogA("mainthread() (%x): Incoming direct connection.", this); - dcc7->contact = getcontact(dcc7->peer_uin, 0, 0, NULL); + dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, NULL); // Check if user is on the list and if it is my uin if (!dcc7->contact || getDword(GG_KEY_UIN, -1) != dcc7->uin) { diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 38a38bf22c..14d4f6bd62 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,7 +381,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Add file recv request { // Make new ggtransfer struct - local_dcc->contact = getcontact(local_dcc->peer_uin, 0, 0, NULL); + local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL); TCHAR* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename); PROTORECVFILET pre = {0}; @@ -952,7 +952,7 @@ HANDLE GGPROTO::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROT list_add(&watches, dcc7, 0); // Store handle - dcc7->contact = hContact; + dcc7->contact = (void*)hContact; dcc7->folder = _strdup(filename); dcc7->tick = 0; // Make folder name @@ -1006,7 +1006,7 @@ HANDLE GGPROTO::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROT if (dcc->fd != -1) list_add(&watches, dcc, 0); // Store handle - dcc->contact = hContact; + dcc->contact = (void*)hContact; dcc->folder = _strdup(filename); dcc->tick = 0; // Make folder name diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index b3ad11201c..1d8e211195 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -206,7 +206,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -224,7 +224,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 2, "sess_mutex", 1); @@ -238,7 +238,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -255,7 +255,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 2, "sess_mutex", 1); @@ -686,7 +686,7 @@ HANDLE GGPROTO::GetAwayMsg(HCONTACT hContact) #ifdef DEBUGMODE debugLogA("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread"); #endif - ForkThread(&GGPROTO::getawaymsgthread, hContact); + ForkThread(&GGPROTO::getawaymsgthread, (void*)hContact); return (HANDLE)1; } diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 8816eae8c3..6d4749f585 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -225,7 +225,7 @@ char *oauth_generate_nonce() mir_snprintf(timestamp, sizeof(timestamp), "%ld", time(NULL)); CallService(MS_UTILS_GETRANDOM, (WPARAM)sizeof(randnum), (LPARAM)randnum); - int strSizeB = strlen(timestamp) + sizeof(randnum); + int strSizeB = int(strlen(timestamp) + sizeof(randnum)); ptrA str((char *)mir_calloc(strSizeB + 1)); strcpy(str, timestamp); strncat(str, randnum, sizeof(randnum)); diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index a78fabf304..fbc43f7cec 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -555,7 +555,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HCONTACT hConta return true; CONTACT user = { (TCHAR*)one.c_str(), NULL, NULL, false, false, false }; - HANDLE hContact2 = CList_AddContact(&user, false, false); + HCONTACT hContact2 = CList_AddContact(&user, false, false); if (hContact2) { if (getByte(hContact, "AdvancedMode", 0) == 0) DoUserhostWithReason(1, (_T("S") + one).c_str(), true, one.c_str()); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 1a33ac9a73..a74fe449da 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -810,11 +810,11 @@ int __cdecl CIrcProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) BYTE bDcc = getByte(hContact, "DCC", 0); WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (bDcc && wStatus != ID_STATUS_ONLINE) { - ForkThread(&CIrcProto::AckMessageFailDcc, hContact); + ForkThread(&CIrcProto::AckMessageFailDcc, (void*)hContact); return 0; } if (!bDcc && (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)) { - ForkThread(&CIrcProto::AckMessageFail, hContact); + ForkThread(&CIrcProto::AckMessageFail, (void*)hContact); return 0; } diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 0786b363bf..11c972ca3b 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -95,7 +95,7 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) ///////////////////////////////////////////////////////////////////////////////////////// static DWORD dwPreviousTimeStamp = -1; -static HANDLE hPreviousContact = INVALID_HANDLE_VALUE; +static HCONTACT hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; static HANDLE hPreviousDbEvent = NULL; // Returns TRUE if the event already exist in the database @@ -240,7 +240,7 @@ BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO& dbei) } } // reset last event - hPreviousContact = INVALID_HANDLE_VALUE; + hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; return FALSE; } diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index d43a3b85ff..4e1ce74aa6 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1328,7 +1328,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_PRESENCE_NA: case IDM_PRESENCE_DND: case IDM_PRESENCE_FREE4CHAT: - if (HANDLE h = ppro->HContactFromJID(item->jid)) + if (HCONTACT h = ppro->HContactFromJID(item->jid)) ppro->OnMenuHandleDirectPresence((WPARAM)h, 0, gch->dwData); break; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index c069d7fb31..04f05dd3e8 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -458,7 +458,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); db_unset(hContact, "CList", "Hidden"); - chatRooms.insert(hContact); + chatRooms.insert((HANDLE)hContact); } else UpdateSubscriptionInfo(hContact, item); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index fad43be645..fc34abf429 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1276,7 +1276,7 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(HCONTACT hContact) { debugLogA("GetAwayMsg called, hContact=%08X", hContact); - ForkThread(&CJabberProto::GetAwayMsgThread, hContact); + ForkThread(&CJabberProto::GetAwayMsgThread, (void*)hContact); return (HANDLE)1; } diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9cdce62c55..56dc3e9807 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -496,7 +496,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para } else if (!_strnicmp(tContentType, "text/x-msnmsgr-datacast", 23)) { if (info->mJoinedContactsWLID.getCount()) { - HANDLE tContact; + HCONTACT tContact; if (info->mChatID[0]) { GC_INFO gci = { 0 }; diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 4e2a8bfb0e..704adaf6f4 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -106,13 +106,13 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch char* pCurBlob = (char*)alloca(pre.lParam); pre.szMessage = pCurBlob; - *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID - *(PHANDLE)pCurBlob = hContact; pCurBlob += sizeof(HANDLE); // Contact Handle - strcpy(pCurBlob, nick); pCurBlob += nicklen + 1; // Nickname - *pCurBlob = '\0'; pCurBlob++; // First Name - *pCurBlob = '\0'; pCurBlob++; // Last Name - strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail - strcpy(pCurBlob, reason); // Reason + *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID + *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle + strcpy(pCurBlob, nick); pCurBlob += nicklen + 1; // Nickname + *pCurBlob = '\0'; pCurBlob++; // First Name + *pCurBlob = '\0'; pCurBlob++; // Last Name + strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail + strcpy(pCurBlob, reason); // Reason ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); } diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8ce3a13620..7f4ad25621 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -846,7 +846,7 @@ void CMsnProto::MsnFakeAck(void* arg) Sleep(150); tParam->proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, tParam->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS, - (HCONTACT)tParam->id, LPARAM(tParam->msg)); + (HANDLE)tParam->id, LPARAM(tParam->msg)); delete tParam; } diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 1c14409e74..f9d1c75b0a 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -361,7 +361,7 @@ void OmegleProto::ClearChat() } // TODO: Could this be done better? -HANDLE OmegleProto::GetChatHandle() +HCONTACT OmegleProto::GetChatHandle() { /*if (facy.chatHandle_ != NULL) return facy.chatHandle_; diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 0827d7616c..f274dc0174 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -132,7 +132,7 @@ public: void SetChatStatus(int); void ClearChat(); void SetTopic(const TCHAR *topic = NULL); - HANDLE GetChatHandle(); + HCONTACT GetChatHandle(); // Connection client Omegle_client facy; diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 49e0c528b7..3a6b431f96 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1186,7 +1186,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free (ci.pszVal); } } - newlen = strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9; + newlen = int(strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9); if (pMsg = (char *)malloc(newlen)) { sprintf (pMsg, "** %s%s%s **", (pszUTFnick?pszUTFnick:""),(pszUTFnick?" ":""),(char*)msgptr); free (ptr); @@ -1211,9 +1211,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { __leave; } #ifdef _UNICODE - msglen = strlen(msg)+1; + msglen = (int)strlen(msg)+1; msgptr = (char*)make_unicode_string ((const unsigned char*)msgptr); - wcLen = (_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR); + wcLen = int(_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR); msg=(char*)realloc(msg, msglen+wcLen); memcpy (msg+msglen, msgptr, wcLen); free(msgptr); @@ -1222,8 +1222,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { msgptr = msg; free (ptr); } - msglen = strlen(msgptr)+1; - } else { + msglen = (int)strlen(msgptr)+1; + } + else { free (ptr); __leave; } @@ -1258,7 +1259,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszText = (TCHAR*)(msgptr+msglen); gce.dwFlags = GCEF_ADDTOLOG; CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - MsgList_Add (pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat + MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat if (ci.pszVal) mir_free (ci.pszVal); free_nonutf_tchar_string((void*)gce.ptszUID); free_nonutf_tchar_string((void*)gcd.ptszID); @@ -1298,7 +1299,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (pre.flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ; if (pre.flags & PREF_UTF) dbei.flags|=DBEF_UTF; dbei.eventType=EVENTTYPE_MESSAGE; - pme = MsgList_Add (pre.lParam, db_event_add(hContact, &dbei)); + pme = MsgList_Add(pre.lParam, db_event_add(hContact, &dbei)); // We could call MS_PROTO_CHAINSEND if we want to have MetaContact adding the history for us, // however we all know that CCSDATA doesn't contain timestamp-information which is @@ -1877,7 +1878,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if((WORD)SkypeStatusToMiranda(ptr+13) != ID_STATUS_OFFLINE) { LOG(("WndProc Status is not offline so get user info")); - pthread_create(GetInfoThread, hContact); + pthread_create(GetInfoThread, (void*)hContact); } } } @@ -2273,7 +2274,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break; } --iReentranceCnt; - return (DefWindowProc(hWndDlg, message, wParam, lParam)); + return DefWindowProc(hWndDlg, message, wParam, lParam); } LOG(("WM_COPYDATA exit (%08X)", message)); if (szSkypeMsg) free(szSkypeMsg); @@ -2358,17 +2359,16 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) return iRet; } -int __stdcall SendBroadcast( HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam ) +int __stdcall SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { - ACKDATA ack = {0}; - ack.cbSize = sizeof( ACKDATA ); + ACKDATA ack = { sizeof( ACKDATA ) }; ack.szModule = SKYPE_PROTONAME; ack.hContact = hContact; ack.type = type; ack.result = result; ack.hProcess = hProcess; ack.lParam = lParam; - return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); + return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack ); } static void __cdecl SkypeGetAwayMessageThread(void *hContact) @@ -2387,7 +2387,7 @@ INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam) UNREFERENCED_PARAMETER(wParam); - pthread_create(SkypeGetAwayMessageThread, ccs->hContact); + pthread_create(SkypeGetAwayMessageThread, (void*)ccs->hContact); return 1; } @@ -2649,7 +2649,7 @@ INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); - pthread_create(GetInfoThread, ccs->hContact); + pthread_create(GetInfoThread, (void*)ccs->hContact); return 0; } @@ -2932,7 +2932,7 @@ void CleanupNicknames(char *dummy) { continue; } db_unset(hContact, SKYPE_PROTONAME, "Nick"); - GetInfoThread(hContact); + GetInfoThread((void*)hContact); db_free(&dbv); db_free(&dbv2); } diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index 84e886b61a..310d26b975 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -811,14 +811,13 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_INITDIALOG: { HCONTACT hContact; - char *szProto; if (!db_get_s((HCONTACT)lParam, SKYPE_PROTONAME, "CallId", &dbv)) { // Check, if another call is in progress for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) { - szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); - if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact!=(HANDLE)lParam && + char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); + if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact != (HCONTACT)lParam && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0 && !db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv2)) { diff --git a/protocols/SkypeClassic/src/voiceservice.cpp b/protocols/SkypeClassic/src/voiceservice.cpp index 11b1f1becd..93181d0d4c 100644 --- a/protocols/SkypeClassic/src/voiceservice.cpp +++ b/protocols/SkypeClassic/src/voiceservice.cpp @@ -40,14 +40,11 @@ static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam) return VOICE_SUPPORTED | VOICE_CALL_CONTACT | VOICE_CAN_HOLD; } -static HANDLE FindContactByCallId(char *callId) +static HCONTACT FindContactByCallId(char *callId) { HCONTACT hContact; int iCmpRes; - for (hContact = db_find_first(); - hContact != NULL; - hContact = db_find_next(hContact)) - { + for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); DBVARIANT dbv; @@ -58,7 +55,8 @@ static HANDLE FindContactByCallId(char *callId) { iCmpRes = strcmp(callId, dbv.pszVal); db_free(&dbv); - if (iCmpRes == 0) return hContact; + if (iCmpRes == 0) + return hContact; } } diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index 670d014fc6..6aed4ecadc 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -63,7 +63,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5; pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob); *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); - *((PHANDLE)pCurBlob) = hContact; pCurBlob += sizeof(DWORD); + *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 034bfd0ea8..479026eb1b 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -219,7 +219,7 @@ HCONTACT TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr) HCONTACT hContact; TLEN_SEARCH_RESULT *jsr = (TLEN_SEARCH_RESULT*)psr; if (jsr->hdr.cbSize != sizeof(TLEN_SEARCH_RESULT)) - return (int) NULL; + return NULL; hContact = AddToListByJID(this, jsr->jid, flags); // wParam is flag e.g. PALF_TEMPORARY return hContact; } @@ -228,16 +228,16 @@ HCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEven { DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) - return (HANDLE) NULL; + return NULL; if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL) - return (HANDLE) NULL; + return NULL; if (db_event_get(hDbEvent, &dbei)) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } if (strcmp(dbei.szModule, m_szModuleName)) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } /* @@ -249,7 +249,7 @@ HCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEven if (dbei.eventType != EVENTTYPE_AUTHREQUEST) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 9d8de71c0e..81891adc44 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -68,7 +68,7 @@ static TwitterProto * GetInstanceByHContact(HCONTACT hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + TwitterProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? (proto->*Fcn)(wParam,lParam) : 0; } @@ -76,7 +76,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) { ShowContactMenus(false); - TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + TwitterProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp index 2e509d3b35..674329f762 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.cpp +++ b/protocols/Xfire/src/Xfire_avatar_loader.cpp @@ -66,7 +66,8 @@ void Xfire_avatar_loader::loadThread(LPVOID lparam) { return; } -BOOL Xfire_avatar_loader::loadAvatar(HANDLE hcontact,char*username,unsigned int userid) { +BOOL Xfire_avatar_loader::loadAvatar(HCONTACT hcontact,char*username,unsigned int userid) +{ Xfire_avatar_process process={0}; //struktur füllen diff --git a/protocols/Xfire/src/Xfire_avatar_loader.h b/protocols/Xfire/src/Xfire_avatar_loader.h index a51082629e..c6305270d1 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.h +++ b/protocols/Xfire/src/Xfire_avatar_loader.h @@ -37,7 +37,7 @@ using namespace xfirelib; struct Xfire_avatar_process { - HANDLE hcontact; + HCONTACT hcontact; char username[128]; unsigned int userid; }; @@ -50,7 +50,7 @@ private: public: vector list; BOOL threadrunning; - BOOL loadAvatar(HANDLE hcontact,char*username,unsigned int userid); + BOOL loadAvatar(HCONTACT hcontact,char*username,unsigned int userid); Xfire_avatar_loader(xfirelib::Client* client); ~Xfire_avatar_loader(); }; diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index bc9e744231..51d217717f 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -221,7 +221,7 @@ class XFireClient : public PacketListener { void getBuddyList(); void sendmsg(char*usr,char*msg); void setNick(char*nnick); - void handlingBuddy(HANDLE handle); + void handlingBuddy(HCONTACT handle); void CheckAvatar(BuddyListEntry* entry); private: @@ -259,11 +259,12 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) { } } -void XFireClient::handlingBuddy(HANDLE handle){ +void XFireClient::handlingBuddy(HCONTACT handle) +{ vector *entries = client->getBuddyList()->getEntries(); for(uint i = 0 ; i < entries->size() ; i ++) { BuddyListEntry *entry = entries->at(i); - if (entry->hcontact==handle) + if (entry->hcontact == handle) { handlingBuddys(entry,0,NULL); break; @@ -1373,10 +1374,10 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) if (myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE) { myClient->sendmsg(dbv.pszVal, ptrA( mir_utf8encode((char*)ccs->lParam))); - mir_forkthread(SendAck,ccs->hContact); + mir_forkthread(SendAck, (void*)ccs->hContact); sended=1; } - else mir_forkthread(SendBadAck,ccs->hContact); + else mir_forkthread(SendBadAck, (void*)ccs->hContact); db_free(&dbv); return sended; @@ -1684,7 +1685,7 @@ HCONTACT CList_FindContact (int uid) void CList_MakeAllOffline() { - vector fhandles; + vector fhandles; for (HCONTACT hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) { //freunde von freunden in eine seperate liste setzen //nur wenn das nicht abgestellt wurde diff --git a/protocols/Xfire/src/recvremovebuddypacket.h b/protocols/Xfire/src/recvremovebuddypacket.h index 87c75c0012..842163ad1a 100644 --- a/protocols/Xfire/src/recvremovebuddypacket.h +++ b/protocols/Xfire/src/recvremovebuddypacket.h @@ -29,26 +29,26 @@ #define XFIRE_RECVREMOVEBUDDYPACKET 139 namespace xfirelib { - class RecvRemoveBuddyPacket : public XFireRecvPacketContent { - public: - virtual ~RecvRemoveBuddyPacket() { } - int getPacketId() { return XFIRE_RECVREMOVEBUDDYPACKET; } - - XFirePacketContent *newPacket() { return new RecvRemoveBuddyPacket(); } - void parseContent(char *buf, int length, int numberOfAtts); - - long userid; - - /** - * I've added this attribute altough it is not part of the actual packet - * because by the time the packet content reaches the client - * application the user will no longer be in the BuddyList .. so no - * way for the client application to know which buddy was just removed. - * (it will be set by the BuddyList, not when parsing the packet) - */ - std::string username; - void* handle; // handle eingefügt, damit ich schnell den buddy killen kann - dufte - }; + class RecvRemoveBuddyPacket : public XFireRecvPacketContent { + public: + virtual ~RecvRemoveBuddyPacket() { } + int getPacketId() { return XFIRE_RECVREMOVEBUDDYPACKET; } + + XFirePacketContent *newPacket() { return new RecvRemoveBuddyPacket(); } + void parseContent(char *buf, int length, int numberOfAtts); + + long userid; + + /** + * I've added this attribute altough it is not part of the actual packet + * because by the time the packet content reaches the client + * application the user will no longer be in the BuddyList .. so no + * way for the client application to know which buddy was just removed. + * (it will be set by the BuddyList, not when parsing the packet) + */ + std::string username; + HCONTACT handle; // handle eingefügt, damit ich schnell den buddy killen kann - dufte + }; }; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index bb30eccb98..d2301f4fe6 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -85,7 +85,7 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HCONTACT hcontact,int type) } } -static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) +static int GetIPPortUDetails(HCONTACT wParam,char* feld1,char* feld2) { char temp[255]; HGLOBAL clipbuffer; @@ -185,7 +185,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam static WCHAR wpath[256]; static HICON gameicon=0; static HICON voiceicon=0; - static HANDLE uhandle=0; + static HCONTACT uhandle=0; static HWND listbox; LVCOLUMNA pcol; diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 224c65677b..fc295a4a42 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -174,7 +174,7 @@ void __cdecl CYahooProto::im_sendackfail_longmsg(void *hContact) int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { if (!m_bLoggedIn) {/* don't send message if we not connected! */ - ForkThread(&CYahooProto::im_sendackfail, hContact); + ForkThread(&CYahooProto::im_sendackfail, (void*)hContact); return 1; } @@ -187,7 +187,7 @@ int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSr msg = mir_utf8encode(pszSrc); if (lstrlenA(msg) > 800) { - ForkThread(&CYahooProto::im_sendackfail_longmsg, hContact); + ForkThread(&CYahooProto::im_sendackfail_longmsg, (void*)hContact); return 1; } @@ -195,7 +195,7 @@ int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSr if (!getString(hContact, YAHOO_LOGINID, &dbv)) { send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), msg, 1); - ForkThread(&CYahooProto::im_sendacksuccess, hContact); + ForkThread(&CYahooProto::im_sendacksuccess, (void*)hContact); db_free(&dbv); return 1; @@ -232,7 +232,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) debugLogA("[YAHOO_SENDNUDGE]"); if (!m_bLoggedIn) {/* don't send nudge if we not connected! */ - ForkThread(&CYahooProto::im_sendackfail, hContact); + ForkThread(&CYahooProto::im_sendackfail, (void*)hContact); return 1; } @@ -241,7 +241,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), "", 0); db_free(&dbv); - ForkThread(&CYahooProto::im_sendacksuccess, hContact); + ForkThread(&CYahooProto::im_sendacksuccess, (void*)hContact); return 1; } diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index b97c79b396..b607385fa0 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -339,7 +339,7 @@ void __cdecl CYahooProto::get_info_thread(void *hContact) int __cdecl CYahooProto::GetInfo(HCONTACT hContact, int /*infoType*/ ) { - ForkThread(&CYahooProto::get_info_thread, hContact); + ForkThread(&CYahooProto::get_info_thread, (void*)hContact); return 0; } @@ -591,7 +591,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(HCONTACT hContact) if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; /* user offline, what Status message? */ - ForkThread(&CYahooProto::get_status_thread, hContact); + ForkThread(&CYahooProto::get_status_thread, (void*)hContact); return (HANDLE)1; //Success } diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 9c5edf2f63..ef7fcfb7c0 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -831,36 +831,36 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha if (msg != NULL) pre.lParam += lstrlenA(msg); - pCurBlob=(PBYTE)malloc(pre.lParam); + pCurBlob = (PBYTE)malloc(pre.lParam); pre.szMessage = (char *)pCurBlob; // UIN - *( PDWORD )pCurBlob = 0; - pCurBlob+=sizeof(DWORD); + *(PDWORD)pCurBlob = 0; + pCurBlob += sizeof(DWORD); // hContact - *( PHANDLE )pCurBlob = hContact; - pCurBlob+=sizeof(HANDLE); + *(PDWORD)pCurBlob = (DWORD)hContact; + pCurBlob += sizeof(DWORD); // NICK - lstrcpyA((char *)pCurBlob, nick); + lstrcpyA((char*)pCurBlob, nick); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // FIRST - lstrcpyA((char *)pCurBlob, (fname != NULL) ? fname : ""); + lstrcpyA((char*)pCurBlob, (fname != NULL) ? fname : ""); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // LAST - lstrcpyA((char *)pCurBlob, (lname != NULL) ? lname : ""); + lstrcpyA((char*)pCurBlob, (lname != NULL) ? lname : ""); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // E-mail - lstrcpyA((char *)pCurBlob,who); + lstrcpyA((char*)pCurBlob,who); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // Reason - lstrcpyA((char *)pCurBlob, (msg != NULL) ? msg : ""); + lstrcpyA((char*)pCurBlob, (msg != NULL) ? msg : ""); ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); } -- cgit v1.2.3