From 31b191bc8ddb639e488ab8306f71ac1dbabf16f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 3 Nov 2012 17:32:37 +0000 Subject: removing built-in Clist Modern extra icons part I git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/res/resource.rc | 12 +- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 249 ++++++------------------- plugins/UserInfoEx/src/commonheaders.h | 1 - plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 1 - plugins/UserInfoEx/src/init.cpp | 7 +- plugins/UserInfoEx/src/psp_options.cpp | 208 ++------------------- plugins/UserInfoEx/src/resource.h | 4 - plugins/UserInfoEx/src/svc_email.cpp | 72 ++----- plugins/UserInfoEx/src/svc_gender.cpp | 100 ++-------- plugins/UserInfoEx/src/svc_homepage.cpp | 60 ++---- plugins/UserInfoEx/src/svc_phone.cpp | 112 +++-------- plugins/UserInfoEx/src/svc_reminder.cpp | 84 +++------ 12 files changed, 173 insertions(+), 737 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/res/resource.rc b/plugins/UserInfoEx/res/resource.rc index 24e0fe94ae..bfabd39d7a 100644 --- a/plugins/UserInfoEx/res/resource.rc +++ b/plugins/UserInfoEx/res/resource.rc @@ -7,7 +7,8 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" +#include "afxres.h" + ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -190,8 +191,6 @@ BEGIN EDITTEXT EDIT_REMIND2,144,154,44,13,ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",SPIN_REMIND2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,186,152,11,14 LTEXT "hours",TXT_REMIND4,198,155,92,8 - LTEXT "CList extra icon:",TXT_REMIND5,16,190,120,8,0,WS_EX_RIGHT - COMBOBOX EDIT_EXTRAICON,144,189,132,123,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Icon flashing on event",CHECK_REMIND_FLASHICON,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,18,41,273,10 COMBOBOX EDIT_REMIND_ENABLED,90,18,98,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Enabled",IDC_STATIC,38,20,47,8,0,WS_EX_RIGHT @@ -445,10 +444,7 @@ BEGIN CONTROL "Off",RADIO_OPT_MI_ACCOUNT_NONE,"Button",BS_AUTORADIOBUTTON,161,84,31,10 CONTROL "Ex-/Import items",RADIO_OPT_MI_ACCOUNT_EXIMPORT,"Button",BS_AUTORADIOBUTTON,222,84,80,10 GROUPBOX "Extra Icons",GROUP_OPT_EXTRAICONS,6,105,144,117 - LTEXT "This options require a contact list which supports extra icons.",TXT_OPT_DEFAULTICONS2,12,117,131,24 - LTEXT "Note: Miranda NG will have to be restarted for changes to take effect.",TXT_OPT_EXTRAICONS,12,148,131,24,NOT WS_VISIBLE LTEXT "Gender:",TXT_OPT_GENDER,12,148,40,8 - COMBOBOX COMBO_OPT_GENDER,12,158,131,137,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Replace the following default icons:",TXT_OPT_DEFAULTICONS,12,180,132,8 CONTROL "Homepage",CHECK_OPT_HOMEPAGEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,192,68,10 CONTROL "Phone",CHECK_OPT_PHONEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,84,192,59,10 @@ -458,7 +454,6 @@ BEGIN CONTROL "Show 'Restart' menu item",CHECK_OPT_MI_RESTART,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,161,117,131,10 CONTROL "Use Zodiac as default avatar",CHECK_OPT_ZODIACAVATAR, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,129,131,10 - COMBOBOX COMBO_OPT_FLAGS,161,158,131,137,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Country Flags",TXT_OPT_FLAGS,161,148,131,8 CONTROL "Use &unknown flag if country can not be determined",CHECK_OPT_FLAGSUNKNOWN, "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,161,180,131,15 @@ -632,6 +627,7 @@ IDB_FLAGSPNG PNG "flags.png" // // Generated from the TEXTINCLUDE 3 resource. // - + + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 8999df2cca..359d574b30 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -52,7 +52,6 @@ static HANDLE hMsgWndEventHook = NULL; static HANDLE hIconsChangedHook = NULL; static HANDLE hSettingChangedHook = NULL; -static HANDLE hExtraIconSvcHook = NULL; static HANDLE hOptInitHook = NULL; static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam); @@ -233,136 +232,58 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) * Clist Extra Image functions ***********************************************************************************************************/ -static void CALLBACK SetExtraImage(LPARAM lParam) { +static void CALLBACK SetExtraImage(LPARAM lParam) +{ /* get contact's country */ int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);; - //use ExtraIconsService ? - if (myGlobals.ExtraIconsServiceExist) { - EXTRAICON ico; - ico.cbSize = sizeof(ico); - ico.hContact = (HANDLE)lParam; - ico.hExtraIcon = hExtraIconSvc; - ico.icoName = (char*)0; //preset - if(countryNumber!=0xFFFF || gFlagsOpts.bUseUnknownFlag) { - char szId[20]; - mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */ - ico.icoName = szId; - } - CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); - } - //use Clist ExtraImageService - else if(gFlagsOpts.bShowExtraImgFlag) { - int index; - IconExtraColumn iec; - iec.cbSize = sizeof(iec); - iec.ColumnType = gFlagsOpts.idExtraColumn; - iec.hImage = INVALID_HANDLE_VALUE; //preset - /* get icon for contact */ - if(phExtraImageList!=NULL) { /* too early? */ - if(countryNumber!=0xFFFF || gFlagsOpts.bUseUnknownFlag) { - index = CountryNumberToIndex(countryNumber); - /* icon not add to clist extra image list? */ - if(phExtraImageList[index]==INVALID_HANDLE_VALUE) { - HICON hIcon=LoadFlag(countryNumber); // Returned HICON SHOULDN'T be destroyed, it is managed by IcoLib - if(hIcon!=NULL) { - phExtraImageList[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0); - Skin_ReleaseIcon(hIcon); /* does NULL check */ - } - } - iec.hImage=phExtraImageList[index]; - } - } - //Set icon for contact at needed column - CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)lParam,(LPARAM)&iec); + + EXTRAICON ico = { sizeof(ico) }; + ico.hContact = (HANDLE)lParam; + ico.hExtraIcon = hExtraIconSvc; + ico.icoName = (char*)0; //preset + if (countryNumber != 0xFFFF || gFlagsOpts.bUseUnknownFlag) { + char szId[20]; + mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */ + ico.icoName = szId; } + CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); } -static void CALLBACK RemoveExtraImages(LPARAM lParam) { - register HANDLE hContact; - //use ExtraIconsService ? - if (myGlobals.ExtraIconsServiceExist) { - EXTRAICON ico; - ico.cbSize = sizeof(ico); - ico.hExtraIcon = hExtraIconSvc; - ico.icoName = (char *)0; /* invalidate icon for contact*/ - /* enum all contacts */ - for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) { - ico.hContact = hContact; - CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); - } - } - //use Clist ExtraImageService - else { - IconExtraColumn iec; - iec.cbSize = sizeof(iec); - iec.ColumnType = gFlagsOpts.idExtraColumn; - iec.hImage = INVALID_HANDLE_VALUE; - /* enum all contacts */ - for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) { - /* invalidate icon for contact*/ - CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)hContact,(LPARAM)&iec); - } +static void CALLBACK RemoveExtraImages(LPARAM lParam) +{ + EXTRAICON ico = { sizeof(ico) }; + ico.hExtraIcon = hExtraIconSvc; + ico.icoName = 0; /* invalidate icon for contact*/ + /* enum all contacts */ + for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) { + ico.hContact = hContact; + CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); } } // always call in context of main thread -void EnsureExtraImages() //garantieren - sicherstellen - updaten +void EnsureExtraImages() { - register HANDLE hContact; - //use Clist ExtraImageService? - if (!myGlobals.ExtraIconsServiceExist) { - BYTE idExtraColumnNew = DB::Setting::GetByte(MODNAMEFLAGS,"ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT); - if(idExtraColumnNew != gFlagsOpts.idExtraColumn) { - /* clear previous column */ - RemoveExtraImages(0); - gFlagsOpts.idExtraColumn = idExtraColumnNew; - /* clear new column */ - RemoveExtraImages(0); - } - } - /* enum all contacts */ - for (hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) { - /* update icon */ + for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY); - } } static void CALLBACK UpdateExtraImages(LPARAM lParam) { if (!lParam) - RemoveExtraImages(0); - else EnsureExtraImages(); - -/* if (!myGlobals.ExtraIconsServiceExist && !gFlagsOpts.bShowExtraImgFlag) - RemoveExtraImages(); - else EnsureExtraImages(); */ -} - -//hookProc ME_CLIST_EXTRA_LIST_REBUILD -static int OnCListRebuildIcons(WPARAM wParam,LPARAM lParam) { - OutputDebugStringA("REBUILD EXTRA\n"); - //use ExtraIconsService ? - if(myGlobals.ExtraIconsServiceExist) return 0; //delete ? - //use Clist ExtraImageService - if(phExtraImageList!=NULL) { - /* invalidate icons */ - for(int i=0;iszModule, "ExtraIcons") && @@ -396,8 +317,8 @@ static int OnExtraIconSvcChanged(WPARAM wParam,LPARAM lParam) { return 0; } -VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) { - if (!myGlobals.HaveCListExtraIcons) return; +VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) +{ gFlagsOpts.bShowExtraImgFlag = (bColumn!=((BYTE)-1)); if (bUpdateDB) { if(gFlagsOpts.bShowExtraImgFlag) DB::Setting::WriteByte(MODNAMEFLAGS,"ExtraImgFlagColumn", bColumn); @@ -406,73 +327,33 @@ VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) { // Flags is on if (gFlagsOpts.bShowExtraImgFlag) { - //use ExtraIconsService ? - if(myGlobals.ExtraIconsServiceExist) { - if(hExtraIconSvc == INVALID_HANDLE_VALUE) { - char szId[20]; - //get local langID for descIcon (try to use user local Flag as icon) - DWORD langid = 0; - int r = GetLocaleInfo( - LOCALE_USER_DEFAULT, - LOCALE_ICOUNTRY | LOCALE_RETURN_NUMBER , - (LPTSTR)&langid, sizeof(langid)/sizeof(TCHAR)); - if (!CallService(MS_UTILS_GETCOUNTRYBYNUMBER,langid,0)) langid = 1; - - EXTRAICON_INFO ico = {0}; - ico.cbSize = sizeof(ico); - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "Flags"; - ico.description = "Flags (uinfoex)"; - mir_snprintf(szId, SIZEOF(szId), (langid==0xFFFF)?"%s_0x%X":"%s_%i","flags",langid); /* buffer safe */ - ico.descIcon = szId; - hExtraIconSvc=(HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - if(hExtraIconSvc) - hExtraIconSvcHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnExtraIconSvcChanged); - - } - } - //use Clist ExtraImageService - else { - if(phExtraImageList == NULL){ - phExtraImageList = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE)); - /* invalidate icons */ - if(phExtraImageList!=NULL) - for(int i=0;i_wReminderState != checkState) { pid->_wReminderState = checkState; } diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index 6b321181fd..2762e67a32 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -103,10 +103,9 @@ static INT OnTopToolBarLoaded(WPARAM wParam, LPARAM lParam) **/ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) { - myGlobals.HaveCListExtraIcons = ServiceExists(MS_CLIST_EXTRA_SET_ICON); - myGlobals.ExtraIconsServiceExist = ServiceExists(MS_EXTRAICON_REGISTER); - myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); - myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON); + myGlobals.HaveCListExtraIcons = ServiceExists(MS_CLIST_EXTRA_SET_ICON); + myGlobals.PopUpActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); + myGlobals.MsgAddIconExist = ServiceExists(MS_MSG_ADDICON); // init meta contacts INT_PTR ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0); diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 5fbb32f94c..c8c9ada146 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -137,92 +137,6 @@ static VOID FORCEINLINE ComboBox_AddItemWithData(HWND hCombo, LPTSTR ptszText, L ComboBox_SetItemData(hCombo, ComboBox_AddString(hCombo, TranslateTS(ptszText)), pData); } -/** - * This function fills a combobox with the advanced column names for clist extra icons. - * - * @param hCombo - the combobox's window handle - * - * @return nothing - **/ -static VOID ComboBox_FillExtraIcons(HWND hCombo) -{ - if (hCombo) - { - ComboBox_AddItemWithData(hCombo, LPGENT(""), -1); - - /* check if Clist Nicer */ - if (ServiceExists("CListFrame/SetSkinnedFrame")) - { - const struct CComboList { - INT nColumn; - LPTSTR ptszName; - } ExtraIcons[] = { - { EXTRA_ICON_ADV1, LPGENT("Advanced #1 (ICQ X-Status)")}, - { EXTRA_ICON_ADV2, LPGENT("Advanced #2")}, - { EXTRA_ICON_ADV3, LPGENT("Advanced #3")}, - { EXTRA_ICON_ADV4, LPGENT("Advanced #4")}, - { EXTRA_ICON_RES0, LPGENT("Reserved, unused")}, - { EXTRA_ICON_RES1, LPGENT("Reserved #1")}, - { EXTRA_ICON_RES2, LPGENT("Reserved #2")}, - { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")}, - }; - - for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++) - { - ComboBox_AddItemWithData(hCombo, - TranslateTS(ExtraIcons[i].ptszName), - ExtraIcons[i].nColumn ); - } - } - /* check if Clist modern*/ - else if (ServiceExists("CList/HideContactAvatar")) - { - const struct CComboList { - INT nColumn; - LPTSTR ptszName; - } ExtraIcons[] = { - { EXTRA_ICON_ADV1, LPGENT("Advanced #1")}, - { EXTRA_ICON_ADV2, LPGENT("Advanced #2")}, - { EXTRA_ICON_ADV3, LPGENT("Advanced #3")}, - { EXTRA_ICON_ADV4, LPGENT("Advanced #4")}, - { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")}, - { EXTRA_ICON_PROTO, LPGENT("Protocol")}, - { EXTRA_ICON_VISMODE, LPGENT("Visibility/Chat activity")}, - }; - - for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++) - { - ComboBox_AddItemWithData(hCombo, - TranslateTS(ExtraIcons[i].ptszName), - ExtraIcons[i].nColumn ); - } - } - /*check if Clist MW*/ - else if (ServiceExists("CLUI/GetConnectingIconForProtocol")) - { - const struct CComboList { - INT nColumn; - LPTSTR ptszName; - } ExtraIcons[] = { - { EXTRA_ICON_ADV1, LPGENT("Advanced #1")}, - { EXTRA_ICON_ADV2, LPGENT("Advanced #2")}, - { EXTRA_ICON_ADV3, LPGENT("Advanced #3")}, - { EXTRA_ICON_ADV4, LPGENT("Advanced #4")}, - { EXTRA_ICON_CLIENT, LPGENT("Client (fingerprint required)")}, - { EXTRA_ICON_PROTO, LPGENT("Protocol Type")}, - }; - - for (BYTE i = 0; i < SIZEOF(ExtraIcons); i++) - { - ComboBox_AddItemWithData(hCombo, - TranslateTS(ExtraIcons[i].ptszName), - ExtraIcons[i].nColumn ); - } - } - ComboBox_SetCurSel(hCombo, NULL); - } -} - /** * This function enables a dialog item * @@ -435,9 +349,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, //enable control if myGlobals.ExtraIconsServiceExist else disable const int idExtraIcons[] = { GROUP_OPT_EXTRAICONS, - TXT_OPT_GENDER, COMBO_OPT_GENDER, - /*TXT_OPT_FLAGS,*/ COMBO_OPT_FLAGS, -// CHECK_OPT_FLAGSUNKNOWN, CHECK_OPT_FLAGSMSGSTATUS, + TXT_OPT_GENDER, TXT_OPT_DEFAULTICONS, CHECK_OPT_HOMEPAGEICON, CHECK_OPT_PHONEICON, CHECK_OPT_EMAILICON, CHECK_OPT_ZODIACAVATAR @@ -450,20 +362,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, #else ShowWindow(GetDlgItem(hDlg, CHECK_OPT_ZODIACAVATAR),SW_HIDE); #endif - - // init extra icons options - ShowWindow(GetDlgItem(hDlg, TXT_OPT_EXTRAICONS),myGlobals.ExtraIconsServiceExist?SW_SHOW:SW_HIDE); - ShowWindow(GetDlgItem(hDlg, TXT_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hDlg, COMBO_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hDlg, CHECK_OPT_GENDER), myGlobals.ExtraIconsServiceExist?SW_SHOW:SW_HIDE); - ShowWindow(GetDlgItem(hDlg, TXT_OPT_FLAGS), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hDlg, COMBO_OPT_FLAGS), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); - if (InitialEnableControls(hDlg, idExtraIcons, SIZEOF(idExtraIcons), myGlobals.HaveCListExtraIcons) && !myGlobals.ExtraIconsServiceExist) - { - ComboBox_FillExtraIcons(GetDlgItem(hDlg, COMBO_OPT_GENDER)); - ComboBox_FillExtraIcons(GetDlgItem(hDlg, COMBO_OPT_FLAGS)); - } - SendNotify_InfoChanged(hDlg); } return TRUE; @@ -489,20 +387,10 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, } // extra icon settings - if (!myGlobals.ExtraIconsServiceExist) - { - ComboBox_SetCurSelByItemDataPtr(GetDlgItem(hDlg, COMBO_OPT_GENDER), - (LPARAM)DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER)); - ComboBox_SetCurSelByItemDataPtr(GetDlgItem(hDlg, COMBO_OPT_FLAGS), - (LPARAM)DB::Setting::GetByte(MODNAMEFLAGS,"ExtraImgFlagColumn", SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT)); - } - else - { - DBGetCheckBtn(hDlg, CHECK_OPT_GENDER, SET_CLIST_EXTRAICON_GENDER2, 0); - } - DBGetCheckBtn (hDlg, CHECK_OPT_HOMEPAGEICON, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE); - DBGetCheckBtn (hDlg, CHECK_OPT_EMAILICON, SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL); - DBGetCheckBtn (hDlg, CHECK_OPT_PHONEICON, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE); + DBGetCheckBtn(hDlg, CHECK_OPT_GENDER, SET_CLIST_EXTRAICON_GENDER2, 0); + DBGetCheckBtn(hDlg, CHECK_OPT_HOMEPAGEICON, SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE); + DBGetCheckBtn(hDlg, CHECK_OPT_EMAILICON, SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL); + DBGetCheckBtn(hDlg, CHECK_OPT_PHONEICON, SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE); CheckDlgButton(hDlg, CHECK_OPT_FLAGSUNKNOWN, gFlagsOpts.bUseUnknownFlag); CheckDlgButton(hDlg, CHECK_OPT_FLAGSMSGSTATUS, gFlagsOpts.bShowStatusIconFlag); @@ -546,32 +434,7 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, FlagsMsgWndChange++; } - if (!myGlobals.ExtraIconsServiceExist) - { - // Enable/Disable extra icon gender modules and write new values to database - BYTE bOldColumn = DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER); - BYTE bNewColumn = (BYTE)ComboBox_GetItemData( - GetDlgItem(hDlg,COMBO_OPT_GENDER), - SendDlgItemMessage(hDlg, COMBO_OPT_GENDER, CB_GETCURSEL, NULL, NULL)); - if (bOldColumn != bNewColumn) { - ClearAllExtraIcons(bOldColumn); - SvcGenderEnableExtraIcons(bNewColumn, TRUE); - } - - // Enable/Disable extra icon Flags and write new values to database - bNewColumn = (BYTE)ComboBox_GetItemData( - GetDlgItem(hDlg,COMBO_OPT_FLAGS), - SendDlgItemMessage(hDlg, COMBO_OPT_FLAGS, CB_GETCURSEL, NULL, NULL)); - if (gFlagsOpts.idExtraColumn != bNewColumn || - gFlagsOpts.bShowExtraImgFlag!=(bNewColumn!=((BYTE)-1))) { - SvcFlagsEnableExtraIcons(bNewColumn, TRUE); - FlagsClistChange++; - } - } - else - { - SvcGenderEnableExtraIcons(IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER)? 1:-1, TRUE); - } + SvcGenderEnableExtraIcons(IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER)? 1:-1, TRUE); if(FlagsClistChange) EnsureExtraImages(); if(FlagsMsgWndChange) UpdateStatusIcons(NULL); @@ -593,15 +456,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, { switch (LOWORD(wParam)) { - case COMBO_OPT_GENDER: - case COMBO_OPT_FLAGS: - { - if (HIWORD(wParam) == CBN_SELCHANGE && bInitialized) - { - NotifyParentOfChange(hDlg); - } - } - break; case CHECK_OPT_MI_MAIN: case CHECK_OPT_MI_CONTACT: case CHECK_OPT_MI_GROUP: @@ -900,8 +754,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam TranslateDialogDefault(hDlg); - ShowWindow(GetDlgItem(hDlg, TXT_REMIND5), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); - ShowWindow(GetDlgItem(hDlg, EDIT_EXTRAICON), myGlobals.ExtraIconsServiceExist?SW_HIDE:SW_SHOW); ShowWindow(GetDlgItem(hDlg, CHECK_REMIND_SECURED), myGlobals.UseDbxTree?SW_HIDE:SW_SHOW); SendDlgItemMessage(hDlg, ICO_BIRTHDAY, STM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_DLG_ANNIVERSARY)); @@ -914,8 +766,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam SendDlgItemMessage(hDlg, EDIT_REMIND_SOUNDOFFSET, EM_LIMITTEXT, 2, 0); SendDlgItemMessage(hDlg, SPIN_REMIND_SOUNDOFFSET, UDM_SETRANGE32, 0, 50); - ComboBox_FillExtraIcons(GetDlgItem(hDlg, EDIT_EXTRAICON)); - if (hCtrl = GetDlgItem(hDlg, EDIT_REMIND_ENABLED)) { ComboBox_AddString(hCtrl, TranslateT("Reminder disabled")); @@ -955,16 +805,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam SetDlgItemInt(hDlg, EDIT_REMIND, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_OFFSET, DEFVAL_REMIND_OFFSET), FALSE); SetDlgItemInt(hDlg, EDIT_REMIND_SOUNDOFFSET, DB::Setting::GetByte(SET_REMIND_SOUNDOFFSET, DEFVAL_REMIND_SOUNDOFFSET), FALSE); SetDlgItemInt(hDlg, EDIT_REMIND2, DB::Setting::GetWord(NULL, MODNAME, SET_REMIND_NOTIFYINTERVAL, DEFVAL_REMIND_NOTIFYINTERVAL), FALSE); - if (!myGlobals.ExtraIconsServiceExist) { - for (int i = 0; i < ComboBox_GetCount(GetDlgItem(hDlg, EDIT_EXTRAICON)); i++) - { - if ((BYTE)ComboBox_GetItemData(GetDlgItem(hDlg,EDIT_EXTRAICON),i) == DB::Setting::GetByte(SET_REMIND_EXTRAICON, 1)) - { - SendDlgItemMessage(hDlg, EDIT_EXTRAICON, CB_SETCURSEL, i, NULL); - break; - } - } - } + SendDlgItemMessage(hDlg, EDIT_BIRTHMODULE, CB_SETCURSEL, DB::Setting::GetByte(SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE), NULL); { MTime mtLast; @@ -983,7 +824,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam case PSN_APPLY: { - BYTE bColumn, bNewVal; + BYTE bNewVal; BOOLEAN bReminderCheck = FALSE; // save checkbox options @@ -1014,18 +855,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam } } - // save new clist extra icon - bColumn = DB::Setting::GetByte(SET_REMIND_EXTRAICON, 1); - bNewVal = (BYTE)ComboBox_GetItemData( - GetDlgItem(hDlg,EDIT_EXTRAICON), - SendDlgItemMessage(hDlg, EDIT_EXTRAICON, CB_GETCURSEL, NULL, NULL)); - if (bColumn != bNewVal) - { - ClearAllExtraIcons(bColumn); - DB::Setting::WriteByte(SET_REMIND_EXTRAICON, bNewVal); - bReminderCheck = TRUE; - } - // update current reminder state bNewVal = (BYTE)SendDlgItemMessage(hDlg, EDIT_REMIND_ENABLED, CB_GETCURSEL, NULL, NULL); if (DB::Setting::GetByte(SET_REMIND_ENABLED, 1) != bNewVal) @@ -1033,7 +862,6 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam DB::Setting::WriteByte(SET_REMIND_ENABLED, bNewVal); if (bNewVal == REMIND_OFF) { - ClearAllExtraIcons(bColumn); SvcReminderEnable(FALSE); bReminderCheck = FALSE; } @@ -1070,20 +898,12 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam EnableControls(hDlg, idCtrl, SIZEOF(idCtrl), bEnabled); bEnabled &= myGlobals.HaveCListExtraIcons; - - EnableDlgItem(hDlg, TXT_REMIND5, bEnabled); - EnableDlgItem(hDlg, EDIT_EXTRAICON, bEnabled); } } - case EDIT_EXTRAICON: case EDIT_BIRTHMODULE: - { - if (bInitialized && HIWORD(wParam) == CBN_SELCHANGE) - { - NotifyParentOfChange(hDlg); - } - } + if (bInitialized && HIWORD(wParam) == CBN_SELCHANGE) + NotifyParentOfChange(hDlg); break; case CHECK_REMIND_MI: @@ -1091,12 +911,8 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam case CHECK_REMIND_VISIBLEONLY: case CHECK_REMIND_STARTUP: case CHECK_REMIND_SECURED: - { - if (bInitialized && HIWORD(wParam) == BN_CLICKED) - { - NotifyParentOfChange(hDlg); - } - } + if (bInitialized && HIWORD(wParam) == BN_CLICKED) + NotifyParentOfChange(hDlg); break; /* diff --git a/plugins/UserInfoEx/src/resource.h b/plugins/UserInfoEx/src/resource.h index 1419fcc501..854031ebf5 100644 --- a/plugins/UserInfoEx/src/resource.h +++ b/plugins/UserInfoEx/src/resource.h @@ -71,7 +71,6 @@ #define TXT_NUMCONTACT 1124 #define TXT_NUMBIRTH 1125 #define TXT_REMIND4 1125 -#define TXT_REMIND5 1126 #define TXT_MESSAGE 1126 #define TXT_OPT_CLR_NORMAL 1127 #define TXT_REMIND6 1127 @@ -154,7 +153,6 @@ #define IDC_TREE 1504 #define IDC_COMBO1 1506 #define EDIT_SORT 1506 -#define EDIT_EXTRAICON 1506 #define EDIT_METASUBCONTACTS 1506 #define EDIT_HISTORY_GROUPING 1506 #define COMBO_VIEW 1506 @@ -201,8 +199,6 @@ #define CHECK_POPUP 1572 #define GROUP_FILTER 1573 #define GROUP_REMINDER 1574 -#define COMBO_OPT_GENDER 1575 -#define COMBO_OPT_FLAGS 1576 #define TXT_OPT_GENDER 1577 #define GROUP_OPT_EXTRAICONS 1578 #define TXT_OPT_DEFAULTICONS 1579 diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index a581dfe2d2..27b7532551 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -137,14 +137,6 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) * Event Handler functions ***********************************************************************************************************/ -static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) -{ - HICON hIcon = IcoLib_GetIcon(ICO_BTN_EMAIL); - ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - return 0; -} - /** * Notification handler for clist extra icons to be applied for a contact. * @@ -155,34 +147,12 @@ static INT OnCListApplyIcons(WPARAM wParam, LPARAM lParam) { LPSTR val = Get((HANDLE)wParam); - if (!myGlobals.ExtraIconsServiceExist) - { - IconExtraColumn iec; - - iec.cbSize = sizeof(IconExtraColumn); - iec.ColumnType = EXTRA_ICON_EMAIL; - if (val) - { - iec.hImage = ghExtraIconDef; - mir_free(val); - } - else - { - iec.hImage = INVALID_HANDLE_VALUE; - mir_free(val); - } - CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM)&iec); - } - else - { - EXTRAICON ico; - ico.cbSize=sizeof(ico); - ico.hContact=(HANDLE)wParam; - ico.hExtraIcon=ghExtraIconSvc; - ico.icoName=val?ICO_BTN_EMAIL:(char *)0; - mir_free(val); - CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); - } + EXTRAICON ico = { sizeof(ico) }; + ico.hContact=(HANDLE)wParam; + ico.hExtraIcon=ghExtraIconSvc; + ico.icoName=val?ICO_BTN_EMAIL:(char *)0; + mir_free(val); + CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); return 0; } @@ -325,26 +295,15 @@ VOID SvcEMailEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) { hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons); } - if (myGlobals.ExtraIconsServiceExist) - { - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - { - EXTRAICON_INFO ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "email"; //must be the same as the group name in extraicon - ico.description= "E-mail (uinfoex)"; - ico.descIcon = ICO_BTN_EMAIL; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - ZeroMemory(&ico,sizeof(ico)); - } - } - else if (hRebuildIconsHook == NULL) - { - hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons); - OnCListRebuildIcons(0, 0); + + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { + EXTRAICON_INFO ico = { sizeof(ico) }; + ico.type = EXTRAICON_TYPE_ICOLIB; + ico.name = "email"; //must be the same as the group name in extraicon + ico.description= "E-mail (uinfoex)"; + ico.descIcon = ICO_BTN_EMAIL; + ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); + ZeroMemory(&ico,sizeof(ico)); } } else // E-mail uncheckt @@ -375,7 +334,6 @@ VOID SvcEMailEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) VOID SvcEMailOnModulesLoaded() { SvcEMailEnableExtraIcons( - myGlobals.ExtraIconsServiceExist || DB::Setting::GetByte(SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL), FALSE); } diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index e48ff7a22f..d8f542b374 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -71,35 +71,20 @@ BYTE GenderOf(HANDLE hContact) * Event Handler functions ***********************************************************************************************************/ -static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) -{ - HICON hIcon = IcoLib_GetIcon(ICO_COMMON_FEMALE); - ghExtraIconF = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - hIcon = IcoLib_GetIcon(ICO_COMMON_MALE); - ghExtraIconM = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - return 0; -} - /** * Notification handler for clist extra icons to be applied for a contact. * * @param wParam - handle to the contact whose extra icon is to apply * @param lParam - not used **/ + static INT OnCListApplyIcons(HANDLE hContact, LPARAM) { - if (myGlobals.ExtraIconsServiceExist && (ghExtraIconSvc != INVALID_HANDLE_VALUE)) - { - EXTRAICON ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); + if (ghExtraIconSvc != INVALID_HANDLE_VALUE) { + EXTRAICON ico = { sizeof(ico) }; ico.hContact = hContact; ico.hExtraIcon = ghExtraIconSvc; - switch (GenderOf(hContact)) - { + switch (GenderOf(hContact)) { case 'M': ico.icoName = ICO_COMMON_MALE; break; @@ -111,28 +96,6 @@ static INT OnCListApplyIcons(HANDLE hContact, LPARAM) } CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); } - else - { - IconExtraColumn iec; - - iec.ColumnType = DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER); - if ((BYTE)iec.ColumnType != -1) - { - iec.cbSize = sizeof(IconExtraColumn); - switch (GenderOf(hContact)) - { - case 'M': - iec.hImage = ghExtraIconM; - break; - case 'F': - iec.hImage = ghExtraIconF; - break; - default: - iec.hImage = INVALID_HANDLE_VALUE; - } - CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec); - } - } return 0; } @@ -184,51 +147,25 @@ VOID SvcGenderEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) if (myGlobals.HaveCListExtraIcons) { if (bUpdateDB) - { - if (myGlobals.ExtraIconsServiceExist) - { - DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn); - } - else - { - DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER, bColumn); - } - } + DB::Setting::WriteByte(SET_CLIST_EXTRAICON_GENDER2, bColumn); if (bEnable) // Gender checkt or dropdown select { - if (myGlobals.ExtraIconsServiceExist) - { - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - { - EXTRAICON_INFO ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "gender"; //must be the same as the group name in extraicon - ico.description="Gender (uinfoex)"; - ico.descIcon = ICO_COMMON_MALE; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } - } - else - { - if (hRebuildIconsHook == NULL) - { - hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons); - OnCListRebuildIcons(0, 0); - } + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { + EXTRAICON_INFO ico = { sizeof(ico) }; + ico.type = EXTRAICON_TYPE_ICOLIB; + ico.name = "gender"; //must be the same as the group name in extraicon + ico.description="Gender (uinfoex)"; + ico.descIcon = ICO_COMMON_MALE; + ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); } + // hook events if (hChangedHook == NULL) - { hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - } + if (hApplyIconHook == NULL) - { hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - } } else { @@ -257,14 +194,7 @@ VOID SvcGenderEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB) **/ VOID SvcGenderLoadModule() { - if ( myGlobals.ExtraIconsServiceExist) - { - SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER2, 0), FALSE); - } - else - { - SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER, DEFVAL_CLIST_EXTRAICON_GENDER), FALSE); - } + SvcGenderEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_GENDER2, 0), FALSE); } /** diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index 77248960ac..cb9533ada2 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -100,14 +100,6 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) * Event Handler functions ***********************************************************************************************************/ -static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) -{ - HICON hIcon = IcoLib_GetIcon(ICO_BTN_GOTO); - ghExtraIconDef = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - return 0; -} - /** * Notification handler for clist extra icons to be applied for a contact. * @@ -117,28 +109,13 @@ static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) static INT OnCListApplyIcons(HANDLE hContact, LPARAM) { LPSTR val = Get(hContact); - - if (myGlobals.ExtraIconsServiceExist && (ghExtraIconSvc != INVALID_HANDLE_VALUE)) - { - EXTRAICON ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); + if (ghExtraIconSvc != INVALID_HANDLE_VALUE) { + EXTRAICON ico = { sizeof(ico) }; ico.hContact = hContact; ico.hExtraIcon = ghExtraIconSvc; ico.icoName = (val) ? ICO_BTN_GOTO : NULL; CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); } - else - { - IconExtraColumn iec; - - ZeroMemory(&iec, sizeof(iec)); - iec.cbSize = sizeof(IconExtraColumn); - iec.ColumnType = EXTRA_ICON_WEB; - iec.hImage = (val) ? ghExtraIconDef : INVALID_HANDLE_VALUE; - CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec); - } MIR_FREE(val); return 0; } @@ -257,32 +234,18 @@ VOID SvcHomepageEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) { // hook events if (hChangedHook == NULL) - { hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - } + if (hApplyIconHook == NULL) - { hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - } - if (myGlobals.ExtraIconsServiceExist) - { - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - { - EXTRAICON_INFO ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "homepage"; //must be the same as the group name in extraicon - ico.description = "Homepage (uinfoex)"; - ico.descIcon = ICO_BTN_GOTO; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } - } - else if (hRebuildIconsHook == NULL) - { - hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnCListRebuildIcons); - OnCListRebuildIcons(0, 0); + + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { + EXTRAICON_INFO ico = { sizeof(ico) }; + ico.type = EXTRAICON_TYPE_ICOLIB; + ico.name = "homepage"; //must be the same as the group name in extraicon + ico.description = "Homepage (uinfoex)"; + ico.descIcon = ICO_BTN_GOTO; + ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); } } else @@ -317,7 +280,6 @@ VOID SvcHomepageLoadModule() { CreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand); SvcHomepageEnableExtraIcons( - myGlobals.ExtraIconsServiceExist || DB::Setting::GetByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE), FALSE); } diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 05d1e8f821..7ccdc576b4 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -93,80 +93,29 @@ static INT_PTR Get(HANDLE hContact) * Event Handler functions ***********************************************************************************************************/ -static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam) -{ - HICON hIcon = IcoLib_GetIcon(ICO_BTN_PHONE); - ghExtraIconDef[0] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - hIcon = IcoLib_GetIcon(ICO_BTN_CELLULAR); - ghExtraIconDef[1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0); - Skin_ReleaseIcon(hIcon); - return 0; -} - /** * Notification handler for clist extra icons to be applied for a contact. * * @param wParam - handle to the contact whose extra icon is to apply * @param lParam - not used **/ + static INT OnCListApplyIcons(HANDLE hContact, LPARAM) { - if (!myGlobals.ExtraIconsServiceExist) - { - IconExtraColumn iec; - iec.cbSize = sizeof(IconExtraColumn); - iec.ColumnType = EXTRA_ICON_SMS; - switch (Get(hContact)) - { - case PHONE_NORMAL: - { - iec.hImage = ghExtraIconDef[0]; - } - break; - - case PHONE_SMS: - { - iec.hImage = ghExtraIconDef[1]; - } - break; - - default: - { - iec.hImage = INVALID_HANDLE_VALUE; - } - } - CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec); - } - else - { - EXTRAICON ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); - ico.hContact = hContact; - ico.hExtraIcon = ghExtraIconSvc; - switch (Get(hContact)) - { - case PHONE_NORMAL: - { - ico.icoName = ICO_BTN_PHONE; - } - break; - - case PHONE_SMS: - { - ico.icoName = ICO_BTN_CELLULAR; - } - break; - - default: - { - ico.icoName = (char *)0; - } - } - CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); + EXTRAICON ico = { sizeof(ico) }; + ico.hContact = hContact; + ico.hExtraIcon = ghExtraIconSvc; + switch (Get(hContact)) { + case PHONE_NORMAL: + ico.icoName = ICO_BTN_PHONE; + break; + case PHONE_SMS: + ico.icoName = ICO_BTN_CELLULAR; + break; + default: + ico.icoName = NULL; } + CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); return 0; } @@ -232,32 +181,18 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) { // hook events if (hChangedHook == NULL) - { hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - } + if (hApplyIconHook == NULL) - { hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - } - if (myGlobals.ExtraIconsServiceExist) - { - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - { - EXTRAICON_INFO ico; - - ZeroMemory(&ico, sizeof(ico)); - ico.cbSize = sizeof(ico); - ico.type = EXTRAICON_TYPE_ICOLIB; - ico.name = "sms"; //must be the same as the group name in extraicon - ico.description = "(uinfoex)"; - ico.descIcon = ICO_BTN_CELLULAR; - ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); - } - } - else if (hRebuildIconsHook == NULL) - { - hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, (MIRANDAHOOK)OnCListRebuildIcons); - OnCListRebuildIcons(0, 0); + + if (ghExtraIconSvc == INVALID_HANDLE_VALUE) { + EXTRAICON_INFO ico = { sizeof(ico) }; + ico.type = EXTRAICON_TYPE_ICOLIB; + ico.name = "sms"; //must be the same as the group name in extraicon + ico.description = "(uinfoex)"; + ico.descIcon = ICO_BTN_CELLULAR; + ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); } } else @@ -288,7 +223,6 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB) VOID SvcPhoneLoadModule() { SvcPhoneEnableExtraIcons( - myGlobals.ExtraIconsServiceExist || DB::Setting::GetByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE), FALSE); } diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index c26e2027e6..bfde666a9b 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -268,58 +268,32 @@ static HANDLE GetCListExtraIcon(const CEvent &evt) **/ static VOID NotifyWithExtraIcon(HANDLE hContact, const CEvent &evt) { - if (myGlobals.HaveCListExtraIcons && gRemindOpts.bCListExtraIcon) - { - if (!myGlobals.ExtraIconsServiceExist) - { - IconExtraColumn iec; + if (gRemindOpts.bCListExtraIcon) { + CHAR szIcon[MAXSETTING]; - iec.cbSize = sizeof(IconExtraColumn); - iec.ColumnType = gRemindOpts.bCListExtraIcon; - iec.hImage = GetCListExtraIcon(evt); - CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec); - } - else - { - CHAR szIcon[MAXSETTING]; - EXTRAICON ico; + EXTRAICON ico = { sizeof(ico) }; + ico.hContact = hContact; + ico.hExtraIcon = ExtraIcon; + switch (evt._eType) { + case CEvent::BIRTHDAY: + if (evt._wDaysLeft > 9) + ico.icoName = ICO_RMD_DTAX; + else { + mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft); + ico.icoName = szIcon; + } + break; - ico.cbSize=sizeof(ico); - ico.hContact=hContact; - ico.hExtraIcon=ExtraIcon; - switch (evt._eType) - { - case CEvent::BIRTHDAY: - { - if (evt._wDaysLeft > 9) - { - ico.icoName=ICO_RMD_DTAX; - } - else - { - mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft); - ico.icoName=szIcon; - } - break; - } - case CEvent::ANNIVERSARY: - { - if (evt._wDaysLeft > 9) - { - ico.icoName=ICO_RMD_DTAX; - } - else - { - mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft); - ico.icoName=szIcon; - } - break; - } - default: - ico.icoName=(char *)0; + case CEvent::ANNIVERSARY: + if (evt._wDaysLeft > 9) + ico.icoName = ICO_RMD_DTAX; + else { + mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft); + ico.icoName = szIcon; } - CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); + break; } + CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0); } } @@ -1081,15 +1055,13 @@ VOID SvcReminderEnable(BOOLEAN bEnable) { if (bEnable) // Reminder is on { - if (myGlobals.ExtraIconsServiceExist && (ExtraIcon == INVALID_HANDLE_VALUE)) - { - EXTRAICON_INFO ico = {0}; + if (ExtraIcon == INVALID_HANDLE_VALUE) { + EXTRAICON_INFO ico = { sizeof(ico) }; ico.type = EXTRAICON_TYPE_ICOLIB; - ico.cbSize=sizeof(ico); - ico.name="Reminder"; - ico.description="Reminder (uinfoex)"; - ico.descIcon=ICO_COMMON_ANNIVERSARY; - ExtraIcon=(HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); + ico.name = "Reminder"; + ico.description = "Reminder (uinfoex)"; + ico.descIcon = ICO_COMMON_ANNIVERSARY; + ExtraIcon = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0); ZeroMemory(&ico,sizeof(ico)); } // init hooks -- cgit v1.2.3