diff options
author | aunsane <aunsane@gmail.com> | 2018-02-28 23:53:51 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-02-28 23:56:44 +0300 |
commit | 77f131a927158e6131fdad1c94ad166e0048e318 (patch) | |
tree | 94ad387a04b0111fa687a2aaa55dec3ab899e142 | |
parent | 24ab74843c7f94e6adb212c3d8081abc4fb27530 (diff) |
CloudFile: auth doesn't work (fixed #1171)
-rw-r--r-- | plugins/CloudFile/src/Services/dropbox_service.cpp | 33 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/dropbox_service.h | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/menus.cpp | 13 | ||||
-rw-r--r-- | plugins/CloudFile/src/oauth.cpp | 31 | ||||
-rw-r--r-- | plugins/CloudFile/src/oauth.h | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/stdafx.h | 3 |
6 files changed, 3 insertions, 81 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp index f92787dec9..d5270ef5e8 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.cpp +++ b/plugins/CloudFile/src/Services/dropbox_service.cpp @@ -4,7 +4,6 @@ CDropboxService::CDropboxService(const char *protoName, const wchar_t *userName) : CCloudService(protoName, userName) { - //CreateServiceFunctionObj(MS_DROPBOX_UPLOAD, &CDropboxService::UploadToDropbox, this); } CDropboxService* CDropboxService::Init(const char *moduleName, const wchar_t *userName) @@ -311,35 +310,3 @@ UINT CDropboxService::Upload(FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; } - -INT_PTR CDropboxService::UploadToDropbox(void *obj, WPARAM wParam, LPARAM lParam) -{ - CDropboxService *self = (CDropboxService*)obj; - DropboxUploadInfo *uploadInfo = (DropboxUploadInfo*)lParam; - - FileTransferParam *ftp = new FileTransferParam(0); - ftp->SetWorkingDirectory(uploadInfo->localPath); - ftp->SetServerFolder(uploadInfo->serverFolder); - - if (PathIsDirectory(uploadInfo->localPath)) - { - // temporary unsupported - Transfers.remove(ftp); - delete ftp; - - return ACKRESULT_FAILED; - } - else - ftp->AddFile(uploadInfo->localPath); - - int res = self->Upload(ftp); - if (res == ACKRESULT_SUCCESS && wParam) { - char **data = (char**)wParam; - *data = mir_utf8encodeW(ftp->GetData()); - } - - Transfers.remove(ftp); - delete ftp; - - return res; -}
\ No newline at end of file diff --git a/plugins/CloudFile/src/Services/dropbox_service.h b/plugins/CloudFile/src/Services/dropbox_service.h index 9c7d781fcd..1010779229 100644 --- a/plugins/CloudFile/src/Services/dropbox_service.h +++ b/plugins/CloudFile/src/Services/dropbox_service.h @@ -31,8 +31,6 @@ public: void Logout() override; UINT Upload(FileTransferParam *ftp) override; - - static INT_PTR UploadToDropbox(void*, WPARAM wParam, LPARAM lParam); }; #endif //_CLOUDSERVICE_DROPBOX_H_
\ No newline at end of file diff --git a/plugins/CloudFile/src/menus.cpp b/plugins/CloudFile/src/menus.cpp index 9bb7ccda8d..17d421b008 100644 --- a/plugins/CloudFile/src/menus.cpp +++ b/plugins/CloudFile/src/menus.cpp @@ -29,16 +29,6 @@ void InitializeMenus() mi.position = -2000019999; mi.hIcon = LoadIconEx(IDI_UPLOAD); hContactMenu = Menu_AddContactMenuItem(&mi); - - /*if (defaultService) - return; - - UNSET_UID(mi); - - mi.root = hContactMenu; - - for (auto &service : Services) - AddServiceMenuItem(service);*/ } void AddServiceMenuItem(const CCloudService *service) @@ -58,7 +48,6 @@ void AddServiceMenuItem(const CCloudService *service) int OnPrebuildContactMenu(WPARAM hContact, LPARAM) { - //Menu_ShowItem(hContactMenu, CanSendToContact(hContact)); - + Menu_ShowItem(hContactMenu, CanSendToContact(hContact)); return 0; }
\ No newline at end of file diff --git a/plugins/CloudFile/src/oauth.cpp b/plugins/CloudFile/src/oauth.cpp index 9ecd3a9ab8..9d8e40cf73 100644 --- a/plugins/CloudFile/src/oauth.cpp +++ b/plugins/CloudFile/src/oauth.cpp @@ -1,14 +1,12 @@ #include "stdafx.h" COAuthDlg::COAuthDlg(CCloudService *service, const char *authUrl, pThreadFuncOwner requestAccessTokenThread) - : CDlgBase(hInstance, IDD_OAUTH), - m_service(service), m_authUrl(authUrl), + : CDlgBase(hInstance, IDD_OAUTH), m_service(service), m_requestAccessTokenThread(requestAccessTokenThread), - m_authorize(this, IDC_OAUTH_AUTHORIZE), + m_authorize(this, IDC_OAUTH_AUTHORIZE, authUrl), m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK) { m_autoClose = CLOSE_ON_CANCEL; - m_authorize.OnClick = Callback(this, &COAuthDlg::Auth_OnClick); m_code.OnChange = Callback(this, &COAuthDlg::Code_OnChange); m_ok.OnClick = Callback(this, &COAuthDlg::Ok_OnClick); } @@ -22,31 +20,6 @@ void COAuthDlg::OnInitDialog() ctrl.SetText(text); } -void COAuthDlg::Auth_OnClick(CCtrlHyperlink*) -{ - if (SUCCEEDED(OleInitialize(NULL))) { - CComPtr<IWebBrowser2> browser; - if (SUCCEEDED(CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (void**)&browser))) { - VARIANT empty; - VariantInit(&empty); - BSTR url = SysAllocString(_A2T(m_authUrl)); - if (SUCCEEDED(browser->Navigate(url, &empty, &empty, &empty, &empty))) { - browser->put_AddressBar(VARIANT_FALSE); - browser->put_MenuBar(VARIANT_FALSE); - browser->put_ToolBar(VARIANT_FALSE); - browser->put_StatusBar(VARIANT_FALSE); - //browser->put_Resizable(VARIANT_FALSE); - browser->put_Visible(VARIANT_TRUE); - } - else - browser->Quit(); - SysFreeString(url); - browser.Release(); - } - OleUninitialize(); - } -} - void COAuthDlg::Code_OnChange(CCtrlBase*) { ptrA requestToken(m_code.GetTextA()); diff --git a/plugins/CloudFile/src/oauth.h b/plugins/CloudFile/src/oauth.h index e38ae45fa3..5107047749 100644 --- a/plugins/CloudFile/src/oauth.h +++ b/plugins/CloudFile/src/oauth.h @@ -5,7 +5,6 @@ class COAuthDlg : public CDlgBase { private: CCloudService *m_service; - const char *m_authUrl; pThreadFuncOwner m_requestAccessTokenThread; CCtrlHyperlink m_authorize; @@ -15,7 +14,6 @@ private: protected: void OnInitDialog() override; - void Auth_OnClick(CCtrlHyperlink*); void Code_OnChange(CCtrlBase*); void Ok_OnClick(CCtrlButton*); diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h index 9fc15e219d..4a32099991 100644 --- a/plugins/CloudFile/src/stdafx.h +++ b/plugins/CloudFile/src/stdafx.h @@ -5,9 +5,6 @@ #include <shlwapi.h> #include <commctrl.h> -#include <exdisp.h> -#include <msapi/comptr.h> - #include <malloc.h> #include <time.h> |