summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/StatusManager/src')
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp (renamed from plugins/StatusManager/src/aaa_msgoptions.cpp)2
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp (renamed from plugins/StatusManager/src/aaa_options.cpp)9
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp (renamed from plugins/StatusManager/src/advancedautoaway.cpp)35
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h (renamed from plugins/StatusManager/src/advancedautoaway.h)14
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.cpp (renamed from plugins/StatusManager/src/keepstatus.cpp)63
-rw-r--r--plugins/StatusManager/src/KeepStatus/keepstatus.h (renamed from plugins/StatusManager/src/keepstatus.h)15
-rw-r--r--plugins/StatusManager/src/KeepStatus/ks_options.cpp (renamed from plugins/StatusManager/src/ks_options.cpp)7
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp (renamed from plugins/StatusManager/src/ss_options.cpp)5
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_profiles.cpp (renamed from plugins/StatusManager/src/ss_profiles.cpp)15
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp (renamed from plugins/StatusManager/src/ss_toolbars.cpp)4
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp (renamed from plugins/StatusManager/src/startupstatus.cpp)63
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.h (renamed from plugins/StatusManager/src/startupstatus.h)18
-rw-r--r--plugins/StatusManager/src/main.cpp105
-rw-r--r--plugins/StatusManager/src/options.cpp42
-rw-r--r--plugins/StatusManager/src/resource.h21
-rw-r--r--plugins/StatusManager/src/stdafx.h43
-rw-r--r--plugins/StatusManager/src/version.h4
17 files changed, 300 insertions, 165 deletions
diff --git a/plugins/StatusManager/src/aaa_msgoptions.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp
index 5647199a43..2484440b2a 100644
--- a/plugins/StatusManager/src/aaa_msgoptions.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
extern char *StatusModeToDbSetting(int status,const char *suffix);
diff --git a/plugins/StatusManager/src/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
index d26678c1ce..63971adcdf 100644
--- a/plugins/StatusManager/src/aaa_options.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName);
@@ -119,7 +119,7 @@ static void SetDialogStatus(HWND hwndDlg, TAAAProtoSetting *sameSetting)
/////////////////////////////////////////////////////////////////////////////////////////
// Rules dialog window procedure
-static TAAAProtoSettingList optionSettings(10, CompareSettings);
+static TAAAProtoSettingList optionSettings(10, AAACompareSettings);
static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
@@ -337,7 +337,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
for (int i = 0; i < optionSettings.getCount(); i++)
WriteAutoAwaySetting(optionSettings[i], optionSettings[i].szName);
}
- LoadOptions(autoAwaySettings, FALSE);
+ AAALoadOptions(autoAwaySettings, FALSE);
}
break;
@@ -402,7 +402,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
db_set_w(NULL, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE));
db_set_b(NULL, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
db_set_b(NULL, AAAMODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD));
- LoadOptions(autoAwaySettings, FALSE);
+ AAALoadOptions(autoAwaySettings, FALSE);
}
break;
}
@@ -513,6 +513,7 @@ int AutoAwayOptInitialise(WPARAM wParam, LPARAM)
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 1000000000;
odp.hInstance = hInst;
+ odp.hLangpack = hAAALangpack;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS);
odp.szTitle.a = LPGEN("Auto away");
odp.szGroup.a = LPGEN("Status");
diff --git a/plugins/StatusManager/src/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
index 7f09466bd2..b9647816f2 100644
--- a/plugins/StatusManager/src/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
@@ -20,7 +20,9 @@
Some code is copied from Miranda's AutoAway module
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
+
+int hAAALangpack = 0;
#ifdef _DEBUG
#define SECS_PER_MINUTE 20 /* speedup */
@@ -30,12 +32,7 @@
/////////////////////////////////////////////////////////////////////////////////////////
-int CompareSettings(const TAAAProtoSetting *p1, const TAAAProtoSetting *p2)
-{
- return mir_strcmp(p1->szName, p2->szName);
-}
-
-TAAAProtoSettingList autoAwaySettings(10, CompareSettings);
+TAAAProtoSettingList autoAwaySettings(10, AAACompareSettings);
TAAAProtoSetting::TAAAProtoSetting(PROTOACCOUNT *pa)
{
@@ -55,7 +52,8 @@ TAAAProtoSetting::~TAAAProtoSetting()
/////////////////////////////////////////////////////////////////////////////////////////
-extern HANDLE hStateChangedEvent;
+HANDLE hAAAModuleLoadedHook = NULL,
+ hStateChangedEvent = NULL;
static BOOL ignoreLockKeys = FALSE;
static BOOL ignoreSysKeys = FALSE;
@@ -95,7 +93,7 @@ extern char *StatusModeToDbSetting(int status,const char *suffix);
/////////////////////////////////////////////////////////////////////////////////////////
// Load from DB
-void LoadOptions(TAAAProtoSettingList &loadSettings, BOOL override)
+void AAALoadOptions(TAAAProtoSettingList &loadSettings, BOOL override)
{
// if override is enabled, samesettings will be ignored (for options loading)
int monitorMiranda = FALSE; // use windows hooks?
@@ -562,7 +560,7 @@ static int AutoAwayShutdown(WPARAM, LPARAM)
return 0;
}
-int AAACSModuleLoaded(WPARAM, LPARAM)
+int AAAModuleLoaded(WPARAM, LPARAM)
{
HookEvent(ME_PROTO_ACCLISTCHANGED, OnAAAAccChanged);
HookEvent(ME_OPT_INITIALISE, AutoAwayOptInitialise);
@@ -585,6 +583,21 @@ int AAACSModuleLoaded(WPARAM, LPARAM)
////////////////////////////////////////////////////////////////////////////////////////
- LoadOptions(autoAwaySettings, FALSE);
+ AAALoadOptions(autoAwaySettings, FALSE);
return 0;
}
+
+void AdvancedAutoAwayLoad()
+{
+ MUUID muidLast = MIID_LAST;
+ hAAALangpack = GetPluginLangId(muidLast, 0);
+
+ hAAAModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, AAAModuleLoaded);
+ hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED);
+}
+
+void AdvancedAutoAwayUnload()
+{
+ UnhookEvent(hAAAModuleLoadedHook);
+ DestroyHookableEvent(hStateChangedEvent);
+} \ No newline at end of file
diff --git a/plugins/StatusManager/src/advancedautoaway.h b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
index a8177c2a77..3f3a0b3c02 100644
--- a/plugins/StatusManager/src/advancedautoaway.h
+++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
@@ -19,6 +19,8 @@
#ifndef __ADVANCED_AUTOAWAY_HEADER
#define __ADVANCED_AUTOAWAY_HEADER
+extern int hAAALangpack;
+
#define AAAMODULENAME "AdvancedAutoAway"
#define SETTING_IGNLOCK "IgnoreLockKeys"
#define SETTING_IGNSYSKEYS "IgnoreSysKeys"
@@ -70,6 +72,11 @@ struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject
unsigned int sts1setTimer;
};
+static int AAACompareSettings(const TAAAProtoSetting *p1, const TAAAProtoSetting *p2)
+{
+ return mir_strcmp(p1->szName, p2->szName);
+}
+
struct AAMSGSETTING
{
short useCustom;
@@ -77,14 +84,13 @@ struct AAMSGSETTING
char* msg;
};
-extern HINSTANCE hInst;
-
-int CompareSettings( const TAAAProtoSetting *p1, const TAAAProtoSetting *p2 );
+void AdvancedAutoAwayLoad();
+void AdvancedAutoAwayUnload();
typedef OBJLIST<TAAAProtoSetting> TAAAProtoSettingList;
extern TAAAProtoSettingList autoAwaySettings;
int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char *protoName);
-void LoadOptions(TAAAProtoSettingList &settings, BOOL override);
+void AAALoadOptions(TAAAProtoSettingList &settings, BOOL override);
#endif
diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
index 41c244cde4..1cc209f0c7 100644
--- a/plugins/StatusManager/src/keepstatus.cpp
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
@@ -17,7 +17,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
+
+int hKSLangpack = 0;
struct TimerInfo {
int timer;
@@ -27,6 +29,16 @@ struct TimerInfo {
HANDLE hEvent;
};
+HANDLE hMainThread = 0;
+unsigned long mainThreadId = 0;
+
+HANDLE hKSModuleLoadedHook = NULL,
+ hConnectionEvent = NULL,
+ hStopRecon = NULL,
+ hEnableProto = NULL,
+ hIsProtoEnabled = NULL,
+ hAnnounceStat = NULL;
+
static mir_cs GenTimerCS, GenStatusCS, CheckContinueslyCS;
static HANDLE hProtoAckHook = NULL;
@@ -34,9 +46,6 @@ static HANDLE hStatusChangeHook = NULL;
static HANDLE hCSStatusChangeHook = NULL;
static HANDLE hCSStatusChangeExHook = NULL;
-extern HANDLE hConnectionEvent;
-extern PLUGININFOEX pluginInfoEx;
-
static HWND hMessageWindow = NULL;
static int CompareConnections(const TConnectionSettings *p1, const TConnectionSettings *p2)
@@ -64,7 +73,6 @@ static int showConnectionPopups = 0;
// prototypes
static int StartTimer(int timer, int timeout, BOOL restart);
static int StopTimer(int timer);
-int KSLoadMainOptions();
static void GetCurrentConnectionSettings();
static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, wchar_t *szMsg);
static int ProcessProtoAck(WPARAM wParam, LPARAM lParam);
@@ -83,7 +91,7 @@ INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam);
static int ProcessPopup(int reason, LPARAM lParam);
static INT_PTR ShowPopup(wchar_t *msg, HICON hIcon);
-LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+LRESULT CALLBACK KSPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// options.c
@@ -106,7 +114,7 @@ TConnectionSettings::~TConnectionSettings()
free(szMsg);
}
-int KSLoadMainOptions()
+int KSLoadOptions()
{
UnhookEvent(hProtoAckHook);
UnhookEvent(hStatusChangeHook);
@@ -991,7 +999,7 @@ static INT_PTR ShowPopup(wchar_t *msg, HICON hIcon)
ppd.colorBack = db_get_dw(NULL, KSMODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
ppd.colorText = db_get_dw(NULL, KSMODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC);
}
- ppd.PluginWindowProc = PopupDlgProc;
+ ppd.PluginWindowProc = KSPopupDlgProc;
switch (db_get_b(NULL, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
@@ -1012,7 +1020,7 @@ static INT_PTR ShowPopup(wchar_t *msg, HICON hIcon)
return PUAddPopupT(&ppd);
}
-LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK KSPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CONTEXTMENU: // right
@@ -1193,15 +1201,48 @@ static int onShutdown(WPARAM, LPARAM)
return 0;
}
-int KSCSModuleLoaded(WPARAM, LPARAM)
+int KSModuleLoaded(WPARAM, LPARAM)
{
protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&connectionSettings;
hMessageWindow = NULL;
- KSLoadMainOptions();
+ KSLoadOptions();
HookEvent(ME_OPT_INITIALISE, KeepStatusOptionsInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, onShutdown);
HookEvent(ME_PROTO_ACCLISTCHANGED, OnKSAccChanged);
return 0;
}
+
+void KeepStatusLoad()
+{
+ MUUID muidLast = MIID_LAST;
+ hKSLangpack = GetPluginLangId(muidLast, 0);
+
+ hKSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, KSModuleLoaded);
+
+ CreateHookableEvent(ME_KS_CONNECTIONEVENT);
+
+ hStopRecon = CreateServiceFunction(MS_KS_STOPRECONNECTING, StopReconnectingService);
+ hEnableProto = CreateServiceFunction(MS_KS_ENABLEPROTOCOL, EnableProtocolService);
+ hIsProtoEnabled = CreateServiceFunction(MS_KS_ISPROTOCOLENABLED, IsProtocolEnabledService);
+ hAnnounceStat = CreateServiceFunction(MS_KS_ANNOUNCESTATUSCHANGE, AnnounceStatusChangeService);
+
+ DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
+ mainThreadId = GetCurrentThreadId();
+}
+
+void KeepStatusUnload()
+{
+ if (hMainThread)
+ CloseHandle(hMainThread);
+
+ DestroyServiceFunction(hStopRecon);
+ DestroyServiceFunction(hEnableProto);
+ DestroyServiceFunction(hIsProtoEnabled);
+ DestroyServiceFunction(hAnnounceStat);
+
+ DestroyHookableEvent(hConnectionEvent);
+
+ UnhookEvent(hKSModuleLoadedHook);
+}
diff --git a/plugins/StatusManager/src/keepstatus.h b/plugins/StatusManager/src/KeepStatus/keepstatus.h
index d44b312e80..167bb1a051 100644
--- a/plugins/StatusManager/src/keepstatus.h
+++ b/plugins/StatusManager/src/KeepStatus/keepstatus.h
@@ -20,6 +20,7 @@
#ifndef __KEEPSTATUS_HEADER
#define __KEEPSTATUS_HEADER
+extern int hKSLangpack;
#define KSMODULENAME "KeepStatus"
#define SETTING_CHECKCONNECTION "CheckConnection"
@@ -113,16 +114,12 @@ typedef struct {
#define ME_CS_STATUSCHANGE "CommonStatus/StatusChange"
/////////////////////////////////////////////////////////////////////////////////////////
-// main.cpp
-
-extern HINSTANCE hInst;
-extern HANDLE hMainThread;
-extern unsigned long mainThreadId;
-
-/////////////////////////////////////////////////////////////////////////////////////////
// keepstatus.cpp
-int KSLoadMainOptions();
-LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+void KeepStatusLoad();
+void KeepStatusUnload();
+int KSLoadOptions();
+
+LRESULT CALLBACK KSPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif //__KEEPSTATUS_HEADER
diff --git a/plugins/StatusManager/src/ks_options.cpp b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
index 890981a8c1..1a4d6075b8 100644
--- a/plugins/StatusManager/src/ks_options.cpp
+++ b/plugins/StatusManager/src/KeepStatus/ks_options.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
// prototypes
INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam);
}
// let main reload options
- KSLoadMainOptions();
+ KSLoadOptions();
}
break;
}
@@ -497,7 +497,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0);
}
- ppd.PluginWindowProc = PopupDlgProc;
+ ppd.PluginWindowProc = KSPopupDlgProc;
ppd.PluginData = NULL;
if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
{
@@ -567,6 +567,7 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
+ odp.hLangpack = hKSLangpack;
odp.szGroup.w = LPGENW("Status");
odp.szTitle.w = LPGENW("Keep status");
odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
diff --git a/plugins/StatusManager/src/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index 2acf61483f..eaa5566820 100644
--- a/plugins/StatusManager/src/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
/////////////////////////////////////////////////////////////////////////////////////////
@@ -27,7 +27,7 @@ TSettingsList* GetCurrentProtoSettings()
PROTOACCOUNT **protos;
Proto_EnumAccounts(&count, &protos);
- TSettingsList *result = new TSettingsList(count, CompareSettings);
+ TSettingsList *result = new TSettingsList(count, SSCompareSettings);
if (result == NULL)
return NULL;
@@ -905,6 +905,7 @@ int StartupStatusOptionsInit(WPARAM wparam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
+ odp.hLangpack = hSSLangpack;
odp.szGroup.a = LPGEN("Status");
odp.szTitle.a = LPGEN("Startup status");
odp.flags = ODPF_BOLDGROUPS;
diff --git a/plugins/StatusManager/src/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
index 521d498fe9..5cb311b605 100644
--- a/plugins/StatusManager/src/ss_profiles.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
#define MAX_MMITEMS 6
@@ -57,6 +57,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
CMenuItem mi;
mi.position = 2000100000;
mi.flags = CMIF_UNICODE;
+ mi.hLangpack = hSSLangpack;
mcount = 0;
int count = GetProfileCount(0, 0);
for (int i = 0; i < count && mcount < MAX_MMITEMS; i++) {
@@ -65,7 +66,7 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
continue;
if (db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) {
- mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000);
+ mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000, 0, hSSLangpack);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D");
}
@@ -199,7 +200,7 @@ INT_PTR LoadAndSetProfile(WPARAM iProfileNo, LPARAM)
{
// wParam == profile no.
int profile = (int)iProfileNo;
- TSettingsList profileSettings(10, CompareSettings);
+ TSettingsList profileSettings(10, SSCompareSettings);
if (!GetProfile(profile, profileSettings)) {
profile = (profile >= 0) ? profile : db_get_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
@@ -313,6 +314,12 @@ int LoadProfileModule()
return 0;
}
+int UnloadProfileModule()
+{
+ DestroyServiceFunction(hLoadAndSetProfileService);
+ return 0;
+}
+
int InitProfileModule()
{
hTTBModuleLoadedHook = HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButtons);
@@ -337,7 +344,5 @@ int DeinitProfilesModule()
UnregisterHotKeys();
RemoveTopToolbarButtons();
-
- DestroyServiceFunction(hLoadAndSetProfileService);
return 0;
}
diff --git a/plugins/StatusManager/src/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
index 2ecf0a6b95..db8f6aeb61 100644
--- a/plugins/StatusManager/src/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
#define MAX_MMITEMS 6
@@ -41,7 +41,7 @@ void RemoveTopToolbarButtons()
int CreateTopToolbarButtons(WPARAM, LPARAM)
{
if (iconList[0].hIcolib == NULL)
- Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
+ Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList), NULL, hSSLangpack);
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
diff --git a/plugins/StatusManager/src/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index 995aa68934..b9de70b28c 100644
--- a/plugins/StatusManager/src/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -17,16 +17,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "stdafx.h"
+#include "..\stdafx.h"
-static UINT_PTR setStatusTimerId = 0;
+int hSSLangpack = 0;
-int CompareSettings(const TSSSetting *p1, const TSSSetting *p2)
-{
- return mir_strcmp(p1->szName, p2->szName);
-}
+static UINT_PTR setStatusTimerId = 0;
-static TSettingsList startupSettings(10, CompareSettings);
+static TSettingsList startupSettings(10, SSCompareSettings);
TSSSetting::TSSSetting(PROTOACCOUNT *pa)
{
@@ -342,8 +339,6 @@ static int OnOkToExit(WPARAM, LPARAM)
static int OnShutdown(WPARAM, LPARAM)
{
- DeinitProfilesModule();
-
// set windowstate and docked for next startup
if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINSTATE, 0)) {
int state = db_get_b(NULL, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
@@ -402,7 +397,7 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM)
return TRUE;
}
-int SSCSModuleLoaded(WPARAM, LPARAM)
+int SSModuleLoaded(WPARAM, LPARAM)
{
protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&startupSettings;
@@ -484,3 +479,51 @@ int SSCSModuleLoaded(WPARAM, LPARAM)
return 0;
}
+
+HANDLE hSSModuleLoadedHook = NULL,
+ hGetProfileService,
+ hGetProfileCountService,
+ hGetProfileNameService;
+
+void StartupStatusLoad()
+{
+ MUUID muidLast = MIID_LAST;
+ hSSLangpack = GetPluginLangId(muidLast, 0);
+
+ hSSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
+
+ if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) ||
+ db_get_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
+ db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+
+ // docking
+ if (db_get_b(NULL, SSMODULENAME, SETTING_SETDOCKED, 0)) {
+ int docked = db_get_b(NULL, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
+ if (docked == DOCKED_LEFT || docked == DOCKED_RIGHT)
+ docked = -docked;
+
+ db_set_b(NULL, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
+ }
+
+ // Create service functions; the get functions are created here; they don't rely on commonstatus
+ hGetProfileService = CreateServiceFunction(MS_SS_GETPROFILE, SrvGetProfile);
+ hGetProfileCountService = CreateServiceFunction(MS_SS_GETPROFILECOUNT, GetProfileCount);
+ hGetProfileNameService = CreateServiceFunction(MS_SS_GETPROFILENAME, GetProfileName);
+
+ LoadProfileModule();
+}
+
+void StartupStatusUnload()
+{
+ KillModuleIcons(hSSLangpack);
+ KillModuleMenus(hSSLangpack);
+
+ DeinitProfilesModule();
+ UnloadProfileModule();
+
+ DestroyServiceFunction(hGetProfileService);
+ DestroyServiceFunction(hGetProfileCountService);
+ DestroyServiceFunction(hGetProfileNameService);
+
+ UnhookEvent(hSSModuleLoadedHook);
+}
diff --git a/plugins/StatusManager/src/startupstatus.h b/plugins/StatusManager/src/StartupStatus/startupstatus.h
index f106a141d9..e1ad779103 100644
--- a/plugins/StatusManager/src/startupstatus.h
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.h
@@ -19,6 +19,8 @@
#ifndef __STARTUPSTATUSHEADER
#define __STARTUPSTATUSHEADER
+extern int hSSLangpack;
+
#define SSMODULENAME "StartupStatus"
struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
@@ -28,6 +30,11 @@ struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
~TSSSetting();
};
+static int SSCompareSettings(const TSSSetting *p1, const TSSSetting *p2)
+{
+ return mir_strcmp(p1->szName, p2->szName);
+}
+
typedef OBJLIST<TSSSetting> TSettingsList;
struct PROFILECE
@@ -130,9 +137,10 @@ int StartupStatusOptionsInit(WPARAM wparam,LPARAM lparam);
char* OptName(int i, const char* setting);
// startupstatus
-int SSLoadMainOptions();
+void StartupStatusLoad();
+void StartupStatusUnload();
-int CompareSettings( const TSSSetting* p1, const TSSSetting* p2 );
+int SSLoadMainOptions();
TSettingsList* GetCurrentProtoSettings();
@@ -140,6 +148,11 @@ TSettingsList* GetCurrentProtoSettings();
int GetProfile(int profileID, TSettingsList& arSettings );
wchar_t *GetStatusMessage(int profile, char *szProto);
+static INT_PTR SrvGetProfile(WPARAM wParam, LPARAM lParam)
+{
+ return GetProfile((int)wParam, *(TSettingsList*)lParam);
+}
+
INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam);
INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam);
INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam);
@@ -149,6 +162,7 @@ void RemoveTopToolbarButtons();
int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam);
int LoadProfileModule();
+int UnloadProfileModule();
int InitProfileModule();
int DeinitProfilesModule();
diff --git a/plugins/StatusManager/src/main.cpp b/plugins/StatusManager/src/main.cpp
index 41455e029a..e1cdb19222 100644
--- a/plugins/StatusManager/src/main.cpp
+++ b/plugins/StatusManager/src/main.cpp
@@ -19,21 +19,6 @@
#include "stdafx.h"
-unsigned long mainThreadId = 0;
-
-HANDLE hMainThread = 0,
- hCSModuleLoadedHook,
- hGetProfileService,
- hGetProfileCountService,
- hGetProfileNameService,
- hStateChangedEvent;
-
-HANDLE hConnectionEvent = NULL,
- hStopRecon = NULL,
- hEnableProto = NULL,
- hIsProtoEnabled = NULL,
- hAnnounceStat = NULL;
-
HINSTANCE hInst;
int hLangpack = 0;
CLIST_INTERFACE *pcli;
@@ -74,19 +59,26 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
/////////////////////////////////////////////////////////////////////////////////////////
// interfaces
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_AUTOAWAY, MIID_LAST };
+MUUID Interfaces[2] = {0};
+MUUID miidAutoAway = MIID_AUTOAWAY;
+
+
+MUUID* GetInterfaces(void)
+{
+ if (IsSubPluginEnabled(AAAMODULENAME))
+ Interfaces[0] = miidAutoAway;
+ return Interfaces;
+};
+
+extern "C" __declspec(dllexport) MUUID* MirandaInterfaces = GetInterfaces();
/////////////////////////////////////////////////////////////////////////////////////////
// plugin's entry point
-INT_PTR StopReconnectingService(WPARAM wParam, LPARAM lParam);
-INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam);
-INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam);
-INT_PTR AnnounceStatusChangeService(WPARAM wParam, LPARAM lParam);
-
-static INT_PTR SrvGetProfile(WPARAM wParam, LPARAM lParam)
+int OnModulesLoaded(WPARAM, LPARAM)
{
- return GetProfile((int)wParam, *(TSettingsList*)lParam);
+ HookEvent(ME_OPT_INITIALISE, CSubPluginsOptionsDlg::OnOptionsInit);
+ return 0;
}
extern "C" int __declspec(dllexport) Load(void)
@@ -94,48 +86,16 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
- //common
- InitCommonStatus();
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- /* KeepStatus */
- hCSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, KSCSModuleLoaded);
-
- hConnectionEvent = CreateHookableEvent(ME_KS_CONNECTIONEVENT);
-
- hStopRecon = CreateServiceFunction(MS_KS_STOPRECONNECTING, StopReconnectingService);
- hEnableProto = CreateServiceFunction(MS_KS_ENABLEPROTOCOL, EnableProtocolService);
- hIsProtoEnabled = CreateServiceFunction(MS_KS_ISPROTOCOLENABLED, IsProtocolEnabledService);
- hAnnounceStat = CreateServiceFunction(MS_KS_ANNOUNCESTATUSCHANGE, AnnounceStatusChangeService);
-
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hMainThread, THREAD_SET_CONTEXT, FALSE, 0);
- mainThreadId = GetCurrentThreadId();
-
- /* StartupStatus */
- hCSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, SSCSModuleLoaded);
-
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) ||
- db_get_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
- db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
-
- // docking
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETDOCKED, 0)) {
- int docked = db_get_b(NULL, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
- if (docked == DOCKED_LEFT || docked == DOCKED_RIGHT)
- docked = -docked;
-
- db_set_b(NULL, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
- }
-
- // Create service functions; the get functions are created here; they don't rely on commonstatus
- hGetProfileService = CreateServiceFunction(MS_SS_GETPROFILE, SrvGetProfile);
- hGetProfileCountService = CreateServiceFunction(MS_SS_GETPROFILECOUNT, GetProfileCount);
- hGetProfileNameService = CreateServiceFunction(MS_SS_GETPROFILENAME, GetProfileName);
-
- LoadProfileModule();
+ InitCommonStatus();
- /* AdvancedAutoAway */
- hCSModuleLoadedHook = HookEvent(ME_SYSTEM_MODULESLOADED, AAACSModuleLoaded);
- hStateChangedEvent = CreateHookableEvent(ME_AAA_STATECHANGED);
+ if (IsSubPluginEnabled(KSMODULENAME))
+ KeepStatusLoad();
+ if (IsSubPluginEnabled(SSMODULENAME))
+ StartupStatusLoad();
+ if (IsSubPluginEnabled(AAAMODULENAME))
+ AdvancedAutoAwayLoad();
return 0;
}
@@ -145,22 +105,9 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
- UnhookEvent(hCSModuleLoadedHook);
-
- // StartupStatus
- DestroyHookableEvent(hConnectionEvent);
-
- if (hMainThread)
- CloseHandle(hMainThread);
- DestroyServiceFunction(hStopRecon);
- DestroyServiceFunction(hEnableProto);
- DestroyServiceFunction(hIsProtoEnabled);
- DestroyServiceFunction(hAnnounceStat);
-
- // StartupStatus
- DestroyServiceFunction(hGetProfileService);
- DestroyServiceFunction(hGetProfileCountService);
- DestroyServiceFunction(hGetProfileNameService);
+ KeepStatusUnload();
+ StartupStatusUnload();
+ AdvancedAutoAwayUnload();
return 0;
}
diff --git a/plugins/StatusManager/src/options.cpp b/plugins/StatusManager/src/options.cpp
new file mode 100644
index 0000000000..c6fe45bda4
--- /dev/null
+++ b/plugins/StatusManager/src/options.cpp
@@ -0,0 +1,42 @@
+#include "stdafx.h"
+
+CSubPluginsOptionsDlg::CSubPluginsOptionsDlg()
+ : CPluginDlgBase(hInst, IDD_OPT_SUBPLUGINS, MODULENAME),
+ m_enableKeepStatus(this, IDC_ENABLE_KEEPSTATUS),
+ m_enableStartupStatus(this, IDC_ENABLE_STARTUPSTATUS),
+ m_enableAdvancedAutoAway(this, IDC_ENABLE_ADVANCEDAUTOAWAY)
+{
+}
+
+void CSubPluginsOptionsDlg::OnInitDialog()
+{
+ CDlgBase::OnInitDialog();
+
+ m_enableKeepStatus.SetState(IsSubPluginEnabled(KSMODULENAME));
+ m_enableStartupStatus.SetState(IsSubPluginEnabled(SSMODULENAME));
+ m_enableAdvancedAutoAway.SetState(IsSubPluginEnabled(AAAMODULENAME));
+}
+
+void CSubPluginsOptionsDlg::OnApply()
+{
+ char setting[128];
+ mir_snprintf(setting, "%s_enabled", KSMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableKeepStatus.GetState());
+ mir_snprintf(setting, "%s_enabled", SSMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableStartupStatus.GetState());
+ mir_snprintf(setting, "%s_enabled", AAAMODULENAME);
+ db_set_b(NULL, MODULENAME, setting, m_enableAdvancedAutoAway.GetState());
+}
+
+int CSubPluginsOptionsDlg::OnOptionsInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.hInstance = hInst;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ odp.szGroup.w = LPGENW("Status");
+ odp.szTitle.w = LPGENW("Status manager");
+ odp.pDialog = CSubPluginsOptionsDlg::CreateOptionsPage();
+ Options_AddPage(wParam, &odp);
+
+ return 0;
+} \ No newline at end of file
diff --git a/plugins/StatusManager/src/resource.h b/plugins/StatusManager/src/resource.h
index f49d2abbd5..fe80e01f93 100644
--- a/plugins/StatusManager/src/resource.h
+++ b/plugins/StatusManager/src/resource.h
@@ -1,8 +1,7 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by resource.rc
+// Used by E:\Projects\C++\miranda-ng\plugins\StatusManager\res\resource.rc
//
-#define IDD_OPT_KEEPSTATUS 101
#define IDD_OPT_KS_BASIC 101
#define IDD_CONFIRMDIALOG 102
#define IDD_OPT_AUTOAWAY 104
@@ -11,28 +10,23 @@
#define IDD_OPT_STARTUPSTATUS 110
#define IDD_PUOPT_KEEPSTATUS 113
#define IDD_OPT_AUTOAWAYMSG 114
-#define IDI_TICK 117
-#define IDI_NOTICK 118
#define IDD_OPT_GENAUTOAWAY 119
#define IDD_OPT_KS_ACTION 120
#define IDD_SETSTSMSGDIALOG 121
#define IDD_OPT_STATUSPROFILES 123
-#define IDD_OPT_AAATABS 126
#define IDD_OPT_TABS 126
#define IDD_OPT_KS_ADV 127
#define IDD_TRG_AAASTATECHANGE 128
#define IDI_TTBDOWN 129
+#define IDD_OPT_SUBPLUGINS 129
#define IDI_TTBUP 130
#define IDC_PROTOCOL 1000
#define IDC_STATUS 1001
#define IDC_PROFILE 1002
#define IDC_STARTUPLIST 1008
#define IDC_STATUSMSG 1008
-#define IDC_SETSTATUSONSTARTUP 1010
#define IDC_SETPROFILE 1010
-#define IDC_SETWINDOW 1011
#define IDC_SETWINSTATE 1011
-#define IDC_WINDOW 1012
#define IDC_WINSTATE 1012
#define IDC_CLOSE 1013
#define IDC_SHOWDIALOG 1014
@@ -46,7 +40,6 @@
#define IDC_CHECKCONNECTION 1025
#define IDC_MAXRETRIES 1026
#define IDC_INITDELAY 1027
-#define IDC_SETSTATUSDELAY 1027
#define IDC_SETPROFILEDELAY 1027
#define IDC_DOCKED 1028
#define IDC_SETDOCKED 1029
@@ -63,12 +56,10 @@
#define IDC_DELPROFILE 1042
#define IDC_PROFILENAME 1043
#define IDC_CANCEL 1044
-#define IDC_DEFAULTPROFILE 1045
#define IDC_MONITORMIRANDA 1045
#define IDC_WINCOLORS 1045
#define IDC_CHKINET 1045
#define IDC_IGNLOCK 1045
-#define IDC_CREATETTBBUTTONS 1046
#define IDC_CREATETTB 1046
#define IDC_PERPROTOCOLSETTINGS 1050
#define IDC_SAMESETTINGS 1051
@@ -145,12 +136,14 @@
#define IDC_LEAVEFIRST 1136
#define IDC_LEAVESECOND 1137
#define IDC_BECOMEACTIVE 1138
+#define IDC_ENABLE_KEEPSTATUS 1141
+#define IDC_ENABLE_STARTUPSTATUS 1142
+#define IDC_ENABLE_ADVANCEDAUTOAWAY 1143
#define IDC_SCREENSAVE 1145
#define IDC_TIMED 1146
#define IDC_AWAYTIME 1147
#define IDC_SETNA 1148
#define IDC_NATIME 1149
-#define IDC_SCREENSAVE2 1150
#define IDC_FULLSCREEN 1150
#define IDC_RADUSEMIRANDA 1210
#define IDC_RADUSECUSTOM 1212
@@ -160,9 +153,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1141
+#define _APS_NEXT_CONTROL_VALUE 1144
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index a8fd9051a7..f82e4ae86a 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -21,17 +21,48 @@
#include <m_protocols.h>
#include <m_toptoolbar.h>
#include <m_statusplugins.h>
+#include <m_gui.h>
#include "version.h"
#include "resource.h"
+#define MODULENAME "StatusManager"
+
#include "commonstatus.h"
-#include "keepstatus.h"
-#include "startupstatus.h"
-#include "advancedautoaway.h"
+#include "KeepStatus\keepstatus.h"
+#include "StartupStatus\startupstatus.h"
+#include "AdvancedAutoAway\advancedautoaway.h"
+
+extern HINSTANCE hInst;
+
+static BYTE IsSubPluginEnabled(const char* name)
+{
+ // Check if this plugin was disabled as separate dll
+ CMStringA dllName(FORMAT, "%s.dll", name);
+ dllName.MakeLower();
+ bool dllEnabled = !db_get_b(NULL, "PluginDisable", dllName);
+
+ char setting[128];
+ mir_snprintf(setting, "%s_enabled", name);
+ return db_get_b(NULL, MODULENAME, setting, dllEnabled ? 1 : 0);
+}
+
+class CSubPluginsOptionsDlg : CPluginDlgBase
+{
+private:
+ CCtrlCheck m_enableKeepStatus;
+ CCtrlCheck m_enableStartupStatus;
+ CCtrlCheck m_enableAdvancedAutoAway;
+
+protected:
+ void OnInitDialog();
+ void OnApply();
+
+public:
+ CSubPluginsOptionsDlg();
-int KSCSModuleLoaded(WPARAM, LPARAM);
-int SSCSModuleLoaded(WPARAM, LPARAM);
-int AAACSModuleLoaded(WPARAM, LPARAM);
+ static int OnOptionsInit(WPARAM wParam, LPARAM);
+ static CDlgBase *CreateOptionsPage() { return new CSubPluginsOptionsDlg(); }
+};
#endif //_COMMON_H_
diff --git a/plugins/StatusManager/src/version.h b/plugins/StatusManager/src/version.h
index afc5ef5d5f..d4e2982f74 100644
--- a/plugins/StatusManager/src/version.h
+++ b/plugins/StatusManager/src/version.h
@@ -1,7 +1,7 @@
// plugin version part
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
-#define __RELEASE_NUM 0
+#define __RELEASE_NUM 2
#define __BUILD_NUM 0
// other stuff for Version resource
@@ -14,4 +14,4 @@
#define __AUTHOR "P Boon"
#define __AUTHOREMAIL "unregistered@users.sourceforge.net"
#define __AUTHORWEB "http://miranda-ng.org/p/StatusManager/"
-#define __COPYRIGHT "© 2003-08 P. Boon, 2008-17 George Hazan"
+#define __COPYRIGHT "� 2003-08 P. Boon, 2008-17 George Hazan"