From b89210e991e554adba6197091f99762182221de6 Mon Sep 17 00:00:00 2001
From: aunsane <aunsane@gmail.com>
Date: Fri, 28 Apr 2017 20:59:52 +0300
Subject: CloudFile: - avoid to simultaniosly load wit Dropbox plugin - service
 loading moved to modules loaded - cleanup

---
 plugins/CloudFile/src/events.cpp | 11 +++++++++++
 plugins/CloudFile/src/main.cpp   | 25 +++----------------------
 plugins/CloudFile/src/proto.cpp  | 32 --------------------------------
 plugins/CloudFile/src/stdafx.h   |  9 ++-------
 4 files changed, 16 insertions(+), 61 deletions(-)
 delete mode 100644 plugins/CloudFile/src/proto.cpp

diff --git a/plugins/CloudFile/src/events.cpp b/plugins/CloudFile/src/events.cpp
index 815a5f0b96..df71721dfb 100644
--- a/plugins/CloudFile/src/events.cpp
+++ b/plugins/CloudFile/src/events.cpp
@@ -2,6 +2,17 @@
 
 int OnModulesLoaded(WPARAM, LPARAM)
 {
+	// init
+	InitServices();
+	InitializeIcons();
+	InitializeMenus();
+	// netlib
+	NETLIBUSER nlu = {};
+	nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
+	nlu.szSettingsModule = MODULE;
+	nlu.szDescriptiveName.w = _A2W("MODULE");
+	hNetlibConnection = Netlib_RegisterUser(&nlu);
+	// options
 	HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized);
 	// srfile
 	size_t count = Services.getCount();
diff --git a/plugins/CloudFile/src/main.cpp b/plugins/CloudFile/src/main.cpp
index d3582642cc..a95c9db056 100644
--- a/plugins/CloudFile/src/main.cpp
+++ b/plugins/CloudFile/src/main.cpp
@@ -16,9 +16,7 @@ PLUGININFOEX pluginInfo =
 	__AUTHORWEB,
 	UNICODE_AWARE,
 	// {E876FE63-0701-4CDA-BED5-7C73A379C1D1}
-	//{ 0xe876fe63, 0x701, 0x4cda, { 0xbe, 0xd5, 0x7c, 0x73, 0xa3, 0x79, 0xc1, 0xd1 }}
-	// {B908773A-86F7-4A91-8674-6A20BA0E67D1}
-	{ 0xb908773a, 0x86f7, 0x4a91,{ 0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1 } }
+	{ 0xe876fe63, 0x701, 0x4cda, { 0xbe, 0xd5, 0x7c, 0x73, 0xa3, 0x79, 0xc1, 0xd1 }}
 };
 
 DWORD WINAPI DllMain(HINSTANCE hInst, DWORD, LPVOID)
@@ -32,32 +30,15 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
 	return &pluginInfo;
 }
 
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DROPBOX, MIID_LAST };
+
 extern "C" int __declspec(dllexport) Load(void)
 {
 	mir_getLP(&pluginInfo);
 
-	PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
-	pd.szName = MODULE;
-	pd.type = PROTOTYPE_VIRTUAL;
-	Proto_RegisterModule(&pd);
-
-	CreateServiceFunction(MODULE PS_GETCAPS, ProtoGetCaps);
-	CreateServiceFunction(MODULE PS_GETNAME, ProtoGetName);
-	CreateServiceFunction(MODULE PS_LOADICON, ProtoLoadIcon);
-
 	HookEvent(ME_PROTO_ACK, OnProtoAck);
 	HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
 
-	NETLIBUSER nlu = {};
-	nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
-	nlu.szSettingsModule = MODULE;
-	nlu.szDescriptiveName.w = _A2W("MODULE");
-	hNetlibConnection = Netlib_RegisterUser(&nlu);
-
-	InitServices();
-	InitializeIcons();
-	InitializeMenus();
-
 	return 0;
 }
 
diff --git a/plugins/CloudFile/src/proto.cpp b/plugins/CloudFile/src/proto.cpp
deleted file mode 100644
index 9698534c50..0000000000
--- a/plugins/CloudFile/src/proto.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "stdafx.h"
-
-INT_PTR ProtoGetCaps(WPARAM wParam, LPARAM)
-{
-	switch (wParam) {
-	case PFLAGNUM_1:
-		return PF1_IM | PF1_FILESEND;
-	case PFLAGNUM_2:
-		return PF2_ONLINE;
-	case PFLAGNUM_4:
-		return PF4_OFFLINEFILES;
-	}
-
-	return 0;
-}
-
-INT_PTR ProtoGetName(WPARAM wParam, LPARAM lParam)
-{
-	if (lParam) {
-		mir_strncpy((char *)lParam, MODULE, wParam);
-		return 0;
-	}
-
-	return 1;
-}
-
-INT_PTR ProtoLoadIcon(WPARAM wParam, LPARAM)
-{
-	return (LOWORD(wParam) == PLI_PROTOCOL)
-		? (INT_PTR)CopyIcon(LoadIconEx(IDI_UPLOAD))
-		: 0;
-}
\ No newline at end of file
diff --git a/plugins/CloudFile/src/stdafx.h b/plugins/CloudFile/src/stdafx.h
index 41720df5b1..e74711a96a 100644
--- a/plugins/CloudFile/src/stdafx.h
+++ b/plugins/CloudFile/src/stdafx.h
@@ -16,7 +16,6 @@
 #include <m_database.h>
 #include <m_netlib.h>
 #include <m_clist.h>
-#include <m_skin.h>
 #include <m_icolib.h>
 #include <m_popup.h>
 #include <m_file.h>
@@ -28,10 +27,11 @@
 #include <m_http.h>
 #include <m_json.h>
 #include <m_metacontacts.h>
-
 #include <m_protoint.h>
 #include <m_protosvc.h>
 
+#include <m_dropbox.h>
+
 #include "version.h"
 #include "resource.h"
 #include "options.h"
@@ -72,11 +72,6 @@ public:
 extern LIST<CCloudService> Services;
 void InitServices();
 
-// proto
-INT_PTR ProtoGetCaps(WPARAM, LPARAM);
-INT_PTR ProtoGetName(WPARAM, LPARAM);
-INT_PTR ProtoLoadIcon(WPARAM, LPARAM);
-
 // events
 int OnModulesLoaded(WPARAM, LPARAM);
 int OnProtoAck(WPARAM, LPARAM);
-- 
cgit v1.2.3