diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-02-19 12:23:54 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-02-19 12:23:54 +0000 |
commit | 4df260317b8bd47ca65dca24b376b68b765a378f (patch) | |
tree | 6f8d71e64c8c728c11f5ec4e41d8eb99eaea30d9 /plugins/DropBox/src/dropbox_services.cpp | |
parent | 8dc7456651251bc112b9edd9b5fd1c4849d7c83d (diff) |
DropBox:
- reorganization of projects and code
- added access request at contact's menu
- temporary disabled folders sending
- added dropbox icon
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@8174 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DropBox/src/dropbox_services.cpp')
-rw-r--r-- | plugins/DropBox/src/dropbox_services.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/plugins/DropBox/src/dropbox_services.cpp b/plugins/DropBox/src/dropbox_services.cpp new file mode 100644 index 0000000000..0524cff1c7 --- /dev/null +++ b/plugins/DropBox/src/dropbox_services.cpp @@ -0,0 +1,82 @@ +#include "dropbox.h"
+
+INT_PTR CDropbox::GetCaps(WPARAM wParam, LPARAM lParam)
+{
+ switch(wParam)
+ {
+ case PFLAGNUM_1:
+ return PF1_IM | PF1_FILESEND | PF1_AUTHREQ;
+ case PFLAGNUM_2:
+ return PF2_ONLINE;
+ case PFLAGNUM_4:
+ return PF4_FORCEAUTH;
+ case PFLAG_UNIQUEIDTEXT:
+ return (INT_PTR)MODULE " ID";
+ case PFLAG_UNIQUEIDSETTING:
+ return (DWORD_PTR)"uid";
+ }
+
+ return 0;
+}
+
+INT_PTR CDropbox::SendFile(WPARAM wParam, LPARAM lParam)
+{
+ CCSDATA *pccsd = (CCSDATA*)lParam;
+
+ FileTransferParam *ftp = new FileTransferParam();
+ ftp->pfts.flags = PFTS_SENDING | PFTS_UTF;
+ ftp->pfts.hContact = pccsd->hContact;
+
+ char **files = (char**)pccsd->lParam;
+
+ for (int i = 0; files[i]; i++)
+ {
+ if (PathIsDirectoryA(files[i]))
+ continue;
+ ftp->pfts.totalFiles++;
+ }
+
+ ftp->pfts.pszFiles = new char*[ftp->pfts.totalFiles + 1];
+ ftp->pfts.pszFiles[ftp->pfts.totalFiles] = NULL;
+ for (int i = 0, j = 0; files[i]; i++)
+ {
+ if (PathIsDirectoryA(files[i]))
+ continue;
+
+ ftp->pfts.pszFiles[j] = mir_strdup(files[i]);
+
+ FILE *file = fopen(files[j], "rb");
+ if (file != NULL)
+ {
+ fseek(file, 0, SEEK_END);
+ ftp->pfts.totalBytes += ftell(file);
+ fseek(file, 0, SEEK_SET);
+ fclose(file);
+ }
+
+ j++;
+ }
+ ULONG fileId = InterlockedIncrement(&g_dropbox->hFileProcess);
+ ftp->hProcess = (HANDLE)fileId;
+
+ mir_forkthread(CDropbox::SendFileAsync, ftp);
+
+ return fileId;
+}
+
+INT_PTR CDropbox::SendMessage( WPARAM wParam, LPARAM lParam)
+{
+ return 0;
+}
+
+INT_PTR CDropbox::RequeriedApiAccess(WPARAM wParam, LPARAM lParam)
+{
+ int result = MessageBox(NULL, TranslateT("Are you sure you want to requeried access?"), TranslateT("Requeried access"), MB_YESNO | MB_ICONQUESTION);
+ if (result == IDYES && g_dropbox->HasAccessToken())
+ {
+ g_dropbox->DestroyAcceessToken();
+ g_dropbox->RequestAcceessToken();
+ }
+
+ return 0;
+}
\ No newline at end of file |