From c9ea0a63cc82a0dbe1d2b5a7fcb9a95c8b9f1aae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 28 Oct 2019 20:23:26 +0300 Subject: fixes #2105 for UserInfoEx --- plugins/UserInfoEx/src/dlg_propsheet.cpp | 44 +++++++++++++++----------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'plugins/UserInfoEx/src/dlg_propsheet.cpp') diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 8946945159..d7099f1667 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -36,10 +36,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HM_SETTING_CHANGED (WM_USER + 12) #define HM_RELOADICONS (WM_USER + 13) #define HM_SETWINDOWTITLE (WM_USER + 14) +#define HM_UNLOADED (WM_USER + 15) -#define TIMERID_UPDATING 1 +#define TIMERID_UPDATING 1 #ifndef TIMERID_RENAME -#define TIMERID_RENAME 2 +#define TIMERID_RENAME 2 #endif // flags for the PS structure @@ -61,16 +62,9 @@ static HANDLE g_hDetailsInitEvent = nullptr; static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); -CPsHdr::CPsHdr() - : _ignore(10, wcscmp) +CPsHdr::CPsHdr() : + _ignore(10, wcscmp) { - _hContact = NULL; - _pszProto = nullptr; - _pszPrefix = nullptr; - _pPages = nullptr; - _numPages = 0; - _dwFlags = 0; - _hImages = nullptr; } CPsHdr::~CPsHdr() @@ -521,9 +515,9 @@ void DlgContactInfoInitTreeIcons() psh._hContact = NULL; psh._pszProto = nullptr; NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); - if (psh._pPages) { + if (psh._pPages) psh.Free_pPages(); - } + bInitIcons |= INIT_ICONS_OWNER; } ImageList_Destroy(psh._hImages); @@ -578,6 +572,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar pPs->dwFlags |= PSF_LOCKED; pPs->hContact = pPsh->_hContact; pPs->hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hDlg, HM_PROTOACK); + pPs->hModuleUnloaded = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, hDlg, HM_UNLOADED); pPs->hSettingChanged = HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hDlg, HM_SETTING_CHANGED); pPs->hIconsChanged = HookEventMessage(ME_SKIN_ICONSCHANGED, hDlg, HM_RELOADICONS); @@ -619,7 +614,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // initialize the optionpages and tree control WORD needWidth = 0; - if (!pPs->pTree->InitTreeItems((LPWORD)&needWidth)) + if (!pPs->pTree->InitTreeItems(&needWidth)) return FALSE; // move and resize dialog and its controls @@ -935,17 +930,19 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar } case M_CHECKONLINE: // determines whether miranda is online or not - { - if (IsProtoOnline(pPs->pszProto)) { - EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), !IsWindowVisible(GetDlgItem(hDlg, TXT_UPDATING))); - return TRUE; - } - - EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); - EnableWindow(GetDlgItem(hDlg, TXT_UPDATING), FALSE); - break; + if (IsProtoOnline(pPs->pszProto)) { + EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), !IsWindowVisible(GetDlgItem(hDlg, TXT_UPDATING))); + return TRUE; } + EnableWindow(GetDlgItem(hDlg, BTN_UPDATE), FALSE); + EnableWindow(GetDlgItem(hDlg, TXT_UPDATING), FALSE); + break; + + case HM_UNLOADED: + pPs->pTree->Remove((HINSTANCE)lParam); + break; + case HM_PROTOACK: // handles all acks from the protocol plugin { ACKDATA *ack = (ACKDATA *)lParam; @@ -1369,6 +1366,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar UnhookEvent(pPs->hProtoAckEvent); UnhookEvent(pPs->hSettingChanged); UnhookEvent(pPs->hIconsChanged); + UnhookEvent(pPs->hModuleUnloaded); // save my window position Utils_SaveWindowPosition(hDlg, NULL, MODULENAME, "DetailsDlg"); -- cgit v1.2.3