summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r--plugins/StatusManager/src/aaa_options.cpp9
-rw-r--r--plugins/StatusManager/src/advancedautoaway.cpp8
-rw-r--r--plugins/StatusManager/src/keepstatus.cpp88
-rw-r--r--plugins/StatusManager/src/ks_options.cpp8
-rw-r--r--plugins/StatusManager/src/main.cpp6
-rw-r--r--plugins/StatusManager/src/options.cpp3
-rw-r--r--plugins/StatusManager/src/ss_options.cpp5
-rw-r--r--plugins/StatusManager/src/ss_profiles.cpp2
-rw-r--r--plugins/StatusManager/src/startupstatus.cpp6
-rw-r--r--plugins/StatusManager/src/stdafx.h8
10 files changed, 72 insertions, 71 deletions
diff --git a/plugins/StatusManager/src/aaa_options.cpp b/plugins/StatusManager/src/aaa_options.cpp
index 153b1656f7..934e550227 100644
--- a/plugins/StatusManager/src/aaa_options.cpp
+++ b/plugins/StatusManager/src/aaa_options.cpp
@@ -600,9 +600,8 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
int AutoAwayOptInitialise(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
+ OPTIONSDIALOGPAGE odp = {};
odp.position = 1000000000;
- odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Auto away");
@@ -610,16 +609,16 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM)
odp.szTab.a = LPGEN("General");
odp.pfnDlgProc = DlgProcAutoAwayGeneralOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GENAUTOAWAY);
- Options_AddPage(wParam, &odp, AAALangPack);
+ Options_AddPage(wParam, &odp, &AAAPlugin);
odp.szTab.a = LPGEN("Rules");
odp.pfnDlgProc = DlgProcAutoAwayRulesOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTOAWAY);
- Options_AddPage(wParam, &odp, AAALangPack);
+ Options_AddPage(wParam, &odp, &AAAPlugin);
odp.szTab.a = LPGEN("Status messages");
odp.pfnDlgProc = DlgProcAutoAwayMsgOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_AUTOAWAYMSG);
- Options_AddPage(wParam, &odp, AAALangPack);
+ Options_AddPage(wParam, &odp, &AAAPlugin);
return 0;
}
diff --git a/plugins/StatusManager/src/advancedautoaway.cpp b/plugins/StatusManager/src/advancedautoaway.cpp
index 8f37e7d596..b3a9d10c75 100644
--- a/plugins/StatusManager/src/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/advancedautoaway.cpp
@@ -30,7 +30,7 @@
/////////////////////////////////////////////////////////////////////////////////////////
-int AAALangPack;
+CFakePlugin AAAPlugin(AAAMODULENAME);
static HANDLE hEvents[3];
@@ -517,9 +517,7 @@ static int AAAModuleLoaded(WPARAM, LPARAM)
void AdvancedAutoAwayLoad()
{
- AAALangPack = GetPluginLangId(MIID_LAST, 0);
-
- g_bAAASettingSame = db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0);
+ g_bAAASettingSame = AAAPlugin.getByte(SETTING_SAMESETTINGS);
if (g_bMirandaLoaded)
AAAModuleLoaded(0, 0);
@@ -532,7 +530,7 @@ void AdvancedAutoAwayUnload()
if (g_bMirandaLoaded)
AutoAwayShutdown(0, 0);
- KillModuleOptions(AAALangPack);
+ KillModuleOptions(&AAAPlugin);
for (auto &it : hEvents) {
UnhookEvent(it);
diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp
index cbb52e8777..2fd5caf039 100644
--- a/plugins/StatusManager/src/keepstatus.cpp
+++ b/plugins/StatusManager/src/keepstatus.cpp
@@ -19,7 +19,7 @@
#include "stdafx.h"
-int KSLangPack;
+CFakePlugin KSPlugin(KSMODULENAME);
static HANDLE hConnectionEvent = nullptr;
static HANDLE hServices[4], hEvents[2];
@@ -93,18 +93,18 @@ int KSLoadOptions()
{
KSUnloadOptions();
- if (db_get_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, FALSE)) {
- if (db_get_b(0, KSMODULENAME, SETTING_CONTCHECK, FALSE)) {
- if (db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE)) {
+ if (KSPlugin.getByte(SETTING_CHECKCONNECTION, FALSE)) {
+ if (KSPlugin.getByte(SETTING_CONTCHECK, FALSE)) {
+ if (KSPlugin.getByte(SETTING_BYPING, FALSE)) {
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
}
StartTimer(IDT_CHECKCONTIN, 0, FALSE);
}
- increaseExponential = db_get_b(0, KSMODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE);
- currentDelay = initDelay = 1000 * db_get_dw(0, KSMODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY);
- maxDelay = 1000 * db_get_dw(0, KSMODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY);
- maxRetries = db_get_b(0, KSMODULENAME, SETTING_MAXRETRIES, 0);
+ increaseExponential = KSPlugin.getByte(SETTING_INCREASEEXPONENTIAL, FALSE);
+ currentDelay = initDelay = 1000 * KSPlugin.getDword(SETTING_INITDELAY, DEFAULT_INITDELAY);
+ maxDelay = 1000 * KSPlugin.getDword(SETTING_MAXDELAY, DEFAULT_MAXDELAY);
+ maxRetries = KSPlugin.getByte(SETTING_MAXRETRIES, 0);
if (maxRetries == 0)
maxRetries = -1;
hProtoAckHook = HookEvent(ME_PROTO_ACK, ProcessProtoAck);
@@ -112,7 +112,7 @@ int KSLoadOptions()
if (ServiceExists(ME_CS_STATUSCHANGE))
hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGE, CSStatusChange);
hCSStatusChangeExHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx);
- if (db_get_b(0, KSMODULENAME, SETTING_CHECKAPMRESUME, 0)) {
+ if (KSPlugin.getByte(SETTING_CHECKAPMRESUME, 0)) {
if (!IsWindow(hMessageWindow)) {
hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
@@ -132,7 +132,7 @@ int SMProto::AssignStatus(int iStatus, int iLastStatus, wchar_t *pwszMsg)
return -1;
if (iStatus != ID_STATUS_OFFLINE && m_status == ID_STATUS_DISABLED)
return -2;
- if (!db_get_b(0, KSMODULENAME, SETTING_NOLOCKED, 0) && Proto_GetAccount(m_szName)->IsLocked())
+ if (!KSPlugin.getByte(SETTING_NOLOCKED, 0) && Proto_GetAccount(m_szName)->IsLocked())
return -3;
mir_cslock lck(GenStatusCS);
@@ -140,7 +140,7 @@ int SMProto::AssignStatus(int iStatus, int iLastStatus, wchar_t *pwszMsg)
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", m_szName);
m_lastStatus = (iLastStatus == 0) ? m_status : iLastStatus;
- if (!db_get_b(0, KSMODULENAME, dbSetting, 1))
+ if (!KSPlugin.getByte(dbSetting, 1))
m_status = ID_STATUS_DISABLED;
else if (iStatus == ID_STATUS_LAST)
m_status = m_lastStatus;
@@ -192,7 +192,7 @@ static int SetCurrentStatus()
log_infoA("KeepStatus: status for %s differs: stored = %d, real = %d", p->m_szName, curStatus, realStatus);
// force offline before reconnecting?
- if (realStatus != ID_STATUS_OFFLINE && db_get_b(0, KSMODULENAME, SETTING_FIRSTOFFLINE, FALSE)) {
+ if (realStatus != ID_STATUS_OFFLINE && KSPlugin.getByte(SETTING_FIRSTOFFLINE, FALSE)) {
log_infoA("KeepStatus: Setting %s offline before making a new connection attempt", p->m_szName);
CallProtoService(p->m_szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
}
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK StartTimerApcProc(void *param)
KillTimer(nullptr, checkContinTimerId);
if (ti->timeout == 0)
- ti->timeout = 1000 * db_get_dw(0, KSMODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY);
+ ti->timeout = 1000 * KSPlugin.getDword(SETTING_CNTDELAY, CHECKCONTIN_DELAY);
checkContinTimerId = SetTimer(nullptr, 0, ti->timeout, CheckContinueslyTimer);
}
}
@@ -434,7 +434,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", ack->szModule);
- if (!db_get_b(0, KSMODULENAME, dbSetting, 1))
+ if (!KSPlugin.getByte(dbSetting, 1))
return 0;
if (ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS) {
@@ -451,7 +451,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
for (auto &it : protoList) {
if (!mir_strcmp(ack->szModule, it->m_szName)) {
it->AssignStatus(ID_STATUS_OFFLINE);
- if (db_get_b(0, KSMODULENAME, SETTING_CNCOTHERLOC, 0)) {
+ if (KSPlugin.getByte(SETTING_CNCOTHERLOC, 0)) {
StopTimer(IDT_PROCESSACK);
for (auto &jt : protoList)
jt->AssignStatus(ID_STATUS_OFFLINE);
@@ -466,7 +466,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
// login failed
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
- switch (db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)) {
+ switch (KSPlugin.getByte(SETTING_LOGINERR, LOGINERR_NOTHING)) {
case LOGINERR_CANCEL:
log_infoA("KeepStatus: cancel on login error (%s)", ack->szModule);
for (auto &it : protoList)
@@ -479,7 +479,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
case LOGINERR_SETDELAY:
{
- int newDelay = 1000 * db_get_dw(0, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
+ int newDelay = 1000 * KSPlugin.getDword(SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
log_infoA("KeepStatus: set delay to %d ms on login error (%s)", newDelay, ack->szModule);
StartTimer(IDT_CHECKCONN, newDelay, TRUE);
}
@@ -504,7 +504,7 @@ static VOID CALLBACK CheckConnectingTimer(HWND, UINT, UINT_PTR, DWORD)
for (auto &it : protoList) {
int curStatus = it->GetStatus();
if (IsStatusConnecting(curStatus)) { // connecting
- int maxConnectingTime = db_get_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0);
+ int maxConnectingTime = KSPlugin.getDword(SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0) {
if ((unsigned int)maxConnectingTime <= ((GetTickCount() - it->lastStatusAckTime) / 1000)) {
// set offline
@@ -529,7 +529,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD)
continue;
if (IsStatusConnecting(newStatus)) { // connecting
- int maxConnectingTime = db_get_dw(0, KSMODULENAME, SETTING_MAXCONNECTINGTIME, 0);
+ int maxConnectingTime = KSPlugin.getDword(SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0)
StartTimer(IDT_CHECKCONNECTING, (maxConnectingTime * 1000 - (GetTickCount() - it->lastStatusAckTime)), FALSE);
}
@@ -575,7 +575,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND, UINT, UINT_PTR, DWORD)
if (increaseExponential)
currentDelay = min(2 * currentDelay, maxDelay);
- if (((db_get_b(0, KSMODULENAME, SETTING_CHKINET, 0)) && (!InternetGetConnectedState(nullptr, 0))) || ((db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
+ if (((KSPlugin.getByte(SETTING_CHKINET, 0)) && (!InternetGetConnectedState(nullptr, 0))) || ((KSPlugin.getByte(SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
// no network
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRYNOCONN, (LPARAM)retryCount + 1);
ProcessPopup(KS_CONN_STATE_RETRYNOCONN, 0);
@@ -670,7 +670,7 @@ static void CheckContinuouslyFunction(void *)
return;
}
- BOOL ping = db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE);
+ BOOL ping = KSPlugin.getByte(SETTING_BYPING, FALSE);
if (ping) {
DBVARIANT dbv;
if (db_get(0, KSMODULENAME, SETTING_PINGHOST, &dbv))
@@ -748,7 +748,7 @@ static void CheckContinuouslyFunction(void *)
log_infoA("KeepStatus: connection lost! (continuesly check)");
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOST, 0);
ProcessPopup(KS_CONN_STATE_LOST, 0);
- maxRetries = db_get_b(0, KSMODULENAME, SETTING_MAXRETRIES, 0);
+ maxRetries = KSPlugin.getByte(SETTING_MAXRETRIES, 0);
if (maxRetries == 0)
maxRetries = -1;
StartTimer(IDT_CHECKCONN, initDelay, FALSE);
@@ -757,7 +757,7 @@ static void CheckContinuouslyFunction(void *)
static VOID CALLBACK CheckContinueslyTimer(HWND, UINT, UINT_PTR, DWORD)
{
- if (db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE))
+ if (KSPlugin.getByte(SETTING_BYPING, FALSE))
mir_forkthread(CheckContinuouslyFunction);
else
CheckContinuouslyFunction(nullptr);
@@ -772,19 +772,19 @@ static INT_PTR ShowPopup(const wchar_t *msg, HICON hIcon)
ppd.lchIcon = hIcon;
wcsncpy(ppd.lptzContactName, TranslateT("Keep status"), MAX_CONTACTNAME);
wcsncpy(ppd.lptzText, msg, MAX_SECONDLINE);
- if (db_get_b(0, KSMODULENAME, SETTING_POPUP_USEWINCOLORS, 0)) {
+ if (KSPlugin.getByte(SETTING_POPUP_USEWINCOLORS, 0)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- else if (!db_get_b(0, KSMODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) {
- ppd.colorBack = db_get_dw(0, KSMODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
- ppd.colorText = db_get_dw(0, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC);
+ else if (!KSPlugin.getByte(SETTING_POPUP_USEDEFCOLORS, 0)) {
+ ppd.colorBack = KSPlugin.getDword(SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
+ ppd.colorText = KSPlugin.getDword(SETTING_POPUP_TEXTCOLOR, 0x0000CC);
}
ppd.PluginWindowProc = KSPopupDlgProc;
- switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
+ switch (KSPlugin.getByte(SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
- ppd.iSeconds = (int)db_get_dw(0, KSMODULENAME, SETTING_POPUP_TIMEOUT, 0);
+ ppd.iSeconds = (int)KSPlugin.getDword(SETTING_POPUP_TIMEOUT, 0);
if (ppd.iSeconds == 0)
ppd.iSeconds = currentDelay / 1000 - 1;
break;
@@ -809,7 +809,7 @@ static wchar_t* GetHumanName(LPARAM lParam)
static int ProcessPopup(int reason, LPARAM lParam)
{
- if (!db_get_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPT))
+ if (!KSPlugin.getByte(SETTING_SHOWCONNECTIONPOPUPS, FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPT))
return -1;
HICON hIcon = nullptr;
@@ -817,7 +817,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
switch (reason) {
case KS_CONN_STATE_OTHERLOCATION: // lParam = 1 proto
- if (!db_get_b(0, KSMODULENAME, SETTING_PUOTHER, TRUE))
+ if (!KSPlugin.getByte(SETTING_PUOTHER, TRUE))
return -1;
hIcon = Skin_LoadProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
@@ -825,20 +825,20 @@ static int ProcessPopup(int reason, LPARAM lParam)
break;
case KS_CONN_STATE_LOGINERROR: // lParam = 1 proto
- if (!db_get_b(0, KSMODULENAME, SETTING_PUOTHER, TRUE))
+ if (!KSPlugin.getByte(SETTING_PUOTHER, TRUE))
return -1;
hIcon = Skin_LoadProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
- if (db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
+ if (KSPlugin.getByte(SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
wszText.Format(TranslateT("%s login error, cancel reconnecting"), GetHumanName(lParam));
- else if (db_get_b(0, KSMODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
- wszText.Format(TranslateT("%s login error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, db_get_dw(0, KSMODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
+ else if (KSPlugin.getByte(SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
+ wszText.Format(TranslateT("%s login error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount + 1, KSPlugin.getDword(SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
else
return -1;
break;
case KS_CONN_STATE_LOST: // lParam = 1 proto, or nullptr
- if (!db_get_b(0, KSMODULENAME, SETTING_PUCONNLOST, TRUE))
+ if (!KSPlugin.getByte(SETTING_PUCONNLOST, TRUE))
return -1;
if (lParam) { // указатель на имя модуля.
@@ -849,7 +849,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
break;
case KS_CONN_STATE_RETRY: // lParam = PROTOCOLSETTINGEX**
- if (!db_get_b(0, KSMODULENAME, SETTING_PUCONNRETRY, TRUE))
+ if (!KSPlugin.getByte(SETTING_PUCONNRETRY, TRUE))
return -1;
if (lParam) {
@@ -866,7 +866,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
continue;
if (mir_wstrlen(p->m_tszAccName) > 0)
- if (db_get_b(0, KSMODULENAME, SETTING_PUSHOWEXTRA, TRUE))
+ if (KSPlugin.getByte(SETTING_PUSHOWEXTRA, TRUE))
wszText.AppendFormat(TranslateT("%s\t(will be set to %s)\r\n"), p->m_tszAccName, Clist_GetStatusModeDescription(p->m_status, 0));
}
@@ -876,7 +876,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
break;
case KS_CONN_STATE_RETRYNOCONN: // lParam = nullptr
- if (!db_get_b(0, KSMODULENAME, SETTING_PUOTHER, TRUE))
+ if (!KSPlugin.getByte(SETTING_PUOTHER, TRUE))
return -1;
if (retryCount == maxRetries - 1)
@@ -886,7 +886,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
break;
case KS_CONN_STATE_STOPPEDCHECKING: // lParam == BOOL succes
- if (!db_get_b(0, KSMODULENAME, SETTING_PURESULT, TRUE))
+ if (!KSPlugin.getByte(SETTING_PURESULT, TRUE))
return -1;
if (lParam) {
@@ -946,7 +946,7 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam)
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", szProto);
- if (!db_get_b(0, KSMODULENAME, dbSetting, 1)) // 'hard' disabled
+ if (!KSPlugin.getByte(dbSetting, 1)) // 'hard' disabled
return -1;
int ret = -2;
@@ -970,7 +970,7 @@ INT_PTR IsProtocolEnabledService(WPARAM, LPARAM lParam)
char dbSetting[128];
mir_snprintf(dbSetting, "%s_enabled", szProto);
- if (!db_get_b(0, KSMODULENAME, dbSetting, 1))
+ if (!KSPlugin.getByte(dbSetting, 1))
return FALSE;
for (auto &it : protoList)
@@ -1066,8 +1066,6 @@ int KSModuleLoaded(WPARAM, LPARAM)
void KeepStatusLoad()
{
- KSLangPack = GetPluginLangId(MIID_LAST, 0);
-
if (g_bMirandaLoaded)
KSModuleLoaded(0, 0);
else
@@ -1086,7 +1084,7 @@ void KeepStatusUnload()
if (g_bMirandaLoaded)
onShutdown(0, 0);
- KillModuleOptions(KSLangPack);
+ KillModuleOptions(&KSPlugin);
for (auto &it : hServices) {
DestroyServiceFunction(it);
diff --git a/plugins/StatusManager/src/ks_options.cpp b/plugins/StatusManager/src/ks_options.cpp
index 11428347db..00fb0ac893 100644
--- a/plugins/StatusManager/src/ks_options.cpp
+++ b/plugins/StatusManager/src/ks_options.cpp
@@ -457,7 +457,6 @@ static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Keep status");
odp.flags = ODPF_BOLDGROUPS;
@@ -465,23 +464,22 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
odp.szTab.a = LPGEN("Basic");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_BASIC);
odp.pfnDlgProc = DlgProcKSBasicOpts;
- Options_AddPage(wparam, &odp, KSLangPack);
+ KSPlugin.addOptions(wparam, &odp);
odp.szTab.a = LPGEN("Advanced");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_ADV);
odp.pfnDlgProc = DlgProcKSAdvOpts;
- Options_AddPage(wparam, &odp, KSLangPack);
+ KSPlugin.addOptions(wparam, &odp);
if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
memset(&odp, 0, sizeof(odp));
odp.position = 150000000;
odp.szGroup.a = LPGEN("Popups");
- odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS);
odp.szTitle.a = LPGEN("Keep status");
odp.pfnDlgProc = PopupOptDlgProc;
odp.flags = ODPF_BOLDGROUPS;
- Options_AddPage(wparam, &odp, KSLangPack);
+ KSPlugin.addOptions(wparam, &odp);
}
return 0;
}
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp
index 14116c9033..597d155589 100644
--- a/plugins/StatusManager/src/main.cpp
+++ b/plugins/StatusManager/src/main.cpp
@@ -41,6 +41,12 @@ CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
{}
+CFakePlugin::CFakePlugin(const char *szModuleName) :
+ CMPluginBase(szModuleName, pluginInfoEx)
+{
+ m_hInst = g_plugin.getInst();
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// interfaces
diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp
index b2b28b0d81..ee375493df 100644
--- a/plugins/StatusManager/src/options.cpp
+++ b/plugins/StatusManager/src/options.cpp
@@ -55,8 +55,7 @@ public:
int OnCommonOptionsInit(WPARAM wParam, LPARAM)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = g_plugin.getInst();
+ OPTIONSDIALOGPAGE odp = {};
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
odp.szGroup.w = LPGENW("Status");
odp.szTitle.w = LPGENW("Status manager");
diff --git a/plugins/StatusManager/src/ss_options.cpp b/plugins/StatusManager/src/ss_options.cpp
index 833c6dd5f4..5c3a3b0d3f 100644
--- a/plugins/StatusManager/src/ss_options.cpp
+++ b/plugins/StatusManager/src/ss_options.cpp
@@ -895,17 +895,16 @@ public:
int StartupStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
- odp.hInstance = g_plugin.getInst();
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Startup status");
odp.flags = ODPF_BOLDGROUPS;
odp.szTab.a = LPGEN("General");
odp.pDialog = new CSSMainOptDlg();
- Options_AddPage(wparam, &odp, SSLangPack);
+ SSPlugin.addOptions(wparam, &odp);
odp.szTab.a = LPGEN("Status profiles");
odp.pDialog = new CSSAdvancedOptDlg();
- Options_AddPage(wparam, &odp, SSLangPack);
+ SSPlugin.addOptions(wparam, &odp);
return 0;
}
diff --git a/plugins/StatusManager/src/ss_profiles.cpp b/plugins/StatusManager/src/ss_profiles.cpp
index 2898136d83..c6082e3479 100644
--- a/plugins/StatusManager/src/ss_profiles.cpp
+++ b/plugins/StatusManager/src/ss_profiles.cpp
@@ -57,7 +57,7 @@ static INT_PTR profileService(WPARAM, LPARAM, LPARAM param)
static int CreateMainMenuItems(WPARAM, LPARAM)
{
- CMenuItem mi(g_plugin);
+ CMenuItem mi(&g_plugin);
mi.position = 2000100000;
mi.flags = CMIF_UNICODE;
mcount = 0;
diff --git a/plugins/StatusManager/src/startupstatus.cpp b/plugins/StatusManager/src/startupstatus.cpp
index 6adac7c061..f6c539f902 100644
--- a/plugins/StatusManager/src/startupstatus.cpp
+++ b/plugins/StatusManager/src/startupstatus.cpp
@@ -19,7 +19,7 @@
#include "stdafx.h"
-int SSLangPack;
+CFakePlugin SSPlugin(SSMODULENAME);
static HANDLE hServices[3], hEvents[3];
static UINT_PTR setStatusTimerId = 0;
@@ -413,8 +413,6 @@ static INT_PTR SrvGetProfile(WPARAM wParam, LPARAM lParam)
void StartupStatusLoad()
{
- SSLangPack = GetPluginLangId(MIID_LAST, 0);
-
if (g_bMirandaLoaded)
SSModuleLoaded(0, 0);
else
@@ -445,7 +443,7 @@ void StartupStatusUnload()
if (g_bMirandaLoaded)
OnShutdown(0, 0);
- KillModuleOptions(SSLangPack);
+ KillModuleOptions(&SSPlugin);
for (auto &it : hServices) {
DestroyServiceFunction(it);
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index 253429458d..6162650dad 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -46,13 +46,19 @@ struct CMPlugin : public PLUGIN<CMPlugin>
int Unload() override;
};
+struct CFakePlugin : public CMPluginBase
+{
+ CFakePlugin(const char *szModuleName);
+};
+
+
#include "commonstatus.h"
#include "keepstatus.h"
#include "startupstatus.h"
#include "advancedautoaway.h"
extern bool g_bMirandaLoaded;
-extern int AAALangPack, KSLangPack, SSLangPack;
+extern CFakePlugin AAAPlugin, KSPlugin, SSPlugin;
extern CMOption<bool> g_AAAEnabled, g_KSEnabled, g_SSEnabled;
int OnCommonOptionsInit(WPARAM wParam, LPARAM);