summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/file_transfer.h
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-04-21 20:45:34 +0300
committeraunsane <aunsane@gmail.com>2018-04-21 20:45:53 +0300
commita74debb40c3df12738c722548c556a97e5976036 (patch)
treef3c2e224d75b64de547778625122d6242e558f36 /plugins/CloudFile/src/file_transfer.h
parent803e7b0b5e7c84a814601141fcb7634516eefa30 (diff)
CloudFile:
- fix #1278 - decrease volume of response data with fields filtering - fix uploading for gdrive and onedrive in some cases - simplifying upload code - version bump
Diffstat (limited to 'plugins/CloudFile/src/file_transfer.h')
-rw-r--r--plugins/CloudFile/src/file_transfer.h51
1 files changed, 22 insertions, 29 deletions
diff --git a/plugins/CloudFile/src/file_transfer.h b/plugins/CloudFile/src/file_transfer.h
index a19c62a412..9918018ff0 100644
--- a/plugins/CloudFile/src/file_transfer.h
+++ b/plugins/CloudFile/src/file_transfer.h
@@ -12,10 +12,8 @@ private:
bool isTerminated;
- CMStringW serverFolder;
-
- const wchar_t* folderName;
- int relativePathStart;
+ CMStringW m_serverDirectory;
+ int m_relativePathStart;
LIST<char> m_links;
CMStringW m_description;
@@ -29,8 +27,7 @@ public:
isTerminated = false;
- folderName = NULL;
- relativePathStart = 0;
+ m_relativePathStart = 0;
pfts.flags = PFTS_UNICODE | PFTS_SENDING;
pfts.hContact = hContact;
@@ -93,19 +90,6 @@ public:
isTerminated = true;
}
- void SetServerFolder(const wchar_t *path)
- {
- if (path)
- serverFolder = path;
- }
-
- const wchar_t* GetServerFolder() const
- {
- if (serverFolder.IsEmpty())
- return NULL;
- return serverFolder;
- }
-
void SetDescription(const wchar_t *description)
{
m_description = description;
@@ -113,21 +97,24 @@ public:
void SetWorkingDirectory(const wchar_t *path)
{
- relativePathStart = wcsrchr(path, '\\') - path + 1;
- pfts.szWorkingDir.w = (wchar_t*)mir_calloc(sizeof(wchar_t) * relativePathStart);
- mir_wstrncpy(pfts.szWorkingDir.w, path, relativePathStart);
+ m_relativePathStart = wcsrchr(path, '\\') - path + 1;
+ pfts.szWorkingDir.w = (wchar_t*)mir_calloc(sizeof(wchar_t) * m_relativePathStart);
+ mir_wstrncpy(pfts.szWorkingDir.w, path, m_relativePathStart);
if (PathIsDirectory(path))
- folderName = wcsrchr(path, '\\') + 1;
+ m_serverDirectory = wcsrchr(path, '\\') + 1;
}
- const wchar_t* IsFolder() const
+ void SetServerDirectory(const wchar_t *name)
{
- return folderName;
+ if (name)
+ m_serverDirectory = name;
}
- const wchar_t* GetFolderName() const
+ const wchar_t* GetServerDirectory() const
{
- return folderName;
+ if (m_serverDirectory.IsEmpty())
+ return nullptr;
+ return m_serverDirectory.GetString();
}
void AddFile(const wchar_t *path)
@@ -149,6 +136,12 @@ public:
m_links.insert(mir_strdup(url));
}
+ const bool IsCurrentFileInSubDirectory() const
+ {
+ const wchar_t *backslash = wcschr(GetCurrentFilePath(), L'\\');
+ return backslash != nullptr;
+ }
+
const wchar_t* GetCurrentFilePath() const
{
return pfts.pszFiles.w[pfts.currentFileNumber];
@@ -156,12 +149,12 @@ public:
const wchar_t* GetCurrentRelativeFilePath() const
{
- return &GetCurrentFilePath()[relativePathStart];
+ return &GetCurrentFilePath()[m_relativePathStart];
}
const wchar_t* GetCurrentFileName() const
{
- return wcsrchr(pfts.pszFiles.w[pfts.currentFileNumber], '\\') + 1;
+ return wcsrchr(GetCurrentFilePath(), '\\') + 1;
}
void OpenCurrentFile()