From 756fa05b6d7a14441d0f9b8d97dbdb4f9df34918 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 31 Oct 2019 18:28:33 +0300 Subject: UInfoEx: duplicate extra-icons removed --- plugins/UserInfoEx/res/resource.rc | 26 ++- plugins/UserInfoEx/src/Flags/svc_flags.h | 1 - plugins/UserInfoEx/src/init.cpp | 10 -- plugins/UserInfoEx/src/mir_menuitems.cpp | 3 - plugins/UserInfoEx/src/psp_options.cpp | 13 -- plugins/UserInfoEx/src/resource.h | 7 +- plugins/UserInfoEx/src/stdafx.h | 3 - plugins/UserInfoEx/src/svc_email.cpp | 275 ------------------------------- plugins/UserInfoEx/src/svc_email.h | 30 ---- plugins/UserInfoEx/src/svc_gender.cpp | 105 ------------ plugins/UserInfoEx/src/svc_gender.h | 3 - plugins/UserInfoEx/src/svc_homepage.cpp | 232 -------------------------- plugins/UserInfoEx/src/svc_homepage.h | 30 ---- plugins/UserInfoEx/src/svc_phone.cpp | 177 -------------------- plugins/UserInfoEx/src/svc_phone.h | 30 ---- plugins/UserInfoEx/src/version.h | 6 +- 16 files changed, 16 insertions(+), 935 deletions(-) delete mode 100644 plugins/UserInfoEx/src/svc_email.cpp delete mode 100644 plugins/UserInfoEx/src/svc_email.h delete mode 100644 plugins/UserInfoEx/src/svc_homepage.cpp delete mode 100644 plugins/UserInfoEx/src/svc_homepage.h delete mode 100644 plugins/UserInfoEx/src/svc_phone.cpp delete mode 100644 plugins/UserInfoEx/src/svc_phone.h (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/res/resource.rc b/plugins/UserInfoEx/res/resource.rc index 78e56a0e97..cffa4c20ba 100644 --- a/plugins/UserInfoEx/res/resource.rc +++ b/plugins/UserInfoEx/res/resource.rc @@ -16,7 +16,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1250) +#pragma code_page(1251) ///////////////////////////////////////////////////////////////////////////// // @@ -411,7 +411,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,165,85,50,14,NOT WS_VISIBLE END -IDD_OPT_COMMON DIALOGEX 0, 0, 310, 230 +IDD_OPT_COMMON DIALOGEX 0, 0, 310, 201 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -445,21 +445,15 @@ BEGIN CONTROL "Off",RADIO_OPT_MI_ACCOUNT_NONE,"Button",BS_AUTORADIOBUTTON,151,84,31,10 CONTROL "Export/import items",RADIO_OPT_MI_ACCOUNT_EXIMPORT, "Button",BS_AUTORADIOBUTTON,212,84,80,10 - GROUPBOX "Extra icons",GROUP_OPT_EXTRAICONS,6,105,144,117 - LTEXT "Replace the following default icons:",TXT_OPT_DEFAULTICONS,12,124,132,8 - CONTROL "Homepage",CHECK_OPT_HOMEPAGEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,140,130,10 - CONTROL "Phone",CHECK_OPT_PHONEICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,157,130,10 - CONTROL "E-mail",CHECK_OPT_EMAILICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,174,130,10 - CONTROL "Gender",CHECK_OPT_GENDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,191,130,10 - GROUPBOX "Misc",GROUP_OPT_EXTRAICONS2,156,105,148,117 - CONTROL "Show 'Restart' menu item",CHECK_OPT_MI_RESTART,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,161,117,132,10 + GROUPBOX "Misc",GROUP_OPT_EXTRAICONS2,6,105,298,91 + CONTROL "Show 'Restart' menu item",CHECK_OPT_MI_RESTART,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,13,119,132,10 CONTROL "Use zodiac as default avatar",CHECK_OPT_ZODIACAVATAR, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,129,131,10 - LTEXT "Country flags",TXT_OPT_FLAGS,161,148,131,8 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,131,131,10 + LTEXT "Country flags",TXT_OPT_FLAGS,13,155,288,8 CONTROL "Use &unknown flag if country cannot be determined",CHECK_OPT_FLAGSUNKNOWN, - "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,161,183,131,16 + "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,168,286,11 CONTROL "Show country flag as &status icon on message window",CHECK_OPT_FLAGSMSGSTATUS, - "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,161,203,131,16 + "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_GROUP | WS_TABSTOP,13,182,290,9 END IDD_CONTACT_ANNIVERSARY DIALOGEX 0, 0, 300, 169 @@ -548,8 +542,10 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_MAIN ICON "main.ico" + IDI_DEFAULT ICON "default.ico" + ///////////////////////////////////////////////////////////////////////////// // // Cursor @@ -557,6 +553,7 @@ IDI_DEFAULT ICON "default.ico" CURSOR_ADDGROUP CURSOR "dragcopy.cur" + ///////////////////////////////////////////////////////////////////////////// // // DESIGNINFO @@ -692,6 +689,7 @@ END // IDB_FLAGSPNG PNG "flags.png" + #endif // Neutral resources ///////////////////////////////////////////////////////////////////////////// diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.h b/plugins/UserInfoEx/src/Flags/svc_flags.h index 1ed7f464be..8de5096e1f 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.h +++ b/plugins/UserInfoEx/src/Flags/svc_flags.h @@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define STATUSICON_REFRESHDELAY 100 /* time for which setting changes are buffered */ extern bool g_bUseUnknownFlag, g_bShowStatusIconFlag; -extern bool g_eiGender, g_eiHome, g_eiEmail, g_eiPhone; struct MsgWndData { diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp index cc5389422a..7e77154b06 100644 --- a/plugins/UserInfoEx/src/init.cpp +++ b/plugins/UserInfoEx/src/init.cpp @@ -101,7 +101,6 @@ static int OnModulesLoaded(WPARAM, LPARAM) SvcReminderOnModulesLoaded(); // load extended intagration services - SvcHomepageLoadModule(); SvcFlagsOnModulesLoaded(); // build contact's menuitems @@ -120,11 +119,7 @@ static int OnShutdown(WPARAM, LPARAM) CtrlButtonUnloadModule(); SvcConstantsUnloadModule(); - SvcEMailUnloadModule(); SvcFlagsUnloadModule(); - SvcGenderUnloadModule(); - SvcHomepageUnloadModule(); - SvcPhoneUnloadModule(); mir_free(hMenuItemAccount); return 0; @@ -183,13 +178,8 @@ int CMPlugin::Load() SvcFlagsLoadModule(); SvcTimezoneLoadModule(); - SvcEMailLoadModule(); SvcRefreshContactInfoLoadModule(); - SvcPhoneEnableExtraIcons(); - SvcGenderEnableExtraIcons(); - SvcHomepageEnableExtraIcons(); - CtrlContactLoadModule(); // load my button class CtrlButtonLoadModule(); diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp index f3c1c6200c..ecbf3837f5 100644 --- a/plugins/UserInfoEx/src/mir_menuitems.cpp +++ b/plugins/UserInfoEx/src/mir_menuitems.cpp @@ -69,9 +69,6 @@ void RebuildContact() HGENMENU mhExIm = nullptr; static HGENMENU hMenuItem[4] = { nullptr, nullptr, nullptr, nullptr }; - SvcEMailRebuildMenu(); - SvcHomepageRebuildMenu(); - // load options int flag = g_plugin.getByte(SET_MI_CONTACT, MCAS_NOTINITIATED); if (flag == MCAS_NOTINITIATED) { diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 06bf4e6e1b..0cb76d7787 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -299,10 +299,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, } // extra icon settings - CheckDlgButton(hDlg, CHECK_OPT_GENDER, g_eiGender ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hDlg, CHECK_OPT_EMAILICON, g_eiEmail ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hDlg, CHECK_OPT_PHONEICON, g_eiPhone ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hDlg, CHECK_OPT_HOMEPAGEICON, g_eiHome ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg, CHECK_OPT_FLAGSUNKNOWN, g_bUseUnknownFlag ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hDlg, CHECK_OPT_FLAGSMSGSTATUS, g_bShowStatusIconFlag ? BST_CHECKED : BST_UNCHECKED); @@ -341,11 +337,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, FlagsMsgWndChange = true; } - FlagsClistChange |= SvcHomepageEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_HOMEPAGEICON), true); - FlagsClistChange |= SvcEMailEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_EMAILICON), true); - FlagsClistChange |= SvcPhoneEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_PHONEICON), true); - FlagsClistChange |= SvcGenderEnableExtraIcons(0 != IsDlgButtonChecked(hDlg, CHECK_OPT_GENDER), true); - if (FlagsClistChange) ExtraIcon_SetAll(); if (FlagsMsgWndChange) @@ -391,10 +382,6 @@ static INT_PTR CALLBACK DlgProc_CommonOpts(HWND hDlg, UINT uMsg, WPARAM wParam, case RADIO_OPT_MI_ACCOUNT_ALL: case RADIO_OPT_MI_ACCOUNT_NONE: case RADIO_OPT_MI_ACCOUNT_EXIMPORT: - case CHECK_OPT_HOMEPAGEICON: - case CHECK_OPT_EMAILICON: - case CHECK_OPT_PHONEICON: - case CHECK_OPT_GENDER: case CHECK_OPT_FLAGSUNKNOWN: case CHECK_OPT_FLAGSMSGSTATUS: case CHECK_OPT_ZODIACAVATAR: diff --git a/plugins/UserInfoEx/src/resource.h b/plugins/UserInfoEx/src/resource.h index f9f0becaec..928b94476b 100644 --- a/plugins/UserInfoEx/src/resource.h +++ b/plugins/UserInfoEx/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by ..\res\resource.rc +// Used by w:\miranda-ng\plugins\UserInfoEx\res\resource.rc // #define IDSKIP 20 #define IDALL 21 @@ -198,7 +198,6 @@ #define CHECK_POPUP 1572 #define GROUP_FILTER 1573 #define GROUP_REMINDER 1574 -#define GROUP_OPT_EXTRAICONS 1578 #define TXT_OPT_DEFAULTICONS 1579 #define TXT_OPT_DEFAULTICONS2 1580 #define ICO_COUNTRY 1580 @@ -210,7 +209,6 @@ #define TITLE_AGE 1583 #define FRAME_AGE 1584 #define IDC_STATIC_GROUP 1585 -#define CHECK_OPT_GENDER 1586 #define TXT_OPT_EXTRAICONS 1587 #define BTN_PREVIEW 1588 #define IDC_PAGETITLE 1589 @@ -285,13 +283,10 @@ #define CHECK_REMIND_HIDDEN 40106 #define CHECK_REMIND_VISIBLEONLY 40106 #define CHECK_OPT_ICOVERSION 40108 -#define CHECK_OPT_HOMEPAGEICON 40108 #define CHECK_OPT_CLR 40109 #define CHECK_OPT_REPLACECONTACTS 40109 #define CHECK_OPT_GROUPS 40110 -#define CHECK_OPT_EMAILICON 40110 #define CHECK_OPT_SORTTREE 40111 -#define CHECK_OPT_PHONEICON 40111 #define CHECK_OPT_READONLY 40112 #define CHECK_OPT_ZODIACAVATAR 40112 #define CHECK_OPT_CHANGEMYDETAILS 40113 diff --git a/plugins/UserInfoEx/src/stdafx.h b/plugins/UserInfoEx/src/stdafx.h index 34d81f6cec..22a8c54bca 100644 --- a/plugins/UserInfoEx/src/stdafx.h +++ b/plugins/UserInfoEx/src/stdafx.h @@ -110,10 +110,7 @@ using namespace std; #include "../IconPacks/ice/src/icons.h" #include "svc_constants.h" #include "svc_avatar.h" -#include "svc_email.h" #include "svc_gender.h" -#include "svc_homepage.h" -#include "svc_phone.h" #include "svc_refreshci.h" #include "svc_reminder.h" #include "svc_timezone.h" diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp deleted file mode 100644 index f8ca9bc814..0000000000 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -� 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -static HGENMENU ghMenuItem = nullptr; -static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE; -static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; - -static HANDLE hChangedHook = nullptr; -static HANDLE hApplyIconHook = nullptr; - -bool g_eiEmail = false; - -/** -* This function reads the email address of the contact. -* -* @param hContact - handle to contact to read email from -* -* @retval email address -* @retval NULL, if contact does not provide any email address -**/ - -static LPSTR Get(MCONTACT hContact) -{ - // ignore owner - if (hContact != NULL) { - LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - - if (pszProto != nullptr) { - LPCSTR e[2][4] = { - { SET_CONTACT_EMAIL, SET_CONTACT_EMAIL0, SET_CONTACT_EMAIL1, "Mye-mail0"}, - { SET_CONTACT_COMPANY_EMAIL, SET_CONTACT_COMPANY_EMAIL0, SET_CONTACT_COMPANY_EMAIL1, "MyCompanye-mail0"} - }; - - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 4; j++) { - LPSTR pszEMail = DB::Setting::GetAStringEx(hContact, USERINFO, pszProto, e[i][j]); - if (pszEMail) { - if (strchr(pszEMail, '@')) - return pszEMail; - - mir_free(pszEMail); - } - } - } - } - } - return nullptr; -} - -/** -* Service function that sends emails -* -* @param wParam - handle to contact to send an email to -* @param lParam - not used -* -* @retval 0 if email was sent -* @retval 1 if no email can be sent -**/ - -static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) -{ - int result = 0; - LPSTR val = nullptr; - - __try - { - val = Get(wParam); - if (val) { - LPSTR szUrl; - INT_PTR len; - - len = mir_strlen(val) + mir_strlen("mailto:"); - - szUrl = (LPSTR)_alloca(len + 1); - - mir_snprintf(szUrl, len + 1, "mailto:%s", val); - mir_free(val); - - Utils_OpenUrl(szUrl); - } - else { - result = 1; - MsgBox((HWND)lParam, MB_OK, LPGENW("Send e-mail"), nullptr, LPGENW("Memory allocation error!")); - } - } - __except(GetExceptionCode()==EXCEPTION_ACCESS_VIOLATION ? - EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - mir_free(val); - result = 1; - MsgErr((HWND)lParam, LPGENW("Memory allocation error!")); - } - return result; -} - -/*********************************************************************************************************** - * Event Handler functions - ***********************************************************************************************************/ - -/** -* 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(WPARAM wParam, LPARAM) -{ - LPSTR val = Get(wParam); - ExtraIcon_SetIcon(ghExtraIconSvc, wParam, (val) ? g_plugin.getIconHandle(IDI_BTN_EMAIL) : nullptr); - mir_free(val); - return 0; -} - -/** -* Notification handler for changed contact settings -* -* @param wParam - (HANDLE)hContact -* @param lParam - (DBCONTACTWRITESETTING*)pdbcws -**/ - -static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) -{ - if (hContact && pdbcws && pdbcws->szSetting && - ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && - (!strncmp(pdbcws->szSetting, SET_CONTACT_EMAIL, 6) || - !strncmp(pdbcws->szSetting, SET_CONTACT_COMPANY_EMAIL, 13) || - !strncmp(pdbcws->szSetting, "mye-mail0", 9))) - { - OnCListApplyIcons(hContact, 0); - } - return 0; -} - -/** -* This function decides whether to show menuitem for sending emails or not. -* -* @param wParam - handle to contact to send an email to -* @param lParam - not used -* -* @return always 0 -**/ - -static int OnPreBuildMenu(WPARAM wParam, LPARAM) -{ - LPSTR val = Get(wParam); - Menu_ShowItem(ghMenuItem, val != nullptr); - mir_free(val); - return 0; -} - -/*********************************************************************************************************** - * public Module Interface functions - ***********************************************************************************************************/ - -void SvcEMailRebuildMenu() -{ - static HANDLE hPrebuildMenuHook = nullptr; - - if (g_plugin.getByte(SET_EXTENDED_EMAILSERVICE, TRUE)) { - if (!hPrebuildMenuHook) - hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildMenu); - - if (!ghMenuItem) { - // insert contact menuitem - CMenuItem mi(&g_plugin); - SET_UID(mi, 0x61d8e25a, 0x92e, 0x4470, 0x84, 0x57, 0x5e, 0x52, 0x17, 0x7f, 0xfa, 0x3); - mi.position = -2000010000; - mi.hIcolibItem = g_plugin.getIconHandle(IDI_DLG_EMAIL); - mi.name.a = "&E-mail"; - mi.pszService = MS_EMAIL_SENDEMAIL; - ghMenuItem = Menu_AddContactMenuItem(&mi); - } - } - else { - if (hPrebuildMenuHook) - UnhookEvent(ME_CLIST_PREBUILDCONTACTMENU), hPrebuildMenuHook = NULL; - - if (ghMenuItem) { - Menu_RemoveItem(ghMenuItem); - ghMenuItem = nullptr; - } - } -} - -/** -* Enable or disable the replacement of clist extra icons. -* -* @param bEnable - determines whether icons are enabled or not -* @param bUpdateDB - if true the database setting is updated, too. -**/ - -bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB) -{ - bool bChanged; - - if (bUpdateDB) { - bChanged = g_eiEmail != bEnable; - g_plugin.setByte(SET_CLIST_EXTRAICON_EMAIL, g_eiEmail = bEnable); - } - else bChanged = g_eiEmail = g_plugin.getByte(SET_CLIST_EXTRAICON_EMAIL, DEFVAL_CLIST_EXTRAICON_EMAIL) != 0; - - if (g_eiEmail) { // E-mail checked - // hook events - if (hChangedHook == nullptr) - hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - - if (hApplyIconHook == nullptr) - hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons); - - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("email", LPGEN("E-mail (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_EMAIL)); - } - else { // E-mail uncheckt - if (hChangedHook) { - UnhookEvent(hChangedHook); - hChangedHook = nullptr; - } - if (hApplyIconHook) { - UnhookEvent(hApplyIconHook); - hApplyIconHook = nullptr; - } - } - - return bChanged; -} - -/** -* This function initially loads the module upon startup. -**/ - -void SvcEMailLoadModule() -{ - SvcEMailEnableExtraIcons(); - if (g_plugin.getByte(SET_EXTENDED_EMAILSERVICE, TRUE)) { - // create own email send command - DestroyServiceFunction(MS_EMAIL_SENDEMAIL); - CreateServiceFunction(MS_EMAIL_SENDEMAIL, MenuCommand); - } -} - -/** -* This function unloads the Email module. -* -* @param none -* -* @return nothing -**/ - -void SvcEMailUnloadModule() -{ - // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = nullptr; - UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; -} diff --git a/plugins/UserInfoEx/src/svc_email.h b/plugins/UserInfoEx/src/svc_email.h deleted file mode 100644 index 8fb6cd7a61..0000000000 --- a/plugins/UserInfoEx/src/svc_email.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -© 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _UINFOEX_SVCEMAIL_H_INCLUDED_ -#define _UINFOEX_SVCEMAIL_H_INCLUDED_ - -void SvcEMailRebuildMenu(); -bool SvcEMailEnableExtraIcons(bool bEnable = false, bool bUpdateDB = false); -void SvcEMailLoadModule(); -void SvcEMailUnloadModule(); - -#endif /* _UINFOEX_SVCEMAIL_H_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 39a6c19af1..64de29720f 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -21,15 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static HANDLE ghExtraIconF = INVALID_HANDLE_VALUE; -static HANDLE ghExtraIconM = INVALID_HANDLE_VALUE; -static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; - -static HANDLE hChangedHook = nullptr; -static HANDLE hApplyIconHook = nullptr; - -bool g_eiGender = false; - BYTE GenderOf(MCONTACT hContact, LPCSTR pszProto) { DBVARIANT dbv; @@ -57,99 +48,3 @@ BYTE GenderOf(MCONTACT hContact) { return GenderOf(hContact, Proto_GetBaseAccountName(hContact)); } - -/*********************************************************************************************************** - * Event Handler functions - ***********************************************************************************************************/ - -/** -* 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(MCONTACT hContact, LPARAM) -{ - if (ghExtraIconSvc != INVALID_HANDLE_VALUE) { - HANDLE hIcon; - switch (GenderOf(hContact)) { - case 'M': hIcon = g_plugin.getIconHandle(IDI_MALE); break; - case 'F': hIcon = g_plugin.getIconHandle(IDI_FEMALE); break; - default: hIcon = nullptr; - } - ExtraIcon_SetIcon(ghExtraIconSvc, hContact, hIcon); - } - return 0; -} - -/** - * Notification handler for changed contact settings - * - * @param wParam - (HANDLE)hContact - * @param lParam - (DBCONTACTWRITESETTING*)pdbcws - **/ - -static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) -{ - if (hContact && pdbcws && (pdbcws->value.type <= DBVT_BYTE) && !strcmp(pdbcws->szSetting, SET_CONTACT_GENDER)) - OnCListApplyIcons(hContact, 0); - - return 0; -} - -/** -* Enable or disable the replacement of clist extra icons. -* -* @param bEnable - determines whether icons are enabled or not -* @param bUpdateDB - if true the database setting is updated, too. -**/ - -bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB) -{ - bool bChanged; - - if (bUpdateDB) { - bChanged = g_eiGender != bEnable; - g_plugin.setByte(SET_CLIST_EXTRAICON_GENDER2, g_eiGender = bEnable); - } - else bChanged = g_eiGender = g_plugin.getByte(SET_CLIST_EXTRAICON_GENDER2, 0) != 0; - - if (g_eiGender) { // Gender checked or dropdown select - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (UInfoEx)"), g_plugin.getIconHandle(IDI_MALE)); - - // hook events - if (hChangedHook == nullptr) - hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - - if (hApplyIconHook == nullptr) - hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - } - else { - if (hChangedHook) { - UnhookEvent(hChangedHook); - hChangedHook = nullptr; - } - if (hApplyIconHook) { - UnhookEvent(hApplyIconHook); - hApplyIconHook = nullptr; - } - } - return bChanged; -} - -/** -* This function unloads the module. -* -* @param none -* -* @return nothing -**/ - -void SvcGenderUnloadModule() -{ - // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = nullptr; - UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; -} diff --git a/plugins/UserInfoEx/src/svc_gender.h b/plugins/UserInfoEx/src/svc_gender.h index 8fbd958130..ec7d9b734e 100644 --- a/plugins/UserInfoEx/src/svc_gender.h +++ b/plugins/UserInfoEx/src/svc_gender.h @@ -25,7 +25,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. BYTE GenderOf(MCONTACT hContact, LPCSTR pszProto); BYTE GenderOf(MCONTACT hContact); -bool SvcGenderEnableExtraIcons(bool bEnable = false, bool bUpdateDB = false); -void SvcGenderUnloadModule(); - #endif /* _UINFOEX_SVCGENDER_H_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp deleted file mode 100644 index 21822d1dd2..0000000000 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -� 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -static HGENMENU ghMenuItem = nullptr; -static HANDLE ghExtraIconDef = INVALID_HANDLE_VALUE; -static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; - -static HANDLE hChangedHook = nullptr; -static HANDLE hApplyIconHook = nullptr; - -bool g_eiHome = false; - -/** -* This function reads the homepage address of the contact. -* -* @param hContact - handle to contact to read email from -* -* @retval URL to contacts homepage -* @retval NULL if contact provides no homepage -**/ - -static LPSTR Get(MCONTACT hContact) -{ - // ignore owner - if (hContact != NULL) { - LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto != nullptr) { - LPCSTR e[2] = { SET_CONTACT_HOMEPAGE, SET_CONTACT_COMPANY_HOMEPAGE }; - for (int i = 0; i < 2; i++) { - LPSTR pszHomepage = DB::Setting::GetAStringEx(hContact, USERINFO, pszProto, e[i]); - if (pszHomepage) - return pszHomepage; - } - } - } - return nullptr; -} - -/** -* Service function that opens the default browser and displays the homepage. -* -* @param wParam - handle to contact to send an email to -* @param lParam - not used -* -* @retval 0 if email was sent -* @retval 1 if no email can be sent -**/ - -static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) -{ - LPSTR szUrl = Get(wParam); - if (szUrl) { - Utils_OpenUrl(szUrl); - mir_free(szUrl); - } - else MessageBox((HWND)lParam, TranslateT("User has no valid homepage"), TranslateT("View Homepage"), MB_OK); - - return 0; -} - -/*********************************************************************************************************** - * Event Handler functions - ***********************************************************************************************************/ - -/** -* 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(MCONTACT hContact, LPARAM) -{ - LPSTR val = Get(hContact); - if (ghExtraIconSvc != INVALID_HANDLE_VALUE) - ExtraIcon_SetIcon(ghExtraIconSvc, hContact, (val) ? g_plugin.getIconHandle(IDI_BTN_GOTO) : nullptr); - MIR_FREE(val); - return 0; -} - -/** -* Notification handler for changed contact settings -* -* @param wParam - (HANDLE)hContact -* @param lParam - (DBCONTACTWRITESETTING*)pdbcws -**/ - -static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) -{ - if (hContact && pdbcws && pdbcws->szSetting && - ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && - (!strncmp(pdbcws->szSetting, SET_CONTACT_HOMEPAGE, 8) || - !strncmp(pdbcws->szSetting, SET_CONTACT_COMPANY_HOMEPAGE, 15))) - OnCListApplyIcons(hContact, 0); - - return 0; -} - -/** -* This function decides whether to show menuitem for sending emails or not. -* -* @param wParam - handle to contact to send an email to -* @param lParam - not used -* -* @return always 0 -**/ - -static int OnPreBuildMenu(WPARAM wParam, LPARAM) -{ - LPSTR val = Get(wParam); - Menu_ShowItem(ghMenuItem, val != nullptr); - mir_free(val); - return 0; -} - -/*********************************************************************************************************** - * public Module Interface functions - ***********************************************************************************************************/ - -/** -* enable or disable menuitem -* -* @param not used -* @return nothing -**/ - -void SvcHomepageRebuildMenu() -{ - static HANDLE hPrebuildMenuHook = nullptr; - - if (!hPrebuildMenuHook) - hPrebuildMenuHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildMenu); - - if (!ghMenuItem) { - // insert contact menuitem - CMenuItem mi(&g_plugin); - SET_UID(mi, 0xdb78c16e, 0x50db, 0x4a40, 0x80, 0x0, 0xd1, 0xa4, 0x1c, 0x1b, 0xa3, 0x2d); - mi.position = -2000010000; - mi.hIcolibItem = g_plugin.getIconHandle(IDI_BTN_GOTO); - mi.name.a = LPGEN("&Homepage"); - mi.pszService = MS_USERINFO_HOMEPAGE_OPENURL; - ghMenuItem = Menu_AddContactMenuItem(&mi); - } -} - -/** -* Enable or disable the replacement of clist extra icons. -* -* @param bEnable - determines whether icons are enabled or not -* @param bUpdateDB - if true the database setting is updated, too. -**/ - -bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB) -{ - bool bChanged; - - if (bUpdateDB) { - bChanged = g_eiHome != bEnable; - g_plugin.setByte(SET_CLIST_EXTRAICON_HOMEPAGE, g_eiHome = bEnable); - } - else bChanged = g_eiHome = g_plugin.getByte(SET_CLIST_EXTRAICON_HOMEPAGE, DEFVAL_CLIST_EXTRAICON_HOMEPAGE) != 0; - - if (g_eiHome) { - // hook events - if (hChangedHook == nullptr) - hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - - if (hApplyIconHook == nullptr) - hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("homepage", LPGEN("Homepage (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_GOTO)); - } - else { - if (hChangedHook) { - UnhookEvent(hChangedHook); - hChangedHook = nullptr; - } - if (hApplyIconHook) { - UnhookEvent(hApplyIconHook); - hApplyIconHook = nullptr; - } - } - return bChanged; -} - -/** -* This function initially loads the module upon startup. -* -* @param not used -* @return nothing -**/ - -void SvcHomepageLoadModule() -{ - CreateServiceFunction(MS_USERINFO_HOMEPAGE_OPENURL, MenuCommand); -} - -/** -* This function unloads the Email module. -* -* @param none -* -* @return nothing -**/ - -void SvcHomepageUnloadModule() -{ - // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = nullptr; - UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; -} diff --git a/plugins/UserInfoEx/src/svc_homepage.h b/plugins/UserInfoEx/src/svc_homepage.h deleted file mode 100644 index cf85beaaa7..0000000000 --- a/plugins/UserInfoEx/src/svc_homepage.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -© 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _UINFOEX_SvcHomepage_H_INCLUDED_ -#define _UINFOEX_SvcHomepage_H_INCLUDED_ - -void SvcHomepageRebuildMenu(); -bool SvcHomepageEnableExtraIcons(bool bEnable = false, bool bUpdateDB = false); -void SvcHomepageLoadModule(); -void SvcHomepageUnloadModule(); - -#endif /* _UINFOEX_SvcHomepage_H_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp deleted file mode 100644 index 97d436a458..0000000000 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -� 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" - -enum EPhoneType -{ - PHONE_NONE, - PHONE_NORMAL, - PHONE_SMS -}; - -static HANDLE ghMenuItem = nullptr; -static HANDLE ghExtraIconDef[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; -static HANDLE ghExtraIconSvc = INVALID_HANDLE_VALUE; - -static HANDLE hChangedHook = nullptr; -static HANDLE hApplyIconHook = nullptr; - -bool g_eiPhone = false; - -/** -* This function reads the contact's phone number from database and returns its type. -* -* @param hContact - handle to contact to read email from -* -* @retval PHONE_SMS: The phone supports sms, so is a cellular -* @retval PHONE_NORMAL: The phone is a normal phone -* @retval PHONE_NONE: The contact does not provide any phone number -**/ - -static INT_PTR Get(MCONTACT hContact) -{ - INT_PTR nType = PHONE_NONE; - - // ignore owner - if (hContact != NULL) { - LPCSTR pszProto = Proto_GetBaseAccountName(hContact); - if (pszProto != nullptr) { - LPCSTR e[2][4] = { - { SET_CONTACT_CELLULAR, SET_CONTACT_PHONE, "MyPhone0" }, - { SET_CONTACT_COMPANY_CELLULAR, SET_CONTACT_COMPANY_PHONE, "MyCompanyPhone0" } - }; - - for (int i = 0; (i < 2) && (nType == PHONE_NONE); i++) { - for (int j = 0; (j < 3) && (nType == PHONE_NONE); j++) { - LPSTR pszPhone = DB::Setting::GetAStringEx(hContact, USERINFO, pszProto, e[i][j]); - if (pszPhone) { - nType = (strstr(pszPhone, " SMS")) ? PHONE_SMS : PHONE_NORMAL; - MIR_FREE(pszPhone); - break; - } - } - } - } - } - return nType; -} - -/*********************************************************************************************************** - * Event Handler functions - ***********************************************************************************************************/ - -/** -* 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(MCONTACT hContact, LPARAM) -{ - HANDLE hIcon; - switch (Get(hContact)) { - case PHONE_NORMAL: hIcon = g_plugin.getIconHandle(IDI_BTN_PHONE); break; - case PHONE_SMS: hIcon = g_plugin.getIconHandle(IDI_BTN_CELLULAR); break; - default: hIcon = nullptr; - } - ExtraIcon_SetIcon(ghExtraIconSvc, hContact, hIcon); - return 0; -} - -/** -* Notification handler for changed contact settings -* -* @param wParam - (HANDLE)hContact -* @param lParam - (DBCONTACTWRITESETTING*)pdbcws -**/ - -static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) -{ - if (hContact && pdbcws && pdbcws->szSetting && - ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && - (!strcmp(pdbcws->szSetting, SET_CONTACT_PHONE) || - !strcmp(pdbcws->szSetting, SET_CONTACT_CELLULAR) || - !strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_PHONE) || - !strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_CELLULAR) || - !strncmp(pdbcws->szSetting, "MyPhone0", 8))) - OnCListApplyIcons(hContact, 0); - - return 0; -} - -/** -* Enable or disable the replacement of clist extra icons. -* -* @param bEnable - determines whether icons are enabled or not -* @param bUpdateDB - if true the database setting is updated, too. -**/ - -bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB) -{ - bool bChanged; - - if (bUpdateDB) { - bChanged = g_eiPhone != bEnable; - g_plugin.setByte(SET_CLIST_EXTRAICON_PHONE, g_eiPhone = bEnable); - } - else bChanged = g_eiPhone = g_plugin.getByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE) != 0; - - // force module enabled, if extraicon plugin was found - if (g_eiPhone) { - // hook events - if (hChangedHook == nullptr) - hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged); - - if (hApplyIconHook == nullptr) - hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons); - - if (ghExtraIconSvc == INVALID_HANDLE_VALUE) - ghExtraIconSvc = ExtraIcon_RegisterIcolib("sms", LPGEN("Phone (UInfoEx)"), g_plugin.getIconHandle(IDI_BTN_CELLULAR)); - } - else { - if (hChangedHook) { - UnhookEvent(hChangedHook); - hChangedHook = nullptr; - } - if (hApplyIconHook) { - UnhookEvent(hApplyIconHook); - hApplyIconHook = nullptr; - } - } - return bChanged; -} - -/** -* This function unloads the Email module. -* -* @param none -* -* @return nothing -**/ - -void SvcPhoneUnloadModule() -{ - // unhook event handlers - UnhookEvent(hChangedHook); hChangedHook = nullptr; - UnhookEvent(hApplyIconHook); hApplyIconHook = nullptr; -} diff --git a/plugins/UserInfoEx/src/svc_phone.h b/plugins/UserInfoEx/src/svc_phone.h deleted file mode 100644 index 8db73d20c7..0000000000 --- a/plugins/UserInfoEx/src/svc_phone.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -UserinfoEx plugin for Miranda IM - -Copyright: -© 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#ifndef _UINFOEX_SVCPHONE_H_INCLUDED_ -#define _UINFOEX_SVCPHONE_H_INCLUDED_ - -void SvcPhoneApplyCListIcons(); -bool SvcPhoneEnableExtraIcons(bool bEnable = false, bool bUpdateDB = false); -void SvcPhoneLoadModule(); -void SvcPhoneUnloadModule(); - -#endif /* _UINFOEX_SVCPHONE_H_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/version.h b/plugins/UserInfoEx/src/version.h index d9fb346a1d..afd0729fb2 100644 --- a/plugins/UserInfoEx/src/version.h +++ b/plugins/UserInfoEx/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 -#define __MINOR_VERSION 8 -#define __RELEASE_NUM 5 -#define __BUILD_NUM 3 +#define __MINOR_VERSION 9 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 1 #include -- cgit v1.2.3