summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-02-22 10:48:36 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-02-22 10:48:36 +0000
commitd5aa68bc585710dcb741ac2cd545c21410b0af7e (patch)
tree3bd7a1bdd0d4ca15a0fda106de74e5c8227e00b1 /plugins/Scriver
parent34c8d175d77f8e9d786b41fc8ed87d6816829fc8 (diff)
hooking loading/unloading plugin events
git-svn-id: http://svn.miranda-ng.org/main/trunk@3687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat/options.cpp2
-rw-r--r--plugins/Scriver/src/globals.cpp3
-rw-r--r--plugins/Scriver/src/msgdialog.cpp4
-rw-r--r--plugins/Scriver/src/msglog.cpp2
-rw-r--r--plugins/Scriver/src/msgoptions.cpp2
-rw-r--r--plugins/Scriver/src/msgs.cpp10
-rw-r--r--plugins/Scriver/src/srmm.cpp5
7 files changed, 17 insertions, 11 deletions
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index 163f687cb8..3cb5352cc0 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -759,7 +759,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg,UINT uMsg,WPARAM wParam
static int OptionsInitialize(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_POPUP_ADDPOPUP)) {
+ if (g_dat->popupInstalled) {
OPTIONSDIALOGPAGE odp = {0};
odp.cbSize = sizeof(odp);
odp.position = 910000002;
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp
index 7c1f15c2e8..b30f9cfc9f 100644
--- a/plugins/Scriver/src/globals.cpp
+++ b/plugins/Scriver/src/globals.cpp
@@ -297,9 +297,6 @@ void FreeGlobals() {
}
void ReloadGlobals() {
- g_dat->smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION);
- g_dat->popupInstalled = ServiceExists(MS_POPUP_ADDPOPUPEX);
- g_dat->ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW);
g_dat->flags = 0;
g_dat->flags2 = 0;
if (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index 9b90c24636..aea89e4730 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -791,7 +791,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (DBGetContactSettingByte(dat->windowData.hContact, SRMMMOD, "UseRTL", (BYTE) 0)) {
dat->flags |= SMF_RTL;
}
- dat->flags |= ServiceExists(MS_IEVIEW_WINDOW) ? g_dat->flags & SMF_USEIEVIEW : 0;
+ dat->flags |= g_dat->ieviewInstalled ? g_dat->flags & SMF_USEIEVIEW : 0;
{
PARAFORMAT2 pf2;
ZeroMemory((void *)&pf2, sizeof(pf2));
@@ -1209,7 +1209,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
LOGFONT lf;
COLORREF colour;
dat->flags &= ~SMF_USEIEVIEW;
- dat->flags |= ServiceExists(MS_IEVIEW_WINDOW) ? g_dat->flags & SMF_USEIEVIEW : 0;
+ dat->flags |= g_dat->ieviewInstalled ? g_dat->flags & SMF_USEIEVIEW : 0;
if (dat->flags & SMF_USEIEVIEW && dat->windowData.hwndLog == NULL) {
IEVIEWWINDOW ieWindow;
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index d197809415..8e2051761f 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -1079,7 +1079,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM) & stream);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & oldSel);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0);
- if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
+ if (g_dat->smileyAddInstalled) {
SMADD_RICHEDIT3 smre;
smre.cbSize = sizeof(SMADD_RICHEDIT3);
smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index b6706cbfab..611817275e 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -789,7 +789,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- if (!ServiceExists(MS_IEVIEW_WINDOW)) {
+ if (!g_dat->ieviewInstalled) {
EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
}
CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp
index 7aed7129aa..d17cd0626d 100644
--- a/plugins/Scriver/src/msgs.cpp
+++ b/plugins/Scriver/src/msgs.cpp
@@ -476,6 +476,13 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) {
return 0;
}
+static int ModuleLoad(WPARAM wParam, LPARAM lParam)
+{
+ g_dat->smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS) != 0;
+ g_dat->popupInstalled = ServiceExists(MS_POPUP_ADDPOPUPEX) != 0;
+ g_dat->ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW) != 0;
+ return 0;
+}
static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
@@ -485,6 +492,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
RegisterKeyBindings();
LoadGlobalIcons();
LoadMsgLogIcons();
+ ModuleLoad(0, 0);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = -2000090000;
@@ -563,6 +571,8 @@ int OnLoadModule(void) {
HookEvent_Ex(ME_PROTO_CONTACTISTYPING, TypingMessage);
HookEvent_Ex(ME_SYSTEM_PRESHUTDOWN, OnSystemPreshutdown);
HookEvent_Ex(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+ HookEvent_Ex(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent_Ex(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp
index 5ec4354e9f..2f6204da9c 100644
--- a/plugins/Scriver/src/srmm.cpp
+++ b/plugins/Scriver/src/srmm.cpp
@@ -43,7 +43,8 @@ PLUGININFOEX pluginInfo = {
"Copyright (c) 2000-2012 Miranda IM Project, 2012-2013 Miranda NG Project",
"http://miranda-ng.org/",
UNICODE_AWARE,
- {0x84636f78, 0x2057, 0x4302, { 0x8a, 0x65, 0x23, 0xa1, 0x6d, 0x46, 0x84, 0x4c }} //{84636F78-2057-4302-8A65-23A16D46844C}
+ //{84636F78-2057-4302-8A65-23A16D46844C}
+ {0x84636f78, 0x2057, 0x4302, {0x8a, 0x65, 0x23, 0xa1, 0x6d, 0x46, 0x84, 0x4c}}
};
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
@@ -61,8 +62,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_SRMM, M
extern "C" __declspec(dllexport) int Load(void)
{
-
-
// set the memory manager
mir_getTMI(&tmi);
mir_getLP( &pluginInfo );