summaryrefslogtreecommitdiff
path: root/plugins/NewAwaySysMod/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-17 20:51:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-17 20:51:37 +0300
commit7639f72273189df60566755c0d5f1e4ab7201b67 (patch)
tree94a51765449331befe968a90b48cbf08fa83e6ed /plugins/NewAwaySysMod/src
parent523f3588b6f21adcc4bcf3ec3ffad05e2298863a (diff)
NewAwaySys, NewEventNotify, NewXstatusNotify, NoHistory, NotesReminders, NotifyAnything, Nudge => CMPlugin
Diffstat (limited to 'plugins/NewAwaySysMod/src')
-rw-r--r--plugins/NewAwaySysMod/src/AwayOpt.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/AwaySys.cpp27
-rw-r--r--plugins/NewAwaySysMod/src/MsgTree.cpp4
-rw-r--r--plugins/NewAwaySysMod/src/ReadAwayMsg.cpp4
-rw-r--r--plugins/NewAwaySysMod/src/Services.cpp2
-rw-r--r--plugins/NewAwaySysMod/src/SetAwayMsg.cpp4
-rw-r--r--plugins/NewAwaySysMod/src/stdafx.h16
7 files changed, 31 insertions, 28 deletions
diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp
index 918589f4c1..731a5de605 100644
--- a/plugins/NewAwaySysMod/src/AwayOpt.cpp
+++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp
@@ -1020,7 +1020,7 @@ int OptsDlgInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE optDi = { sizeof(optDi) };
optDi.position = 920000000;
- optDi.hInstance = g_hInstance;
+ optDi.hInstance = g_plugin.getInst();
optDi.flags = ODPF_BOLDGROUPS;
optDi.szTitle.a = OPT_MAINGROUP;
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp
index a29cfd136d..14e0376802 100644
--- a/plugins/NewAwaySysMod/src/AwaySys.cpp
+++ b/plugins/NewAwaySysMod/src/AwaySys.cpp
@@ -41,9 +41,9 @@
#include "Services.h"
#include "version.h"
-HINSTANCE g_hInstance;
-
+CMPlugin g_plugin;
int hLangpack;
+
HANDLE g_hTopToolbarbutton;
HGENMENU g_hToggleSOEMenuItem, g_hToggleSOEContactMenuItem, g_hContactMenuItem, g_hReadStatMenuItem;
HGENMENU g_hAutoreplyOnContactMenuItem, g_hAutoreplyOffContactMenuItem, g_hAutoreplyUseDefaultContactMenuItem;
@@ -75,7 +75,10 @@ HICON GetIcon(int iconId, bool size)
return nullptr;
}
-PLUGININFOEX pluginInfo = {
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfo =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -87,14 +90,6 @@ PLUGININFOEX pluginInfo = {
{ 0xb2dd9270, 0xce5e, 0x11df, { 0xbd, 0x3d, 0x8, 0x0, 0x20, 0xc, 0x9a, 0x66 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- g_hInstance = hinstDLL;
- return TRUE;
-}
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRAWAY, MIID_LAST }; // TODO: add MIID_WHOISREADING here if there'll be any some time in future..
-
extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
@@ -102,6 +97,10 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
/////////////////////////////////////////////////////////////////////////////////////////
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRAWAY, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
TCString GetDynamicStatMsg(MCONTACT hContact, char *szProto, DWORD UIN, int iStatus)
{
// hContact is the contact that requests the status message
@@ -260,7 +259,7 @@ int StatusChanged(WPARAM wParam, LPARAM lParam)
memset(dat, 0, sizeof(SetAwayMsgData));
dat->szProtocol = (char*)lParam;
dat->IsModeless = false;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
}
return 0;
}
@@ -378,7 +377,7 @@ static INT_PTR SetContactStatMsg(WPARAM hContact, LPARAM)
dat->hInitContact = hContact;
dat->szProtocol = GetContactProto(hContact);
dat->IsModeless = false;
- DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
+ DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
return 0;
}
@@ -710,7 +709,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_MODULESLOADED, MirandaLoaded);
- Icon_Register(g_hInstance, MOD_NAME, iconList, _countof(iconList), "nas");
+ Icon_Register(g_plugin.getInst(), MOD_NAME, iconList, _countof(iconList), "nas");
InitCommonControls();
InitOptions(); // must be called before we hook CallService
diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp
index 647f6bbff4..891789651e 100644
--- a/plugins/NewAwaySysMod/src/MsgTree.cpp
+++ b/plugins/NewAwaySysMod/src/MsgTree.cpp
@@ -369,9 +369,9 @@ LRESULT CALLBACK MsgTreeSubclassProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
if (Order >= 0) {
HMENU hMenu;
if (TreeCtrl->m_value[Order].Flags & TIF_GROUP)
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_MSGTREE_CATEGORYMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MSGTREE_CATEGORYMENU));
else
- hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_MSGTREE_MESSAGEMENU));
+ hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MSGTREE_MESSAGEMENU));
_ASSERT(hMenu);
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
index c65196fc67..45ae7c6dce 100644
--- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp
@@ -110,7 +110,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_READAWAYMSG), ReadAwayMsgDlgResize);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_READAWAYMSG), ReadAwayMsgDlgResize);
break;
case WM_CLOSE:
@@ -135,6 +135,6 @@ INT_PTR GetContactStatMsg(WPARAM wParam, LPARAM)
if (HWND hWnd = WindowList_Find(g_hReadWndList, wParam)) // already have it
SetForegroundWindow(hWnd);
else
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_READAWAYMSG), nullptr, ReadAwayMsgDlgProc, wParam);
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_READAWAYMSG), nullptr, ReadAwayMsgDlgProc, wParam);
return 0;
}
diff --git a/plugins/NewAwaySysMod/src/Services.cpp b/plugins/NewAwaySysMod/src/Services.cpp
index c807905c73..1300c7c556 100644
--- a/plugins/NewAwaySysMod/src/Services.cpp
+++ b/plugins/NewAwaySysMod/src/Services.cpp
@@ -182,5 +182,5 @@ INT_PTR InvokeStatusWindow(WPARAM wParam, LPARAM)
dat->IsModeless = true;
if (iswi->cbSize > sizeof(NAS_ISWINFOv1))
dat->ISW_Flags = iswi->Flags;
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SETAWAYMSG), nullptr, SetAwayMsgDlgProc, (LPARAM)dat);
}
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
index 1d9f70b544..88fb5f0dcd 100644
--- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
+++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp
@@ -1048,7 +1048,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
case IDC_SAWAYMSG_OPTIONS:
{
- HMENU hMenu = LoadMenu(g_hInstance, MAKEINTRESOURCE(IDR_SAM_OPTIONS));
+ HMENU hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SAM_OPTIONS));
_ASSERT(hMenu);
HMENU hPopupMenu = GetSubMenu(hMenu, 0);
TranslateMenu(hPopupMenu);
@@ -1254,7 +1254,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
return true;
case WM_SIZE:
- Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_SETAWAYMSG), SetAwayMsgDlgResize, (LPARAM)&g_SetAwayMsgPage);
+ Utils_ResizeDialog(hwndDlg, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_SETAWAYMSG), SetAwayMsgDlgResize, (LPARAM)&g_SetAwayMsgPage);
// means that we sent WM_SIZE message to apply new settings to the dialog; probably it's somewhat a misuse, but who cares ;-P
if (!wParam && !lParam) {
diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h
index c31cad6418..991bd0aa23 100644
--- a/plugins/NewAwaySysMod/src/stdafx.h
+++ b/plugins/NewAwaySysMod/src/stdafx.h
@@ -36,8 +36,6 @@
#include <crtdbg.h>
#include <stdarg.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include "newpluginapi.h"
#include "m_clist.h"
#include "m_system.h"
@@ -221,6 +219,15 @@ int ICQStatusToGeneralStatus(int bICQStat); // TODO: get rid of these protocol-s
#define MS_AWAYSYS_SETSTATUSMODE "AwaySys/SetStatusMode" // change the status mode. wParam is new mode, lParam is new status message (AwaySys will interpret variables out of it), may be NULL.
#define MS_AWAYSYS_IGNORENEXT "AwaySys/IgnoreNextStatusChange" //ignore nest status change
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MOD_NAME)
+ {}
+};
+
struct SetAwayMsgData
{
CString szProtocol;
@@ -272,7 +279,6 @@ extern COptPage g_AutoreplyOptPage;
extern COptPage g_MoreOptPage;
extern COptPage g_SetAwayMsgPage;
-extern HINSTANCE g_hInstance;
extern int g_Messages_RecentRootID, g_Messages_PredefinedRootID;
extern VAR_PARSE_DATA VarParseData;
extern bool g_fNoProcessing;
@@ -304,8 +310,6 @@ void ShowLog(TCString &LogFilePath);
void ShowMsg(wchar_t *szFirstLine, wchar_t *szSecondLine = L"", bool IsErrorMsg = false, int Timeout = 0);
#define AWAYSYS_STATUSMSGREQUEST_SOUND "AwaySysStatusMsgRequest"
-#define ME_AWAYSYS_WORKAROUND "AwaySys/_CallService"
-int _Workaround_CallService(const char *name, WPARAM wParam, LPARAM lParam);
// MsgEventAdded.cpp
int MsgEventAdded(WPARAM wParam, LPARAM lParam);
@@ -343,4 +347,4 @@ static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags
//icons
extern IconItem iconList[];
-HICON GetIcon(int iconId, bool size = false); \ No newline at end of file
+HICON GetIcon(int iconId, bool size = false);