summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/stdautoaway/src/autoaway.cpp2
-rw-r--r--src/core/stdautoaway/src/main.cpp8
-rw-r--r--src/core/stdautoaway/src/stdafx.h11
-rw-r--r--src/core/stdaway/src/awaymsg.cpp6
-rw-r--r--src/core/stdaway/src/main.cpp8
-rw-r--r--src/core/stdaway/src/sendmsg.cpp24
-rw-r--r--src/core/stdaway/src/stdafx.h11
-rw-r--r--src/core/stdclist/src/clcopts.cpp2
-rw-r--r--src/core/stdclist/src/clistopts.cpp15
-rw-r--r--src/core/stdclist/src/cluiopts.cpp41
-rw-r--r--src/core/stdclist/src/contact.cpp8
-rw-r--r--src/core/stdclist/src/init.cpp17
-rw-r--r--src/core/stdclist/src/stdafx.h9
-rw-r--r--src/core/stdcrypt/src/main.cpp8
-rw-r--r--src/core/stdcrypt/src/stdafx.h9
-rw-r--r--src/core/stdemail/src/main.cpp8
-rw-r--r--src/core/stdemail/src/stdafx.h9
-rw-r--r--src/core/stdfile/src/file.cpp12
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp2
-rw-r--r--src/core/stdfile/src/fileopts.cpp36
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp16
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp14
-rw-r--r--src/core/stdfile/src/ftmanager.cpp20
-rw-r--r--src/core/stdfile/src/main.cpp9
-rw-r--r--src/core/stdfile/src/stdafx.h11
-rw-r--r--src/core/stdidle/src/main.cpp8
-rw-r--r--src/core/stdidle/src/options.cpp2
-rw-r--r--src/core/stdidle/src/stdafx.h9
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp2
-rw-r--r--src/core/stdmsg/src/chat_options.cpp10
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/globals.cpp2
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp4
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp8
-rw-r--r--src/core/stdmsg/src/msgs.cpp2
-rw-r--r--src/core/stdmsg/src/msgtimedout.cpp2
-rw-r--r--src/core/stdmsg/src/srmm.cpp9
-rw-r--r--src/core/stdmsg/src/stdafx.h14
-rw-r--r--src/core/stdmsg/src/tabs.cpp4
-rw-r--r--src/core/stdssl/src/main.cpp8
-rw-r--r--src/core/stdssl/src/stdafx.h8
-rw-r--r--src/core/stduihist/src/history.cpp6
-rw-r--r--src/core/stduihist/src/main.cpp8
-rw-r--r--src/core/stduihist/src/stdafx.h9
-rw-r--r--src/core/stduserinfo/src/contactinfo.cpp22
-rw-r--r--src/core/stduserinfo/src/main.cpp8
-rw-r--r--src/core/stduserinfo/src/stdafx.h11
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp8
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp6
-rw-r--r--src/core/stduseronline/src/main.cpp8
-rw-r--r--src/core/stduseronline/src/stdafx.h11
-rw-r--r--src/core/stduseronline/src/useronline.cpp22
52 files changed, 249 insertions, 280 deletions
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp
index 3dda6e2d87..c5cf316d36 100644
--- a/src/core/stdautoaway/src/autoaway.cpp
+++ b/src/core/stdautoaway/src/autoaway.cpp
@@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-#define AA_MODULE "AutoAway"
-
static int iBreakSounds = 0;
static int AutoAwaySound(WPARAM, LPARAM)
diff --git a/src/core/stdautoaway/src/main.cpp b/src/core/stdautoaway/src/main.cpp
index b7138e4b1f..cae20cf28f 100644
--- a/src/core/stdautoaway/src/main.cpp
+++ b/src/core/stdautoaway/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadAutoAwayModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{ 0x9f5ca736, 0x1108, 0x4872, {0xbe, 0xc3, 0x19, 0xc8, 0x4b, 0xc2, 0x14, 0x3b}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdautoaway/src/stdafx.h b/src/core/stdautoaway/src/stdafx.h
index 2f94563910..d785f0f238 100644
--- a/src/core/stdautoaway/src/stdafx.h
+++ b/src/core/stdautoaway/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_utils.h>
@@ -67,4 +65,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define AA_MODULE "AutoAway"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(AA_MODULE)
+ {}
+};
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index d5cc58afae..0a8014e618 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -78,7 +78,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
ack.result = ACKRESULT_SUCCESS;
SendMessage(hwndDlg, HM_AWAYMSG, 0, (LPARAM)&ack);
}
- Utils_RestoreWindowPosition(hwndDlg, lParam, "SRAway", "AwayMsgDlg");
+ Utils_RestoreWindowPosition(hwndDlg, lParam, MODULENAME, "AwayMsgDlg");
return TRUE;
case HM_AWAYMSG:
@@ -111,7 +111,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
case WM_DESTROY:
if (dat->hAwayMsgEvent) UnhookEvent(dat->hAwayMsgEvent);
- Utils_SaveWindowPosition(hwndDlg, dat->hContact, "SRAway", "AwayMsgDlg");
+ Utils_SaveWindowPosition(hwndDlg, dat->hContact, MODULENAME, "AwayMsgDlg");
WindowList_Remove(hWindowList, hwndDlg);
Window_FreeIcon_IcoLib(hwndDlg);
mir_free(dat);
@@ -126,7 +126,7 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM)
SetForegroundWindow(hwnd);
SetFocus(hwnd);
}
- else CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
+ else CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_READAWAYMSG), NULL, ReadAwayMsgDlgProc, wParam);
return 0;
}
diff --git a/src/core/stdaway/src/main.cpp b/src/core/stdaway/src/main.cpp
index f9b1b2e174..4ea617bc4e 100644
--- a/src/core/stdaway/src/main.cpp
+++ b/src/core/stdaway/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadAwayMsgModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{ 0xe58558e3, 0x83e7, 0x44ef, {0x8e, 0x39, 0xd9, 0xe0, 0x54, 0x19, 0x56, 0xdf}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp
index 1ec83b0b38..532ad9d1ec 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -70,12 +70,12 @@ static const char* StatusModeToDbSetting(int status, const char *suffix)
static bool GetStatusModeByte(int status, const char *suffix, bool bDefault = false)
{
- return db_get_b(NULL, "SRAway", StatusModeToDbSetting(status, suffix), bDefault) != 0;
+ return db_get_b(NULL, MODULENAME, StatusModeToDbSetting(status, suffix), bDefault) != 0;
}
static void SetStatusModeByte(int status, const char *suffix, BYTE value)
{
- db_set_b(NULL, "SRAway", StatusModeToDbSetting(status, suffix), value);
+ db_set_b(NULL, MODULENAME, StatusModeToDbSetting(status, suffix), value);
}
static wchar_t* GetAwayMessage(int statusMode, char *szProto)
@@ -88,11 +88,11 @@ static wchar_t* GetAwayMessage(int statusMode, char *szProto)
DBVARIANT dbv;
if (GetStatusModeByte(statusMode, "UsePrev")) {
- if (db_get_ws(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Msg"), &dbv))
+ if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(statusMode, "Msg"), &dbv))
dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
}
else {
- if (db_get_ws(NULL, "SRAway", StatusModeToDbSetting(statusMode, "Default"), &dbv))
+ if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(statusMode, "Default"), &dbv))
dbv.ptszVal = mir_wstrdup(GetDefaultMessage(statusMode));
for (int i = 0; dbv.ptszVal[i]; i++) {
@@ -231,7 +231,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
dat->countdown = 6;
SendMessage(hwndDlg, WM_TIMER, 0, 0);
Window_SetProtoIcon_IcoLib(hwndDlg, dat->szProto, dat->statusMode);
- Utils_RestoreWindowPosition(hwndDlg, NULL, "SRAway", "AwayMsgDlg");
+ Utils_RestoreWindowPosition(hwndDlg, NULL, MODULENAME, "AwayMsgDlg");
SetTimer(hwndDlg, 1, 1000, nullptr);
dat->hPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwndDlg, DM_SRAWAY_SHUTDOWN);
}
@@ -265,7 +265,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
wchar_t str[1024];
GetDlgItemText(hwndDlg, IDC_MSG, str, _countof(str));
ChangeAllProtoMessages(dat->szProto, dat->statusMode, str);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(dat->statusMode, "Msg"), str);
+ db_set_ws(NULL, MODULENAME, StatusModeToDbSetting(dat->statusMode, "Msg"), str);
DestroyWindow(hwndDlg);
}
else PostMessage(hwndDlg, WM_CLOSE, 0, 0);
@@ -286,7 +286,7 @@ static INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
break;
case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, "SRAway", "AwayMsgDlg");
+ Utils_SaveWindowPosition(hwndDlg, NULL, MODULENAME, "AwayMsgDlg");
KillTimer(hwndDlg, 1);
UnhookEvent(dat->hPreshutdown);
Window_FreeIcon_IcoLib(hwndDlg);
@@ -332,7 +332,7 @@ static int StatusModeChange(WPARAM wParam, LPARAM lParam)
newdat->statusMode = statusMode;
if (hwndStatusMsg)
DestroyWindow(hwndStatusMsg);
- hwndStatusMsg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)newdat);
+ hwndStatusMsg = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETAWAYMSG), NULL, SetAwayMsgDlgProc, (LPARAM)newdat);
}
return 0;
}
@@ -388,8 +388,8 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
dat->info[j].usePrevious = GetStatusModeByte(it, "UsePrev");
DBVARIANT dbv;
- if (db_get_ws(NULL, "SRAway", StatusModeToDbSetting(it, "Default"), &dbv))
- if (db_get_ws(NULL, "SRAway", StatusModeToDbSetting(it, "Msg"), &dbv))
+ if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(it, "Default"), &dbv))
+ if (db_get_ws(NULL, MODULENAME, StatusModeToDbSetting(it, "Msg"), &dbv))
dbv.ptszVal = mir_wstrdup(GetDefaultMessage(it));
mir_wstrcpy(dat->info[j].msg, dbv.ptszVal);
mir_free(dbv.ptszVal);
@@ -494,7 +494,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
SetStatusModeByte(status, "Ignore", (BYTE)dat->info[i].ignore);
SetStatusModeByte(status, "NoDlg", (BYTE)dat->info[i].noDialog);
SetStatusModeByte(status, "UsePrev", (BYTE)dat->info[i].usePrevious);
- db_set_ws(NULL, "SRAway", StatusModeToDbSetting(status, "Default"), dat->info[i].msg);
+ db_set_ws(NULL, MODULENAME, StatusModeToDbSetting(status, "Default"), dat->info[i].msg);
}
return TRUE;
}
@@ -517,7 +517,7 @@ static int AwayMsgOptInitialise(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 870000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AWAYMSG);
odp.szTitle.a = LPGEN("Status messages");
odp.szGroup.a = LPGEN("Status");
diff --git a/src/core/stdaway/src/stdafx.h b/src/core/stdaway/src/stdafx.h
index 44a47b363a..6ae1a5bd6a 100644
--- a/src/core/stdaway/src/stdafx.h
+++ b/src/core/stdaway/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_utils.h>
@@ -68,4 +66,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define MODULENAME "SRAway"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
diff --git a/src/core/stdclist/src/clcopts.cpp b/src/core/stdclist/src/clcopts.cpp
index 0450672c0d..e2790adc9c 100644
--- a/src/core/stdclist/src/clcopts.cpp
+++ b/src/core/stdclist/src/clcopts.cpp
@@ -424,7 +424,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
int ClcOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Contact list");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLC);
odp.szTitle.a = LPGEN("List");
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp
index 32b8dafab8..cf77a0d953 100644
--- a/src/core/stdclist/src/clistopts.cpp
+++ b/src/core/stdclist/src/clistopts.cpp
@@ -67,14 +67,11 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
CheckDlgButton(hwndDlg, IDC_ALWAYSMULTI,
!db_get_b(NULL, "CList", "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DONTCYCLE,
- db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CYCLE,
- db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_CYCLE ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_MULTITRAY,
- db_get_b(NULL, "CList", "TrayIcon",
- SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
+ db_get_b(NULL, "CList", "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DISABLEBLINK,
db_get_b(NULL, "CList", "DisableTrayFlash", 0) == 1 ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKTIME), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_DISABLEBLINK));
@@ -151,7 +148,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
db_set_b(NULL, "CList", "HideOffline", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEOFFLINE));
db_set_b(NULL, "CList", "HideEmptyGroups", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDEEMPTYGROUPS));
db_set_b(NULL, "CList", "UseGroups", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEGROUPS));
-
+
g_bSortByStatus = IsDlgButtonChecked(hwndDlg, IDC_SORTBYSTATUS);
g_bSortByProto = IsDlgButtonChecked(hwndDlg, IDC_SORTBYPROTO);
@@ -163,7 +160,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
db_set_b(NULL, "CList", "AlwaysMulti", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_ALWAYSMULTI));
db_set_b(NULL, "CList", "TrayIcon",
(BYTE)(IsDlgButtonChecked(hwndDlg, IDC_DONTCYCLE) ? SETTING_TRAYICON_SINGLE
- : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
+ : (IsDlgButtonChecked(hwndDlg, IDC_CYCLE) ? SETTING_TRAYICON_CYCLE : SETTING_TRAYICON_MULTI)));
db_set_w(NULL, "CList", "CycleTime",
(WORD)SendDlgItemMessage(hwndDlg, IDC_CYCLETIMESPIN, UDM_GETPOS, 0, 0));
db_set_w(NULL, "CList", "IconFlashTime",
@@ -197,7 +194,7 @@ int CListOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -1000000000;
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLIST);
odp.szTitle.a = LPGEN("Contact list");
odp.pfnDlgProc = DlgProcGenOpts;
diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp
index 358638cc96..a2afe36280 100644
--- a/src/core/stdclist/src/cluiopts.cpp
+++ b/src/core/stdclist/src/cluiopts.cpp
@@ -29,26 +29,22 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT,
- db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_TOOLWND,
- db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_MIN2TRAY,
- db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND))
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
- CheckDlgButton(hwndDlg, IDC_SHOWCAPTION,
- db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU,
- db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CLIENTDRAG,
- db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE);
}
+
CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -72,13 +68,12 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZESPIN), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), FALSE);
}
-
- { DBVARIANT dbv;
- if (!db_get_ws(NULL, "CList", "TitleText", &dbv)) {
- SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal);
- db_free(&dbv);
- }
- else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
+ {
+ ptrW wszTitle(db_get_wsa(NULL, "CList", "TitleText"));
+ if (wszTitle != nullptr)
+ SetDlgItemText(hwndDlg, IDC_TITLETEXT, wszTitle);
+ else
+ SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME);
}
CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED);
@@ -90,11 +85,11 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVEPERC), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_INACTIVEPERC), FALSE);
}
+
SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255));
SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT));
- SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE,
- db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
+ SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT));
SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0);
return TRUE;
@@ -297,7 +292,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
DestroyWindow(pcli->hwndStatus);
flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0;
flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0;
- pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_hInst, nullptr);
+ pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, nullptr, flags, 0, 0, 0, 0, parent, nullptr, g_plugin.getInst(), nullptr);
}
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR))
ShowWindow(pcli->hwndStatus, SW_SHOW);
@@ -316,7 +311,7 @@ static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
int CluiOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CLUI);
odp.szTitle.a = LPGEN("Window");
odp.szGroup.a = LPGEN("Contact list");
diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp
index e4fc490248..95a5e2212a 100644
--- a/src/core/stdclist/src/contact.cpp
+++ b/src/core/stdclist/src/contact.cpp
@@ -30,7 +30,8 @@ const struct
{
int status, order;
}
-static statusModeOrder[] = {
+static statusModeOrder[] =
+{
{ ID_STATUS_OFFLINE, 500 },
{ ID_STATUS_ONLINE, 10 },
{ ID_STATUS_AWAY, 200 },
@@ -40,7 +41,8 @@ static statusModeOrder[] = {
{ ID_STATUS_FREECHAT, 0 },
{ ID_STATUS_INVISIBLE, 20 },
{ ID_STATUS_ONTHEPHONE, 150 },
- { ID_STATUS_OUTTOLUNCH, 425 } };
+ { ID_STATUS_OUTTOLUNCH, 425 }
+};
int GetStatusModeOrdering(int statusMode)
{
@@ -87,7 +89,7 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2)
nameb = Clist_GetContactDisplayName(a);
wcsncpy_s(namea, nameb, _TRUNCATE);
- namea[ _countof(namea)-1 ] = 0;
+ namea[_countof(namea) - 1] = 0;
nameb = Clist_GetContactDisplayName(b);
//otherwise just compare names
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp
index 013341958c..63bf340448 100644
--- a/src/core/stdclist/src/init.cpp
+++ b/src/core/stdclist/src/init.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-HINSTANCE g_hInst = nullptr;
+CMPlugin g_plugin;
CLIST_INTERFACE* pcli = nullptr, coreCli;
HIMAGELIST himlCListClc = nullptr;
int hLangpack;
@@ -32,8 +32,8 @@ int hLangpack;
/////////////////////////////////////////////////////////////////////////////////////////
// external functions
-void RegisterCListFonts( void );
-void InitCustomMenus( void );
+void RegisterCListFonts(void);
+void InitCustomMenus(void);
void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint);
int ClcOptInit(WPARAM wParam, LPARAM lParam);
@@ -41,15 +41,6 @@ int CluiOptInit(WPARAM wParam, LPARAM lParam);
int CListOptInit(WPARAM wParam, LPARAM lParam);
/////////////////////////////////////////////////////////////////////////////////////////
-// dll stub
-
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
-{
- g_hInst = hInstDLL;
- return TRUE;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// returns the plugin information
PLUGININFOEX pluginInfo = {
@@ -125,7 +116,7 @@ extern "C" __declspec(dllexport) int CListInitialise()
g_bSortByProto = db_get_b(NULL, "CList", "SortByProto", SETTING_SORTBYPROTO_DEFAULT);
coreCli = *pcli;
- pcli->hInst = g_hInst;
+ pcli->hInst = g_plugin.getInst();
pcli->pfnPaintClc = PaintClc;
pcli->pfnLoadClcOptions = LoadClcOptions;
pcli->pfnCompareContacts = CompareContacts;
diff --git a/src/core/stdclist/src/stdafx.h b/src/core/stdclist/src/stdafx.h
index 60e58f22e8..3803aa1214 100644
--- a/src/core/stdclist/src/stdafx.h
+++ b/src/core/stdclist/src/stdafx.h
@@ -37,7 +37,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <Uxtheme.h>
#include <shlwapi.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
#include <newpluginapi.h>
#include <m_clistint.h>
@@ -57,8 +56,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "version.h"
#include "resource.h"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>("CList")
+ {}
+};
+
// shared vars
-extern HINSTANCE g_hInst;
extern CLIST_INTERFACE coreCli;
extern int g_bSortByStatus, g_bSortByProto;
diff --git a/src/core/stdcrypt/src/main.cpp b/src/core/stdcrypt/src/main.cpp
index f14cab066a..9633341f8c 100644
--- a/src/core/stdcrypt/src/main.cpp
+++ b/src/core/stdcrypt/src/main.cpp
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadEncryptionModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -38,12 +38,6 @@ PLUGININFOEX pluginInfo = {
{ 0xd3637189, 0xa5a5, 0x41f5, {0xbc, 0x72, 0x67, 0xa2, 0xf8, 0xaf, 0x1b, 0x6f}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdcrypt/src/stdafx.h b/src/core/stdcrypt/src/stdafx.h
index 2bc0d66d3e..c10671bcca 100644
--- a/src/core/stdcrypt/src/stdafx.h
+++ b/src/core/stdcrypt/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_utils.h>
@@ -69,7 +67,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdcrypt.h"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
bool getRandomBytes(BYTE *buf, size_t bufLen);
void slow_hash(const void *buf, size_t bufLen, BYTE *tmpHash);
diff --git a/src/core/stdemail/src/main.cpp b/src/core/stdemail/src/main.cpp
index 97ae5aa792..b767444bda 100644
--- a/src/core/stdemail/src/main.cpp
+++ b/src/core/stdemail/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadSendRecvEMailModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{0xb774d10a, 0xc761, 0x11e1, {0x84, 0x05, 0x27, 0xe7, 0x61, 0x88, 0x70, 0x9b }}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdemail/src/stdafx.h b/src/core/stdemail/src/stdafx.h
index f9505f25a8..e9a3f62ed1 100644
--- a/src/core/stdemail/src/stdafx.h
+++ b/src/core/stdemail/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_utils.h>
@@ -66,4 +64,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 089f5d999f..9dda11aa92 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -47,7 +47,7 @@ static INT_PTR SendFileCommand(WPARAM hContact, LPARAM)
struct FileSendData fsd;
fsd.hContact = hContact;
fsd.ppFiles = nullptr;
- return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
}
static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)
@@ -65,7 +65,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)
fsd.ppFiles[i] = mir_a2u(ppFiles[i]);
fsd.ppFiles[count] = nullptr;
- HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ HWND hWnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
for (int j = 0; j < count; j++)
mir_free((void*)fsd.ppFiles[j]);
return (INT_PTR)hWnd;
@@ -76,7 +76,7 @@ static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam)
FileSendData fsd;
fsd.hContact = hContact;
fsd.ppFiles = (const wchar_t**)lParam;
- return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
}
static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
@@ -91,7 +91,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam)
{
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, lParam);
return 0;
}
@@ -101,8 +101,8 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
cle.hContact = hContact;
cle.hDbEvent = hdbe;
cle.lParam = lParam;
- if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
+ if (db_get_b(NULL, MODULENAME, "AutoAccept", 0) && !db_get_b(hContact, "CList", "NotOnList", 0)) {
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILERECV), NULL, DlgProcRecvFile, (LPARAM)&cle);
}
else {
Skin_PlaySound("RecvFile");
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index 7a8125d02a..60b1dc43e9 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -184,7 +184,7 @@ void __cdecl LoadIconsAndTypesThread(void* param)
}
else
iconIndex = 0;
- HICON hIcon = ExtractIcon(hInst, szIconFile, iconIndex);
+ HICON hIcon = ExtractIcon(g_plugin.getInst(), szIconFile, iconIndex);
if (hIcon)
fileInfo.hIcon = hIcon;
}
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index ef06a6d4b2..3d75637686 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -66,16 +66,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
- CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, "SRFile", "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, "SRFile", "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, "SRFile", "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, "SRFile", "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
- switch (db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE)) {
+ CheckDlgButton(hwndDlg, IDC_AUTOACCEPT, db_get_b(NULL, MODULENAME, "AutoAccept", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, MODULENAME, "AutoMin", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, MODULENAME, "AutoClose", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOCLEAR, db_get_b(NULL, MODULENAME, "AutoClear", 1) ? BST_CHECKED : BST_UNCHECKED);
+ switch (db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE)) {
case VIRUSSCAN_AFTERDL: CheckDlgButton(hwndDlg, IDC_SCANAFTERDL, BST_CHECKED); break;
case VIRUSSCAN_DURINGDL: CheckDlgButton(hwndDlg, IDC_SCANDURINGDL, BST_CHECKED); break;
default: CheckDlgButton(hwndDlg, IDC_NOSCANNER, BST_CHECKED); break;
}
- CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, MODULENAME, "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
for (int i = 0; i < _countof(virusScanners); i++) {
wchar_t szScanExe[MAX_PATH];
@@ -90,7 +90,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
DBVARIANT dbv;
- if (db_get_ws(NULL, "SRFile", "ScanCmdLine", &dbv) == 0) {
+ if (db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv) == 0) {
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, dbv.ptszVal);
db_free(&dbv);
}
@@ -99,7 +99,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
PostMessage(hwndDlg, M_SCANCMDLINESELCHANGE, 0, 0);
}
- switch (db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK)) {
+ switch (db_get_b(NULL, MODULENAME, "IfExists", FILERESUME_ASK)) {
case FILERESUME_RESUMEALL: CheckDlgButton(hwndDlg, IDC_RESUME, BST_CHECKED); break;
case FILERESUME_OVERWRITEALL: CheckDlgButton(hwndDlg, IDC_OVERWRITE, BST_CHECKED); break;
case FILERESUME_RENAMEALL: CheckDlgButton(hwndDlg, IDC_RENAME, BST_CHECKED); break;
@@ -205,16 +205,16 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t str[512];
GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str));
RemoveInvalidPathChars(str);
- db_set_ws(NULL, "SRFile", "RecvFilesDirAdv", str);
- db_set_b(NULL, "SRFile", "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
- db_set_b(NULL, "SRFile", "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- db_set_b(NULL, "SRFile", "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
- db_set_b(NULL, "SRFile", "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
- db_set_b(NULL, "SRFile", "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE)));
+ db_set_ws(NULL, MODULENAME, "RecvFilesDirAdv", str);
+ db_set_b(NULL, MODULENAME, "AutoAccept", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOACCEPT));
+ db_set_b(NULL, MODULENAME, "AutoMin", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, MODULENAME, "AutoClose", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
+ db_set_b(NULL, MODULENAME, "AutoClear", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAR));
+ db_set_b(NULL, MODULENAME, "UseScanner", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SCANAFTERDL) ? VIRUSSCAN_AFTERDL : (IsDlgButtonChecked(hwndDlg, IDC_SCANDURINGDL) ? VIRUSSCAN_DURINGDL : VIRUSSCAN_DISABLE)));
GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str));
- db_set_ws(NULL, "SRFile", "ScanCmdLine", str);
- db_set_b(NULL, "SRFile", "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
- db_set_b(NULL, "SRFile", "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(hwndDlg, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL))));
+ db_set_ws(NULL, MODULENAME, "ScanCmdLine", str);
+ db_set_b(NULL, MODULENAME, "WarnBeforeOpening", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WARNBEFOREOPENING));
+ db_set_b(NULL, MODULENAME, "IfExists", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_ASK) ? FILERESUME_ASK : (IsDlgButtonChecked(hwndDlg, IDC_RESUME) ? FILERESUME_RESUMEALL : (IsDlgButtonChecked(hwndDlg, IDC_OVERWRITE) ? FILERESUME_OVERWRITEALL : FILERESUME_RENAMEALL))));
return TRUE;
}
break;
@@ -226,7 +226,7 @@ int FileOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 900000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FILETRANSFER);
odp.szTitle.a = LPGEN("File transfers");
odp.szGroup.a = LPGEN("Events");
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 36160ebdf0..3db0e42786 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -125,7 +125,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B
{
wchar_t tszTemp[MAX_PATH];
- ptrW tszRecvPath(db_get_wsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_wsa(NULL, MODULENAME, "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
@@ -165,7 +165,7 @@ void GetReceivedFilesDir(wchar_t *szDir, int cchDir)
{
wchar_t tszTemp[MAX_PATH];
- ptrW tszRecvPath(db_get_wsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_wsa(NULL, MODULENAME, "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
@@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
mir_snprintf(idstr, "MruDir%d", i);
DBVARIANT dbv;
- if (db_get_ws(NULL, "SRFile", idstr, &dbv))
+ if (db_get_ws(NULL, MODULENAME, idstr, &dbv))
break;
SendDlgItemMessage(hwndDlg, IDC_FILEDIR, CB_ADDSTRING, 0, (LPARAM)dbv.ptszVal);
db_free(&dbv);
@@ -257,7 +257,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
GetWindowRect(GetDlgItem(hwndDlg, IDC_DATE), &rcDateCtrl);
SetWindowPos(GetDlgItem(hwndDlg, IDC_DATE), 0, 0, 0, rcDateCtrl.right - rcDateCtrl.left - (rcBtn2.left - rcBtn1.left), rcDateCtrl.bottom - rcDateCtrl.top, SWP_NOZORDER | SWP_NOMOVE);
}
- else if (db_get_b(NULL, "SRFile", "AutoAccept", 0)) {
+ else if (db_get_b(NULL, MODULENAME, "AutoAccept", 0)) {
//don't check auto-min here to fix BUG#647620
PostMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDOK, BN_CLICKED), (LPARAM)GetDlgItem(hwndDlg, IDOK));
}
@@ -313,12 +313,12 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
DBVARIANT dbv;
for (i = MAX_MRU_DIRS-2;i>=0;i--) {
mir_snprintf(idstr, "MruDir%d", i);
- if (db_get_ws(NULL, "SRFile", idstr, &dbv)) continue;
+ if (db_get_ws(NULL, MODULENAME, idstr, &dbv)) continue;
mir_snprintf(idstr, "MruDir%d", i+1);
- db_set_ws(NULL, "SRFile", idstr, dbv.ptszVal);
+ db_set_ws(NULL, MODULENAME, idstr, dbv.ptszVal);
db_free(&dbv);
}
- db_set_ws(NULL, "SRFile", idstr, szRecvDir);
+ db_set_ws(NULL, MODULENAME, idstr, szRecvDir);
}
}
EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAMES), FALSE);
@@ -332,7 +332,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
dat->hwndTransfer = FtMgr_AddTransfer(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
//check for auto-minimize here to fix BUG#647620
- if (db_get_b(NULL, "SRFile", "AutoAccept", 0) && db_get_b(NULL, "SRFile", "AutoMin", 0)) {
+ if (db_get_b(NULL, MODULENAME, "AutoAccept", 0) && db_get_b(NULL, MODULENAME, "AutoMin", 0)) {
ShowWindow(hwndDlg, SW_HIDE);
ShowWindow(hwndDlg, SW_SHOWMINNOACTIVE);
}
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 7cfd4097ad..f5227c6f79 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -31,7 +31,7 @@ static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i)
if (dat->send) return 1;
if (dat->fileVirusScanned == nullptr) return 0;
if (dat->fileVirusScanned[i]) return 1;
- if (db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) == 0) return 1;
+ if (db_get_b(NULL, MODULENAME, "WarnBeforeOpening", 1) == 0) return 1;
return IDYES == MessageBox(hwnd, TranslateT("This file has not yet been scanned for viruses. Are you certain you want to open it?"), TranslateT("File received"), MB_YESNO|MB_DEFBUTTON2);
}
@@ -94,7 +94,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, "SRFile", "ScanCmdLine", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "ScanCmdLine", &dbv)) {
if (dbv.ptszVal[0]) {
STARTUPINFO si = { 0 };
si.cb = sizeof(si);
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.szWorkingDir.w = mir_wstrdup(dat->szSavePath);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
- else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
+ else dat->resumeBehaviour = db_get_b(NULL, MODULENAME, "IfExists", FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT);
}
@@ -518,7 +518,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SetDlgItemTextA(hwndDlg, IDC_FILENAME, "");
if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles > 1 && !dat->send)
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
- if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
+ if (dat->transferStatus.currentFileNumber != -1 && dat->files && !dat->send && db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE) == VIRUSSCAN_DURINGDL) {
if (GetFileAttributes(dat->files[dat->transferStatus.currentFileNumber])&FILE_ATTRIBUTE_DIRECTORY)
PostMessage(hwndDlg, M_VIRUSSCANDONE, dat->transferStatus.currentFileNumber, 0);
else {
@@ -543,7 +543,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->resumeBehaviour == FILERESUME_ASK) {
TDlgProcFileExistsParam param = { hwndDlg, fts };
ShowWindow(hwndDlg, SW_SHOWNORMAL);
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)&param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILEEXISTS), hwndDlg, DlgProcFileExists, (LPARAM)&param);
EnableWindow(hwndDlg, FALSE);
}
else {
@@ -649,7 +649,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
LPGENW("Transfer completed, open folder."),
FTS_OPEN);
- int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE);
+ int useScanner = db_get_b(NULL, MODULENAME, "UseScanner", VIRUSSCAN_DISABLE);
if (useScanner != VIRUSSCAN_DISABLE) {
struct virusscanthreadstartinfo *vstsi;
vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
@@ -706,7 +706,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_FILETRANSFERINFO), FileTransferDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FILETRANSFERINFO), FileTransferDlgResizer);
RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp
index 00ba7cd691..46d329b9f2 100644
--- a/src/core/stdfile/src/ftmanager.cpp
+++ b/src/core/stdfile/src/ftmanager.cpp
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
if (i == dat->wnds->realCount)
PostMessage(GetParent(hwnd), WM_TIMER, 1, NULL);
- if(dat->runningCount == 0 && wParam == ACKRESULT_SUCCESS && db_get_b(NULL, "SRFile", "AutoClose", 0))
+ if(dat->runningCount == 0 && wParam == ACKRESULT_SUCCESS && db_get_b(NULL, MODULENAME, "AutoClose", 0))
ShowWindow(hwndFtMgr, SW_HIDE);
break;
@@ -276,8 +276,8 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
dat->hhkPreshutdown = HookEventMessage(ME_SYSTEM_PRESHUTDOWN, hwnd, M_PRESHUTDOWN);
- dat->hwndIncoming = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
- dat->hwndOutgoing = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
+ dat->hwndIncoming = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
+ dat->hwndOutgoing = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTPAGE), hwnd, FtMgrPageDlgProc);
ShowWindow(dat->hwndIncoming, SW_SHOW);
tci.mask = TCIF_PARAM|TCIF_TEXT;
@@ -288,7 +288,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
tci.lParam = (LPARAM)dat->hwndOutgoing;
TabCtrl_InsertItem(hwndTab, 1, &tci);
- Utils_RestoreWindowPosition(hwnd, NULL, "SRFile", "FtMgrDlg_", RWPF_NOACTIVATE);
+ Utils_RestoreWindowPosition(hwnd, NULL, MODULENAME, "FtMgrDlg_", RWPF_NOACTIVATE);
// Fall through to setup initial placement
}
case WM_SIZE:
@@ -414,7 +414,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_CLOSE:
ShowWindow(hwnd, SW_HIDE);
- if (db_get_b(NULL, "SRFile", "AutoClear", 1)) {
+ if (db_get_b(NULL, MODULENAME, "AutoClear", 1)) {
PostMessage(dat->hwndIncoming, WM_FT_CLEANUP, 0, 0);
PostMessage(dat->hwndOutgoing, WM_FT_CLEANUP, 0, 0);
}
@@ -427,7 +427,7 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
DestroyWindow(dat->hwndOutgoing);
mir_free(dat);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
- Utils_SaveWindowPosition(hwnd, NULL, "SRFile", "FtMgrDlg_");
+ Utils_SaveWindowPosition(hwnd, NULL, MODULENAME, "FtMgrDlg_");
break;
case WM_ACTIVATE:
@@ -476,11 +476,11 @@ static INT_PTR CALLBACK FtMgrDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
HWND FtMgr_Show(bool bForceActivate, bool bFromMenu)
{
- bool bAutoMin = db_get_b(NULL, "SRFile", "AutoMin", 0) != 0; /* lqbe */
+ bool bAutoMin = db_get_b(NULL, MODULENAME, "AutoMin", 0) != 0; /* lqbe */
bool bJustCreated = (hwndFtMgr == nullptr);
if (bJustCreated)
- hwndFtMgr = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc);
+ hwndFtMgr = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FTMGR), NULL, FtMgrDlgProc);
if (bFromMenu) { /* lqbe */
ShowWindow(hwndFtMgr, SW_RESTORE);
@@ -520,13 +520,13 @@ void FtMgr_ShowPage(int page)
HWND FtMgr_AddTransfer(FileDlgData *fdd)
{
- bool bForceActivate = fdd->send || !db_get_b(NULL, "SRFile", "AutoAccept", 0);
+ bool bForceActivate = fdd->send || !db_get_b(NULL, MODULENAME, "AutoAccept", 0);
TFtMgrData *dat = (TFtMgrData*)GetWindowLongPtr(FtMgr_Show(bForceActivate, false), GWLP_USERDATA);
if (dat == nullptr)
return nullptr;
HWND hwndBox = fdd->send ? dat->hwndOutgoing : dat->hwndIncoming;
- HWND hwndFt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd);
+ HWND hwndFt = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILETRANSFERINFO), hwndBox, DlgProcFileTransfer, (LPARAM)fdd);
ShowWindow(hwndFt, SW_SHOWNA);
SendMessage(hwndBox, WM_FT_ADD, 0, (LPARAM)hwndFt);
FtMgr_ShowPage(fdd->send ? 1 : 0);
diff --git a/src/core/stdfile/src/main.cpp b/src/core/stdfile/src/main.cpp
index 51e71e11ab..36ef0dcfdc 100644
--- a/src/core/stdfile/src/main.cpp
+++ b/src/core/stdfile/src/main.cpp
@@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadSendRecvFileModule(void);
+CMPlugin g_plugin;
+
CLIST_INTERFACE* pcli;
-HINSTANCE hInst;
int hLangpack;
ITaskbarList3 * pTaskbarInterface;
@@ -42,12 +43,6 @@ PLUGININFOEX pluginInfo = {
{ 0x39698dce, 0x7ed4, 0x4334, {0xac, 0x4c, 0xba, 0x8b, 0x37, 0xa8, 0x6f, 0x13}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdfile/src/stdafx.h b/src/core/stdfile/src/stdafx.h
index eba834de22..2edc930862 100644
--- a/src/core/stdfile/src/stdafx.h
+++ b/src/core/stdfile/src/stdafx.h
@@ -43,9 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/types.h>
#include <sys/stat.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <newpluginapi.h>
#include <m_system.h>
#include <m_database.h>
@@ -74,6 +72,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define MODULENAME "SRFile"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
extern ITaskbarList3 * pTaskbarInterface;
diff --git a/src/core/stdidle/src/main.cpp b/src/core/stdidle/src/main.cpp
index 07ac3d6d36..fa6340963f 100644
--- a/src/core/stdidle/src/main.cpp
+++ b/src/core/stdidle/src/main.cpp
@@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadIdleModule(void);
void UnloadIdleModule(void);
+CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
-HINSTANCE hInst;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -41,12 +41,6 @@ PLUGININFOEX pluginInfo = {
{ 0x53ac190b, 0xe223, 0x4341, {0x82, 0x5f, 0x70, 0x9d, 0x85, 0x20, 0x21, 0x5b}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdidle/src/options.cpp b/src/core/stdidle/src/options.cpp
index 6fd0773192..6f8732223b 100644
--- a/src/core/stdidle/src/options.cpp
+++ b/src/core/stdidle/src/options.cpp
@@ -57,7 +57,7 @@ class COptionsDlg : public CPluginDlgBase
public:
COptionsDlg() :
- CPluginDlgBase(hInst, IDD_OPT_IDLE, IDLEMOD),
+ CPluginDlgBase(g_plugin.getInst(), IDD_OPT_IDLE, IDLEMOD),
edt1sttime(this, IDC_IDLE1STTIME),
spinIdle(this, IDC_IDLESPIN),
cmbAAStatus(this, IDC_AASTATUS),
diff --git a/src/core/stdidle/src/stdafx.h b/src/core/stdidle/src/stdafx.h
index 594499c890..5eff95b29b 100644
--- a/src/core/stdidle/src/stdafx.h
+++ b/src/core/stdidle/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_utils.h>
@@ -69,7 +67,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define IDLEMOD "Idle"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(IDLEMOD)
+ {}
+};
struct Settings
{
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index fd0bf8cf8a..06ca982f74 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -249,7 +249,7 @@ void Load_ChatModule()
oldDoTrayIcon = pci->DoTrayIcon; pci->DoTrayIcon = DoTrayIcon;
pci->ReloadSettings();
- g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
+ g_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENU));
HookEvent(ME_SYSTEM_MODULELOAD, OnCheckPlugins);
}
diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp
index 2764e3c528..6f9dcc88db 100644
--- a/src/core/stdmsg/src/chat_options.cpp
+++ b/src/core/stdmsg/src/chat_options.cpp
@@ -178,8 +178,8 @@ static IconItem iconList[] =
void AddIcons(void)
{
- Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group chats"), iconList, 21);
- Icon_Register(g_hInst, LPGEN("Messaging") "/" LPGEN("Group chats log"), iconList + 21, 14);
+ Icon_Register(g_plugin.getInst(), LPGEN("Messaging") "/" LPGEN("Group chats"), iconList, 21);
+ Icon_Register(g_plugin.getInst(), LPGEN("Messaging") "/" LPGEN("Group chats log"), iconList + 21, 14);
}
// load icons from the skinning module if available
@@ -332,7 +332,7 @@ class COptMainDlg : public CDlgBase
public:
COptMainDlg()
- : CDlgBase(g_hInst, IDD_OPTIONS1),
+ : CDlgBase(g_plugin.getInst(), IDD_OPTIONS1),
checkBoxes(this, IDC_CHECKBOXES)
{
checkBoxes.OnItemChanged = Callback(this, &COptMainDlg::onChange_Tree);
@@ -433,7 +433,7 @@ class COptLogDlg : public CDlgBase
public:
COptLogDlg() :
- CDlgBase(g_hInst, IDD_OPTIONS2),
+ CDlgBase(g_plugin.getInst(), IDD_OPTIONS2),
spin2(this, IDC_SPIN2),
spin3(this, IDC_SPIN3),
spin4(this, IDC_SPIN4),
@@ -596,7 +596,7 @@ class COptPopupDlg : public CDlgBase
public:
COptPopupDlg()
- : CDlgBase(g_hInst, IDD_OPTIONSPOPUP),
+ : CDlgBase(g_plugin.getInst(), IDD_OPTIONSPOPUP),
chkRadio1(this, IDC_RADIO1),
chkRadio2(this, IDC_RADIO2),
chkRadio3(this, IDC_RADIO3)
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 61600f5619..f6e101eb5f 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -258,7 +258,7 @@ void CChatRoomDlg::ScrollToBottom()
void CChatRoomDlg::ShowFilterMenu()
{
- HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)this);
+ HWND hwnd = CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_FILTER), m_hwnd, FilterWndProc, (LPARAM)this);
TranslateDialogDefault(hwnd);
RECT rc;
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp
index 4a3632a363..dd0ab36221 100644
--- a/src/core/stdmsg/src/globals.cpp
+++ b/src/core/stdmsg/src/globals.cpp
@@ -30,7 +30,7 @@ IconItem iconList[] =
static void InitIcons(void)
{
- Icon_Register(g_hInst, LPGEN("Messaging"), iconList, _countof(iconList), "SRMM");
+ Icon_Register(g_plugin.getInst(), LPGEN("Messaging"), iconList, _countof(iconList), "SRMM");
}
static int IconsChanged(WPARAM, LPARAM)
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index d1d63b4562..4750710aaf 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -852,7 +852,7 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam)
mwpd.hContact = m_hContact;
mwpd.hwnd = m_message.GetHwnd();
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
mwpd.hMenu = GetSubMenu(hMenu, 1);
TranslateMenu(mwpd.hMenu);
@@ -1335,7 +1335,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_RBUTTONUP:
CHARRANGE all = { 0, -1 };
- HMENU hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_CONTEXT));
HMENU hSubMenu = GetSubMenu(hMenu, 0);
TranslateMenu(hSubMenu);
SendMessage(((NMHDR *)lParam)->hwndFrom, EM_EXGETSEL, 0, (LPARAM)&sel);
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 6c62b74d07..101c07cf46 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -193,7 +193,7 @@ class COptionMainDlg : public CPluginDlgBase
public:
COptionMainDlg() :
- CPluginDlgBase(g_hInst, IDD_OPT_MSGDLG, SRMMMOD),
+ CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGDLG, SRMMMOD),
tree(this, IDC_POPLIST),
edtSecs(this, IDC_SECONDS),
edtNFlash(this, IDC_NFLASHES),
@@ -315,7 +315,7 @@ class COptionLogDlg : public CPluginDlgBase
public:
COptionLogDlg() :
- CPluginDlgBase(g_hInst, IDD_OPT_MSGLOG, SRMMMOD),
+ CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGLOG, SRMMMOD),
chkSecs(this, IDC_SHOWSECS),
chkDate(this, IDC_SHOWDATES),
chkTime(this, IDC_SHOWTIMES),
@@ -418,7 +418,7 @@ class COptionTypingDlg : public CPluginDlgBase
public:
COptionTypingDlg() :
- CPluginDlgBase(g_hInst, IDD_OPT_MSGTYPE, SRMMMOD),
+ CPluginDlgBase(g_plugin.getInst(), IDD_OPT_MSGTYPE, SRMMMOD),
clist(this, IDC_CLIST),
chkType(this, IDC_SHOWNOTIFY),
chkTypeWin(this, IDC_TYPEWIN),
@@ -529,7 +529,7 @@ class COptionsTabDlg : public CDlgBase
public:
COptionsTabDlg() :
- CDlgBase(g_hInst, IDD_OPT_TABS),
+ CDlgBase(g_plugin.getInst(), IDD_OPT_TABS),
m_chkTabs(this, IDC_USETABS),
m_chkTabsBottom(this, IDC_TABSBOTTOM),
m_chkTabsClose(this, IDC_CLOSETABS),
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index a95501bf69..9b9ad4fe75 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
CMsgDialog::CMsgDialog(int iDialogId, SESSION_INFO *si)
- : CSuper(g_hInst, iDialogId, si),
+ : CSuper(g_plugin.getInst(), iDialogId, si),
m_btnOk(this, IDOK)
{
m_autoClose = 0;
diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp
index dd63373531..6175957d49 100644
--- a/src/core/stdmsg/src/msgtimedout.cpp
+++ b/src/core/stdmsg/src/msgtimedout.cpp
@@ -96,5 +96,5 @@ void MessageFailureProcess(TMsgQueue *item, const char* err)
Skin_PlaySound("SendError");
ErrorDlgParam param = { err, item };
- CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGSENDERROR), hwnd, ErrorDlgProc, (LPARAM)&param);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGSENDERROR), hwnd, ErrorDlgProc, (LPARAM)&param);
}
diff --git a/src/core/stdmsg/src/srmm.cpp b/src/core/stdmsg/src/srmm.cpp
index 1c4dd443e0..6d283102d6 100644
--- a/src/core/stdmsg/src/srmm.cpp
+++ b/src/core/stdmsg/src/srmm.cpp
@@ -24,8 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int LoadSendRecvMessageModule(void);
void SplitmsgShutdown(void);
+CMPlugin g_plugin;
+
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInst;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -40,12 +41,6 @@ PLUGININFOEX pluginInfo = {
{ 0x657fe89b, 0xd121, 0x40c2, { 0x8a, 0xc9, 0xb9, 0xfa, 0x57, 0x55, 0xb3, 0x0D } } //{657FE89B-D121-40c2-8AC9-B9FA5755B30D}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index e477a56005..8654d9153d 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "resource.h"
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <newpluginapi.h>
#include <m_system.h>
#include <m_database.h>
@@ -94,8 +92,6 @@ struct LOGSTREAMDATA : public GCLogStreamDataBase {};
#define GC_TABCHANGE (WM_USER+0x105)
#define GC_SWITCHTAB (WM_USER+0x106)
-extern HINSTANCE g_hInst;
-
/////////////////////////////////////////////////////////////////////////////////////////
struct GlobalLogSettings : public GlobalLogSettingsBase
@@ -110,10 +106,18 @@ struct GlobalLogSettings : public GlobalLogSettingsBase
/////////////////////////////////////////////////////////////////////////////////////////
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(SRMMMOD)
+ {}
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern GlobalLogSettings g_Settings;
extern HMENU g_hMenu;
-extern HINSTANCE g_hInst;
extern BOOL SmileyAddInstalled, PopupInstalled;
// main.cpp
diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp
index f185a1de1f..234ff9a657 100644
--- a/src/core/stdmsg/src/tabs.cpp
+++ b/src/core/stdmsg/src/tabs.cpp
@@ -163,7 +163,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
/////////////////////////////////////////////////////////////////////////////////////////
CTabbedWindow::CTabbedWindow() :
- CDlgBase(g_hInst, IDD_CONTAINER),
+ CDlgBase(g_plugin.getInst(), IDD_CONTAINER),
m_tab(this, IDC_TAB)
{
}
@@ -173,7 +173,7 @@ void CTabbedWindow::OnInitDialog()
SetWindowLongPtr(m_tab.GetHwnd(), GWLP_USERDATA, LPARAM(this));
mir_subclassWindow(m_tab.GetHwnd(), ::TabSubclassProc);
- m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, WS_CHILD | WS_VISIBLE | SBT_TOOLTIPS | SBARS_SIZEGRIP, 0, 0, 0, 0, m_hwnd, nullptr, g_hInst, nullptr);
+ m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, WS_CHILD | WS_VISIBLE | SBT_TOOLTIPS | SBARS_SIZEGRIP, 0, 0, 0, 0, m_hwnd, nullptr, g_plugin.getInst(), nullptr);
SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
SetWindowPosition();
diff --git a/src/core/stdssl/src/main.cpp b/src/core/stdssl/src/main.cpp
index 5cde1cd401..6fb8898d70 100644
--- a/src/core/stdssl/src/main.cpp
+++ b/src/core/stdssl/src/main.cpp
@@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadSslModule(void);
void UnloadSslModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -40,12 +40,6 @@ PLUGININFOEX pluginInfo = {
{ 0x312C4F84, 0x75BE, 0x4404, {0xBC, 0xB1, 0xC1, 0x03, 0xDB, 0xE5, 0xA3, 0xB8 }}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stdssl/src/stdafx.h b/src/core/stdssl/src/stdafx.h
index ae3bbd4f13..6221d6c3b4 100644
--- a/src/core/stdssl/src/stdafx.h
+++ b/src/core/stdssl/src/stdafx.h
@@ -32,7 +32,6 @@ typedef struct SslHandle *HSSL;
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <newpluginapi.h>
#include <m_langpack.h>
#include <m_netlib.h>
@@ -41,4 +40,9 @@ typedef struct SslHandle *HSSL;
#include "version.h"
-extern HINSTANCE g_hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index fb94c7e26b..540aff5d08 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -236,7 +236,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
break;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HISTORY), HistoryDlgResizer);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_HISTORY), HistoryDlgResizer);
return TRUE;
case WM_COMMAND:
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
return TRUE;
case IDC_FIND:
- ShowWindow(CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY_FIND), hwndDlg, DlgProcHistoryFind, (LPARAM)hwndDlg), SW_SHOW);
+ ShowWindow(CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HISTORY_FIND), hwndDlg, DlgProcHistoryFind, (LPARAM)hwndDlg), SW_SHOW);
return TRUE;
case IDC_DELETEHISTORY:
@@ -370,7 +370,7 @@ static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM)
SetFocus(hwnd);
return 0;
}
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_HISTORY), NULL, DlgProcHistory, wParam);
return 0;
}
diff --git a/src/core/stduihist/src/main.cpp b/src/core/stduihist/src/main.cpp
index a598b630cc..c56c0bdabe 100644
--- a/src/core/stduihist/src/main.cpp
+++ b/src/core/stduihist/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadHistoryModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{ 0x5eedf3c5, 0x3071, 0x4234, {0xa6, 0x27, 0xef, 0xd0, 0x62, 0xa4, 0xd6, 0x94}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stduihist/src/stdafx.h b/src/core/stduihist/src/stdafx.h
index 7251d4ab74..c07a081180 100644
--- a/src/core/stduihist/src/stdafx.h
+++ b/src/core/stduihist/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -66,6 +64,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(nullptr)
+ {}
+};
#pragma comment(lib, "version.lib")
diff --git a/src/core/stduserinfo/src/contactinfo.cpp b/src/core/stduserinfo/src/contactinfo.cpp
index 41a5c6331e..bd99b262d7 100644
--- a/src/core/stduserinfo/src/contactinfo.cpp
+++ b/src/core/stduserinfo/src/contactinfo.cpp
@@ -301,7 +301,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
for (i = 0;; i++) {
lvi.lParam = i;
mir_snprintf(idstr, "Mye-mail%d", i);
- if (db_get_ws(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ws(hContact, MODULENAME, idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
@@ -362,7 +362,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
for (i = 0;; i++) {
lvi.lParam = i;
mir_snprintf(idstr, "MyPhone%d", i);
- if (db_get_ws(hContact, "UserInfo", idstr, &dbv))
+ if (db_get_ws(hContact, MODULENAME, idstr, &dbv))
break;
lvi.pszText = idstr2;
mir_snwprintf(idstr2, TranslateT("Custom %d"), i + 1);
@@ -472,14 +472,14 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// add
char szNewData[256] = "", idstr[33];
DBVARIANT dbv;
- if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szNewData))
+ if (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szNewData))
break;
for (i = 0;; i++) {
mir_snprintf(idstr, szIdTemplate, i);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
db_free(&dbv);
}
- db_set_s(hContact, "UserInfo", idstr, szNewData);
+ db_set_s(hContact, MODULENAME, idstr, szNewData);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
@@ -489,13 +489,13 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DBVARIANT dbv;
for (i = lvi.lParam;; i++) {
mir_snprintf(idstr, szIdTemplate, i + 1);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
mir_snprintf(idstr, szIdTemplate, i);
- db_set_s(hContact, "UserInfo", idstr, dbv.pszVal);
+ db_set_s(hContact, MODULENAME, idstr, dbv.pszVal);
db_free(&dbv);
}
mir_snprintf(idstr, szIdTemplate, i);
- db_unset(hContact, "UserInfo", idstr);
+ db_unset(hContact, MODULENAME, idstr);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
else if (hti.iSubItem - 2 == (nm->hdr.idFrom == IDC_PHONES)) {
@@ -503,12 +503,12 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
char szText[256], idstr[33];
DBVARIANT dbv;
mir_snprintf(idstr, szIdTemplate, lvi.lParam);
- if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
+ if (db_get_s(hContact, MODULENAME, idstr, &dbv)) break;
mir_strncpy(szText, dbv.pszVal, _countof(szText));
db_free(&dbv);
- if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szText))
+ if (IDOK != DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES ? IDD_ADDPHONE : IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES ? EditUserPhoneDlgProc : EditUserEmailDlgProc, (LPARAM)szText))
break;
- db_set_s(hContact, "UserInfo", idstr, szText);
+ db_set_s(hContact, MODULENAME, idstr, szText);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
}
}
diff --git a/src/core/stduserinfo/src/main.cpp b/src/core/stduserinfo/src/main.cpp
index 7e7551ee97..ac767568d5 100644
--- a/src/core/stduserinfo/src/main.cpp
+++ b/src/core/stduserinfo/src/main.cpp
@@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadUserInfoModule(void);
-HINSTANCE hInst;
+CMPlugin g_plugin;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -39,12 +39,6 @@ PLUGININFOEX pluginInfo = {
{ 0x8198dc94, 0xbc4, 0x448a, { 0x84, 0x95, 0x8f, 0xe8, 0x32, 0xc1, 0xd3, 0x33 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stduserinfo/src/stdafx.h b/src/core/stduserinfo/src/stdafx.h
index f91ec2e15f..814e260abb 100644
--- a/src/core/stduserinfo/src/stdafx.h
+++ b/src/core/stduserinfo/src/stdafx.h
@@ -41,9 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <m_core.h>
#include <newpluginapi.h>
@@ -68,4 +66,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define MODULENAME "UserInfo"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index f5eacac7a9..5892e57f6c 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
HFONT hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
- ptrW szNotes(db_get_wsa(lParam, "UserInfo", "MyNotes"));
+ ptrW szNotes(db_get_wsa(lParam, MODULENAME, "MyNotes"));
if (szNotes != nullptr)
SetDlgItemText(hwndDlg, IDC_MYNOTES, szNotes);
}
@@ -576,9 +576,9 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) {
char text[2048];
GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, _countof(text));
- db_set_s(hContact, "UserInfo", "MyNotes", text);
+ db_set_s(hContact, MODULENAME, "MyNotes", text);
}
- else db_unset(hContact, "UserInfo", "MyNotes");
+ else db_unset(hContact, MODULENAME, "MyNotes");
break;
}
break;
@@ -608,7 +608,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam)
return 0;
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pfnDlgProc = SummaryDlgProc;
odp.position = -2100000000;
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 83f50d9ef1..ab80204d29 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -118,7 +118,7 @@ static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM)
psh.pszCaption = (wchar_t*)wParam; //more abuses of structure: this is hContact
psh.ppsp = (PROPSHEETPAGE*)opi.odp; //blatent misuse of the structure, but what the hell
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_DETAILS), NULL, DlgProcDetails, (LPARAM)&psh);
for (int i = 0; i < opi.pageCount; i++) {
//cleanup moved to WM_DESTROY
if (opi.odp[i].szGroup.w != nullptr)
@@ -265,7 +265,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
LPTSTR ptszLastTab;
DBVARIANT dbv;
- if (!db_get_ws(NULL, "UserInfo", "LastTab", &dbv)) {
+ if (!db_get_ws(NULL, MODULENAME, "LastTab", &dbv)) {
ptszLastTab = NEWWSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
@@ -584,7 +584,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP
tvi.pszText = name;
tvi.cchTextMax = _countof(name);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_PAGETREE), &tvi);
- db_set_ws(NULL, "UserInfo", "LastTab", name);
+ db_set_ws(NULL, MODULENAME, "LastTab", name);
Window_FreeIcon_IcoLib(hwndDlg);
SendDlgItemMessage(hwndDlg, IDC_NAME, WM_SETFONT, SendDlgItemMessage(hwndDlg, IDC_WHITERECT, WM_GETFONT, 0, 0), 0);
diff --git a/src/core/stduseronline/src/main.cpp b/src/core/stduseronline/src/main.cpp
index 2d4a395103..3273f7f579 100644
--- a/src/core/stduseronline/src/main.cpp
+++ b/src/core/stduseronline/src/main.cpp
@@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadUserOnlineModule(void);
+CMPlugin g_plugin;
CLIST_INTERFACE* pcli;
-HINSTANCE hInst;
int hLangpack;
PLUGININFOEX pluginInfo = {
@@ -40,12 +40,6 @@ PLUGININFOEX pluginInfo = {
{ 0x251c78d7, 0xf6e0, 0x4083, {0x92, 0xdc, 0x25, 0x2d, 0xcb, 0x3b, 0xe7, 0x24}}
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
diff --git a/src/core/stduseronline/src/stdafx.h b/src/core/stduseronline/src/stdafx.h
index c29da6dc6f..9fae72e8ed 100644
--- a/src/core/stduseronline/src/stdafx.h
+++ b/src/core/stduseronline/src/stdafx.h
@@ -40,9 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <direct.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-
#include <m_system.h>
#include <newpluginapi.h>
#include <m_database.h>
@@ -66,4 +64,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../mir_app/src/resource.h"
-extern HINSTANCE hInst;
+#define MODULENAME "UserOnline"
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULENAME)
+ {}
+};
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp
index 148eada919..54063cb44c 100644
--- a/src/core/stduseronline/src/useronline.cpp
+++ b/src/core/stduseronline/src/useronline.cpp
@@ -33,23 +33,23 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
int newStatus = cws->value.wVal;
- int oldStatus = db_get_w(hContact, "UserOnline", "OldStatus", ID_STATUS_OFFLINE);
- db_set_w(hContact, "UserOnline", "OldStatus", (WORD)newStatus);
+ int oldStatus = db_get_w(hContact, MODULENAME, "OldStatus", ID_STATUS_OFFLINE);
+ db_set_w(hContact, MODULENAME, "OldStatus", (WORD)newStatus);
if (CallService(MS_IGNORE_ISIGNORED, hContact, IGNOREEVENT_USERONLINE)) return 0;
if (db_get_b(hContact, "CList", "Hidden", 0)) return 0;
if (newStatus == ID_STATUS_OFFLINE && oldStatus != ID_STATUS_OFFLINE) {
// Remove the event from the queue if it exists since they are now offline
- int lastEvent = (int)db_get_dw(hContact, "UserOnline", "LastEvent", 0);
+ int lastEvent = (int)db_get_dw(hContact, MODULENAME, "LastEvent", 0);
if (lastEvent) {
pcli->pfnRemoveEvent(hContact, lastEvent);
- db_set_dw(hContact, "UserOnline", "LastEvent", 0);
+ db_set_dw(hContact, MODULENAME, "LastEvent", 0);
}
}
if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) &&
oldStatus != ID_STATUS_ONLINE && oldStatus != ID_STATUS_FREECHAT) {
{
- DWORD ticked = db_get_dw(NULL, "UserOnline", cws->szModule, GetTickCount());
+ DWORD ticked = db_get_dw(NULL, MODULENAME, cws->szModule, GetTickCount());
// only play the sound (or show event) if this event happens at least 10 secs after the proto went from offline
if (GetTickCount() - ticked > (1000*10)) {
wchar_t tooltip[256];
@@ -64,8 +64,8 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam)
cle.szTooltip.w = tooltip;
pcli->pfnAddEvent(&cle);
IcoLib_ReleaseIcon(cle.hIcon, 0);
- db_set_dw(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent);
- Skin_PlaySound("UserOnline");
+ db_set_dw(cle.hContact, MODULENAME, "LastEvent", (DWORD)cle.hDbEvent);
+ Skin_PlaySound(MODULENAME);
}
}
}
@@ -77,7 +77,7 @@ static int UserOnlineAck(WPARAM, LPARAM lParam)
ACKDATA * ack = (ACKDATA*) lParam;
if (ack != nullptr && ack->szModule && ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS && ack->hProcess == (HANDLE)ID_STATUS_OFFLINE) {
// if going from offline to any other mode, remember when it happened.
- db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
+ db_set_dw(NULL, MODULENAME, ack->szModule, GetTickCount());
}
return 0;
}
@@ -86,7 +86,7 @@ static int UserOnlineModulesLoaded(WPARAM, LPARAM)
{
for (auto &pa : Accounts())
if (pa->IsEnabled())
- db_set_dw(NULL, "UserOnline", pa->szModuleName, GetTickCount());
+ db_set_dw(NULL, MODULENAME, pa->szModuleName, GetTickCount());
return 0;
}
@@ -100,7 +100,7 @@ static int UserOnlineAccountsChanged(WPARAM eventCode, LPARAM lParam)
case PRAC_CHECKED:
// reset the counter
if (pa->IsEnabled())
- db_set_dw(NULL, "UserOnline", pa->szModuleName, GetTickCount());
+ db_set_dw(NULL, MODULENAME, pa->szModuleName, GetTickCount());
break;
}
return 0;
@@ -112,6 +112,6 @@ int LoadUserOnlineModule(void)
HookEvent(ME_PROTO_ACK, UserOnlineAck);
HookEvent(ME_SYSTEM_MODULESLOADED, UserOnlineModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, UserOnlineAccountsChanged);
- Skin_AddSound("UserOnline", LPGENW("Alerts"), LPGENW("Online"));
+ Skin_AddSound(MODULENAME, LPGENW("Alerts"), LPGENW("Online"));
return 0;
}