From 69ee782255e915d282f17cf702eff574fb82e84a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 18 Jan 2014 07:53:00 +0000 Subject: kernel chat module still to be loaded only by request git-svn-id: http://svn.miranda-ng.org/main/trunk@7707 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/chat/chat_svc.cpp | 17 +++++++++++++++-- src/modules/chat/manager.cpp | 4 ++++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index b27525400e..bfb928ce11 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -557,8 +557,19 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // Service creation +static bool bInited = false; + int LoadChatModule(void) { + CreateServiceFunction("GChat/GetInterface", SvcGetChatManager); + return 0; +} + +void InitChatModule(void) +{ + if (bInited) + return; + InitializeCriticalSection(&cs); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); @@ -576,18 +587,20 @@ int LoadChatModule(void) CreateServiceFunction("GChat/PrebuildMenuEvent", PrebuildContactMenuSvc); CreateServiceFunction("GChat/JoinChat", JoinChat); CreateServiceFunction("GChat/LeaveChat", LeaveChat); - CreateServiceFunction("GChat/GetInterface", SvcGetChatManager); ci.hSendEvent = CreateHookableEvent(ME_GC_EVENT); ci.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU); HookEvent(ME_FONT_RELOAD, FontsChanged); HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); - return 0; + bInited = true; } void UnloadChatModule(void) { + if (!bInited) + return; + OptionsUnInit(); DeleteCriticalSection(&cs); diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index cdd4cf52d2..6c7b1c6afa 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" +void InitChatModule(void); + #define WINDOWS_COMMANDS_MAX 30 MODULEINFO *m_ModList = 0; @@ -1482,6 +1484,8 @@ CHAT_MANAGER ci = INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam) { + InitChatModule(); + // wipe out old junk memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER)-offsetof(CHAT_MANAGER, OnCreateModule)); -- cgit v1.2.3