summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/cloud_file.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-03-11 22:59:22 +0300
committeraunsane <aunsane@gmail.com>2018-03-11 22:59:22 +0300
commit8d0758286e5d0220647355a218a4c94f70591e6f (patch)
tree3c03ff78e0300fbd04309183592ba5505921ff2d /plugins/CloudFile/src/cloud_file.cpp
parent5532fd4e1374c15c13e203a89b7cd060c7e15499 (diff)
CloudFile: Dropbox OAuth with miranda-ng redirect uri
Diffstat (limited to 'plugins/CloudFile/src/cloud_file.cpp')
-rw-r--r--plugins/CloudFile/src/cloud_file.cpp51
1 files changed, 39 insertions, 12 deletions
diff --git a/plugins/CloudFile/src/cloud_file.cpp b/plugins/CloudFile/src/cloud_file.cpp
index d4c082148f..331d4d426c 100644
--- a/plugins/CloudFile/src/cloud_file.cpp
+++ b/plugins/CloudFile/src/cloud_file.cpp
@@ -44,6 +44,45 @@ DWORD_PTR CCloudService::GetCaps(int type, MCONTACT)
}
}
+int CCloudService::FileCancel(MCONTACT, HANDLE hTransfer)
+{
+ FileTransferParam *ftp = Transfers.find((FileTransferParam*)&hTransfer);
+ if (ftp)
+ ftp->Terminate();
+
+ return 0;
+}
+
+HANDLE CCloudService::SendFile(MCONTACT hContact, const wchar_t *description, wchar_t **paths)
+{
+ FileTransferParam *ftp = new FileTransferParam(hContact);
+ ftp->SetDescription(description);
+ ftp->SetWorkingDirectory(paths[0]);
+ for (int i = 0; paths[i]; i++) {
+ if (PathIsDirectory(paths[i]))
+ continue;
+ ftp->AddFile(paths[i]);
+ }
+ Transfers.insert(ftp);
+ mir_forkthreadowner(UploadAndReportProgressThread, this, ftp);
+ return (HANDLE)ftp->GetId();
+}
+
+void CCloudService::OpenUploadDialog(MCONTACT hContact)
+{
+ char *proto = GetContactProto(hContact);
+ if (!mir_strcmpi(proto, META_PROTO))
+ hContact = CallService(MS_MC_GETMOSTONLINECONTACT, hContact);
+
+ auto it = InterceptedContacts.find(hContact);
+ if (it == InterceptedContacts.end()) {
+ HWND hwnd = (HWND)CallService(MS_FILE_SENDFILE, hContact, 0);
+ InterceptedContacts[hContact] = hwnd;
+ }
+ else
+ SetActiveWindow(it->second);
+}
+
int CCloudService::OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM)
{
switch (iEventType) {
@@ -58,18 +97,6 @@ int CCloudService::OnEvent(PROTOEVENTTYPE iEventType, WPARAM, LPARAM)
return 1;
}
-void CCloudService::Report(MCONTACT hContact, const wchar_t *data)
-{
- if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
- SendToContact(hContact, data);
-
- if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 0))
- PasteToInputArea(hContact, data);
-
- if (db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0))
- PasteToClipboard(data);
-}
-
std::string CCloudService::PreparePath(const char *path)
{
std::string newPath = path;