From 36df84a13018c6c26e7cd1bb8e093dc54393aed7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 19 Feb 2014 13:33:46 +0000 Subject: folder rename git-svn-id: http://svn.miranda-ng.org/main/trunk@8179 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DropBox/Dropbox_10.vcxproj | 207 --------------------------- plugins/DropBox/Dropbox_10.vcxproj.filters | 73 ---------- plugins/DropBox/Dropbox_11.vcxproj | 216 ----------------------------- plugins/DropBox/Dropbox_11.vcxproj.filters | 73 ---------- plugins/DropBox/Dropbox_12.vcxproj | 209 ---------------------------- plugins/DropBox/Dropbox_12.vcxproj.filters | 73 ---------- plugins/DropBox/res/dropbox.ico | Bin 6518 -> 0 bytes plugins/DropBox/res/resource.rc | Bin 7492 -> 0 bytes plugins/DropBox/res/version.rc | 38 ----- plugins/DropBox/src/common.h | 39 ------ plugins/DropBox/src/dropbox.cpp | 128 ----------------- plugins/DropBox/src/dropbox.h | 110 --------------- plugins/DropBox/src/dropbox_dialogs.cpp | 62 --------- plugins/DropBox/src/dropbox_events.cpp | 40 ------ plugins/DropBox/src/dropbox_icons.cpp | 33 ----- plugins/DropBox/src/dropbox_menus.cpp | 17 --- plugins/DropBox/src/dropbox_services.cpp | 82 ----------- plugins/DropBox/src/dropbox_transfers.cpp | 210 ---------------------------- plugins/DropBox/src/dropbox_utils.cpp | 26 ---- plugins/DropBox/src/http_request.h | 92 ------------ plugins/DropBox/src/main.cpp | 52 ------- plugins/DropBox/src/resource.h | Bin 1370 -> 0 bytes plugins/DropBox/src/version.h | 15 -- plugins/Dropbox/Dropbox_10.vcxproj | 207 +++++++++++++++++++++++++++ plugins/Dropbox/Dropbox_10.vcxproj.filters | 73 ++++++++++ plugins/Dropbox/Dropbox_11.vcxproj | 216 +++++++++++++++++++++++++++++ plugins/Dropbox/Dropbox_11.vcxproj.filters | 73 ++++++++++ plugins/Dropbox/Dropbox_12.vcxproj | 209 ++++++++++++++++++++++++++++ plugins/Dropbox/Dropbox_12.vcxproj.filters | 73 ++++++++++ plugins/Dropbox/res/dropbox.ico | Bin 0 -> 6518 bytes plugins/Dropbox/res/resource.rc | Bin 0 -> 7492 bytes plugins/Dropbox/res/version.rc | 38 +++++ plugins/Dropbox/src/common.h | 39 ++++++ plugins/Dropbox/src/dropbox.cpp | 128 +++++++++++++++++ plugins/Dropbox/src/dropbox.h | 110 +++++++++++++++ plugins/Dropbox/src/dropbox_dialogs.cpp | 62 +++++++++ plugins/Dropbox/src/dropbox_events.cpp | 40 ++++++ plugins/Dropbox/src/dropbox_icons.cpp | 33 +++++ plugins/Dropbox/src/dropbox_menus.cpp | 17 +++ plugins/Dropbox/src/dropbox_services.cpp | 82 +++++++++++ plugins/Dropbox/src/dropbox_transfers.cpp | 210 ++++++++++++++++++++++++++++ plugins/Dropbox/src/dropbox_utils.cpp | 26 ++++ plugins/Dropbox/src/http_request.h | 92 ++++++++++++ plugins/Dropbox/src/main.cpp | 52 +++++++ plugins/Dropbox/src/resource.h | Bin 0 -> 1370 bytes plugins/Dropbox/src/version.h | 15 ++ 46 files changed, 1795 insertions(+), 1795 deletions(-) delete mode 100644 plugins/DropBox/Dropbox_10.vcxproj delete mode 100644 plugins/DropBox/Dropbox_10.vcxproj.filters delete mode 100644 plugins/DropBox/Dropbox_11.vcxproj delete mode 100644 plugins/DropBox/Dropbox_11.vcxproj.filters delete mode 100644 plugins/DropBox/Dropbox_12.vcxproj delete mode 100644 plugins/DropBox/Dropbox_12.vcxproj.filters delete mode 100644 plugins/DropBox/res/dropbox.ico delete mode 100644 plugins/DropBox/res/resource.rc delete mode 100644 plugins/DropBox/res/version.rc delete mode 100644 plugins/DropBox/src/common.h delete mode 100644 plugins/DropBox/src/dropbox.cpp delete mode 100644 plugins/DropBox/src/dropbox.h delete mode 100644 plugins/DropBox/src/dropbox_dialogs.cpp delete mode 100644 plugins/DropBox/src/dropbox_events.cpp delete mode 100644 plugins/DropBox/src/dropbox_icons.cpp delete mode 100644 plugins/DropBox/src/dropbox_menus.cpp delete mode 100644 plugins/DropBox/src/dropbox_services.cpp delete mode 100644 plugins/DropBox/src/dropbox_transfers.cpp delete mode 100644 plugins/DropBox/src/dropbox_utils.cpp delete mode 100644 plugins/DropBox/src/http_request.h delete mode 100644 plugins/DropBox/src/main.cpp delete mode 100644 plugins/DropBox/src/resource.h delete mode 100644 plugins/DropBox/src/version.h create mode 100644 plugins/Dropbox/Dropbox_10.vcxproj create mode 100644 plugins/Dropbox/Dropbox_10.vcxproj.filters create mode 100644 plugins/Dropbox/Dropbox_11.vcxproj create mode 100644 plugins/Dropbox/Dropbox_11.vcxproj.filters create mode 100644 plugins/Dropbox/Dropbox_12.vcxproj create mode 100644 plugins/Dropbox/Dropbox_12.vcxproj.filters create mode 100644 plugins/Dropbox/res/dropbox.ico create mode 100644 plugins/Dropbox/res/resource.rc create mode 100644 plugins/Dropbox/res/version.rc create mode 100644 plugins/Dropbox/src/common.h create mode 100644 plugins/Dropbox/src/dropbox.cpp create mode 100644 plugins/Dropbox/src/dropbox.h create mode 100644 plugins/Dropbox/src/dropbox_dialogs.cpp create mode 100644 plugins/Dropbox/src/dropbox_events.cpp create mode 100644 plugins/Dropbox/src/dropbox_icons.cpp create mode 100644 plugins/Dropbox/src/dropbox_menus.cpp create mode 100644 plugins/Dropbox/src/dropbox_services.cpp create mode 100644 plugins/Dropbox/src/dropbox_transfers.cpp create mode 100644 plugins/Dropbox/src/dropbox_utils.cpp create mode 100644 plugins/Dropbox/src/http_request.h create mode 100644 plugins/Dropbox/src/main.cpp create mode 100644 plugins/Dropbox/src/resource.h create mode 100644 plugins/Dropbox/src/version.h (limited to 'plugins') diff --git a/plugins/DropBox/Dropbox_10.vcxproj b/plugins/DropBox/Dropbox_10.vcxproj deleted file mode 100644 index f7d946da0e..0000000000 --- a/plugins/DropBox/Dropbox_10.vcxproj +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CBA58126-3E02-4159-9BD3-059AF9DBC84E} - Dropbox - - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - NotUsing - common.h - - - Windows - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - NotUsing - common.h - - - Windows - true - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - NotUsing - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - NotUsing - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib - $(IntDir)$(TargetName).lib - /PDBALTPATH:%_PDB% %(AdditionalOptions) - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - - - - - - - - - - Create - - - - - - - - - - \ No newline at end of file diff --git a/plugins/DropBox/Dropbox_10.vcxproj.filters b/plugins/DropBox/Dropbox_10.vcxproj.filters deleted file mode 100644 index d5d53e93d6..0000000000 --- a/plugins/DropBox/Dropbox_10.vcxproj.filters +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - {bb96e6a3-2d56-4aed-9352-30558014561b} - - - {007efe6e-3f6a-49d0-be83-77c03481c085} - - - {badc339a-531c-4f2a-8a2e-e46bd5630044} - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/DropBox/Dropbox_11.vcxproj b/plugins/DropBox/Dropbox_11.vcxproj deleted file mode 100644 index 8f52177702..0000000000 --- a/plugins/DropBox/Dropbox_11.vcxproj +++ /dev/null @@ -1,216 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CBA58126-3E02-4159-9BD3-059AF9DBC84E} - Dropbox - - - - DynamicLibrary - true - Unicode - v110_xp - - - DynamicLibrary - true - Unicode - v110_xp - - - DynamicLibrary - false - true - Unicode - v110_xp - - - DynamicLibrary - false - true - Unicode - v110_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - common.h - NotUsing - - - Windows - true - $(ProfileDir)..\..\bin11\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - NotUsing - common.h - - - Windows - true - $(ProfileDir)..\..\bin11\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - NotUsing - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin11\lib - $(IntDir)$(TargetName).lib - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - Use - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin11\lib - $(IntDir)$(TargetName).lib - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/DropBox/Dropbox_11.vcxproj.filters b/plugins/DropBox/Dropbox_11.vcxproj.filters deleted file mode 100644 index d5d53e93d6..0000000000 --- a/plugins/DropBox/Dropbox_11.vcxproj.filters +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - {bb96e6a3-2d56-4aed-9352-30558014561b} - - - {007efe6e-3f6a-49d0-be83-77c03481c085} - - - {badc339a-531c-4f2a-8a2e-e46bd5630044} - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/DropBox/Dropbox_12.vcxproj b/plugins/DropBox/Dropbox_12.vcxproj deleted file mode 100644 index fe1fbb0686..0000000000 --- a/plugins/DropBox/Dropbox_12.vcxproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CBA58126-3E02-4159-9BD3-059AF9DBC84E} - Dropbox - - - - DynamicLibrary - true - Unicode - v120_xp - - - DynamicLibrary - true - Unicode - v120_xp - - - DynamicLibrary - false - true - Unicode - v120_xp - - - DynamicLibrary - false - true - Unicode - v120_xp - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - NotUsing - common.h - - - Windows - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Disabled - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - false - true - 4996;%(DisableSpecificWarnings) - MultiThreadedDebugDLL - NotUsing - common.h - - - Windows - true - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - false - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - NotUsing - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - Level3 - Full - true - true - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - 4996;%(DisableSpecificWarnings) - NotUsing - common.h - Size - - - Windows - true - true - true - false - comctl32.lib;shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib - $(IntDir)$(TargetName).lib - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - - - - - - - - - - - - Create - - - - - - - - - - \ No newline at end of file diff --git a/plugins/DropBox/Dropbox_12.vcxproj.filters b/plugins/DropBox/Dropbox_12.vcxproj.filters deleted file mode 100644 index d5d53e93d6..0000000000 --- a/plugins/DropBox/Dropbox_12.vcxproj.filters +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - {bb96e6a3-2d56-4aed-9352-30558014561b} - - - {007efe6e-3f6a-49d0-be83-77c03481c085} - - - {badc339a-531c-4f2a-8a2e-e46bd5630044} - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/plugins/DropBox/res/dropbox.ico b/plugins/DropBox/res/dropbox.ico deleted file mode 100644 index c5d1023f9a..0000000000 Binary files a/plugins/DropBox/res/dropbox.ico and /dev/null differ diff --git a/plugins/DropBox/res/resource.rc b/plugins/DropBox/res/resource.rc deleted file mode 100644 index 52a1d26839..0000000000 Binary files a/plugins/DropBox/res/resource.rc and /dev/null differ diff --git a/plugins/DropBox/res/version.rc b/plugins/DropBox/res/version.rc deleted file mode 100644 index 5bfbab4754..0000000000 --- a/plugins/DropBox/res/version.rc +++ /dev/null @@ -1,38 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#ifdef APSTUDIO_INVOKED -#error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - -#include "afxres.h" -#include "..\src\version.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __FILEVERSION_STRING - PRODUCTVERSION __FILEVERSION_STRING - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x0L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "FileDescription", __DESCRIPTION - VALUE "InternalName", __PLUGIN_NAME - VALUE "LegalCopyright", __COPYRIGHT - VALUE "OriginalFilename", __FILENAME - VALUE "ProductName", __PLUGIN_NAME - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END diff --git a/plugins/DropBox/src/common.h b/plugins/DropBox/src/common.h deleted file mode 100644 index d3b14a3e15..0000000000 --- a/plugins/DropBox/src/common.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _COMMON_H_ -#define _COMMON_H_ - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include "version.h" -#include "resource.h" - -#define MODULE "Dropbox" - -class CDropbox; - -extern HINSTANCE g_hInstance; -extern CDropbox *g_dropbox; - -HANDLE CreateProtoServiceFunctionObj(const char *szModule, const char *szService, MIRANDASERVICEOBJ serviceProc, void* obj); - -#endif //_COMMON_H_ \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox.cpp b/plugins/DropBox/src/dropbox.cpp deleted file mode 100644 index 35f9a7b832..0000000000 --- a/plugins/DropBox/src/dropbox.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "dropbox.h" - -CDropbox::CDropbox() -{ - PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; - pd.szName = MODULE; - pd.type = PROTOTYPE_VIRTUAL; - CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); - - HookEvent(ME_OPT_INITIALISE, OnOptionsInit); - HookEvent(ME_SYSTEM_MODULESLOADED, CDropbox::OnModulesLoaded); - - CreateProtoServiceFunction(MODULE, PS_GETCAPS, CDropbox::GetCaps); - CreateProtoServiceFunction(MODULE, PSS_FILE, CDropbox::SendFile); - CreateProtoServiceFunction(MODULE, PSS_MESSAGE, CDropbox::SendMessage); - - InitIcons(); - InitMenus(); -} - -MCONTACT CDropbox::GetDefaultContact() -{ - return db_find_first(MODULE); -} - -bool CDropbox::HasAccessToken() -{ - return db_get_sa(NULL, MODULE, "TokenSecret") != NULL; -} - -void CDropbox::RequestAcceessToken() -{ - ShellExecuteA(NULL, "open", DROPBOX_WWW_URL "/" DROPBOX_API_VER "/oauth2/authorize?response_type=code&client_id=" DROPBOX_API_KEY, NULL, NULL, SW_SHOWDEFAULT); - - char request_token[128] = { 0 }; - //request_token[0] = 0; - - if (DialogBoxParam( - g_hInstance, - MAKEINTRESOURCE(IDD_TOKEN_REQUEST), - NULL, - CDropbox::TokenRequestProc, - (LPARAM)&request_token) == IDOK) - { - char data[64]; - mir_snprintf( - data, - SIZEOF(data), - "client_id=%s&client_secret=%s", - DROPBOX_API_KEY, - DROPBOX_API_SECRET); - - HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/oauth2/token"); - request->AddParameter("grant_type", "authorization_code"); - request->AddParameter("code", request_token); - request->AddHeader("Content-Type", "application/x-www-form-urlencoded"); - request->pData = mir_strdup(data); - request->dataLength = strlen(data); - - NETLIBHTTPREQUEST *response = request->Send(); - - delete request; - - if (response) - { - if (response->resultCode == HttpStatus::OK) - { - JSONNODE *root = json_parse(response->pData); - if (root != NULL) - { - JSONNODE *node = json_get(root, "access_token"); - ptrA access_token = ptrA(mir_u2a(json_as_string(node))); - db_set_s(NULL, MODULE, "TokenSecret", access_token); - - MCONTACT hContact = GetDefaultContact(); - if (hContact) - { - node = json_get(root, "uid"); - wchar_t *uid = json_as_string(node); - db_set_ws(hContact, MODULE, "uid", uid); - if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) - db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE); - } - - CDropbox::ShowNotification(TranslateT("Access request"), TranslateT("Access granted"), MB_ICONINFORMATION); - - delete node; - delete root; - } - } - else - { - JSONNODE *root = json_parse(response->pData); - if (root != NULL) - { - JSONNODE *node = json_get(root, "error_description"); - wchar_t *error_description = json_as_string(node); - - CDropbox::ShowNotification(TranslateT("Access request"), error_description, MB_ICONERROR); - - delete node; - delete root; - } - } - - mir_free(response); - } - } -} - -void CDropbox::DestroyAcceessToken() -{ - - HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/disable_access_token"); - //request->SendAsync(&CDropboxProto::AsyncFunc); - NETLIBHTTPREQUEST *response = request->Send(); - - delete request; - mir_free(response); - - db_unset(NULL, MODULE, "TokenSecret"); - MCONTACT hContact = GetDefaultContact(); - if (hContact) - { - if (db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) == ID_STATUS_ONLINE) - db_set_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE); - } -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox.h b/plugins/DropBox/src/dropbox.h deleted file mode 100644 index ba400d90d0..0000000000 --- a/plugins/DropBox/src/dropbox.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef _Dropbox_PROTO_H_ -#define _Dropbox_PROTO_H_ - -//#include "common.h" -#include "http_request.h" - -#define DROPBOX_API_VER "1" -#define DROPBOX_API_ROOT "sandbox" -#define DROPBOX_WWW_URL "https://www.dropbox.com/" -#define DROPBOX_API_URL "https://api.dropbox.com/" DROPBOX_API_VER -#define DROPBOX_APICONTENT_URL "https://api-content.dropbox.com/" DROPBOX_API_VER - -#define DROPBOX_API_KEY "fa8du7gkf2q8xzg" -#include "..\..\..\Dropbox\secret_key.h" - -#define DROPBOX_FILE_CHUNK_SIZE 1024 * 1024 //1 MB - -enum -{ - CMI_API_ACCESS_REQUERIED, - CMI_URL_OPEN_ROOT, - CMI_MAX // this item shall be the last one -}; - -struct FileTransferParam -{ - HANDLE hProcess; - PROTOFILETRANSFERSTATUS pfts; - - FileTransferParam() - { - pfts.cbSize = sizeof(this->pfts); - pfts.flags = PFTS_UTF; - pfts.currentFileNumber = 0; - pfts.currentFileProgress = 0; - pfts.currentFileSize = 0; - pfts.currentFileTime = 0; - pfts.totalBytes = 0; - pfts.totalFiles = 0; - pfts.totalProgress = 0; - pfts.tszWorkingDir = NULL; - pfts.wszCurrentFile = NULL; - } - - ~FileTransferParam() - { - for (int i = 0; pfts.pszFiles[pfts.totalFiles]; i++) - { - delete pfts.pszFiles[i]; - } - delete pfts.pszFiles; - } -}; - -class CDropbox -{ -public: - CDropbox(); - ~CDropbox() { } - -private: - HANDLE hNetlibUser; - ULONG hFileProcess; - - static HGENMENU ContactMenuItems[CMI_MAX]; - - // hooks - static int OnModulesLoaded(WPARAM wParam, LPARAM lParam); - static int OnOptionsInit(WPARAM wParam, LPARAM lParam); - - // services - static INT_PTR GetCaps(WPARAM wParam, LPARAM lParam); - static INT_PTR SendFile(WPARAM wParam, LPARAM lParam); - static INT_PTR SendMessage(WPARAM wParam, LPARAM lParam); - - static INT_PTR RequeriedApiAccess(WPARAM wParam, LPARAM lParam); - - // access token - static bool HasAccessToken(); - - void RequestAcceessToken(); - void DestroyAcceessToken(); - - // transrers - HttpRequest *CreateFileSendChunkedRequest(const char *data, int length); - void SendFileChunkedFirst(const char *data, int length, char *uploadId, int &offset); - void SendFileChunkedNext(const char *data, int length, const char *uploadId, int &offset); - void SendFileChunkedLast(const char *fileName, const char *uploadId, MCONTACT hContact); - - static void _cdecl SendFileAsync(void *arg); - - // contacts - static MCONTACT GetDefaultContact(); - - // icons - static void InitIcons(); - - // menus - static void InitMenus(); - - // dialogs - static INT_PTR CALLBACK TokenRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - static INT_PTR CALLBACK MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - - // utils - void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); - void ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); -}; - -#endif //_Dropbox_PROTO_H_ \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_dialogs.cpp b/plugins/DropBox/src/dropbox_dialogs.cpp deleted file mode 100644 index 1bbe8af20c..0000000000 --- a/plugins/DropBox/src/dropbox_dialogs.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "dropbox.h" - -INT_PTR CALLBACK CDropbox::TokenRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - char *token = reinterpret_cast(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); - - switch (msg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - - token = (char*)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - { - //::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)CSkypeProto::IconList[0].Handle); - //::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)CSkypeProto::IconList[0].Handle); - - /*wchar_t title[MAX_PATH]; - ::mir_sntprintf( - title, - MAX_PATH, - ::TranslateT("Enter a password for %s:"), - param->login);*/ - //::SetDlgItemText(hwndDlg, IDC_INSTRUCTION, title); - - SendDlgItemMessage(hwndDlg, IDC_TOKEN, EM_LIMITTEXT, 128 - 1, 0); - } - break; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - break; - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK: - { - char data[128]; - GetDlgItemTextA(hwndDlg, IDC_TOKEN, data, SIZEOF(data)); - strcpy(token, data); - - EndDialog(hwndDlg, IDOK); - } - break; - - case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - break; - } - } - break; - } - - return FALSE; -} - -INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) -{ - return FALSE; -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_events.cpp b/plugins/DropBox/src/dropbox_events.cpp deleted file mode 100644 index 83ee861712..0000000000 --- a/plugins/DropBox/src/dropbox_events.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "dropbox.h" - -int CDropbox::OnModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - NETLIBUSER nlu = { sizeof(nlu) }; - nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; - nlu.szSettingsModule = MODULE; - nlu.szSettingsModule = MODULE; - nlu.ptszDescriptiveName = L"Dropbox"; - - g_dropbox->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); - - MCONTACT hContact = GetDefaultContact(); - if (!hContact) - { - hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); - if (!CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)MODULE)) - { - db_set_s(hContact, MODULE, "Nick", MODULE); - } - } - - return 0; -} - -int CDropbox::OnOptionsInit(WPARAM wParam, LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.position = 100000000; - odp.hInstance = g_hInstance; - odp.flags = ODPF_BOLDGROUPS; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN); - odp.pszGroup = LPGEN("Network"); - odp.pszTitle = LPGEN("Dropbox"); - odp.pfnDlgProc = MainOptionsProc; - - //Options_AddPage(wParam, &odp); - - return 0; -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_icons.cpp b/plugins/DropBox/src/dropbox_icons.cpp deleted file mode 100644 index c781369f8e..0000000000 --- a/plugins/DropBox/src/dropbox_icons.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "dropbox.h" - -void CDropbox::InitIcons() -{ - wchar_t filePath[MAX_PATH]; - GetModuleFileName(g_hInstance, filePath, MAX_PATH); - - wchar_t sectionName[100]; - mir_sntprintf( - sectionName, - SIZEOF(sectionName), - _T("%s/%s"), - LPGENT("Protocols"), - LPGENT(MODULE)); - - char settingName[100]; - mir_snprintf( - settingName, - SIZEOF(settingName), - "%s_%s", - MODULE, - "main"); - - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(SKINICONDESC); - sid.flags = SIDF_ALL_TCHAR; - sid.ptszDefaultFile = filePath; - sid.pszName = settingName; - sid.ptszSection = sectionName; - sid.ptszDescription = LPGENT("Protocol icon"); - sid.iDefaultIndex = -IDI_DROPBOX; - /*HANDLE hIcon = */Skin_AddIcon(&sid); -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_menus.cpp b/plugins/DropBox/src/dropbox_menus.cpp deleted file mode 100644 index fe20bddf1d..0000000000 --- a/plugins/DropBox/src/dropbox_menus.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "dropbox.h" - -HGENMENU CDropbox::ContactMenuItems[CMI_MAX]; - -void CDropbox::InitMenus() -{ - CLISTMENUITEM mi = { 0 }; - mi.cbSize = sizeof(CLISTMENUITEM); - mi.flags = CMIF_TCHAR; - - mi.pszService = MODULE"/RequeriedAccess"; - mi.ptszName = LPGENT("Requeried access"); - mi.position = -201001000 + CMI_API_ACCESS_REQUERIED; - mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REVOKE); - ContactMenuItems[CMI_API_ACCESS_REQUERIED] = Menu_AddContactMenuItem(&mi); - CreateServiceFunction(mi.pszService, RequeriedApiAccess); -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_services.cpp b/plugins/DropBox/src/dropbox_services.cpp deleted file mode 100644 index 0524cff1c7..0000000000 --- a/plugins/DropBox/src/dropbox_services.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#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 diff --git a/plugins/DropBox/src/dropbox_transfers.cpp b/plugins/DropBox/src/dropbox_transfers.cpp deleted file mode 100644 index 550e6b7e64..0000000000 --- a/plugins/DropBox/src/dropbox_transfers.cpp +++ /dev/null @@ -1,210 +0,0 @@ -#include "dropbox.h" - -HttpRequest *CDropbox::CreateFileSendChunkedRequest(const char *data, int length) -{ - HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_PUT, DROPBOX_APICONTENT_URL "/chunked_upload"); - request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); - if (length > 0) - { - request->AddHeader("Content-Type", "application/octet-stream"); - request->dataLength = length; - request->pData = (char*)mir_alloc(sizeof(char) * (length + 1)); - memcpy(request->pData, data, length); - request->pData[length] = 0; - } - - return request; -} - -void CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId, int &offset) -{ - HttpRequest *request = CreateFileSendChunkedRequest(data, length); - NETLIBHTTPREQUEST *response = request->Send(); - - delete request; - - if (response) - { - if (response->resultCode == HttpStatus::OK) - { - JSONNODE *root = json_parse(response->pData); - if (root != NULL) - { - JSONNODE *node = json_get(root, "upload_id"); - strcpy(uploadId, mir_u2a(json_as_string(node))); - - node = json_get(root, "offset"); - offset = json_as_int(node); - - delete node; - delete root; - } - } - - mir_free(response); - } -} - -void CDropbox::SendFileChunkedNext(const char *data, int length, const char *uploadId, int &offset) -{ - HttpRequest *request = CreateFileSendChunkedRequest(data, length); - request->AddParameter("upload_id", uploadId); - request->AddParameter("offset", offset); - - NETLIBHTTPREQUEST *response = request->Send(); - - delete request; - - if (response) - { - if (response->resultCode == HttpStatus::OK) - { - JSONNODE *root = json_parse(response->pData); - if (root != NULL) - { - JSONNODE *node = json_get(root, "offset"); - offset = json_as_int(node); - - delete node; - delete root; - } - } - - mir_free(response); - } -} - -void CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId, MCONTACT hContact) -{ - char url[MAX_PATH]; - mir_snprintf( - url, - SIZEOF(url), - "%s/commit_chunked_upload/%s/%s", - DROPBOX_APICONTENT_URL, - DROPBOX_API_ROOT, - fileName); - - HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, url); - request->AddParameter("upload_id", uploadId); - request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); - - NETLIBHTTPREQUEST *response = request->Send(); - - delete request; - - if (response && response->resultCode == HttpStatus::OK) - { - mir_snprintf( - url, - SIZEOF(url), - "%s/shares/%s/%s", - DROPBOX_API_URL, - DROPBOX_API_ROOT, - fileName); - - request = new HttpRequest(hNetlibUser, REQUEST_POST, url); - request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); - - mir_free(response); - - response = request->Send(); - - if (response) - { - if (response->resultCode == HttpStatus::OK) - { - JSONNODE *root = json_parse(response->pData); - if (root != NULL) - { - JSONNODE *node = json_get(root, "url"); - char message[1024]; - mir_snprintf( - message, - SIZEOF(message), - Translate("Link to download file \"%s\": %s"), - fileName, - mir_utf8encodeW(json_as_string(node))); - - DBEVENTINFO dbei = { sizeof(dbei) }; - dbei.szModule = MODULE; - dbei.timestamp = time(NULL); - dbei.eventType = EVENTTYPE_MESSAGE; - dbei.cbBlob = strlen(message); - dbei.pBlob = (PBYTE)mir_strdup(message); - dbei.flags = DBEF_UTF; - ::db_event_add(hContact, &dbei); - - delete node; - delete root; - } - } - - mir_free(response); - } - } -} - -void _cdecl CDropbox::SendFileAsync(void *arg) -{ - FileTransferParam *ftp = (FileTransferParam *)arg; - - ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ftp->hProcess, 0); - - for (int i = 0; ftp->pfts.pszFiles[i]; i++) - { - FILE *file = fopen(ftp->pfts.pszFiles[i], "rb"); - if (file != NULL) - { - int offset = 0; - char *uploadId = new char[32]; - - const char *fileName = strrchr(ftp->pfts.pszFiles[i], '\\') + 1; - - fseek(file, 0, SEEK_END); - DWORD fileSize = ftell(file); - fseek(file, 0, SEEK_SET); - - ftp->pfts.currentFileNumber = i; - ftp->pfts.currentFileSize = fileSize; - ftp->pfts.currentFileProgress = 0; - ftp->pfts.szCurrentFile = strrchr(ftp->pfts.pszFiles[i], '\\') + 1; - - ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts); - - while (!feof(file) && !ferror(file)) - { - int chunkSize = DROPBOX_FILE_CHUNK_SIZE; - if (fileSize < 1024*1024) - chunkSize = DROPBOX_FILE_CHUNK_SIZE / 5; - else if (fileSize > 20*1024*1024) - chunkSize = DROPBOX_FILE_CHUNK_SIZE * 4; - - char *data = new char[chunkSize + 1]; - size_t count = fread(data, sizeof(char), chunkSize, file); - - if (!offset) - g_dropbox->SendFileChunkedFirst(data, count, uploadId, offset); - else - g_dropbox->SendFileChunkedNext(data, count, uploadId, offset); - - ftp->pfts.currentFileProgress += count; - ftp->pfts.totalProgress += count; - - ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts); - } - - fclose(file); - - g_dropbox->SendFileChunkedLast(fileName, uploadId, ftp->pfts.hContact); - ftp->pfts.currentFileProgress = ftp->pfts.currentFileSize; - - if (i < ftp->pfts.totalFiles - 1) - ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ftp->hProcess, 0); - } - } - - ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ftp->hProcess, 0); - - delete ftp; -} \ No newline at end of file diff --git a/plugins/DropBox/src/dropbox_utils.cpp b/plugins/DropBox/src/dropbox_utils.cpp deleted file mode 100644 index caf4d9c980..0000000000 --- a/plugins/DropBox/src/dropbox_utils.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "dropbox.h" - -void CDropbox::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact) -{ - if (Miranda_Terminated()) return; - - if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) - { - POPUPDATAW ppd = {0}; - ppd.lchContact = hContact; - wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); - wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE); - ppd.lchIcon = Skin_GetIcon("Skype_main"); - - if (!PUAddPopupW(&ppd)) - return; - - } - - MessageBox(NULL, message, caption, MB_OK | flags); -} - -void CDropbox::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact) -{ - ShowNotification(TranslateT(MODULE), message, flags, hContact); -} \ No newline at end of file diff --git a/plugins/DropBox/src/http_request.h b/plugins/DropBox/src/http_request.h deleted file mode 100644 index b17ef16b58..0000000000 --- a/plugins/DropBox/src/http_request.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef _HTTP_REQUEST_H_ -#define _HTTP_REQUEST_H_ - -#include "common.h" - -enum HttpStatus -{ - OK = 200 -}; - -class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject -{ -public: - HttpRequest(HANDLE hNetlibUser, int requestType, LPCSTR url) - { - cbSize = sizeof(NETLIBHTTPREQUEST); - flags = NLHRF_HTTP11; - this->requestType = requestType; - - m_hNetlibUser = hNetlibUser; - m_szUrl = mir_strdup(url); - } - - ~HttpRequest() - { - for (int i=0; i < headersCount; i++) - { - mir_free(headers[i].szName); - mir_free(headers[i].szValue); - } - mir_free(headers); - mir_free(pData); - } - - - void AddHeader(LPCSTR szName, LPCSTR szValue) - { - headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount+1)); - headers[headersCount].szName = mir_strdup(szName); - headers[headersCount].szValue = mir_strdup(szValue); - headersCount++; - } - - void AddParameter(LPCSTR szName, LPCSTR szValue) - { - if(m_szUrl.Find('?') == -1) - m_szUrl.AppendFormat("?%s=%s", szName, szValue); - else - m_szUrl.AppendFormat("&%s=%s", szName, szValue); - } - - void AddParameter(LPCSTR szName, int value) - { - if(m_szUrl.Find('?') == -1) - m_szUrl.AppendFormat("?%s=%i", szName, value); - else - m_szUrl.AppendFormat("&%s=%i", szName, value); - } - - NETLIBHTTPREQUEST *Send() - { - szUrl = m_szUrl.GetBuffer(); - return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)this); - } - - //void SendAsync(typename CBaseProto::AsyncHttpRequest callback) - //{ - // szUrl = m_szUrl.GetBuffer(); - // AsyncParam param = { this, proto, callback }; - // /*HANDLE hThread = */mir_forkthread(SendAsync, ¶m); - // //WaitForSingleObject(hThread, INFINITE); - //} - -private: - - CMStringA m_szUrl; - HANDLE m_hNetlibUser; - - /*static void SendAsync(void *arg) - { - AsyncParam *param = (AsyncParam*)arg; - NETLIBHTTPREQUEST* response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)param->m_proto->m_hNetlibUser, (LPARAM)param->m_request); - - CBaseProto *proto = param->m_proto; - AsyncRequestCallback callback = param->m_callback; - proto->*callback(response); - - delete response; - }*/ -}; - -#endif //_HTTP_REQUEST_H_ \ No newline at end of file diff --git a/plugins/DropBox/src/main.cpp b/plugins/DropBox/src/main.cpp deleted file mode 100644 index da1ccca07f..0000000000 --- a/plugins/DropBox/src/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//#include "common.h" -#include "dropbox.h" - -int hLangpack; -HINSTANCE g_hInstance; -CDropbox *g_dropbox; - -PLUGININFOEX pluginInfo = -{ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {B908773A-86F7-4A91-8674-6A20BA0E67D1} - {0xb908773a, 0x86f7, 0x4a91, {0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1}} - -}; - -DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) -{ - g_hInstance = hInstance; - - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; - -extern "C" int __declspec(dllexport) Load(void) -{ - mir_getLP(&pluginInfo); - - g_dropbox = new CDropbox(); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - delete g_dropbox; - - return 0; -} \ No newline at end of file diff --git a/plugins/DropBox/src/resource.h b/plugins/DropBox/src/resource.h deleted file mode 100644 index 50deccd319..0000000000 Binary files a/plugins/DropBox/src/resource.h and /dev/null differ diff --git a/plugins/DropBox/src/version.h b/plugins/DropBox/src/version.h deleted file mode 100644 index 178ef67ee7..0000000000 --- a/plugins/DropBox/src/version.h +++ /dev/null @@ -1,15 +0,0 @@ -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 11 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 1 - -#include - -#define __PLUGIN_NAME "Dropbox" -#define __INTERNAL_NAME "Dropbox" -#define __FILENAME "Dropbox.dll" -#define __DESCRIPTION "Provides ability to upload files on Dropbox." -#define __AUTHOR "unsane" -#define __AUTHOREMAIL "" -#define __AUTHORWEB "http://miranda-ng.org/p/Dropbox/" -#define __COPYRIGHT "© 2014 Miranda NG project" diff --git a/plugins/Dropbox/Dropbox_10.vcxproj b/plugins/Dropbox/Dropbox_10.vcxproj new file mode 100644 index 0000000000..f7d946da0e --- /dev/null +++ b/plugins/Dropbox/Dropbox_10.vcxproj @@ -0,0 +1,207 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CBA58126-3E02-4159-9BD3-059AF9DBC84E} + Dropbox + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + NotUsing + common.h + + + Windows + true + $(ProfileDir)..\..\bin10\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + NotUsing + common.h + + + Windows + true + $(ProfileDir)..\..\bin10\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + NotUsing + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin10\lib + $(IntDir)$(TargetName).lib + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + NotUsing + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin10\lib + $(IntDir)$(TargetName).lib + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + + Create + + + + + + + + + + \ No newline at end of file diff --git a/plugins/Dropbox/Dropbox_10.vcxproj.filters b/plugins/Dropbox/Dropbox_10.vcxproj.filters new file mode 100644 index 0000000000..d5d53e93d6 --- /dev/null +++ b/plugins/Dropbox/Dropbox_10.vcxproj.filters @@ -0,0 +1,73 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + {bb96e6a3-2d56-4aed-9352-30558014561b} + + + {007efe6e-3f6a-49d0-be83-77c03481c085} + + + {badc339a-531c-4f2a-8a2e-e46bd5630044} + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/plugins/Dropbox/Dropbox_11.vcxproj b/plugins/Dropbox/Dropbox_11.vcxproj new file mode 100644 index 0000000000..8f52177702 --- /dev/null +++ b/plugins/Dropbox/Dropbox_11.vcxproj @@ -0,0 +1,216 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CBA58126-3E02-4159-9BD3-059AF9DBC84E} + Dropbox + + + + DynamicLibrary + true + Unicode + v110_xp + + + DynamicLibrary + true + Unicode + v110_xp + + + DynamicLibrary + false + true + Unicode + v110_xp + + + DynamicLibrary + false + true + Unicode + v110_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + common.h + NotUsing + + + Windows + true + $(ProfileDir)..\..\bin11\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + NotUsing + common.h + + + Windows + true + $(ProfileDir)..\..\bin11\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + NotUsing + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin11\lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + Use + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin11\lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/Dropbox/Dropbox_11.vcxproj.filters b/plugins/Dropbox/Dropbox_11.vcxproj.filters new file mode 100644 index 0000000000..d5d53e93d6 --- /dev/null +++ b/plugins/Dropbox/Dropbox_11.vcxproj.filters @@ -0,0 +1,73 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + {bb96e6a3-2d56-4aed-9352-30558014561b} + + + {007efe6e-3f6a-49d0-be83-77c03481c085} + + + {badc339a-531c-4f2a-8a2e-e46bd5630044} + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/plugins/Dropbox/Dropbox_12.vcxproj b/plugins/Dropbox/Dropbox_12.vcxproj new file mode 100644 index 0000000000..fe1fbb0686 --- /dev/null +++ b/plugins/Dropbox/Dropbox_12.vcxproj @@ -0,0 +1,209 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {CBA58126-3E02-4159-9BD3-059AF9DBC84E} + Dropbox + + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + v120_xp + + + DynamicLibrary + false + true + Unicode + v120_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + NotUsing + common.h + + + Windows + true + $(ProfileDir)..\..\bin12\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Disabled + _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + false + true + 4996;%(DisableSpecificWarnings) + MultiThreadedDebugDLL + NotUsing + common.h + + + Windows + true + $(ProfileDir)..\..\bin12\lib + $(IntDir)$(TargetName).lib + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + NotUsing + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin12\lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Level3 + Full + true + true + NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + 4996;%(DisableSpecificWarnings) + NotUsing + common.h + Size + + + Windows + true + true + true + false + comctl32.lib;shlwapi.lib;%(AdditionalDependencies) + $(ProfileDir)..\..\bin12\lib + $(IntDir)$(TargetName).lib + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + + Create + + + + + + + + + + \ No newline at end of file diff --git a/plugins/Dropbox/Dropbox_12.vcxproj.filters b/plugins/Dropbox/Dropbox_12.vcxproj.filters new file mode 100644 index 0000000000..d5d53e93d6 --- /dev/null +++ b/plugins/Dropbox/Dropbox_12.vcxproj.filters @@ -0,0 +1,73 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + {bb96e6a3-2d56-4aed-9352-30558014561b} + + + {007efe6e-3f6a-49d0-be83-77c03481c085} + + + {badc339a-531c-4f2a-8a2e-e46bd5630044} + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/plugins/Dropbox/res/dropbox.ico b/plugins/Dropbox/res/dropbox.ico new file mode 100644 index 0000000000..c5d1023f9a Binary files /dev/null and b/plugins/Dropbox/res/dropbox.ico differ diff --git a/plugins/Dropbox/res/resource.rc b/plugins/Dropbox/res/resource.rc new file mode 100644 index 0000000000..52a1d26839 Binary files /dev/null and b/plugins/Dropbox/res/resource.rc differ diff --git a/plugins/Dropbox/res/version.rc b/plugins/Dropbox/res/version.rc new file mode 100644 index 0000000000..5bfbab4754 --- /dev/null +++ b/plugins/Dropbox/res/version.rc @@ -0,0 +1,38 @@ +// Microsoft Visual C++ generated resource script. +// +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +#include "afxres.h" +#include "..\src\version.h" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __FILEVERSION_STRING + PRODUCTVERSION __FILEVERSION_STRING + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "FileDescription", __DESCRIPTION + VALUE "InternalName", __PLUGIN_NAME + VALUE "LegalCopyright", __COPYRIGHT + VALUE "OriginalFilename", __FILENAME + VALUE "ProductName", __PLUGIN_NAME + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/plugins/Dropbox/src/common.h b/plugins/Dropbox/src/common.h new file mode 100644 index 0000000000..d3b14a3e15 --- /dev/null +++ b/plugins/Dropbox/src/common.h @@ -0,0 +1,39 @@ +#ifndef _COMMON_H_ +#define _COMMON_H_ + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include "version.h" +#include "resource.h" + +#define MODULE "Dropbox" + +class CDropbox; + +extern HINSTANCE g_hInstance; +extern CDropbox *g_dropbox; + +HANDLE CreateProtoServiceFunctionObj(const char *szModule, const char *szService, MIRANDASERVICEOBJ serviceProc, void* obj); + +#endif //_COMMON_H_ \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp new file mode 100644 index 0000000000..35f9a7b832 --- /dev/null +++ b/plugins/Dropbox/src/dropbox.cpp @@ -0,0 +1,128 @@ +#include "dropbox.h" + +CDropbox::CDropbox() +{ + PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; + pd.szName = MODULE; + pd.type = PROTOTYPE_VIRTUAL; + CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); + + HookEvent(ME_OPT_INITIALISE, OnOptionsInit); + HookEvent(ME_SYSTEM_MODULESLOADED, CDropbox::OnModulesLoaded); + + CreateProtoServiceFunction(MODULE, PS_GETCAPS, CDropbox::GetCaps); + CreateProtoServiceFunction(MODULE, PSS_FILE, CDropbox::SendFile); + CreateProtoServiceFunction(MODULE, PSS_MESSAGE, CDropbox::SendMessage); + + InitIcons(); + InitMenus(); +} + +MCONTACT CDropbox::GetDefaultContact() +{ + return db_find_first(MODULE); +} + +bool CDropbox::HasAccessToken() +{ + return db_get_sa(NULL, MODULE, "TokenSecret") != NULL; +} + +void CDropbox::RequestAcceessToken() +{ + ShellExecuteA(NULL, "open", DROPBOX_WWW_URL "/" DROPBOX_API_VER "/oauth2/authorize?response_type=code&client_id=" DROPBOX_API_KEY, NULL, NULL, SW_SHOWDEFAULT); + + char request_token[128] = { 0 }; + //request_token[0] = 0; + + if (DialogBoxParam( + g_hInstance, + MAKEINTRESOURCE(IDD_TOKEN_REQUEST), + NULL, + CDropbox::TokenRequestProc, + (LPARAM)&request_token) == IDOK) + { + char data[64]; + mir_snprintf( + data, + SIZEOF(data), + "client_id=%s&client_secret=%s", + DROPBOX_API_KEY, + DROPBOX_API_SECRET); + + HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/oauth2/token"); + request->AddParameter("grant_type", "authorization_code"); + request->AddParameter("code", request_token); + request->AddHeader("Content-Type", "application/x-www-form-urlencoded"); + request->pData = mir_strdup(data); + request->dataLength = strlen(data); + + NETLIBHTTPREQUEST *response = request->Send(); + + delete request; + + if (response) + { + if (response->resultCode == HttpStatus::OK) + { + JSONNODE *root = json_parse(response->pData); + if (root != NULL) + { + JSONNODE *node = json_get(root, "access_token"); + ptrA access_token = ptrA(mir_u2a(json_as_string(node))); + db_set_s(NULL, MODULE, "TokenSecret", access_token); + + MCONTACT hContact = GetDefaultContact(); + if (hContact) + { + node = json_get(root, "uid"); + wchar_t *uid = json_as_string(node); + db_set_ws(hContact, MODULE, "uid", uid); + if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE); + } + + CDropbox::ShowNotification(TranslateT("Access request"), TranslateT("Access granted"), MB_ICONINFORMATION); + + delete node; + delete root; + } + } + else + { + JSONNODE *root = json_parse(response->pData); + if (root != NULL) + { + JSONNODE *node = json_get(root, "error_description"); + wchar_t *error_description = json_as_string(node); + + CDropbox::ShowNotification(TranslateT("Access request"), error_description, MB_ICONERROR); + + delete node; + delete root; + } + } + + mir_free(response); + } + } +} + +void CDropbox::DestroyAcceessToken() +{ + + HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, DROPBOX_API_URL "/disable_access_token"); + //request->SendAsync(&CDropboxProto::AsyncFunc); + NETLIBHTTPREQUEST *response = request->Send(); + + delete request; + mir_free(response); + + db_unset(NULL, MODULE, "TokenSecret"); + MCONTACT hContact = GetDefaultContact(); + if (hContact) + { + if (db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) == ID_STATUS_ONLINE) + db_set_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE); + } +} \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h new file mode 100644 index 0000000000..ba400d90d0 --- /dev/null +++ b/plugins/Dropbox/src/dropbox.h @@ -0,0 +1,110 @@ +#ifndef _Dropbox_PROTO_H_ +#define _Dropbox_PROTO_H_ + +//#include "common.h" +#include "http_request.h" + +#define DROPBOX_API_VER "1" +#define DROPBOX_API_ROOT "sandbox" +#define DROPBOX_WWW_URL "https://www.dropbox.com/" +#define DROPBOX_API_URL "https://api.dropbox.com/" DROPBOX_API_VER +#define DROPBOX_APICONTENT_URL "https://api-content.dropbox.com/" DROPBOX_API_VER + +#define DROPBOX_API_KEY "fa8du7gkf2q8xzg" +#include "..\..\..\Dropbox\secret_key.h" + +#define DROPBOX_FILE_CHUNK_SIZE 1024 * 1024 //1 MB + +enum +{ + CMI_API_ACCESS_REQUERIED, + CMI_URL_OPEN_ROOT, + CMI_MAX // this item shall be the last one +}; + +struct FileTransferParam +{ + HANDLE hProcess; + PROTOFILETRANSFERSTATUS pfts; + + FileTransferParam() + { + pfts.cbSize = sizeof(this->pfts); + pfts.flags = PFTS_UTF; + pfts.currentFileNumber = 0; + pfts.currentFileProgress = 0; + pfts.currentFileSize = 0; + pfts.currentFileTime = 0; + pfts.totalBytes = 0; + pfts.totalFiles = 0; + pfts.totalProgress = 0; + pfts.tszWorkingDir = NULL; + pfts.wszCurrentFile = NULL; + } + + ~FileTransferParam() + { + for (int i = 0; pfts.pszFiles[pfts.totalFiles]; i++) + { + delete pfts.pszFiles[i]; + } + delete pfts.pszFiles; + } +}; + +class CDropbox +{ +public: + CDropbox(); + ~CDropbox() { } + +private: + HANDLE hNetlibUser; + ULONG hFileProcess; + + static HGENMENU ContactMenuItems[CMI_MAX]; + + // hooks + static int OnModulesLoaded(WPARAM wParam, LPARAM lParam); + static int OnOptionsInit(WPARAM wParam, LPARAM lParam); + + // services + static INT_PTR GetCaps(WPARAM wParam, LPARAM lParam); + static INT_PTR SendFile(WPARAM wParam, LPARAM lParam); + static INT_PTR SendMessage(WPARAM wParam, LPARAM lParam); + + static INT_PTR RequeriedApiAccess(WPARAM wParam, LPARAM lParam); + + // access token + static bool HasAccessToken(); + + void RequestAcceessToken(); + void DestroyAcceessToken(); + + // transrers + HttpRequest *CreateFileSendChunkedRequest(const char *data, int length); + void SendFileChunkedFirst(const char *data, int length, char *uploadId, int &offset); + void SendFileChunkedNext(const char *data, int length, const char *uploadId, int &offset); + void SendFileChunkedLast(const char *fileName, const char *uploadId, MCONTACT hContact); + + static void _cdecl SendFileAsync(void *arg); + + // contacts + static MCONTACT GetDefaultContact(); + + // icons + static void InitIcons(); + + // menus + static void InitMenus(); + + // dialogs + static INT_PTR CALLBACK TokenRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); + + // utils + void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); + void ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); +}; + +#endif //_Dropbox_PROTO_H_ \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_dialogs.cpp b/plugins/Dropbox/src/dropbox_dialogs.cpp new file mode 100644 index 0000000000..1bbe8af20c --- /dev/null +++ b/plugins/Dropbox/src/dropbox_dialogs.cpp @@ -0,0 +1,62 @@ +#include "dropbox.h" + +INT_PTR CALLBACK CDropbox::TokenRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + char *token = reinterpret_cast(::GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); + + switch (msg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + + token = (char*)lParam; + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); + { + //::SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)CSkypeProto::IconList[0].Handle); + //::SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)CSkypeProto::IconList[0].Handle); + + /*wchar_t title[MAX_PATH]; + ::mir_sntprintf( + title, + MAX_PATH, + ::TranslateT("Enter a password for %s:"), + param->login);*/ + //::SetDlgItemText(hwndDlg, IDC_INSTRUCTION, title); + + SendDlgItemMessage(hwndDlg, IDC_TOKEN, EM_LIMITTEXT, 128 - 1, 0); + } + break; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDOK: + { + char data[128]; + GetDlgItemTextA(hwndDlg, IDC_TOKEN, data, SIZEOF(data)); + strcpy(token, data); + + EndDialog(hwndDlg, IDOK); + } + break; + + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + break; + } + } + break; + } + + return FALSE; +} + +INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return FALSE; +} \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp new file mode 100644 index 0000000000..83ee861712 --- /dev/null +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -0,0 +1,40 @@ +#include "dropbox.h" + +int CDropbox::OnModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + NETLIBUSER nlu = { sizeof(nlu) }; + nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; + nlu.szSettingsModule = MODULE; + nlu.szSettingsModule = MODULE; + nlu.ptszDescriptiveName = L"Dropbox"; + + g_dropbox->hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + + MCONTACT hContact = GetDefaultContact(); + if (!hContact) + { + hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); + if (!CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)MODULE)) + { + db_set_s(hContact, MODULE, "Nick", MODULE); + } + } + + return 0; +} + +int CDropbox::OnOptionsInit(WPARAM wParam, LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; + odp.position = 100000000; + odp.hInstance = g_hInstance; + odp.flags = ODPF_BOLDGROUPS; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_MAIN); + odp.pszGroup = LPGEN("Network"); + odp.pszTitle = LPGEN("Dropbox"); + odp.pfnDlgProc = MainOptionsProc; + + //Options_AddPage(wParam, &odp); + + return 0; +} \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_icons.cpp b/plugins/Dropbox/src/dropbox_icons.cpp new file mode 100644 index 0000000000..c781369f8e --- /dev/null +++ b/plugins/Dropbox/src/dropbox_icons.cpp @@ -0,0 +1,33 @@ +#include "dropbox.h" + +void CDropbox::InitIcons() +{ + wchar_t filePath[MAX_PATH]; + GetModuleFileName(g_hInstance, filePath, MAX_PATH); + + wchar_t sectionName[100]; + mir_sntprintf( + sectionName, + SIZEOF(sectionName), + _T("%s/%s"), + LPGENT("Protocols"), + LPGENT(MODULE)); + + char settingName[100]; + mir_snprintf( + settingName, + SIZEOF(settingName), + "%s_%s", + MODULE, + "main"); + + SKINICONDESC sid = {0}; + sid.cbSize = sizeof(SKINICONDESC); + sid.flags = SIDF_ALL_TCHAR; + sid.ptszDefaultFile = filePath; + sid.pszName = settingName; + sid.ptszSection = sectionName; + sid.ptszDescription = LPGENT("Protocol icon"); + sid.iDefaultIndex = -IDI_DROPBOX; + /*HANDLE hIcon = */Skin_AddIcon(&sid); +} \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp new file mode 100644 index 0000000000..fe20bddf1d --- /dev/null +++ b/plugins/Dropbox/src/dropbox_menus.cpp @@ -0,0 +1,17 @@ +#include "dropbox.h" + +HGENMENU CDropbox::ContactMenuItems[CMI_MAX]; + +void CDropbox::InitMenus() +{ + CLISTMENUITEM mi = { 0 }; + mi.cbSize = sizeof(CLISTMENUITEM); + mi.flags = CMIF_TCHAR; + + mi.pszService = MODULE"/RequeriedAccess"; + mi.ptszName = LPGENT("Requeried access"); + mi.position = -201001000 + CMI_API_ACCESS_REQUERIED; + mi.icolibItem = LoadSkinnedIconHandle(SKINICON_AUTH_REVOKE); + ContactMenuItems[CMI_API_ACCESS_REQUERIED] = Menu_AddContactMenuItem(&mi); + CreateServiceFunction(mi.pszService, RequeriedApiAccess); +} \ No newline at end of file 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 diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp new file mode 100644 index 0000000000..550e6b7e64 --- /dev/null +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -0,0 +1,210 @@ +#include "dropbox.h" + +HttpRequest *CDropbox::CreateFileSendChunkedRequest(const char *data, int length) +{ + HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_PUT, DROPBOX_APICONTENT_URL "/chunked_upload"); + request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); + if (length > 0) + { + request->AddHeader("Content-Type", "application/octet-stream"); + request->dataLength = length; + request->pData = (char*)mir_alloc(sizeof(char) * (length + 1)); + memcpy(request->pData, data, length); + request->pData[length] = 0; + } + + return request; +} + +void CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId, int &offset) +{ + HttpRequest *request = CreateFileSendChunkedRequest(data, length); + NETLIBHTTPREQUEST *response = request->Send(); + + delete request; + + if (response) + { + if (response->resultCode == HttpStatus::OK) + { + JSONNODE *root = json_parse(response->pData); + if (root != NULL) + { + JSONNODE *node = json_get(root, "upload_id"); + strcpy(uploadId, mir_u2a(json_as_string(node))); + + node = json_get(root, "offset"); + offset = json_as_int(node); + + delete node; + delete root; + } + } + + mir_free(response); + } +} + +void CDropbox::SendFileChunkedNext(const char *data, int length, const char *uploadId, int &offset) +{ + HttpRequest *request = CreateFileSendChunkedRequest(data, length); + request->AddParameter("upload_id", uploadId); + request->AddParameter("offset", offset); + + NETLIBHTTPREQUEST *response = request->Send(); + + delete request; + + if (response) + { + if (response->resultCode == HttpStatus::OK) + { + JSONNODE *root = json_parse(response->pData); + if (root != NULL) + { + JSONNODE *node = json_get(root, "offset"); + offset = json_as_int(node); + + delete node; + delete root; + } + } + + mir_free(response); + } +} + +void CDropbox::SendFileChunkedLast(const char *fileName, const char *uploadId, MCONTACT hContact) +{ + char url[MAX_PATH]; + mir_snprintf( + url, + SIZEOF(url), + "%s/commit_chunked_upload/%s/%s", + DROPBOX_APICONTENT_URL, + DROPBOX_API_ROOT, + fileName); + + HttpRequest *request = new HttpRequest(hNetlibUser, REQUEST_POST, url); + request->AddParameter("upload_id", uploadId); + request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); + + NETLIBHTTPREQUEST *response = request->Send(); + + delete request; + + if (response && response->resultCode == HttpStatus::OK) + { + mir_snprintf( + url, + SIZEOF(url), + "%s/shares/%s/%s", + DROPBOX_API_URL, + DROPBOX_API_ROOT, + fileName); + + request = new HttpRequest(hNetlibUser, REQUEST_POST, url); + request->AddParameter("access_token", db_get_sa(NULL, MODULE, "TokenSecret")); + + mir_free(response); + + response = request->Send(); + + if (response) + { + if (response->resultCode == HttpStatus::OK) + { + JSONNODE *root = json_parse(response->pData); + if (root != NULL) + { + JSONNODE *node = json_get(root, "url"); + char message[1024]; + mir_snprintf( + message, + SIZEOF(message), + Translate("Link to download file \"%s\": %s"), + fileName, + mir_utf8encodeW(json_as_string(node))); + + DBEVENTINFO dbei = { sizeof(dbei) }; + dbei.szModule = MODULE; + dbei.timestamp = time(NULL); + dbei.eventType = EVENTTYPE_MESSAGE; + dbei.cbBlob = strlen(message); + dbei.pBlob = (PBYTE)mir_strdup(message); + dbei.flags = DBEF_UTF; + ::db_event_add(hContact, &dbei); + + delete node; + delete root; + } + } + + mir_free(response); + } + } +} + +void _cdecl CDropbox::SendFileAsync(void *arg) +{ + FileTransferParam *ftp = (FileTransferParam *)arg; + + ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ftp->hProcess, 0); + + for (int i = 0; ftp->pfts.pszFiles[i]; i++) + { + FILE *file = fopen(ftp->pfts.pszFiles[i], "rb"); + if (file != NULL) + { + int offset = 0; + char *uploadId = new char[32]; + + const char *fileName = strrchr(ftp->pfts.pszFiles[i], '\\') + 1; + + fseek(file, 0, SEEK_END); + DWORD fileSize = ftell(file); + fseek(file, 0, SEEK_SET); + + ftp->pfts.currentFileNumber = i; + ftp->pfts.currentFileSize = fileSize; + ftp->pfts.currentFileProgress = 0; + ftp->pfts.szCurrentFile = strrchr(ftp->pfts.pszFiles[i], '\\') + 1; + + ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts); + + while (!feof(file) && !ferror(file)) + { + int chunkSize = DROPBOX_FILE_CHUNK_SIZE; + if (fileSize < 1024*1024) + chunkSize = DROPBOX_FILE_CHUNK_SIZE / 5; + else if (fileSize > 20*1024*1024) + chunkSize = DROPBOX_FILE_CHUNK_SIZE * 4; + + char *data = new char[chunkSize + 1]; + size_t count = fread(data, sizeof(char), chunkSize, file); + + if (!offset) + g_dropbox->SendFileChunkedFirst(data, count, uploadId, offset); + else + g_dropbox->SendFileChunkedNext(data, count, uploadId, offset); + + ftp->pfts.currentFileProgress += count; + ftp->pfts.totalProgress += count; + + ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts); + } + + fclose(file); + + g_dropbox->SendFileChunkedLast(fileName, uploadId, ftp->pfts.hContact); + ftp->pfts.currentFileProgress = ftp->pfts.currentFileSize; + + if (i < ftp->pfts.totalFiles - 1) + ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ftp->hProcess, 0); + } + } + + ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ftp->hProcess, 0); + + delete ftp; +} \ No newline at end of file diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp new file mode 100644 index 0000000000..caf4d9c980 --- /dev/null +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -0,0 +1,26 @@ +#include "dropbox.h" + +void CDropbox::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, MCONTACT hContact) +{ + if (Miranda_Terminated()) return; + + if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) + { + POPUPDATAW ppd = {0}; + ppd.lchContact = hContact; + wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); + wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE); + ppd.lchIcon = Skin_GetIcon("Skype_main"); + + if (!PUAddPopupW(&ppd)) + return; + + } + + MessageBox(NULL, message, caption, MB_OK | flags); +} + +void CDropbox::ShowNotification(const wchar_t *message, int flags, MCONTACT hContact) +{ + ShowNotification(TranslateT(MODULE), message, flags, hContact); +} \ No newline at end of file diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h new file mode 100644 index 0000000000..b17ef16b58 --- /dev/null +++ b/plugins/Dropbox/src/http_request.h @@ -0,0 +1,92 @@ +#ifndef _HTTP_REQUEST_H_ +#define _HTTP_REQUEST_H_ + +#include "common.h" + +enum HttpStatus +{ + OK = 200 +}; + +class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject +{ +public: + HttpRequest(HANDLE hNetlibUser, int requestType, LPCSTR url) + { + cbSize = sizeof(NETLIBHTTPREQUEST); + flags = NLHRF_HTTP11; + this->requestType = requestType; + + m_hNetlibUser = hNetlibUser; + m_szUrl = mir_strdup(url); + } + + ~HttpRequest() + { + for (int i=0; i < headersCount; i++) + { + mir_free(headers[i].szName); + mir_free(headers[i].szValue); + } + mir_free(headers); + mir_free(pData); + } + + + void AddHeader(LPCSTR szName, LPCSTR szValue) + { + headers = (NETLIBHTTPHEADER*)mir_realloc(headers, sizeof(NETLIBHTTPHEADER)*(headersCount+1)); + headers[headersCount].szName = mir_strdup(szName); + headers[headersCount].szValue = mir_strdup(szValue); + headersCount++; + } + + void AddParameter(LPCSTR szName, LPCSTR szValue) + { + if(m_szUrl.Find('?') == -1) + m_szUrl.AppendFormat("?%s=%s", szName, szValue); + else + m_szUrl.AppendFormat("&%s=%s", szName, szValue); + } + + void AddParameter(LPCSTR szName, int value) + { + if(m_szUrl.Find('?') == -1) + m_szUrl.AppendFormat("?%s=%i", szName, value); + else + m_szUrl.AppendFormat("&%s=%i", szName, value); + } + + NETLIBHTTPREQUEST *Send() + { + szUrl = m_szUrl.GetBuffer(); + return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)this); + } + + //void SendAsync(typename CBaseProto::AsyncHttpRequest callback) + //{ + // szUrl = m_szUrl.GetBuffer(); + // AsyncParam param = { this, proto, callback }; + // /*HANDLE hThread = */mir_forkthread(SendAsync, ¶m); + // //WaitForSingleObject(hThread, INFINITE); + //} + +private: + + CMStringA m_szUrl; + HANDLE m_hNetlibUser; + + /*static void SendAsync(void *arg) + { + AsyncParam *param = (AsyncParam*)arg; + NETLIBHTTPREQUEST* response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)param->m_proto->m_hNetlibUser, (LPARAM)param->m_request); + + CBaseProto *proto = param->m_proto; + AsyncRequestCallback callback = param->m_callback; + proto->*callback(response); + + delete response; + }*/ +}; + +#endif //_HTTP_REQUEST_H_ \ No newline at end of file diff --git a/plugins/Dropbox/src/main.cpp b/plugins/Dropbox/src/main.cpp new file mode 100644 index 0000000000..da1ccca07f --- /dev/null +++ b/plugins/Dropbox/src/main.cpp @@ -0,0 +1,52 @@ +//#include "common.h" +#include "dropbox.h" + +int hLangpack; +HINSTANCE g_hInstance; +CDropbox *g_dropbox; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {B908773A-86F7-4A91-8674-6A20BA0E67D1} + {0xb908773a, 0x86f7, 0x4a91, {0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1}} + +}; + +DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID) +{ + g_hInstance = hInstance; + + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); + + g_dropbox = new CDropbox(); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + delete g_dropbox; + + return 0; +} \ No newline at end of file diff --git a/plugins/Dropbox/src/resource.h b/plugins/Dropbox/src/resource.h new file mode 100644 index 0000000000..50deccd319 Binary files /dev/null and b/plugins/Dropbox/src/resource.h differ diff --git a/plugins/Dropbox/src/version.h b/plugins/Dropbox/src/version.h new file mode 100644 index 0000000000..178ef67ee7 --- /dev/null +++ b/plugins/Dropbox/src/version.h @@ -0,0 +1,15 @@ +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 11 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 1 + +#include + +#define __PLUGIN_NAME "Dropbox" +#define __INTERNAL_NAME "Dropbox" +#define __FILENAME "Dropbox.dll" +#define __DESCRIPTION "Provides ability to upload files on Dropbox." +#define __AUTHOR "unsane" +#define __AUTHOREMAIL "" +#define __AUTHORWEB "http://miranda-ng.org/p/Dropbox/" +#define __COPYRIGHT "© 2014 Miranda NG project" -- cgit v1.2.3