summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-23 20:51:11 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-23 20:51:11 +0000
commit2e5c904f370d48a8e780ce64db2633d54ec0f5cd (patch)
tree9d18c3dd5cb067588c6a8e345f96230e323703c8 /plugins
parent8e146597bbd27b72a42a3a197c1db17153e2e0b3 (diff)
Dropbox:
- fixed crash on file upload - added upload icon (thx dracosha) - resource fix - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@13797 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dropbox/Dropbox.vcxproj.filters195
-rw-r--r--plugins/Dropbox/res/resource.rc91
-rw-r--r--plugins/Dropbox/src/api/upload.h15
-rw-r--r--plugins/Dropbox/src/dropbox.h6
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_icons.cpp9
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp4
-rw-r--r--plugins/Dropbox/src/dropbox_transfers.cpp29
-rw-r--r--plugins/Dropbox/src/http_request.h3
-rw-r--r--plugins/Dropbox/src/resource.h3
-rw-r--r--plugins/Dropbox/src/stdafx.h2
-rw-r--r--plugins/Dropbox/src/version.h2
12 files changed, 79 insertions, 284 deletions
diff --git a/plugins/Dropbox/Dropbox.vcxproj.filters b/plugins/Dropbox/Dropbox.vcxproj.filters
index 7689b5aced..a8ab01c0e5 100644
--- a/plugins/Dropbox/Dropbox.vcxproj.filters
+++ b/plugins/Dropbox/Dropbox.vcxproj.filters
@@ -1,197 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
- <ItemGroup>
- <ClCompile Include="src\stdafx.cxx">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\dropbox.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="src\dropbox_commands.cpp" />
- <ClCompile Include="src\dropbox_dialogs.cpp" />
- <ClCompile Include="src\dropbox_events.cpp" />
- <ClCompile Include="src\dropbox_icons.cpp" />
- <ClCompile Include="src\dropbox_menus.cpp" />
- <ClCompile Include="src\dropbox_services.cpp" />
- <ClCompile Include="src\dropbox_transfers.cpp" />
- <ClCompile Include="src\dropbox_utils.cpp" />
- <ClCompile Include="src\main.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\dropbox.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="src\file_transfer.h" />
- <ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\resource.h" />
- <ClInclude Include="src\stdafx.h" />
- <ClInclude Include="src\version.h" />
- <ClInclude Include="src\api\account.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="res\resource.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- <ResourceCompile Include="res\version.rc" />
- <ResourceCompile Include="res\resource.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- <ResourceCompile Include="res\version.rc" />
- </ItemGroup>
- <ItemGroup>
- <None Include="res\*.ico">
- <Filter>Resource Files</Filter>
- </None>
- </ItemGroup>
-</Project> \ No newline at end of file
+</Project>
diff --git a/plugins/Dropbox/res/resource.rc b/plugins/Dropbox/res/resource.rc
index 86708c0e07..616ebafb3c 100644
--- a/plugins/Dropbox/res/resource.rc
+++ b/plugins/Dropbox/res/resource.rc
@@ -13,12 +13,48 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
+// Russian (Russia) resources
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
+LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "..\\src\\resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Russian (Russia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@@ -80,16 +116,6 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral (Default) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
-LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
-#pragma code_page(1251)
/////////////////////////////////////////////////////////////////////////////
//
@@ -99,43 +125,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_DROPBOX ICON "dropbox.ico"
-#endif // Neutral (Default) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-/////////////////////////////////////////////////////////////////////////////
-// Russian (Russia) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
-LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
-#pragma code_page(1251)
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "..\\src\\resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // Russian (Russia) resources
+IDI_UPLOAD ICON "upload.ico"
+#endif // English resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Dropbox/src/api/upload.h b/plugins/Dropbox/src/api/upload.h
index a871940e20..4bc9da9043 100644
--- a/plugins/Dropbox/src/api/upload.h
+++ b/plugins/Dropbox/src/api/upload.h
@@ -4,34 +4,31 @@
class UploadFileRequest : public HttpRequest
{
public:
- UploadFileRequest(const char *token, const char *fileName, const char *data, int length, const char *root = "auto") :
+ UploadFileRequest(const char *token, const char *fileName, const char *data, size_t size, const char *root = "auto") :
HttpRequest(REQUEST_PUT, FORMAT, DROPBOX_APICONTENT_URL "/files_put/%s/%s", root, fileName)
{
AddBearerAuthHeader(token);
- pData = (char*)data;
- dataLength = length;
+ SetData(data, size);
}
};
class UploadFileChunkRequest : public HttpRequest
{
public:
- UploadFileChunkRequest(const char *token, const char *data, int length) :
+ UploadFileChunkRequest(const char *token, const char *data, size_t size) :
HttpRequest(REQUEST_PUT, DROPBOX_APICONTENT_URL "/chunked_upload")
{
AddBearerAuthHeader(token);
AddHeader("Content-Type", "application/octet-stream");
- pData = (char*)data;
- dataLength = length;
+ SetData(data, size);
}
- UploadFileChunkRequest(const char *token, const char *uploadId, size_t offset, const char *data, int length) :
+ UploadFileChunkRequest(const char *token, const char *uploadId, size_t offset, const char *data, size_t size) :
HttpRequest(REQUEST_PUT, FORMAT, DROPBOX_APICONTENT_URL "/chunked_upload?upload_id=%s&offset=%i", uploadId, offset)
{
AddBearerAuthHeader(token);
AddHeader("Content-Type", "application/octet-stream");
- pData = (char*)data;
- dataLength = length;
+ SetData(data, size);
}
UploadFileChunkRequest(const char *token, const char *uploadId, const char *path, const char *root = "auto") :
diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h
index 6889c0467a..74b156c864 100644
--- a/plugins/Dropbox/src/dropbox.h
+++ b/plugins/Dropbox/src/dropbox.h
@@ -82,9 +82,9 @@ private:
void RequestAccountInfo();
// transfers
- void SendFile(const char *path, const char *data, int length);
- void SendFileChunkedFirst(const char *data, int length, char *uploadId, size_t &offset);
- void SendFileChunkedNext(const char *data, int length, const char *uploadId, size_t &offset);
+ void SendFile(const char *path, const char *data, size_t size);
+ void SendFileChunkedFirst(const char *data, size_t size, char *uploadId, size_t &offset);
+ void SendFileChunkedNext(const char *data, size_t size, const char *uploadId, size_t &offset);
void SendFileChunkedLast(const char *path, const char *uploadId);
void CreateFolder(const char *encodedPath);
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index b2d83e23ea..9ab3242645 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -29,8 +29,8 @@ int CDropbox::OnModulesLoaded(WPARAM, LPARAM)
bbd.pszModuleName = MODULE;
bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.ptszTooltip = TranslateT("Send files to Dropbox");
- bbd.hIcon = GetIconHandle(IDI_DROPBOX);
+ bbd.ptszTooltip = TranslateT("Upload files to Dropbox");
+ bbd.hIcon = GetIconHandleByName("upload");
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.dwDefPos = 100 + bbd.dwButtonID;
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp
index 881c41e7db..094c27bcb7 100644
--- a/plugins/Dropbox/src/dropbox_icons.cpp
+++ b/plugins/Dropbox/src/dropbox_icons.cpp
@@ -2,7 +2,8 @@
static IconItem iconList[] =
{
- { LPGEN("Protocol icon"), "main", IDI_DROPBOX }
+ { LPGEN("Protocol icon"), "main", IDI_DROPBOX },
+ { LPGEN("Upload file(s)"), "upload", IDI_UPLOAD }
};
void InitializeIcons()
@@ -10,10 +11,10 @@ void InitializeIcons()
Icon_Register(g_hInstance, "Protocols/" MODULE, iconList, SIZEOF(iconList), MODULE);
}
-HANDLE GetIconHandle(int iconId)
+HANDLE GetIconHandleByName(const char *name)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
- if (iconList[i].defIconID == iconId)
+ for (size_t i = 0; i < SIZEOF(iconList); i++)
+ if (mir_strcmpi(iconList[i].szName, name) == 0)
return iconList[i].hIcolib;
return NULL;
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index e14948e791..b03f25104a 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -18,9 +18,9 @@ void CDropbox::InitializeMenus()
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(CLISTMENUITEM);
mi.pszService = MODULE"/SendFilesToDropbox";
- mi.pszName = LPGEN("Send files to Dropbox");
+ mi.pszName = LPGEN("Upload files to Dropbox");
mi.position = -2000020000 + CMI_SEND_FILES;
- mi.icolibItem = GetIconHandle(IDI_DROPBOX);
+ mi.icolibItem = GetIconHandleByName("upload");
contactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionObj(mi.pszService, SendFilesToDropboxCommand, this);
}
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp
index 9fce0e6b01..36990b3f74 100644
--- a/plugins/Dropbox/src/dropbox_transfers.cpp
+++ b/plugins/Dropbox/src/dropbox_transfers.cpp
@@ -1,18 +1,18 @@
#include "stdafx.h"
-void CDropbox::SendFile(const char *path, const char *data, int length)
+void CDropbox::SendFile(const char *path, const char *data, size_t size)
{
ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
- UploadFileRequest request(token, encodedPath, data, length);
+ UploadFileRequest request(token, encodedPath, data, size);
mir_ptr<NETLIBHTTPREQUEST> response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
}
-void CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId, size_t &offset)
+void CDropbox::SendFileChunkedFirst(const char *data, size_t size, char *uploadId, size_t &offset)
{
ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
- UploadFileChunkRequest request(token, data, length);
+ UploadFileChunkRequest request(token, data, size);
mir_ptr<NETLIBHTTPREQUEST> response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
JSONROOT root(response->pData);
@@ -26,10 +26,10 @@ void CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId
}
}
-void CDropbox::SendFileChunkedNext(const char *data, int length, const char *uploadId, size_t &offset)
+void CDropbox::SendFileChunkedNext(const char *data, size_t size, const char *uploadId, size_t &offset)
{
ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
- UploadFileChunkRequest request(token, uploadId, offset, data, length);
+ UploadFileChunkRequest request(token, uploadId, offset, data, size);
mir_ptr<NETLIBHTTPREQUEST> response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
JSONROOT root(response->pData);
@@ -131,12 +131,8 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
ftp->pfts.currentFileProgress = 0;
ftp->pfts.tszCurrentFile = _tcsrchr(ftp->pfts.ptszFiles[i], '\\') + 1;
- ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts);
-
- //
size_t offset = 0;
char uploadId[32];
-
int chunkSize = DROPBOX_FILE_CHUNK_SIZE / 4;
if (fileSize < 1024 * 1024)
chunkSize = DROPBOX_FILE_CHUNK_SIZE / 20;
@@ -152,14 +148,14 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
if (ftp->isTerminated)
throw TransferException("Transfer was terminated");
- int count = (int)fread(data, sizeof(char), chunkSize, hFile);
+ size_t size = fread(data, sizeof(char), chunkSize, hFile);
try
{
if (offset == 0)
- instance->SendFileChunkedFirst(data, count, uploadId, offset);
+ instance->SendFileChunkedFirst(data, size, uploadId, offset);
else
- instance->SendFileChunkedNext(data, count, uploadId, offset);
+ instance->SendFileChunkedNext(data, size, uploadId, offset);
}
catch (TransferException)
{
@@ -168,14 +164,17 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg)
throw;
}
- ftp->pfts.currentFileProgress += count;
- ftp->pfts.totalProgress += count;
+ ftp->pfts.currentFileProgress += size;
+ ftp->pfts.totalProgress += size;
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts);
}
mir_free(data);
fclose(hFile);
+ if (ftp->pfts.currentFileProgress < ftp->pfts.currentFileSize)
+ throw TransferException("Transfer was terminated");
+
ptrA utf8_fileName(mir_utf8encodeW(fileName));
instance->SendFileChunkedLast(utf8_fileName, uploadId);
diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h
index 2d2b8d130d..9980945b66 100644
--- a/plugins/Dropbox/src/http_request.h
+++ b/plugins/Dropbox/src/http_request.h
@@ -121,9 +121,8 @@ protected:
mir_free(pData);
dataLength = (int)size;
- pData = (char*)mir_alloc(size + 1);
+ pData = (char*)mir_alloc(size);
memcpy(pData, data, size);
- pData[size] = 0;
}
public:
diff --git a/plugins/Dropbox/src/resource.h b/plugins/Dropbox/src/resource.h
index f52fb0a3a7..314d82c2b3 100644
--- a/plugins/Dropbox/src/resource.h
+++ b/plugins/Dropbox/src/resource.h
@@ -3,6 +3,7 @@
// Used by e:\Projects\C++\MirandaNG\plugins\Dropbox\res\resource.rc
//
#define IDI_DROPBOX 102
+#define IDI_UPLOAD 103
#define IDD_OPTIONS_MAIN 109
#define IDC_REQUEST_CODE 1001
#define IDC_AUTHORIZE 1002
@@ -22,7 +23,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1011
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/Dropbox/src/stdafx.h b/plugins/Dropbox/src/stdafx.h
index c541f3ad4a..3df9e83ad8 100644
--- a/plugins/Dropbox/src/stdafx.h
+++ b/plugins/Dropbox/src/stdafx.h
@@ -64,7 +64,7 @@ extern HINSTANCE g_hInstance;
// icons
void InitializeIcons();
-HANDLE GetIconHandle(int iconId);
+HANDLE GetIconHandleByName(const char *name);
HICON LoadIconEx(int iconId, bool big = false);
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/plugins/Dropbox/src/version.h b/plugins/Dropbox/src/version.h
index a8bcc19833..65d96b82ca 100644
--- a/plugins/Dropbox/src/version.h
+++ b/plugins/Dropbox/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 12
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#include <stdver.h>