From 1925d3521846f4e6683d3d537cc41de9c9bd7250 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Feb 2014 19:01:03 +0000 Subject: "we don't need these variables" (c) Pink Floyd git-svn-id: http://svn.miranda-ng.org/main/trunk@8101 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdfile/file.cpp | 12 ++--- src/core/stdmsg/src/globals.cpp | 9 ++-- src/core/stdmsg/src/msgs.cpp | 42 ++++++++------- src/core/stdmsg/src/statusicon.cpp | 3 +- src/core/stdurl/url.cpp | 8 +-- src/core/stduseronline/useronline.cpp | 22 ++++---- src/modules/chat/clist.cpp | 20 +++----- src/modules/clist/clistevents.cpp | 3 +- src/modules/clist/clistmenus.cpp | 5 +- src/modules/clist/clistsettings.cpp | 14 +++-- src/modules/clist/clui.cpp | 77 +++++++++++----------------- src/modules/extraicons/DefaultExtraIcons.cpp | 9 ++-- src/modules/extraicons/extraicons.cpp | 6 +-- src/modules/protocols/protoaccs.cpp | 12 ++--- src/modules/srmm/statusicon.cpp | 5 +- 15 files changed, 104 insertions(+), 143 deletions(-) (limited to 'src') diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 19dcf2f27c..08d5b250b5 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -59,19 +59,19 @@ TCHAR *GetContactID(MCONTACT hContact) return NULL; } -static INT_PTR SendFileCommand(WPARAM wParam, LPARAM) +static INT_PTR SendFileCommand(WPARAM hContact, LPARAM) { struct FileSendData fsd; - fsd.hContact = wParam; + fsd.hContact = hContact; fsd.ppFiles = NULL; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; } -static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) +static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) { FileSendData fsd; - fsd.hContact = wParam; + fsd.hContact = hContact; char** ppFiles = (char**)lParam; int count = 0; @@ -89,10 +89,10 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) +static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) { FileSendData fsd; - fsd.hContact = wParam; + fsd.hContact = hContact; fsd.ppFiles = (const TCHAR**)lParam; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index fb90ce71ff..a56ee6f898 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -119,9 +119,8 @@ void ReloadGlobals() if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT; } -static int dbaddedevent(WPARAM wParam, LPARAM lParam) +static int dbaddedevent(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); if (h) @@ -142,10 +141,10 @@ static int ackevent(WPARAM wParam, LPARAM lParam) return 0; } -int AvatarChanged(WPARAM wParam, LPARAM lParam) +int AvatarChanged(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); - if (h) SendMessage(h, HM_AVATARACK, wParam, lParam); + if (h) + SendMessage(h, HM_AVATARACK, hContact, lParam); return 0; } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 83312cb914..f164d72b31 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -49,7 +49,7 @@ static int SRMMStatusToPf2(int status) return 0; } -static int MessageEventAdded(WPARAM wParam, LPARAM lParam) +static int MessageEventAdded(WPARAM hContact, LPARAM lParam) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); @@ -57,9 +57,9 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) return 0; - CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); + CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1); /* does a window for the contact exist? */ - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); if (hwnd) { if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS)) { ShowWindow(hwnd, SW_RESTORE); @@ -78,10 +78,10 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) /* new message */ SkinPlaySound("AlertMsg"); - char *szProto = GetContactProto(wParam); + char *szProto = GetContactProto(hContact); if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) { NewMessageWindowLParam newData = { 0 }; - newData.hContact = wParam; + newData.hContact = hContact; newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS); CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM)&newData); return 0; @@ -89,12 +89,12 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) TCHAR toolTip[256], *contactName; CLISTEVENT cle = { sizeof(cle) }; - cle.hContact = wParam; + cle.hContact = hContact; cle.hDbEvent = (HANDLE)lParam; cle.flags = CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; - contactName = pcli->pfnGetContactDisplayName(wParam, 0); + contactName = pcli->pfnGetContactDisplayName(hContact, 0); mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName); cle.ptszTooltip = toolTip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); @@ -152,21 +152,21 @@ static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam) return 0; } -static int TypingMessage(WPARAM wParam, LPARAM lParam) +static int TypingMessage(WPARAM hContact, LPARAM lParam) { if (!(g_dat.flags & SMF_SHOWTYPING)) return 0; SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) { TCHAR szTip[256]; - mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(wParam, 0)); + mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags&SMF_SHOWTYPINGCLIST)) { + if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) { MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) }; tn.tszInfoTitle = TranslateT("Typing notification"); tn.tszInfo = szTip; @@ -177,26 +177,25 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) } else { CLISTEVENT cle = { sizeof(cle) }; - cle.hContact = wParam; + cle.hContact = hContact; cle.hDbEvent = (HANDLE)1; cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon( SKINICON_OTHER_TYPING ); cle.pszService = "SRMsg/ReadMessage"; cle.ptszTooltip = szTip; - CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); - CallServiceSync(MS_CLIST_ADDEVENT, wParam, (LPARAM) & cle); + CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1); + CallServiceSync(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle); Skin_ReleaseIcon(cle.hIcon); } } return 0; } -static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) +static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - MCONTACT hContact = wParam; - - if (cws->szModule == NULL) return 0; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; + if (cws->szModule == NULL) + return 0; if (!strcmp(cws->szModule, "CList")) WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0); @@ -204,7 +203,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) if (cws->szSetting && !strcmp(cws->szSetting, "Timezone")) WindowList_Broadcast(g_dat.hMessageWindowList, DM_NEWTIMEZONE, (WPARAM) cws, 0); else { - char *szProto = GetContactProto(wParam); + char *szProto = GetContactProto(hContact); if (szProto && !strcmp(cws->szModule, szProto)) WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0); } @@ -313,9 +312,8 @@ static int IconsChanged(WPARAM, LPARAM) return 0; } -static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) +static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { bool bEnabled = false; char *szProto = GetContactProto(hContact); diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index bd813201cf..935af689ec 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -24,9 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hHookIconPressedEvt; -static int OnSrmmIconChanged(WPARAM wParam, LPARAM) +static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { - MCONTACT hContact = wParam; if (hContact == NULL) WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0); else { diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index 5473c6a596..763fb637bd 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -39,21 +39,21 @@ static INT_PTR ReadUrlCommand(WPARAM, LPARAM lParam) return 0; } -static int UrlEventAdded(WPARAM wParam, LPARAM lParam) +static int UrlEventAdded(WPARAM hContact, LPARAM lParam) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); - if (dbei.flags&(DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL) + if (dbei.flags & (DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_URL) return 0; SkinPlaySound("RecvUrl"); TCHAR szTooltip[256]; - mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(wParam, 0)); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; - cle.hContact = wParam; + cle.hContact = hContact; cle.hDbEvent = (HANDLE)lParam; cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL); cle.pszService = "SRUrl/ReadUrl"; diff --git a/src/core/stduseronline/useronline.cpp b/src/core/stduseronline/useronline.cpp index 1093f380db..2f896fe3af 100644 --- a/src/core/stduseronline/useronline.cpp +++ b/src/core/stduseronline/useronline.cpp @@ -31,24 +31,24 @@ static bool Proto_IsAccountEnabled(PROTOACCOUNT* pa) return pa && ((pa->bIsEnabled && !pa->bDynDisabled) || pa->bOldProto); } -static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) +static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if ((HANDLE)wParam == NULL || strcmp(cws->szSetting, "Status")) + if (hContact == NULL || strcmp(cws->szSetting, "Status")) return 0; int newStatus = cws->value.wVal; - int oldStatus = db_get_w(wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE); - db_set_w(wParam, "UserOnline", "OldStatus", (WORD)newStatus); - if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_USERONLINE)) return 0; - if (db_get_b(wParam, "CList", "Hidden", 0)) return 0; + int oldStatus = db_get_w(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE); + db_set_w(hContact, "UserOnline", "OldStatus", (WORD)newStatus); + if (CallService(MS_IGNORE_ISIGNORED, hContact, IGNOREEVENT_USERONLINE)) return 0; + if (db_get_b(hContact, "CList", "Hidden", 0)) return 0; if (newStatus == ID_STATUS_OFFLINE && oldStatus != ID_STATUS_OFFLINE) { // Remove the event from the queue if it exists since they are now offline - int lastEvent = (int)db_get_dw(wParam, "UserOnline", "LastEvent", 0); + int lastEvent = (int)db_get_dw(hContact, "UserOnline", "LastEvent", 0); if (lastEvent) { - CallService(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)lastEvent); - db_set_dw(wParam, "UserOnline", "LastEvent", 0); + CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)lastEvent); + db_set_dw(hContact, "UserOnline", "LastEvent", 0); } } if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) && @@ -63,11 +63,11 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) ZeroMemory(&cle, sizeof(cle)); cle.cbSize = sizeof(cle); cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; - cle.hContact = wParam; + cle.hContact = hContact; cle.hDbEvent = (HANDLE)(uniqueEventId++); cle.hIcon = LoadSkinIcon(SKINICON_OTHER_USERONLINE, false); cle.pszService = "UserOnline/Description"; - mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName(wParam, 0)); + mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = tooltip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); IcoLib_ReleaseIcon(cle.hIcon, 0); diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index 1400bc8d07..64af00ea2c 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -101,9 +101,8 @@ BOOL SetAllOffline(BOOL bHide, const char *pszModule) return TRUE; } -int RoomDoubleclicked(WPARAM wParam, LPARAM lParam) +int RoomDoubleclicked(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (!hContact) return 0; @@ -139,37 +138,34 @@ INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam) return RoomDoubleclicked((WPARAM)((CLISTEVENT*)lParam)->hContact, 0); } -INT_PTR JoinChat(WPARAM wParam, LPARAM lParam) +INT_PTR JoinChat(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { char *szProto = GetContactProto(hContact); if (szProto) { if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) - CallProtoService(szProto, PS_JOINCHAT, wParam, lParam); + CallProtoService(szProto, PS_JOINCHAT, hContact, lParam); else - RoomDoubleclicked(wParam, 0); + RoomDoubleclicked(hContact, 0); } } return 0; } -INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam) +INT_PTR LeaveChat(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { char *szProto = GetContactProto(hContact); if (szProto) - CallProtoService(szProto, PS_LEAVECHAT, wParam, lParam); + CallProtoService(szProto, PS_LEAVECHAT, hContact, lParam); } return 0; } -int PrebuildContactMenu(WPARAM wParam, LPARAM) +int PrebuildContactMenu(WPARAM hContact, LPARAM) { - MCONTACT hContact = wParam; - if (hContact == NULL) + if (hContact == 0) return 0; bool bEnabled = false; diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index afea5bcfc7..73b3abfb4c 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -382,9 +382,8 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM) return 0; } -static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) +static int CListEventSettingsChanged(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL && cws && cws->szModule && cws->szSetting && strcmp(cws->szModule, "CList") == 0) { if (strcmp(cws->szSetting, "DisableTrayFlash") == 0) diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index dd5b278f86..56b6cd7720 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -318,10 +318,9 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) return (INT_PTR)menuHandle; } -static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) +static INT_PTR BuildContactMenu(WPARAM hContact, LPARAM) { - MCONTACT hContact = wParam; - NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); + NotifyEventHooks(hPreBuildContactMenuEvent, hContact, 0); char *szProto = GetContactProto(hContact); diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 81dc9c3008..196daf1b51 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -156,11 +156,10 @@ TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode) return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer; } -INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) +INT_PTR GetContactDisplayName(WPARAM hContact, LPARAM lParam) { static char retVal[200]; ClcCacheEntry *cacheEntry = NULL; - MCONTACT hContact = wParam; if (lParam & GCDNF_UNICODE) return (INT_PTR)cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE); @@ -226,11 +225,10 @@ int ContactDeleted(WPARAM wParam, LPARAM) return 0; } -int ContactSettingChanged(WPARAM wParam, LPARAM lParam) +int ContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; DBVARIANT dbv; - MCONTACT hContact = wParam; // Early exit if (hContact == NULL) @@ -242,7 +240,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) cli.pfnInvalidateDisplayNameCacheEntry(hContact); if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) { - CallService(MS_CLUI_CONTACTRENAMED, wParam, 0); + CallService(MS_CLUI_CONTACTRENAMED, hContact, 0); } else if (!strcmp(cws->szSetting, "Status")) { if (!db_get_b(hContact, "CList", "Hidden", 0)) { @@ -250,7 +248,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 0); - CallService(MS_CLUI_CONTACTDELETED, wParam, 0); + CallService(MS_CLUI_CONTACTDELETED, hContact, 0); mir_free(dbv.pszVal); return 0; } @@ -270,11 +268,11 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "Hidden")) { if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { - char *szProto = GetContactProto(wParam); + char *szProto = GetContactProto(hContact); cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1); } else - CallService(MS_CLUI_CONTACTDELETED, wParam, 0); + CallService(MS_CLUI_CONTACTDELETED, hContact, 0); } if (!strcmp(cws->szSetting, "MyHandle")) cli.pfnInvalidateDisplayNameCacheEntry(hContact); diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 4242f183c8..3c332f7042 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -73,9 +73,8 @@ static int CluiModulesLoaded(WPARAM, LPARAM) // Happens on shutdown and standby. static void DisconnectAll() { - int nProto; - for (nProto = 0; nProto < accounts.getCount(); nProto++) - CallProtoServiceInt(NULL,accounts[nProto]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0); + for (int i = 0; i < accounts.getCount(); i++) + CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_SETSTATUS, ID_STATUS_OFFLINE, 0); } static int CluiIconsChanged(WPARAM, LPARAM) @@ -89,12 +88,10 @@ static HGENMENU hRenameMenuItem; static int MenuItem_PreBuild(WPARAM, LPARAM) { TCHAR cls[128]; - HANDLE hItem; HWND hwndClist = GetFocus(); - GetClassName(hwndClist, cls, SIZEOF(cls)); hwndClist = (!lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; - hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); + HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); Menu_ShowItem(hRenameMenuItem, hItem != 0); return 0; } @@ -102,12 +99,11 @@ static int MenuItem_PreBuild(WPARAM, LPARAM) static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM) { TCHAR cls[128]; - HANDLE hItem; HWND hwndClist = GetFocus(); GetClassName(hwndClist, cls, SIZEOF(cls)); // worst case scenario, the rename is sent to the main contact list hwndClist = (!lstrcmp( _T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList; - hItem = (HANDLE) SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); + HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); if (hItem) { SetFocus(hwndClist); SendMessage(hwndClist, CLM_EDITLABEL, (WPARAM) hItem, 0); @@ -122,17 +118,12 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP TranslateDialogDefault(hWnd); { LOGFONT lf; - HFONT hFont; - - hFont = (HFONT) SendDlgItemMessage(hWnd, IDYES, WM_GETFONT, 0, 0); + HFONT hFont = (HFONT)SendDlgItemMessage(hWnd, IDYES, WM_GETFONT, 0, 0); GetObject(hFont, sizeof(lf), &lf); lf.lfWeight = FW_BOLD; SendDlgItemMessage(hWnd, IDC_TOPLINE, WM_SETFONT, (WPARAM) CreateFontIndirect(&lf), 0); - } - { - TCHAR szFormat[256]; - TCHAR szFinal[256]; - + + TCHAR szFormat[256], szFinal[256]; GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, SIZEOF(szFormat)); mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName(lParam, 0)); SetDlgItemText(hWnd, IDC_TOPLINE, szFinal); @@ -173,56 +164,46 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) //see notes about deleting contacts on PF1_SERVERCLIST servers in m_protosvc.h UINT_PTR action; - if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) && - !(GetKeyState(VK_SHIFT)&0x8000)) + if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT) && !(GetKeyState(VK_SHIFT) & 0x8000)) // Ask user for confirmation, and if the contact should be archived (hidden, not deleted) action = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), (HWND) lParam, AskForConfirmationDlgProc, wParam); else action = IDYES; switch (action) { - - // Delete contact - case IDYES: - { - char *szProto = GetContactProto(wParam); - if (szProto != NULL) { - // Check if protocol uses server side lists - DWORD caps; - - caps = (DWORD) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0); - if (caps & PF1_SERVERCLIST) { - int status; - - status = CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0); - if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) { - // Set a flag so we remember to delete the contact when the protocol goes online the next time - db_set_b(wParam, "CList", "Delete", 1); - MessageBox(NULL, - TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), - TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK); - return 0; - } + case IDC_HIDE: // Archive contact + db_set_b(wParam, "CList", "Hidden", 1); + break; + + case IDYES: // Delete contact + char *szProto = GetContactProto(wParam); + if (szProto != NULL) { + // Check if protocol uses server side lists + DWORD caps = CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0); + if (caps & PF1_SERVERCLIST) { + int status = CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0); + if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) { + // Set a flag so we remember to delete the contact when the protocol goes online the next time + db_set_b(wParam, "CList", "Delete", 1); + MessageBox(NULL, + TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), + TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK); + return 0; } } - - CallService(MS_DB_CONTACT_DELETE, wParam, 0); } - break; - // Archive contact - case IDC_HIDE: - db_set_b(wParam, "CList", "Hidden", 1); + CallService(MS_DB_CONTACT_DELETE, wParam, 0); break; } return 0; } -static INT_PTR MenuItem_AddContactToList(WPARAM wParam, LPARAM) +static INT_PTR MenuItem_AddContactToList(WPARAM hContact, LPARAM) { ADDCONTACTSTRUCT acs = { 0 }; - acs.hContact = wParam; + acs.hContact = hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp index a47ce5e7a9..7fa9fc17de 100644 --- a/src/modules/extraicons/DefaultExtraIcons.cpp +++ b/src/modules/extraicons/DefaultExtraIcons.cpp @@ -159,9 +159,8 @@ static void SetExtraIcons(MCONTACT hContact) } } -static int SettingChanged(WPARAM wParam, LPARAM lParam) +static int SettingChanged(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact == NULL) return 0; @@ -203,13 +202,12 @@ static int SettingChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param) +static int DefaultOnClick(WPARAM hContact, LPARAM lParam, LPARAM param) { Info *p = (Info*)param; if (p == NULL) return 0; - MCONTACT hContact = wParam; if (hContact == NULL) return 0; @@ -277,9 +275,8 @@ static ProtoInfo* FindProto(const char *proto) return p; } -static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam) +static int ProtocolApplyIcon(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; char *proto = GetContactProto(hContact); if (IsEmpty(proto)) return 0; diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index 7fae900021..037c97e142 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -246,9 +246,8 @@ int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam) return 0; } -int ClistExtraImageApply(WPARAM wParam, LPARAM lParam) +int ClistExtraImageApply(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact == NULL) return 0; @@ -260,9 +259,8 @@ int ClistExtraImageApply(WPARAM wParam, LPARAM lParam) return 0; } -int ClistExtraClick(WPARAM wParam, LPARAM lParam) +int ClistExtraClick(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact == NULL) return 0; diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 94a96366e4..9f7480390b 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -197,24 +197,22 @@ void WriteDbAccounts() } ///////////////////////////////////////////////////////////////////////////////////////// -static int OnContactDeleted(WPARAM wParam, LPARAM lParam) +static int OnContactDeleted(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { - PROTOACCOUNT* pa = Proto_GetAccount(hContact); + PROTOACCOUNT *pa = Proto_GetAccount(hContact); if (Proto_IsAccountEnabled(pa) && pa->ppro) - pa->ppro->OnEvent(EV_PROTO_ONCONTACTDELETED, wParam, lParam); + pa->ppro->OnEvent(EV_PROTO_ONCONTACTDELETED, hContact, lParam); } return 0; } -static int OnDbSettingsChanged(WPARAM wParam, LPARAM lParam) +static int OnDbSettingsChanged(WPARAM hContact, LPARAM lParam) { - MCONTACT hContact = wParam; if (hContact) { PROTOACCOUNT* pa = Proto_GetAccount(hContact); if (Proto_IsAccountEnabled(pa) && pa->ppro) - pa->ppro->OnEvent(EV_PROTO_DBSETTINGSCHANGED, wParam, lParam); + pa->ppro->OnEvent(EV_PROTO_DBSETTINGSCHANGED, hContact, lParam); } return 0; } diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 17d48c3a32..5ca2c8740e 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -78,7 +78,7 @@ static OBJLIST arIcons(3, CompareIcons); static HANDLE hHookIconsChanged; -INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) +INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam) { StatusIconData *sid = (StatusIconData *)lParam; if (sid == NULL || sid->cbSize != sizeof(StatusIconData)) @@ -88,7 +88,6 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) if (p == NULL) return 1; - MCONTACT hContact = wParam; if (hContact == NULL) { mir_free(p->sid.szModule); mir_free(p->sid.szTooltip); @@ -115,7 +114,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) mir_free(pc->tszTooltip); pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip); - NotifyEventHooks(hHookIconsChanged, wParam, (LPARAM)p); + NotifyEventHooks(hHookIconsChanged, hContact, (LPARAM)p); return 0; } -- cgit v1.2.3