summaryrefslogtreecommitdiff
path: root/src/modules/chat/manager.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-17 14:41:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-17 14:41:49 +0000
commitb638838fd6ec1eb32d096e0244e8e0d2a8196c73 (patch)
tree77673fe0a3e1f5513e11e323a894cee82488091e /src/modules/chat/manager.cpp
parent6d2b23beea4515281f3b0760c0246d4aea9b1e80 (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/manager.cpp')
-rw-r--r--src/modules/chat/manager.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index 7dd26e8713..ac110f3429 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -66,7 +66,7 @@ static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule)
if (ci.SM_FindSession(pszID, pszModule))
return NULL;
- SESSION_INFO *node = (SESSION_INFO*)mir_calloc(ci.cbSession);
+ SESSION_INFO *node = (SESSION_INFO*)mir_calloc(g_cbSession);
node->ptszID = mir_tstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
@@ -257,10 +257,10 @@ static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
ci.OnEventBroadcast(pTemp, gce);
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- DoSoundsFlashPopupTrayStuff(pTemp, gce, FALSE, bManyFix);
+ ci.DoSoundsFlashPopupTrayStuff(pTemp, gce, FALSE, bManyFix);
bManyFix++;
- if ((gce->dwFlags & GCEF_ADDTOLOG) && ci.pSettings->LoggingEnabled)
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
LogToFile(pTemp, gce);
}
}
@@ -293,10 +293,10 @@ static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce,
li->time = gce->time;
li->bIsHighlighted = bIsHighlighted;
- if (ci.pSettings->iEventLimit > 0 && pTemp->iEventCount > ci.pSettings->iEventLimit + 20) {
- ci.LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - ci.pSettings->iEventLimit);
+ if (g_Settings->iEventLimit > 0 && pTemp->iEventCount > g_Settings->iEventLimit + 20) {
+ ci.LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - g_Settings->iEventLimit);
pTemp->bTrimmed = true;
- pTemp->iEventCount = ci.pSettings->iEventLimit;
+ pTemp->iEventCount = g_Settings->iEventLimit;
return FALSE;
}
return TRUE;
@@ -858,7 +858,7 @@ static MODULEINFO* MM_AddModule(const char *pszModule)
if (ci.MM_FindModule(pszModule))
return NULL;
- MODULEINFO *node = (MODULEINFO*)mir_calloc(ci.cbModuleInfo);
+ MODULEINFO *node = (MODULEINFO*)mir_calloc(g_cbModuleInfo);
replaceStr(node->pszModule, pszModule);
if (ci.OnCreateModule)
ci.OnCreateModule(node);
@@ -1459,20 +1459,35 @@ CHAT_MANAGER ci =
SetAllOffline,
AddEvent,
FindRoom,
+
Log_CreateRTF,
+ Log_CreateRtfHeader,
LoadMsgDlgFont,
MakeTimeStamp,
+
+ DoEventHook,
+ DoEventHookAsync,
+
+ DoSoundsFlashPopupTrayStuff,
DoPopup,
ShowPopup,
- RemoveFormatting
+ LogToFile,
+
+ RemoveFormatting,
+ LoadGlobalSettings
};
INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
{
- LoadChatModule();
-
+ // wipe out old junk
memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER)-offsetof(CHAT_MANAGER, OnCreateModule));
- ci.pSettings = (GlobalLogSettingsBase*)lParam;
+
+ CHAT_MANAGER_INITDATA *pInit = (CHAT_MANAGER_INITDATA*)lParam;
+ g_Settings = pInit->pSettings;
+ g_szFontGroup = pInit->szFontGroup;
+ g_cbSession = pInit->cbSession;
+ g_cbModuleInfo = pInit->cbModuleInfo;
+ RegisterFonts();
OptionsInit();
return (INT_PTR)&ci;
}