summaryrefslogtreecommitdiff
path: root/plugins/Watrack_MPD
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 17:09:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 17:09:50 +0300
commitbce8bc74daf1c5f510404c8bdf956b41fb1c10fc (patch)
tree9879ad5ce5f42087558601af6a6f2827d7df4c39 /plugins/Watrack_MPD
parentba1083b4da33ca44a5ae7d90eabbe3d6d340a81e (diff)
WinterSpeak, WhoUsesMyFiles, WhenWasIt, wbOSD, Watrack_MPD -> CMPlugin
Diffstat (limited to 'plugins/Watrack_MPD')
-rwxr-xr-xplugins/Watrack_MPD/src/init.cpp35
-rwxr-xr-xplugins/Watrack_MPD/src/main.cpp2
-rwxr-xr-xplugins/Watrack_MPD/src/options.cpp2
-rwxr-xr-xplugins/Watrack_MPD/src/stdafx.h10
4 files changed, 26 insertions, 23 deletions
diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp
index 9d28c299ff..b764322a32 100755
--- a/plugins/Watrack_MPD/src/init.cpp
+++ b/plugins/Watrack_MPD/src/init.cpp
@@ -16,14 +16,18 @@
#include "stdafx.h"
-HINSTANCE hInst;
+int hLangpack;
+CMPlugin g_plugin;
+
BOOL bWatrackService = FALSE;
-int hLangpack = 0;
wchar_t *gbHost, *gbPassword;
WORD gbPort;
HNETLIBUSER ghNetlibUser;
-PLUGININFOEX pluginInfo={
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -33,26 +37,15 @@ PLUGININFOEX pluginInfo={
__AUTHORWEB,
UNICODE_AWARE,
// 692E87D0-6C71-4CDC-9E36-2B69FBDC4C
- {0x692e87d0, 0x6c71, 0x4cdc, {0x9e, 0x36, 0x2b, 0x2d, 0x69, 0xfb, 0xdc, 0x4c}}
+ { 0x692e87d0, 0x6c71, 0x4cdc, {0x9e, 0x36, 0x2b, 0x2d, 0x69, 0xfb, 0xdc, 0x4c }}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
-void InitVars()
-{
- gbPort = db_get_w(NULL, szModuleName, "Port", 6600);
- gbHost = UniGetContactSettingUtf(NULL, szModuleName, "Server", L"127.0.0.1");
- gbPassword = UniGetContactSettingUtf(NULL, szModuleName, "Password", L"");
-}
+/////////////////////////////////////////////////////////////////////////////////////////
static int OnModulesLoaded(WPARAM, LPARAM)
{
@@ -61,11 +54,15 @@ static int OnModulesLoaded(WPARAM, LPARAM)
nlu.szDescriptiveName.w = TranslateT("Watrack MPD connection");
nlu.szSettingsModule = __PLUGIN_NAME;
ghNetlibUser = Netlib_RegisterUser(&nlu);
- InitVars();
+
+ gbPort = db_get_w(NULL, szModuleName, "Port", 6600);
+ gbHost = UniGetContactSettingUtf(NULL, szModuleName, "Server", L"127.0.0.1");
+ gbPassword = UniGetContactSettingUtf(NULL, szModuleName, "Password", L"");
+
if (ServiceExists(MS_WAT_PLAYER))
bWatrackService = TRUE;
- RegisterPlayer();
+ RegisterPlayer();
return 0;
}
@@ -78,6 +75,8 @@ extern "C" __declspec(dllexport) int Load()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) int Unload(void)
{
mir_free(gbHost);
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index 913bc19f84..ebd5de898f 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -413,4 +413,4 @@ void RegisterPlayer()
// player.Icon = //TODO:implement icon support
CallService(MS_WAT_PLAYER, WAT_ACT_REGISTER, (LPARAM)&player);
}
-} \ No newline at end of file
+}
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp
index b615ee3826..8d7c28bc6f 100755
--- a/plugins/Watrack_MPD/src/options.cpp
+++ b/plugins/Watrack_MPD/src/options.cpp
@@ -19,7 +19,7 @@
class COptWaMpdDlg : public CDlgBase
{
public:
- COptWaMpdDlg() : CDlgBase(hInst, IDD_OPT_WA_MPD),
+ COptWaMpdDlg() : CDlgBase(g_plugin.getInst(), IDD_OPT_WA_MPD),
edit_PORT(this, IDC_PORT), edit_SERVER(this, IDC_SERVER), edit_PASSWORD(this, IDC_PASSWORD)
{}
virtual void OnInitDialog() override
diff --git a/plugins/Watrack_MPD/src/stdafx.h b/plugins/Watrack_MPD/src/stdafx.h
index 2b17d1d703..161ccb2209 100755
--- a/plugins/Watrack_MPD/src/stdafx.h
+++ b/plugins/Watrack_MPD/src/stdafx.h
@@ -18,7 +18,6 @@
#include <windows.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_database.h>
#include <m_netlib.h>
@@ -35,12 +34,17 @@
#define szModuleName "Watrack_MPD"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(szModuleName)
+ {}
+};
+
extern HNETLIBUSER ghNetlibUser;
extern BOOL bWatrackService;
extern wchar_t *gbHost, *gbPassword;
extern WORD gbPort;
-extern char *date();
extern int WaMpdOptInit(WPARAM, LPARAM);
extern void RegisterPlayer();