diff options
Diffstat (limited to 'plugins/NewXstatusNotify')
-rw-r--r-- | plugins/NewXstatusNotify/src/indsnd.cpp | 4 | ||||
-rw-r--r-- | plugins/NewXstatusNotify/src/main.cpp | 79 | ||||
-rw-r--r-- | plugins/NewXstatusNotify/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/NewXstatusNotify/src/stdafx.h | 12 |
4 files changed, 52 insertions, 47 deletions
diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index 697e59dc34..98bf7c9d6a 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -69,7 +69,7 @@ wchar_t *SelectSound(HWND hwndDlg, wchar_t *buff, size_t bufflen) ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetParent(hwndDlg);
- ofn.hInstance = hInst;
+ ofn.hInstance = g_plugin.getInst();
wchar_t filter[MAX_PATH];
if (GetModuleHandle(L"bass_interface.dll"))
mir_snwprintf(filter, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%s (*.*)%c*%c", TranslateT("Sound files"), 0, 0, TranslateT("All files"), 0, 0);
@@ -597,7 +597,7 @@ int UserInfoInitialise(WPARAM wParam, LPARAM lParam) if (lParam) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_INFO_SOUNDS);
odp.szTitle.a = LPGEN("Status Notify");
odp.pfnDlgProc = DlgProcSoundUIPage;
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 09d9025e14..e960275006 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -22,8 +22,8 @@ #include "stdafx.h"
CLIST_INTERFACE *pcli;
-
-HINSTANCE hInst;
+CMPlugin g_plugin;
+int hLangpack;
LIST<DBEVENT> eventListXStatus(10, PtrKeySortT);
LIST<DBEVENT> eventListStatus(10, PtrKeySortT);
@@ -35,11 +35,29 @@ HGENMENU hEnableDisableMenu; STATUS StatusList[STATUS_COUNT];
STATUS StatusListEx[STATUSEX_COUNT];
HWND SecretWnd;
-int hLangpack;
int ContactStatusChanged(MCONTACT hContact, WORD oldStatus, WORD newStatus);
-PLUGININFOEX pluginInfoEx = {
+IconItem iconList[] =
+{
+ { LPGEN("Reset"), ICO_RESET, IDI_RESET },
+ { LPGEN("Popups"), ICO_POPUP, IDI_POPUP },
+ { LPGEN("Sounds"), ICO_SOUND, IDI_SOUND },
+ { LPGEN("Notification enabled"), ICO_NOTIFICATION_OFF, IDI_NOTIFICATION_OFF },
+ { LPGEN("Notification disabled"), ICO_NOTIFICATION_ON, IDI_NOTIFICATION_ON },
+ { LPGEN("Extra status notify"), ICO_XSTATUS, IDI_XSTATUS },
+ { LPGEN("Disable all"), ICO_DISABLEALL, IDI_DISABLEALL },
+ { LPGEN("Enable all"), ICO_ENABLEALL, IDI_ENABLEALL },
+ { LPGEN("Variables"), ICO_VARIABLES, IDI_VARIABLES },
+ { LPGEN("Status message notify"), ICO_STATUS_MESSAGE, IDI_STATUS_MESSAGE },
+ { LPGEN("Extra status logging"), ICO_LOGGING_XSTATUS, IDI_LOGGING_XSTATUS },
+ { LPGEN("Status message logging"), ICO_LOGGING_SMSG, IDI_LOGGING_SMSG }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+PLUGININFOEX pluginInfoEx =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -52,19 +70,17 @@ PLUGININFOEX pluginInfoEx = { { 0xebf19652, 0xe434, 0x4d79, { 0x98, 0x97, 0x91, 0xa0, 0xff, 0x22, 0x6f, 0x51 } }
};
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
-{
- hInst = hinstDLL;
- return TRUE;
-}
-
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_USERONLINE, MIID_LAST };
+/////////////////////////////////////////////////////////////////////////////////////////
+
BYTE GetGender(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
@@ -107,7 +123,8 @@ static int __inline CheckStrW(WCHAR *str, int not_empty, int empty) return not_empty;
}
-static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, char *szSetting) {
+static int CompareStatusMsg(STATUSMSGINFO *smi, DBCONTACTWRITESETTING *cws_new, char *szSetting)
+{
DBVARIANT dbv_old;
int ret = -1;
@@ -325,7 +342,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name) DBVARIANT dbv;
wchar_t stzSoundFile[MAX_PATH] = { 0 };
if (!db_get_ws(hContact, MODULE, name, &dbv)) {
- wcsncpy(stzSoundFile, dbv.ptszVal, _countof(stzSoundFile)-1);
+ wcsncpy(stzSoundFile, dbv.ptszVal, _countof(stzSoundFile) - 1);
db_free(&dbv);
}
@@ -695,7 +712,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (db_get_ws(NULL, MODULE, protoname, &dbVar)) {
str = GetStr(&smi, DEFAULT_POPUP_SMSGREMOVED);
}
- else {
+ else {
str = GetStr(&smi, dbVar.ptszVal);
db_free(&dbVar);
}
@@ -1079,28 +1096,7 @@ void InitMainMenuItem() EnableDisableMenuCommand(0, 0);
}
-IconItem iconList[] =
-{
- { LPGEN("Reset"), ICO_RESET, IDI_RESET },
- { LPGEN("Popups"), ICO_POPUP, IDI_POPUP },
- { LPGEN("Sounds"), ICO_SOUND, IDI_SOUND },
- { LPGEN("Notification enabled"), ICO_NOTIFICATION_OFF, IDI_NOTIFICATION_OFF },
- { LPGEN("Notification disabled"), ICO_NOTIFICATION_ON, IDI_NOTIFICATION_ON },
- { LPGEN("Extra status notify"), ICO_XSTATUS, IDI_XSTATUS },
- { LPGEN("Disable all"), ICO_DISABLEALL, IDI_DISABLEALL },
- { LPGEN("Enable all"), ICO_ENABLEALL, IDI_ENABLEALL },
- { LPGEN("Variables"), ICO_VARIABLES, IDI_VARIABLES },
- { LPGEN("Status message notify"), ICO_STATUS_MESSAGE, IDI_STATUS_MESSAGE },
- { LPGEN("Extra status logging"), ICO_LOGGING_XSTATUS, IDI_LOGGING_XSTATUS },
- { LPGEN("Status message logging"), ICO_LOGGING_SMSG, IDI_LOGGING_SMSG }
-};
-
-void InitIcolib()
-{
- Icon_Register(hInst, LPGEN("New Status Notify"), iconList, _countof(iconList), MODULE);
-}
-
-void InitSound()
+static void InitSound()
{
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++)
Skin_AddSound(StatusList[Index(i)].lpzSkinSoundName, LPGENW("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc);
@@ -1109,7 +1105,7 @@ void InitSound() Skin_AddSound(StatusListEx[i].lpzSkinSoundName, LPGENW("Status Notify"), StatusListEx[i].lpzSkinSoundDesc);
}
-int InitTopToolbar(WPARAM, LPARAM)
+static int InitTopToolbar(WPARAM, LPARAM)
{
TTBButton tbb = {};
tbb.pszService = MS_STATUSCHANGE_MENUCOMMAND;
@@ -1124,7 +1120,7 @@ int InitTopToolbar(WPARAM, LPARAM) return 0;
}
-int ModulesLoaded(WPARAM, LPARAM)
+static int ModulesLoaded(WPARAM, LPARAM)
{
InitMainMenuItem();
@@ -1134,7 +1130,7 @@ int ModulesLoaded(WPARAM, LPARAM) SecretWnd = CreateWindowEx(WS_EX_TOOLWINDOW, L"static", L"ConnectionTimerWindow", 0,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP,
- nullptr, hInst, nullptr);
+ nullptr, g_plugin.getInst(), nullptr);
for (auto &pa : Accounts())
if (pa->IsEnabled())
@@ -1149,11 +1145,15 @@ static int OnShutdown(WPARAM, LPARAM) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfoEx);
pcli = Clist_GetInterface();
+ Icon_Register(g_plugin.getInst(), LPGEN("New Status Notify"), iconList, _countof(iconList), MODULE);
+
//"Service" Hook, used when the DB settings change: we'll monitor the "status" setting.
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
@@ -1170,7 +1170,6 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_CLIST_STATUSMODECHANGE, StatusModeChanged);
HookEvent(ME_PROTO_ACK, ProtoAck);
- InitIcolib();
LoadOptions();
InitStatusList();
InitSound();
@@ -1193,6 +1192,8 @@ extern "C" int __declspec(dllexport) Load(void) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
DestroyHookableEvent(hHookContactStatusChanged);
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 4c88c3d10a..1187e17cab 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -225,7 +225,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_CONFIGUREAUTODISABLE:
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_AUTODISABLE), hwndDlg, DlgProcAutoDisableOpts);
+ CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_AUTODISABLE), hwndDlg, DlgProcAutoDisableOpts);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return FALSE;
case IDC_AUTODISABLE:
@@ -1174,7 +1174,7 @@ int OptionsInitialize(WPARAM wParam, LPARAM) {
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = -100000000;
- odp.hInstance = hInst;
+ odp.hInstance = g_plugin.getInst();
odp.flags = ODPF_BOLDGROUPS;
odp.szTitle.a = LPGEN("Status Notify");
odp.szGroup.a = LPGEN("Status");
diff --git a/plugins/NewXstatusNotify/src/stdafx.h b/plugins/NewXstatusNotify/src/stdafx.h index 98b7f13614..a4def10dd4 100644 --- a/plugins/NewXstatusNotify/src/stdafx.h +++ b/plugins/NewXstatusNotify/src/stdafx.h @@ -34,8 +34,6 @@ #include <time.h>
#include <malloc.h>
-#define __NO_CMPLUGIN_NEEDED
-
#include <newpluginapi.h>
#include <win2k.h>
#include <m_button.h>
@@ -70,6 +68,13 @@ #define MODULE "NewStatusNotify"
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(MODULE)
+ {}
+};
+
#define MAX_STATUSTEXT 36
#define MAX_STANDARDTEXT 36
#define MAX_SKINSOUNDNAME 36
@@ -89,7 +94,7 @@ #define ID_STATUSEX_MAX 6
#define STATUSEX_COUNT ID_STATUSEX_MAX + 1
#define ID_STATUS_EXTRASTATUS 40081
-#define ID_STATUS_STATUSMSG 40082
+#define ID_STATUS_STATUSMSG 40082
#define ID_STATUS_MIN ID_STATUS_OFFLINE
#define ID_STATUS_MAX ID_STATUS_OUTTOLUNCH
#define ID_STATUS_MAX2 ID_STATUS_STATUSMSG
@@ -157,7 +162,6 @@ extern LIST<DBEVENT> eventListXStatus; extern LIST<DBEVENT> eventListStatus;
extern LIST<DBEVENT> eventListSMsg;
extern TEMPLATES templates;
-extern HINSTANCE hInst;
extern HGENMENU hEnableDisableMenu;
extern STATUS StatusList[STATUS_COUNT];
extern STATUS StatusListEx[STATUSEX_COUNT];
|