From ddba4ede6b451d0cfcd0d32b5180fbd0689966bf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 08:04:30 +0000 Subject: - HANDLE hContact => HCONTACT - GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ContactsPlus/src/main.cpp | 19 ++++++++--------- plugins/ContactsPlus/src/receive.cpp | 10 ++++----- plugins/ContactsPlus/src/receive.h | 20 +++++++++--------- plugins/ContactsPlus/src/send.cpp | 40 ++++++++++++++++++------------------ plugins/ContactsPlus/src/send.h | 16 +++++++-------- plugins/ContactsPlus/src/utils.cpp | 10 ++++----- plugins/ContactsPlus/src/utils.h | 10 ++++----- 7 files changed, 61 insertions(+), 64 deletions(-) (limited to 'plugins/ContactsPlus') diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 7b20a0ace1..5d42d3db9c 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -59,7 +59,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hDbEvent = (HANDLE)lParam; //process the event DBEVENTINFO dbe = { sizeof(dbe) }; @@ -92,7 +92,7 @@ static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) static void ProcessUnreadEvents(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -117,7 +117,7 @@ static bool CheckContactsServiceSupport(const char* szProto) static int HookPreBuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *szProto = GetContactProto(hContact); int bVisible = FALSE; @@ -156,7 +156,7 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) static int HookContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (strcmpnull(cws->szModule, "CList") && strcmpnull(cws->szModule, szProto)) return 0; @@ -167,24 +167,21 @@ static int HookContactSettingChanged(WPARAM wParam, LPARAM lParam) static int HookContactDeleted(WPARAM wParam, LPARAM lParam) { // if our contact gets deleted close his window - HWND h = WindowList_Find(ghSendWindowList, (HANDLE)wParam); + HWND h = WindowList_Find(ghSendWindowList, (HCONTACT)wParam); if (h) - { SendMessage(h, WM_CLOSE, 0, 0); - } - while (h = WindowList_Find(ghRecvWindowList, (HANDLE)wParam)) - { // since we hack the window list - more windows for one contact, we need to close them all + // since we hack the window list - more windows for one contact, we need to close them all + while (h = WindowList_Find(ghRecvWindowList, (HCONTACT)wParam)) SendMessage(h, WM_CLOSE, 0, 0); - } return 0; } static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM lParam) { //find window for hContact - HWND hWnd = WindowList_Find(ghSendWindowList, (HANDLE)wParam); + HWND hWnd = WindowList_Find(ghSendWindowList, (HCONTACT)wParam); if (!hWnd) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), NULL, SendDlgProc, wParam); else { diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 5e61067781..02c219edba 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -25,7 +25,7 @@ /* TRecvContactsData */ -TRecvContactsData::TRecvContactsData(HANDLE contact) +TRecvContactsData::TRecvContactsData(HCONTACT contact) { mhContact = contact; hHook = NULL; @@ -136,7 +136,7 @@ static void RebuildGroupCombo(HWND hwndDlg) } } -static HANDLE CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wndData, int iItem) +static HCONTACT CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wndData, int iItem) { TCHAR *caUIN = ListView_GetItemTextEx(GetDlgItem(hwndDlg, IDC_CONTACTS), iItem, 0); char *szProto = GetContactProto(wndData->mhContact); @@ -144,7 +144,7 @@ static HANDLE CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wnd replaceStrT(wndData->haUin, caUIN); for (int j = 0; j < wndData->cbReceived; j++) if (!lstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) - return (HANDLE)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(PALF_TEMPORARY, j), (LPARAM)wndData->mhDbEvent); + return (HCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(PALF_TEMPORARY, j), (LPARAM)wndData->mhDbEvent); return NULL; } @@ -162,7 +162,7 @@ void RecvListView_AddColumn(HWND hList, int nWidth, TCHAR *szTitle, int nItem) INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TRecvContactsData *wndData = (TRecvContactsData*)GetWindowLongPtr(hwndDlg, DWLP_USER); - HANDLE hContact; + HCONTACT hContact; switch (msg) { case WM_INITDIALOG: @@ -317,7 +317,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara for (int j = 0; j < wndData->cbReceived; j++) // determine item index in packet if (!lstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) { char *szProto =GetContactProto(wndData->mhContact); - hContact = (HANDLE)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(0, j), (LPARAM)wndData->mhDbEvent); + hContact = (HCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(0, j), (LPARAM)wndData->mhDbEvent); if (hContact && caGroup) { // use newest group API if available if (ServiceExists(MS_CLIST_CONTACTCHANGEGROUP)) diff --git a/plugins/ContactsPlus/src/receive.h b/plugins/ContactsPlus/src/receive.h index dce1b023ac..1ad8eed542 100644 --- a/plugins/ContactsPlus/src/receive.h +++ b/plugins/ContactsPlus/src/receive.h @@ -43,21 +43,21 @@ struct TReceivedItem { struct TRecvContactsData { - TRecvContactsData(HANDLE contact); + TRecvContactsData(HCONTACT contact); ~TRecvContactsData(); - HANDLE mhDbEvent; // handle to recv DB event - HANDLE mhContact; // from whom we received this + HANDLE mhDbEvent; // handle to recv DB event + HCONTACT mhContact; // from whom we received this HIMAGELIST mhListIcon;// icons for listview - HMENU mhPopup; // popup menu for listview - HANDLE hHook; // hook to event - HANDLE rhSearch; // handle to uin-search - TCHAR* haUin; - int iPopupItem; + HMENU mhPopup; // popup menu for listview + HANDLE hHook; // hook to event + HANDLE rhSearch; // handle to uin-search + TCHAR* haUin; + int iPopupItem; TReceivedItem** maReceived;// received contacts - int cbReceived; + int cbReceived; TReceivedItem* AddReceivedItem(); - HICON hIcons[4]; // icons for dialog + HICON hIcons[4]; // icons for dialog }; extern HANDLE ghRecvWindowList; diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index beefc0aedf..d0a2c511a3 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -60,7 +60,7 @@ void TSendProcessList::Remove(HANDLE hProcc) /* TSendContactsData */ -TSendContactsData::TSendContactsData(HANDLE contact) : uacklist() +TSendContactsData::TSendContactsData(HCONTACT contact) : uacklist() { hContact = contact; hHook = NULL; @@ -107,14 +107,14 @@ void TSendContactsData::ClearContacts() nContacts = 0; } -void TSendContactsData::AddContact(HANDLE hContact) +void TSendContactsData::AddContact(HCONTACT hContact) { - aContacts = (HANDLE*)mir_realloc(aContacts, (nContacts + 1)*sizeof(HANDLE)); + aContacts = (HCONTACT*)mir_realloc(aContacts, (nContacts + 1)*sizeof(HCONTACT)); aContacts[nContacts] = hContact; nContacts++; } -int TSendContactsData::SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int nContacts) +int TSendContactsData::SendContactsPacket(HWND hwndDlg, HCONTACT *phContacts, int nContacts) { HANDLE hProcc = (HANDLE)CallContactService(hContact, PSS_CONTACTS, MAKEWPARAM(0, nContacts), (LPARAM)phContacts); if (!hProcc) { @@ -126,8 +126,8 @@ int TSendContactsData::SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int TAckData *ackData = gaAckData.Add(hProcc, new TAckData(hContact)); uacklist.Add(hProcc); ackData->nContacts = nContacts; - ackData->aContacts = (HANDLE*)mir_alloc(nContacts*sizeof(HANDLE)); - memmove(ackData->aContacts, phContacts, nContacts*sizeof(HANDLE)); // copy the array of hContact for ack array + ackData->aContacts = (HCONTACT*)mir_alloc(nContacts*sizeof(HCONTACT)); + memmove(ackData->aContacts, phContacts, nContacts*sizeof(HCONTACT)); // copy the array of hContact for ack array EnableDlgItem(hwndDlg, IDOK, FALSE); EnableDlgItem(hwndDlg, IDC_LIST, FALSE); return TRUE; // Success @@ -179,12 +179,12 @@ static void ResetListOptions(HWND hwndList) } } -static HANDLE FindNextClistContact(HWND hList, HANDLE hContact, HANDLE *phItem) +static HCONTACT FindNextClistContact(HWND hList, HCONTACT hContact, HCONTACT *phItem) { - HANDLE hNextContact = db_find_next(hContact); - HANDLE hNextItem = NULL; + HCONTACT hNextContact = db_find_next(hContact); + HCONTACT hNextItem = NULL; - while (hNextContact && !(hNextItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hNextContact, 0))) + while (hNextContact && !(hNextItem = (HCONTACT)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hNextContact, 0))) hNextContact = db_find_next(hNextContact); if (phItem) @@ -194,10 +194,10 @@ static HANDLE FindNextClistContact(HWND hList, HANDLE hContact, HANDLE *phItem) } -static HANDLE FindFirstClistContact(HWND hList, HANDLE *phItem) +static HCONTACT FindFirstClistContact(HWND hList, HCONTACT *phItem) { - HANDLE hContact = db_find_first(); - HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0); + HCONTACT hContact = db_find_first(); + HCONTACT hItem = (HCONTACT)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hContact && !hItem) return FindNextClistContact(hList, hContact, phItem); @@ -211,7 +211,7 @@ static HANDLE FindFirstClistContact(HWND hList, HANDLE *phItem) bool binListEvent = FALSE; -static void SetAllContactChecks(HWND hwndList, HANDLE hReceiver) // doubtful name +static void SetAllContactChecks(HWND hwndList, HCONTACT hReceiver) // doubtful name { if (binListEvent) return; @@ -226,7 +226,7 @@ static void SetAllContactChecks(HWND hwndList, HANDLE hReceiver) // doubtful nam else SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, (WPARAM)FALSE, 0); - HANDLE hItem, hContact = FindFirstClistContact(hwndList, &hItem); + HCONTACT hItem, hContact = FindFirstClistContact(hwndList, &hItem); while (hContact) { char* szProto2 = GetContactProto(hContact); @@ -251,9 +251,9 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS))); ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST)); - SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)lParam); - WindowList_Add(ghSendWindowList, hwndDlg, (HANDLE)lParam); - wndData = new TSendContactsData((HANDLE)lParam); + SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), (HCONTACT)lParam); + WindowList_Add(ghSendWindowList, hwndDlg, (HCONTACT)lParam); + wndData = new TSendContactsData((HCONTACT)lParam); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)wndData); // new dlg init wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, MAKEINTRESOURCEA(IDI_ADDCONTACT), LPGEN("Add Contact Permanently to List")); @@ -342,7 +342,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (LOWORD(wParam)) { case IDOK: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) { - HANDLE hContact, hItem; + HCONTACT hContact, hItem; wndData->ClearContacts(); // do not include contacts twice HWND hList = GetDlgItem(hwndDlg, IDC_LIST); @@ -370,7 +370,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara { // select all contacts HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); - HANDLE hItem, hContact = FindFirstClistContact(hwndList, &hItem); + HCONTACT hItem, hContact = FindFirstClistContact(hwndList, &hItem); while (hContact) { SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1); hContact = FindNextClistContact(hwndList, hContact, &hItem); diff --git a/plugins/ContactsPlus/src/send.h b/plugins/ContactsPlus/src/send.h index 73908b4ecf..8a8c1250ed 100644 --- a/plugins/ContactsPlus/src/send.h +++ b/plugins/ContactsPlus/src/send.h @@ -53,27 +53,27 @@ struct TSendContactsData { // hope uack is released automaticly, static propert HANDLE hHook; // hook to event void HookProtoAck(HWND hwndDlg); void UnhookProtoAck(); - HANDLE* aContacts; // contacts to be sent + HCONTACT *aContacts; // contacts to be sent int nContacts; // now many UIDs shall we send? void ClearContacts(); - void AddContact(HANDLE hContact); - HANDLE hContact; // to whom shall we send? + void AddContact(HCONTACT hContact); + HCONTACT hContact; // to whom shall we send? TSendProcessList uacklist;// ackdata - necessary for errorbox HWND hError; // handle of error box, if any void ShowErrorDlg(HWND hwndDlg, char* szMsg, bool bAllowRetry); - int SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int nContacts); + int SendContactsPacket(HWND hwndDlg, HCONTACT *phContacts, int nContacts); int SendContacts(HWND hwndDlg); HICON hIcons[4]; // icons for dialog - TSendContactsData(HANDLE contact); + TSendContactsData(HCONTACT contact); ~TSendContactsData(); }; struct TAckData { - HANDLE hContact; // to whom was it sent - HANDLE* aContacts; // obj + HCONTACT hContact; // to whom was it sent + HCONTACT* aContacts; // obj int nContacts; // how many - TAckData(HANDLE contact) { hContact = contact; aContacts = NULL; nContacts = 0;}; + TAckData(HCONTACT contact) { hContact = contact; aContacts = NULL; nContacts = 0;}; ~TAckData() { mir_free(aContacts); } }; diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index b050c28f76..9b64ae65d5 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -55,7 +55,7 @@ char* __fastcall null_strdup(const char *string) return NULL; } -TCHAR* GetContactUID(HANDLE hContact) +TCHAR* GetContactUID(HCONTACT hContact) { char *szProto = GetContactProto(hContact); char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); @@ -98,7 +98,7 @@ void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact) } -void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact) +void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HCONTACT hContact) { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; @@ -114,7 +114,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact) } -void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart) +void UpdateDialogTitle(HWND hwndDlg, HCONTACT hContact, TCHAR *pszTitleStart) { TCHAR newtitle[512]; lstrcpyn(newtitle, TranslateTS(pszTitleStart), SIZEOF(newtitle)); @@ -140,7 +140,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart) } -void UpdateDialogAddButton(HWND hwndDlg, HANDLE hContact) +void UpdateDialogAddButton(HWND hwndDlg, HCONTACT hContact) { int bVisible = db_get_b(hContact, "CList", "NotOnList", 0); ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), bVisible ? SW_SHOW : SW_HIDE); @@ -159,7 +159,7 @@ HICON InitMButton(HWND hDlg, int idButton, LPCSTR szIcon, char *szTip) } -HICON LoadContactProtoIcon(HANDLE hContact) +HICON LoadContactProtoIcon(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto) diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index ceffbe3502..4d633d0aa5 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -32,17 +32,17 @@ int __fastcall strcmpnull(const char *str1, const char *str2); void __fastcall strcpynull(char *str1, const char *str2); char* __fastcall null_strdup(const char *string); -TCHAR* GetContactUID(HANDLE hContact); +TCHAR* GetContactUID(HCONTACT hContact); -void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact); -void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart); -void UpdateDialogAddButton(HWND hwndDlg, HANDLE hContact); +void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HCONTACT hContact); +void UpdateDialogTitle(HWND hwndDlg, HCONTACT hContact, TCHAR *pszTitleStart); +void UpdateDialogAddButton(HWND hwndDlg, HCONTACT hContact); HICON InitMButton(HWND hDlg, int idButton, LPCSTR szIcon, char* szTip); void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact); -HICON LoadContactProtoIcon(HANDLE hContact); +HICON LoadContactProtoIcon(HCONTACT hContact); void EnableDlgItem(HWND hwndDlg, UINT control, int state); -- cgit v1.2.3