summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp1
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp2
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp6
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp1
-rw-r--r--plugins/CloudFile/src/services.cpp6
-rw-r--r--plugins/Db_autobackups/src/options.cpp5
-rw-r--r--plugins/ExternalAPI/m_cloudfile.h7
-rw-r--r--plugins/SendScreenshotPlus/src/CSendCloudFile.cpp7
8 files changed, 22 insertions, 13 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index bfc5320c98..8eadbc4e4c 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -225,6 +225,7 @@ void CDropboxService::Upload(FileTransferParam *ftp)
std::string serverFolder = serverDictionary ? T2Utf(serverDictionary) : "";
if (!serverFolder.empty()) {
auto path = PreparePath(serverFolder);
+ CreateFolder(path);
auto link = CreateSharedLink(path);
ftp->AddSharedLink(link.c_str());
}
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index 26ff2d02c4..c9fbb45c1c 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -243,7 +243,7 @@ auto CGDriveService::CreateSharedLink(const std::string &itemId)
void CGDriveService::Upload(FileTransferParam *ftp)
{
- std::string folderId;
+ std::string folderId = "root";
auto serverDictionary = ftp->GetServerDirectory();
std::string serverFolder = serverDictionary ? T2Utf(serverDictionary) : "";
if (!serverFolder.empty()) {
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index db8acf7cc6..2843e66d0f 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -214,10 +214,8 @@ void COneDriveService::Upload(FileTransferParam *ftp)
auto serverDictionary = ftp->GetServerDirectory();
std::string serverFolder = serverDictionary ? T2Utf(serverDictionary) : "";
if (!serverFolder.empty()) {
- auto path = PreparePath(serverFolder);
- folderId = CreateFolder(path);
-
- auto link = CreateSharedLink(path);
+ folderId = CreateFolder(serverFolder);
+ auto link = CreateSharedLink(folderId);
ftp->AddSharedLink(link.c_str());
}
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index 1f87c14da5..f1082a6899 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -235,7 +235,6 @@ void CYandexService::Upload(FileTransferParam *ftp)
if (!serverFolder.empty()) {
auto path = PreparePath(serverFolder);
CreateFolder(path);
-
auto link = CreateSharedLink(path);
ftp->AddSharedLink(link.c_str());
}
diff --git a/plugins/CloudFile/src/services.cpp b/plugins/CloudFile/src/services.cpp
index 826554ca97..d367dc1fe8 100644
--- a/plugins/CloudFile/src/services.cpp
+++ b/plugins/CloudFile/src/services.cpp
@@ -85,8 +85,10 @@ INT_PTR Upload(WPARAM wParam, LPARAM lParam)
if (res == ACKRESULT_SUCCESS && lParam) {
size_t linkCount = 0;
const char **links = ftp.GetSharedLinks(linkCount);
- if (linkCount > 0)
- lParam = (LPARAM)mir_strdup(links[linkCount - 1]);
+ if (linkCount > 0) {
+ CFUPLOADRESULT *result = (CFUPLOADRESULT*)lParam;
+ result->link = mir_strdup(links[linkCount - 1]);
+ }
}
return res;
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index c3d41975ef..7a7e9d8fd0 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -316,9 +316,10 @@ int CALLBACK COptionsDlg::BrowseProc(HWND hwnd, UINT uMsg, LPARAM, LPARAM)
int COptionsDlg::EnumCloudFileServices(const CFSERVICEINFO *serviceInfo, void *param)
{
CCtrlCombo &combo = *(CCtrlCombo*)param;
- combo.AddString(serviceInfo->userName, (LPARAM)serviceInfo->accountName);
+ int pos = combo.GetCount();
+ combo.InsertString(serviceInfo->userName, pos, (LPARAM)serviceInfo->accountName);
if (mir_strcmp(serviceInfo->accountName, options.cloudfile_service) == 0)
- combo.SetCurSel(combo.GetCount() - 1);
+ combo.SetCurSel(pos);
return 0;
}
diff --git a/plugins/ExternalAPI/m_cloudfile.h b/plugins/ExternalAPI/m_cloudfile.h
index b7dee2f51b..24a82a63c9 100644
--- a/plugins/ExternalAPI/m_cloudfile.h
+++ b/plugins/ExternalAPI/m_cloudfile.h
@@ -29,9 +29,14 @@ struct CFUPLOADDATA
const wchar_t *serverFolder; // server folder in witch file will be placed (can be NULL)
};
+struct CFUPLOADRESULT
+{
+ char *link; // link to file in cloud service (needs to be freed)
+};
+
// upload file on cloud service
// wParam = (WPARAM)(const CFUPLOADDATA*)uploadData
-// lParam = (LPARAM)(char*)link to file in cloud service (needs to be freed) (can be NULL)
+// lParam = (LPARAM)(const CFUPLOADRESULT*)uploadResult (can be NULL)
// returns 0 on success, nonzero on failure
#define MS_CLOUDFILE_UPLOAD "CloudFile/Upload"
diff --git a/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp b/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp
index d06669df80..842ebaee24 100644
--- a/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp
+++ b/plugins/SendScreenshotPlus/src/CSendCloudFile.cpp
@@ -57,12 +57,15 @@ void CSendCloudFile::SendThread()
/// @todo : SS_DLG_DESCRIPTION and SS_DLG_DELETEAFTERSSEND are of no use as of now since we don't track upload progress
CFUPLOADDATA ud = { m_service, m_pszFile, L"SendSS" };
+ CFUPLOADRESULT ur = { };
- if (CallService(MS_CLOUDFILE_UPLOAD, (WPARAM)&ud, (LPARAM)m_URL)) {
+ if (CallService(MS_CLOUDFILE_UPLOAD, (WPARAM)&ud, (LPARAM)&ur)) {
Error(LPGENW("%s (%i):\nCould not add a share to the CloudFile plugin."), TranslateW(m_pszSendTyp), 0);
- Exit(ACKRESULT_FAILED); return;
+ Exit(ACKRESULT_FAILED);
+ return;
}
+ m_URL = ur.link;
if (m_URL)
svcSendMsgExit(m_URL);
else