diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-17 14:41:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-17 14:41:49 +0000 |
commit | b638838fd6ec1eb32d096e0244e8e0d2a8196c73 (patch) | |
tree | 77673fe0a3e1f5513e11e323a894cee82488091e /src/modules/chat/chat_svc.cpp | |
parent | 6d2b23beea4515281f3b0760c0246d4aea9b1e80 (diff) |
- kernel chat module loads automatically, not on request;
- the special structure, CHAT_MANAGER_INITDATA, is used to customize chats;
- fix for fonts group for all plugins;
- fix for options in tabSRMM
git-svn-id: http://svn.miranda-ng.org/main/trunk@7688 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/chat/chat_svc.cpp')
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 68 |
1 files changed, 26 insertions, 42 deletions
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index f39318bc32..5bbd5caeba 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -29,8 +29,6 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM); HGENMENU hJoinMenuItem, hLeaveMenuItem;
CRITICAL_SECTION cs;
-void RegisterFonts(void);
-
static HANDLE
hServiceRegister = NULL,
hServiceNewChat = NULL,
@@ -51,7 +49,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) LoadLogFonts();
SetIndentSize();
- ci.pSettings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
ci.MM_FontsChanged();
ci.MM_FixColors();
@@ -184,8 +182,8 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->dwFlags = gcw->dwFlags;
si->ptszName = mir_tstrdup(gcw->ptszName);
si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
- si->iSplitterX = ci.pSettings->iSplitterX;
- si->iSplitterY = ci.pSettings->iSplitterY;
+ si->iSplitterX = g_Settings->iSplitterX;
+ si->iSplitterY = g_Settings->iSplitterY;
si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
@@ -477,8 +475,8 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (ci.OnAddLog)
ci.OnAddLog(si, isOk);
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
- if ((gce->dwFlags & GCEF_ADDTOLOG) && ci.pSettings->LoggingEnabled)
+ ci.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
LogToFile(si, gce);
}
@@ -503,9 +501,27 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+
char* mods[3] = { "Chat", "ChatFonts" };
CallService("DBEditorpp/RegisterModule", (WPARAM)mods, 2);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = -2000090001;
+ mi.flags = CMIF_DEFAULT;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);
+ mi.pszName = LPGEN("&Join");
+ mi.pszService = "GChat/JoinChat";
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -2000090000;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_LEAVE);
+ mi.flags = CMIF_NOTOFFLINE;
+ mi.pszName = LPGEN("&Leave");
+ mi.pszService = "GChat/LeaveChat";
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
+
ci.SetAllOffline(TRUE, NULL);
return 0;
}
@@ -513,22 +529,11 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Service creation
-static bool bInited = false;
-
-void InitChatModule(void)
-{
- CreateServiceFunction("GChat/GetInterface", SvcGetChatManager);
-}
-
-void LoadChatModule(void)
+int LoadChatModule(void)
{
- if (bInited)
- return;
-
InitializeCriticalSection(&cs);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
@@ -543,39 +548,18 @@ void 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);
- RegisterFonts();
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = -2000090001;
- mi.flags = CMIF_DEFAULT;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);
- mi.pszName = LPGEN("&Join");
- mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = Menu_AddContactMenuItem(&mi);
-
- mi.position = -2000090000;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_LEAVE);
- mi.flags = CMIF_NOTOFFLINE;
- mi.pszName = LPGEN("&Leave");
- mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
-
HookEvent(ME_FONT_RELOAD, FontsChanged);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
-
- bInited = true;
+ return 0;
}
void UnloadChatModule(void)
{
- if (!bInited)
- return;
-
OptionsUnInit();
DeleteCriticalSection(&cs);
|