diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-21 19:37:00 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-21 19:37:00 +0000 |
commit | 9fbb540928c2584128bdd6361d60ee57f315a0f6 (patch) | |
tree | c4287ad64de116771179d5e240b8d4133caaac97 /plugins/Dropbox/src/dropbox_services.cpp | |
parent | 84fb545f1ee85924b1c51971e0d69dcaa49f6fe0 (diff) |
insignificant changes
git-svn-id: http://svn.miranda-ng.org/main/trunk@8203 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox_services.cpp')
-rw-r--r-- | plugins/Dropbox/src/dropbox_services.cpp | 88 |
1 files changed, 77 insertions, 11 deletions
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 124a76b4e3..c485779737 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -1,6 +1,6 @@ #include "common.h"
-INT_PTR CDropbox::GetCaps(WPARAM wParam, LPARAM lParam)
+INT_PTR CDropbox::ProtoGetCaps(WPARAM wParam, LPARAM lParam)
{
switch(wParam)
{
@@ -19,7 +19,7 @@ INT_PTR CDropbox::GetCaps(WPARAM wParam, LPARAM lParam) return 0;
}
-INT_PTR CDropbox::SendFile(WPARAM wParam, LPARAM lParam)
+INT_PTR CDropbox::ProtoSendFile(WPARAM wParam, LPARAM lParam)
{
CCSDATA *pccsd = (CCSDATA*)lParam;
@@ -60,12 +60,7 @@ INT_PTR CDropbox::SendFile(WPARAM wParam, LPARAM lParam) }
else
{
- //if (!relativePathStart)
- ftp->pfts.pszFiles[k] = mir_strdup(files[i]);
- /*else
- {
- ftp->pfts.pszFiles[k] = mir_strdup(&files[i][relativePathStart]);
- }*/
+ ftp->pfts.pszFiles[k] = mir_strdup(files[i]);
FILE *file = fopen(files[i], "rb");
if (file != NULL)
@@ -86,14 +81,85 @@ INT_PTR CDropbox::SendFile(WPARAM wParam, LPARAM lParam) return fileId;
}
-INT_PTR CDropbox::SendMessage( WPARAM wParam, LPARAM lParam)
+INT_PTR CDropbox::ProtoSendMessage( WPARAM wParam, LPARAM lParam)
+{
+ return 0;
+}
+
+INT_PTR CDropbox::RequestApiAuthorization(WPARAM wParam, LPARAM lParam)
{
+ mir_forkthread(CDropbox::RequestApiAuthorizationAsync, (void*)wParam);
+
return 0;
}
-INT_PTR CDropbox::RequeriedApiAccess(WPARAM wParam, LPARAM lParam)
+INT_PTR CDropbox::SendFilesToDropbox(WPARAM wParam, LPARAM lParam)
{
- mir_forkthread(CDropbox::RequeriedAccessAsync, (void*)wParam);
+ TCHAR filter[128], *pfilter;
+ wchar_t buffer[4096] = {0};
+
+ OPENFILENAME ofn = {0};
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
+ //ofn.hwndOwner = hwndDlg;
+ lstrcpy(filter, TranslateT("All files"));
+ lstrcat(filter, _T(" (*)"));
+ pfilter = filter + lstrlen(filter)+1;
+ lstrcpy(pfilter, _T("*"));
+ pfilter = filter + lstrlen(filter)+1;
+ pfilter[ 0 ] = '\0';
+ ofn.lpstrFilter = filter;
+ ofn.lpstrFile = buffer;
+ ofn.nMaxFile = 4096;
+ ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_HIDEREADONLY | OFN_DONTADDTORECENT;
+ if (GetOpenFileName(&ofn))
+ {
+ wchar_t **files = NULL;
+
+ if (buffer[ofn.nFileOffset - 1] != '\0')
+ {
+ // Single-Select
+ files = (wchar_t**)mir_alloc(sizeof(wchar_t*) * 2);
+
+ files[0] = mir_wstrdup(buffer);
+ files[1] = NULL;
+ }
+ else
+ {
+ // Multi-Select
+ int i = 0;
+ wchar_t *p = buffer;
+
+ while (*p)
+ {
+ p += lstrlen(p) + 1;
+ i++;
+ }
+
+ files = (wchar_t**)mir_alloc(sizeof(wchar_t*) * i);
+ p = buffer; i = 0;
+
+ while (*p)
+ {
+ p += lstrlen(p) + 1;
+ if (lstrlen(p) > 0)
+ {
+ int len = lstrlen(buffer) + lstrlen(p) + 1;
+ files[i] = (wchar_t*)mir_alloc(sizeof(wchar_t) * len);
+ lstrcpy(files[i], buffer);
+ lstrcat(files[i], L"\\");
+ lstrcat(files[i], p);
+ files[i++][len] = '\0';
+ }
+ }
+ files[i] = NULL;
+ }
+
+ /*char *cHandle = (char*)wParam;
+ char hHandle[16]= { 0 };
+ strcat(&hHandle[1], cHandle);*/
+
+ CallContactService(wParam, PSS_FILET, wParam, (LPARAM)files);
+ }
return 0;
}
\ No newline at end of file |