From cb07641dfb24d64306b3c473990622d0c653e567 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 18 Apr 2016 16:47:38 +0000 Subject: empty services removed git-svn-id: http://svn.miranda-ng.org/main/trunk@16714 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_app/src/clc.cpp | 26 ++++++++--------- src/mir_app/src/clcitems.cpp | 11 +++++--- src/mir_app/src/clistmod.cpp | 2 -- src/mir_app/src/clistsettings.cpp | 12 +------- src/mir_app/src/cluiservices.cpp | 59 +++++++++++++++------------------------ src/mir_app/src/contact.cpp | 10 ++----- 6 files changed, 46 insertions(+), 74 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 8ea5f48ef4..246f7e6b45 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -64,7 +64,7 @@ void fnClcOptionsChanged(void) static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "MyHandle")) { @@ -91,7 +91,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) // something is being written to a protocol module if (!strcmp(szProto, cws->szModule)) { // was a unique setting key written? - char *id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + char *id = (char *)CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting)) cli.pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); } @@ -99,7 +99,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) if (szProto == NULL || strcmp(szProto, cws->szModule)) return 0; if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail") - || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN")) + || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN")) cli.pfnClcBroadcast(INTM_NAMECHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "ApparentMode")) cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, hContact, lParam); @@ -112,17 +112,17 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) static int ClcAccountsChanged(WPARAM, LPARAM) { int i, cnt; - for (i=0, cnt=0; i < accounts.getCount(); i++) + for (i = 0, cnt = 0; i < accounts.getCount(); i++) if (Proto_IsAccountEnabled(accounts[i])) cnt++; cli.hClcProtoCount = cnt; - cli.clcProto = (ClcProtoStatus *) mir_realloc(cli.clcProto, sizeof(ClcProtoStatus) * cli.hClcProtoCount); + cli.clcProto = (ClcProtoStatus *)mir_realloc(cli.clcProto, sizeof(ClcProtoStatus) * cli.hClcProtoCount); - for (i=0, cnt=0; i < accounts.getCount(); i++) { + for (i = 0, cnt = 0; i < accounts.getCount(); i++) { if (Proto_IsAccountEnabled(accounts[i])) { cli.clcProto[cnt].szProto = accounts[i]->szModuleName; - cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL,accounts[i]->szModuleName, PS_GETSTATUS, 0, 0); + cli.clcProto[cnt].dwStatus = CallProtoServiceInt(NULL, accounts[i]->szModuleName, PS_GETSTATUS, 0, 0); ++cnt; } } @@ -138,13 +138,13 @@ static int ClcModulesLoaded(WPARAM, LPARAM) static int ClcProtoAck(WPARAM, LPARAM lParam) { - ACKDATA *ack = (ACKDATA *) lParam; + ACKDATA *ack = (ACKDATA *)lParam; if (ack->type == ACKTYPE_STATUS) { WindowList_BroadcastAsync(hClcWindowList, INTM_INVALIDATE, 0, 0); if (ack->result == ACKRESULT_SUCCESS) { - for (int i=0; i < cli.hClcProtoCount; i++) { + for (int i = 0; i < cli.hClcProtoCount; i++) { if (!mir_strcmp(cli.clcProto[i].szProto, ack->szModule)) { - cli.clcProto[i].dwStatus = (WORD) ack->lParam; + cli.clcProto[i].dwStatus = (WORD)ack->lParam; break; } } @@ -179,7 +179,7 @@ static int ClcIconsChanged(WPARAM, LPARAM) static INT_PTR SetInfoTipHoverTime(WPARAM wParam, LPARAM) { - db_set_w(NULL, "CLC", "InfoTipHoverTime", (WORD) wParam); + db_set_w(NULL, "CLC", "InfoTipHoverTime", (WORD)wParam); cli.pfnClcBroadcast(INTM_SETINFOTIPHOVERTIME, wParam, 0); return 0; } @@ -976,7 +976,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam POINT pt; pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); - + HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO); cli.pfnInvalidateRect(hwnd, NULL, FALSE); if (dat->dragAutoScrolling) { @@ -996,7 +996,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm); dat->dragStage &= ~DRAGSTAGEF_OUTSIDE; } - + switch (target) { case DROPTARGET_ONSELF: case DROPTARGET_ONCONTACT: diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index 7933b9ef52..9f249e3d30 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -545,11 +545,11 @@ static void SortGroup(struct ClcData *dat, ClcGroup *group, int useInsertionSort void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) { - ClcContact *selcontact; - ClcGroup *group = &dat->list, *selgroup; - MCONTACT hSelItem; + ClcGroup *group = &dat->list; if (dat->needsResort) { + MCONTACT hSelItem; + ClcContact *selcontact; if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) hSelItem = NULL; else @@ -570,9 +570,12 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) } group->scanIndex++; } - if (hSelItem) + + if (hSelItem) { + ClcGroup *selgroup; if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); + } cli.pfnRecalcScrollBar(hwnd, dat); } diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index 1987c9db6f..ce2516b70c 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -31,7 +31,6 @@ void UninitCListEvents(void); void UninitGroupServices(void); int ContactSettingChanged(WPARAM wParam, LPARAM lParam); int ContactAdded(WPARAM wParam, LPARAM lParam); -int ContactDeleted(WPARAM wParam, LPARAM lParam); INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam); INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM lParam); int InitGroupServices(void); @@ -421,7 +420,6 @@ int LoadContactListModule2(void) HookEvent(ME_PROTO_ACCLISTCHANGED, ContactListAccountsChanged); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); HookEvent(ME_DB_CONTACT_ADDED, ContactAdded); - HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted); HookEvent(ME_PROTO_ACK, ProtocolAck); hContactDoubleClicked = CreateHookableEvent(ME_CLIST_DOUBLECLICKED); diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index fa7a706a62..51fbb266d0 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -149,12 +149,6 @@ int ContactAdded(WPARAM wParam, LPARAM) return 0; } -int ContactDeleted(WPARAM wParam, LPARAM) -{ - CallService(MS_CLUI_CONTACTDELETED, wParam, 0); - return 0; -} - ///////////////////////////////////////////////////////////////////////////////////////// static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, TCHAR* &pStr) @@ -201,7 +195,6 @@ int ContactSettingChanged(WPARAM hContact, 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, hContact, 0); return 0; } cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(cws->szModule, cws->value.wVal, hContact), 1); @@ -212,11 +205,8 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) } else if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "Hidden")) { - if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { + if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) 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, hContact, 0); } else if (!strcmp(cws->szSetting, "MyHandle")) { ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index a7b481887b..2dfe87b2be 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -43,57 +43,45 @@ static INT_PTR GroupAdded(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR ContactSetIcon(WPARAM, LPARAM) -{ - //unnecessary: CLC does this automatically - return 0; -} - -static INT_PTR ContactDeleted(WPARAM, LPARAM) -{ - //unnecessary: CLC does this automatically - return 0; -} - -static INT_PTR ContactAdded(WPARAM, LPARAM) -{ - //unnecessary: CLC does this automatically - return 0; -} - static INT_PTR ListBeginRebuild(WPARAM, LPARAM) { - //unnecessary: CLC does this automatically return 0; } static INT_PTR ListEndRebuild(WPARAM, LPARAM) { - int rebuild = 0; - //CLC does this automatically, but we need to force it if hideoffline or hideempty has changed - if ((db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEOFFLINE) == 0)) { + bool bRebuild = false; + LONG_PTR dwStyle = GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE); + + // CLC does this automatically, but we need to force it if hideoffline or hideempty has changed + if ((db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) { if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) | CLS_HIDEOFFLINE); + dwStyle |= CLS_HIDEOFFLINE; else - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & ~CLS_HIDEOFFLINE); - rebuild = 1; + dwStyle &= ~CLS_HIDEOFFLINE; + bRebuild = true; } - if ((db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) == 0)) { + + if ((db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) { if (db_get_b(NULL, "CList", "HideEmptyGroups", SETTING_HIDEEMPTYGROUPS_DEFAULT)) - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) | CLS_HIDEEMPTYGROUPS); + dwStyle |= CLS_HIDEEMPTYGROUPS; else - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS); - rebuild = 1; + dwStyle &= ~CLS_HIDEEMPTYGROUPS; + bRebuild = true; } - if ((db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS) == 0)) { + + if ((db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) { if (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT)) - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) | CLS_USEGROUPS); + dwStyle |= CLS_USEGROUPS; else - SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, GetWindowLongPtr(cli.hwndContactTree, GWL_STYLE) & ~CLS_USEGROUPS); - rebuild = 1; + dwStyle &= ~CLS_USEGROUPS; + bRebuild = true; } - if (rebuild) + + if (bRebuild) { + SetWindowLongPtr(cli.hwndContactTree, GWL_STYLE, dwStyle); cli.pfnInitAutoRebuild(cli.hwndContactTree); + } return 0; } @@ -111,9 +99,6 @@ static INT_PTR GetCaps(WPARAM wParam, LPARAM) void LoadCluiServices(void) { CreateServiceFunction(MS_CLUI_GROUPADDED, GroupAdded); - CreateServiceFunction(MS_CLUI_CONTACTSETICON, ContactSetIcon); - CreateServiceFunction(MS_CLUI_CONTACTADDED, ContactAdded); - CreateServiceFunction(MS_CLUI_CONTACTDELETED, ContactDeleted); CreateServiceFunction(MS_CLUI_LISTBEGINREBUILD, ListBeginRebuild); CreateServiceFunction(MS_CLUI_LISTENDREBUILD, ListEndRebuild); CreateServiceFunction(MS_CLUI_GETCAPS, GetCaps); diff --git a/src/mir_app/src/contact.cpp b/src/mir_app/src/contact.cpp index fb57f3a9e9..76466126db 100644 --- a/src/mir_app/src/contact.cpp +++ b/src/mir_app/src/contact.cpp @@ -36,9 +36,8 @@ static int GetContactStatus(MCONTACT hContact) return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } -void fnChangeContactIcon(MCONTACT hContact, int iIcon, int add) +void fnChangeContactIcon(MCONTACT hContact, int iIcon, int) { - CallService(add ? MS_CLUI_CONTACTADDED : MS_CLUI_CONTACTSETICON, hContact, iIcon); NotifyEventHooks(hContactIconChangedEvent, hContact, iIcon); } @@ -64,15 +63,12 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) { CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, NULL }; - CallService(MS_CLUI_CONTACTDELETED, wParam, 0); - if ((HANDLE) lParam == NULL) + if (lParam == NULL) db_unset(wParam, "CList", "Group"); else { grpChg.pszNewName = Clist_GroupGetName(lParam, NULL); db_set_ts(wParam, "CList", "Group", grpChg.pszNewName); } - CallService(MS_CLUI_CONTACTADDED, wParam, - cli.pfnIconFromStatusMode(GetContactProto(wParam), GetContactStatus(wParam), wParam)); NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg); return 0; @@ -80,7 +76,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) int fnSetHideOffline(WPARAM wParam, LPARAM) { - switch((int)wParam) { + switch ((int)wParam) { case 0: db_set_b(NULL, "CList", "HideOffline", 0); break; -- cgit v1.2.3