From 1432ca2e089f3c1cb68baebc1b70563bc133f857 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 22 Jan 2013 17:55:05 +0000 Subject: fixed work with HTTPServer git-svn-id: http://svn.miranda-ng.org/main/trunk@3235 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SendScreenshotPlus/src/CSend.cpp | 36 +++++++++------------- plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 3 +- plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 6 ++-- plugins/SendScreenshotPlus/src/Main.cpp | 15 ++++----- plugins/SendScreenshotPlus/src/UAboutForm.cpp | 4 +-- plugins/SendScreenshotPlus/src/UAboutForm.h | 2 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 6 ++-- 7 files changed, 33 insertions(+), 39 deletions(-) (limited to 'plugins') diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 83a9de4007..9c7a867fa7 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -68,7 +68,7 @@ void CSend::SetContact(HANDLE hContact) { //--------------------------------------------------------------------------- bool CSend::hasCap(unsigned int Flag) { - return (Flag & CallContactService(m_hContact, PS_GETCAPS, (WPARAM)PFLAGNUM_1, NULL)) == Flag; + return (Flag & CallContactService(m_hContact, PS_GETCAPS, PFLAGNUM_1, NULL)) == Flag; } //--------------------------------------------------------------------------- @@ -135,10 +135,7 @@ void CSend::svcSendUrl(const char* url) { } void CSend::svcSendChat() { - LPTSTR dirtyFix = NULL; GC_INFO gci = {0}; - GCDEST gcd = {0}; - GCEVENT gce = {0}; int res = GC_RESULT_NOSESSION; int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_pszProto); @@ -146,28 +143,24 @@ void CSend::svcSendChat() { gci.pszModule = m_pszProto; for (int i = 0; i < cnt ; i++ ) { gci.iItem = i; - gci.Flags = BYINDEX | HCONTACT | ID; //need dirty fix - CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci); + gci.Flags = BYINDEX | HCONTACT | ID; + CallService(MS_GC_GETINFO, 0, (LPARAM) &gci); if (gci.hContact == m_hContact) { + GCDEST gcd = {0}; gcd.pszModule = m_pszProto; - gcd.iType = GC_EVENT_SENDMESSAGE; //GC_EVENT_MESSAGE ???; -#ifdef _UNICODE + gcd.iType = GC_EVENT_SENDMESSAGE; gcd.ptszID = gci.pszID; -#else //dirty fix coz MS_GC_GETINFO dont know if caller is ansi or unicode. - //result from MS_GC_GETINFO only depend on type of chat.dll and not of caller type - dirtyFix = mir_u2t((wchar_t*)gci.pszID); - gcd.ptszID = dirtyFix; //fixed gci.pszID; -#endif - gce.cbSize = sizeof(GCEVENT); - gce.pDest = &gcd; - gce.bIsMe = TRUE; - gce.dwFlags = GC_TCHAR|GCEF_ADDTOLOG; - gce.ptszText = m_szEventMsgT; - gce.time = time(NULL); + + GCEVENT gce = {0}; + gce.cbSize = sizeof(GCEVENT); + gce.pDest = &gcd; + gce.bIsMe = TRUE; + gce.dwFlags = GC_TCHAR|GCEF_ADDTOLOG; + gce.ptszText = m_szEventMsgT; + gce.time = time(NULL); //* returns 0 on success or error code on failure - res = 200 + (int)CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce); - mir_freeAndNil(dirtyFix); + res = 200 + (int)CallService(MS_GC_EVENT, 0, (LPARAM) &gce); break; } } @@ -347,6 +340,7 @@ void CSend::Exit(unsigned int Result) { break; case ACKRESULT_FAILED: default: + err = false; break; } if (err){ diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index 609e279bad..76dd061393 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -67,10 +67,9 @@ void CSendFTPFile::Send() { } void CSendFTPFile::SendThread() { - int ret; mir_freeAndNil(m_URL); - ret = (int)CallService(MS_FTPFILE_SHAREFILE, (WPARAM)m_hContact, (LPARAM)m_pszFileName); + INT_PTR ret = CallService(MS_FTPFILE_SHAREFILE, (WPARAM)m_hContact, (LPARAM)m_pszFileName); if (ret != 0) { Error(TranslateT("%s (%i):\nCould not add a share to the FTP File plugin."),TranslateTS(m_pszSendTyp),ret); Exit(ret); diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index 2676fbb0c0..0a484b0361 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -79,12 +79,12 @@ void CSendHTTPServer::Send() { } void CSendHTTPServer::SendThread() { - int ret; + INT_PTR ret; mir_freeAndNil(m_URL); if (ServiceExists(MS_HTTP_GET_LINK)) { //patched plugin version - ret = (int)CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); + ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); if (!ret) { m_URL = (LPSTR)CallService(MS_HTTP_GET_LINK, (WPARAM)m_fsi.pszSrvPath, NULL); } @@ -94,7 +94,7 @@ void CSendHTTPServer::SendThread() { m_fsi.dwOptions = OPT_SEND_LINK; //send DATA and wait for reply - ret = (int)CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); + ret = CallService(MS_HTTP_ADD_CHANGE_REMOVE, (WPARAM)m_hContact, (LPARAM)&m_fsi); } if (ret != 0) { diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 4d9ae948f7..1eb2bc387d 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -176,8 +176,7 @@ HANDLE NetlibInit(void) { nlu.szSettingsModule = PLUGNAME; nlu.ptszDescriptiveName = TranslateT("SendSS HTTP connections"); nlu.flags = NUF_OUTGOING|NUF_HTTPCONNS|NUF_TCHAR; //|NUF_NOHTTPSOPTION; - hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - return hNetlibUser; + return hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); } void NetlibClose(void) { @@ -202,14 +201,15 @@ INT_PTR service_CaptureAndSendDesktop(WPARAM wParam, LPARAM lParam) { LPTSTR pszPath = GetCustomPath(); if(pszPath) { - LPSTR pszProto = GetContactProto((HANDLE)wParam); - bool bChatRoom = DBGetContactSettingByte((HANDLE)wParam, pszProto, "ChatRoom", 0) != 0; + HANDLE hContact = (HANDLE) wParam; + LPSTR pszProto = GetContactProto(hContact); + bool bChatRoom = db_get_b(hContact, pszProto, "ChatRoom", 0) != 0; frmMain->m_opt_chkTimed = false; frmMain->m_opt_tabCapture = 1; frmMain->m_opt_cboxDesktop = 0; frmMain->m_opt_chkEditor = false; frmMain->m_opt_cboxSendBy = bChatRoom ? SS_IMAGESHACK:SS_FILESEND; - frmMain->Init(pszPath, (HANDLE)wParam); // this method create the window hidden. + frmMain->Init(pszPath, hContact); // this method create the window hidden. frmMain->btnCaptureClick(); // this method will call Close() mir_free(pszPath); } @@ -290,7 +290,7 @@ void AddMenuItems(void) { // Common CLISTMENUITEM mi = { sizeof(mi) }; - mi.flags = CMIF_ROOTHANDLE | CMIF_UNICODE; + mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR; mi.hParentMenu = HGENMENU_ROOT; // Add item to contact menu @@ -351,7 +351,8 @@ LPTSTR GetCustomPath() { MessageBox(NULL, _T("Can not retrieve Screenshot path."), _T("Send Screenshot"), MB_OK | MB_ICONERROR | MB_APPLMODAL); return 0; } - INT_PTR result = CallService(MS_UTILS_CREATEDIRTREET,0,(LPARAM) pszPath); + + int result = CreateDirectoryTreeT(pszPath); if(result != NULL) { TCHAR szError[MAX_PATH]; diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index aaeb3b71fa..edcaaedfe5 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- TfrmAbout::CHandleMapping TfrmAbout::_HandleMapping; -LRESULT CALLBACK TfrmAbout::DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK TfrmAbout::DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_CTLCOLOREDIT || msg == WM_CTLCOLORSTATIC) { switch ( GetWindowLongPtr(( HWND )lParam, GWL_ID )) { @@ -168,7 +168,7 @@ LRESULT TfrmAbout::wmClose(WPARAM wParam, LPARAM lParam) { TfrmAbout::TfrmAbout(HWND Owner) { m_hWndOwner = Owner; // create window - m_hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_UAboutForm),0, (DLGPROC)DlgTfrmAbout,(LPARAM)this); + m_hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_UAboutForm),0, DlgTfrmAbout,(LPARAM)this); //register object _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); //init page diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.h b/plugins/SendScreenshotPlus/src/UAboutForm.h index 31c1d10356..c93b34c7b7 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.h +++ b/plugins/SendScreenshotPlus/src/UAboutForm.h @@ -49,7 +49,7 @@ class TfrmAbout{ UINT m_Page; typedef std::map CHandleMapping; static CHandleMapping _HandleMapping; - static LRESULT CALLBACK DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK DlgTfrmAbout(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT wmInitdialog(WPARAM wParam, LPARAM lParam); LRESULT wmCommand(WPARAM wParam, LPARAM lParam); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index b22c1c526e..8a4ab3587d 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -241,7 +241,7 @@ LRESULT TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { itab.tcih.pszText = TranslateT("Window"); itab.tcih.iImage = 0; - itab.hwndTabPage = CreateDialog(hInst,MAKEINTRESOURCE(IDD_UMain_CaptureWindow), m_hWnd,(DLGPROC)DlgProc_CaptureWindow); + itab.hwndTabPage = CreateDialog(hInst,MAKEINTRESOURCE(IDD_UMain_CaptureWindow), m_hWnd,DlgProc_CaptureWindow); TabCtrl_InsertItem(m_hwndTab, 0, &itab); MoveWindow(itab.hwndTabPage, (rcTab.left - rcClient.left)+2, (rcTab.top - rcClient.top), (rcTab.right - rcTab.left) - 2*5, (rcTab.bottom - rcTab.top) - 2*20, TRUE); ShowWindow(itab.hwndTabPage, SW_HIDE); @@ -256,7 +256,7 @@ LRESULT TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { hCtrl = GetDlgItem(itab.hwndTabPage, ID_edtCaption); ComboBox_ResetContent(hCtrl); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("")) ,(DWORD)0); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("")) ,0); ComboBox_SetCurSel (hCtrl,0); if(m_MonitorCount >1) { TCHAR tszTemp[120]; @@ -266,7 +266,7 @@ LRESULT TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { TranslateT("Monitor"), (m_Monitors[i].dwFlags & MONITORINFOF_PRIMARY) ? TranslateT(" (primary)") : _T("") ); - ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, (LPCTSTR)tszTemp) , i+1); + ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, tszTemp) , i+1); } ComboBox_SelectItemData (hCtrl, -1, m_opt_cboxDesktop); //use Workaround for MS bug ComboBox_SelectItemData } -- cgit v1.2.3