From 3b247d07d6bae82efdc5d0f61213b8605345cb6c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 12 Feb 2014 15:27:33 +0000 Subject: fixes for the MCONTACTs, stored in the database git-svn-id: http://svn.miranda-ng.org/main/trunk@8111 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/YAMN/src/browser/badconnect.cpp | 127 ++++++++++++++------------------ 1 file changed, 55 insertions(+), 72 deletions(-) (limited to 'plugins/YAMN/src/browser/badconnect.cpp') diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 3c91453bab..f113392917 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -14,76 +14,62 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { DWORD PluginParam; - switch(msg) - { - case WM_COMMAND: - if ((HIWORD(wParam)==STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam))) //if clicked and it's new mail popup window - { - PROCESS_INFORMATION pi; - STARTUPINFOW si; - HACCOUNT ActualAccount; - - ZeroMemory(&si,sizeof(si)); - si.cb=sizeof(si); - ActualAccount=(HACCOUNT)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); + switch(msg) { + case WM_COMMAND: + // if clicked and it's new mail popup window + if ((HIWORD(wParam)==STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&PluginParam))) { + PROCESS_INFORMATION pi; + STARTUPINFOW si; + ZeroMemory(&si,sizeof(si)); + si.cb=sizeof(si); + HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0); #ifdef DEBUG_SYNCHRO - DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read wait\n"); + DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read wait\n"); #endif - if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO)) - { + if (WAIT_OBJECT_0==WaitToReadFcn(ActualAccount->AccountAccessSO)) { #ifdef DEBUG_SYNCHRO - DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter\n"); + DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter\n"); #endif - if (ActualAccount->BadConnectN.App != NULL) - { - WCHAR *Command; + if (ActualAccount->BadConnectN.App != NULL) { + WCHAR *Command; + if (ActualAccount->BadConnectN.AppParam != NULL) + Command = new WCHAR[wcslen(ActualAccount->BadConnectN.App)+wcslen(ActualAccount->BadConnectN.AppParam)+6]; + else + Command = new WCHAR[wcslen(ActualAccount->BadConnectN.App)+6]; + + if (Command != NULL) { + lstrcpyW(Command,L"\""); + lstrcatW(Command,ActualAccount->BadConnectN.App); + lstrcatW(Command,L"\" "); if (ActualAccount->BadConnectN.AppParam != NULL) - Command=new WCHAR[wcslen(ActualAccount->BadConnectN.App)+wcslen(ActualAccount->BadConnectN.AppParam)+6]; - else - Command=new WCHAR[wcslen(ActualAccount->BadConnectN.App)+6]; - - if (Command != NULL) - { - lstrcpyW(Command,L"\""); - lstrcatW(Command,ActualAccount->BadConnectN.App); - lstrcatW(Command,L"\" "); - if (ActualAccount->BadConnectN.AppParam != NULL) - lstrcatW(Command,ActualAccount->BadConnectN.AppParam); - CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi); - delete[] Command; - } + lstrcatW(Command,ActualAccount->BadConnectN.AppParam); + CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi); + delete[] Command; } -#ifdef DEBUG_SYNCHRO - DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read done\n"); -#endif - ReadDoneFcn(ActualAccount->AccountAccessSO); } #ifdef DEBUG_SYNCHRO - else - DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter failed\n"); + DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read done\n"); #endif - SendMessage(hWnd,UM_DESTROYPOPUP,0,0); + ReadDoneFcn(ActualAccount->AccountAccessSO); } - break; - case UM_FREEPLUGINDATA: - //Here we'd free our own data, if we had it. - return FALSE; - case UM_INITPOPUP: - //This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups. - break; - case WM_CONTEXTMENU: +#ifdef DEBUG_SYNCHRO + else + DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter failed\n"); +#endif SendMessage(hWnd,UM_DESTROYPOPUP,0,0); - break; - case WM_NOTIFY: -/* switch(((LPNMHDR)lParam)->code) - { - case NM_CLICK: - { - } - } - break; -*/ default: - break; + } + break; + + case UM_FREEPLUGINDATA: + //Here we'd free our own data, if we had it. + return FALSE; + + case UM_INITPOPUP: + //This is the equivalent to WM_INITDIALOG you'd get if you were the maker of dialog popups. + break; + case WM_CONTEXTMENU: + SendMessage(hWnd,UM_DESTROYPOPUP,0,0); + break; } return DefWindowProc(hWnd,msg,wParam,lParam); } @@ -125,22 +111,19 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA ShowMsg=ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG; ShowIco=ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO; - if (ShowPopup) - { - BadConnectPopup.lchContact=(MCONTACT)ActualAccount; - BadConnectPopup.lchIcon=g_LoadIconEx(3); - BadConnectPopup.colorBack=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupB : GetSysColor(COLOR_BTNFACE); - BadConnectPopup.colorText=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupT : GetSysColor(COLOR_WINDOWTEXT); - BadConnectPopup.iSeconds=ActualAccount->BadConnectN.PopupTime; + if (ShowPopup) { + BadConnectPopup.lchIcon = g_LoadIconEx(3); + BadConnectPopup.colorBack = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupB : GetSysColor(COLOR_BTNFACE); + BadConnectPopup.colorText = ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupT : GetSysColor(COLOR_WINDOWTEXT); + BadConnectPopup.iSeconds = ActualAccount->BadConnectN.PopupTime; - BadConnectPopup.PluginWindowProc=BadConnectPopupProc; - BadConnectPopup.PluginData=0; //it's bad connect popup - lstrcpyn(BadConnectPopup.lptzContactName,_A2T(ActualAccount->Name),SIZEOF(BadConnectPopup.lptzContactName)); + BadConnectPopup.PluginWindowProc = BadConnectPopupProc; + BadConnectPopup.PluginData = ActualAccount; + lstrcpyn(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(BadConnectPopup.lptzContactName)); } - if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) - { - Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode); + if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) { + Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode); SetDlgItemText(hDlg,IDC_STATICMSG,Message1W); lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText)); if (ShowPopup) -- cgit v1.2.3