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 | |
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')
-rw-r--r-- | src/modules/chat/chat.h | 13 | ||||
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 188 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 68 | ||||
-rw-r--r-- | src/modules/chat/log.cpp | 32 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 37 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 70 |
6 files changed, 207 insertions, 201 deletions
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 91caba9bde..74855f1785 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -36,6 +36,9 @@ struct GCPTRS };
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
+extern GlobalLogSettingsBase *g_Settings;
+extern int g_cbSession, g_cbModuleInfo;
+extern TCHAR *g_szFontGroup;
// log.c
void LoadMsgLogBitmaps(void);
@@ -66,11 +69,11 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour); void LoadGlobalSettings(void);
HICON LoadIconEx(char* pszIcoLibName, BOOL big);
void LoadLogFonts(void);
-void SetIndentSize();
+void SetIndentSize(void);
+void RegisterFonts(void);
// services.c
-void InitChatModule(void);
-void LoadChatModule(void);
+int LoadChatModule(void);
void UnloadChatModule(void);
// tools.c
@@ -83,8 +86,8 @@ int GetRichTextLength(HWND hwnd); BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, INT_PTR dwItem);
+BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index e32f7f467d..6917d0be6f 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -26,6 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession;
+GlobalLogSettingsBase *g_Settings;
+int g_cbSession, g_cbModuleInfo;
+TCHAR *g_szFontGroup;
+
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
struct FontOptionsList
@@ -67,9 +71,9 @@ static const fontOptionsList[] = { static void LoadColors()
{
- ci.pSettings->crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings->crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
}
void LoadLogFonts(void)
@@ -80,18 +84,17 @@ void LoadLogFonts(void) if (ci.hListBkgBrush != NULL)
DeleteObject(ci.hListBkgBrush);
- ci.hListBkgBrush = CreateSolidBrush(ci.pSettings->crUserListBGColor);
+ ci.hListBkgBrush = CreateSolidBrush(g_Settings->crUserListBGColor);
if (ci.hListSelectedBkgBrush != NULL)
DeleteObject(ci.hListSelectedBkgBrush);
- ci.hListSelectedBkgBrush = CreateSolidBrush(ci.pSettings->crUserListSelectedBGColor);
+ ci.hListSelectedBkgBrush = CreateSolidBrush(g_Settings->crUserListSelectedBGColor);
}
void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
{
char str[32];
int style;
- DBVARIANT dbv;
if (colour) {
mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
@@ -116,12 +119,12 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%d", i);
- if (db_get_ts(NULL, "ChatFonts", str, &dbv))
+
+ ptrT tszFace(db_get_tsa(NULL, "ChatFonts", str));
+ if (tszFace == NULL)
lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
- else {
- lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
- db_free(&dbv);
- }
+ else
+ _tcsncpy_s(lf->lfFaceName, SIZEOF(lf->lfFaceName), tszFace, _TRUNCATE);
}
}
@@ -133,7 +136,7 @@ void RegisterFonts(void) fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
strncpy(fontid.dbSettingsGroup, "ChatFonts", sizeof(fontid.dbSettingsGroup));
- _tcsncpy(fontid.group, _T("Chat module"), SIZEOF(fontid.group));
+ _tcsncpy(fontid.group, g_szFontGroup, SIZEOF(fontid.group));
_tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
char idstr[10];
@@ -146,7 +149,7 @@ void RegisterFonts(void) fontid.deffontsettings.size = fontOptionsList[i].defSize;
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
_tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace));
- _tcsncpy(fontid.backgroundGroup, _T("Chat module"), SIZEOF(fontid.backgroundGroup));
+ _tcsncpy(fontid.backgroundGroup, g_szFontGroup, SIZEOF(fontid.backgroundGroup));
switch (i) {
case 17:
_tcsncpy(fontid.backgroundName, _T("Message background"), SIZEOF(fontid.backgroundName));
@@ -164,9 +167,10 @@ void RegisterFonts(void) ColourIDT colourid = { sizeof(colourid) };
strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup));
+ _tcsncpy(colourid.group, g_szFontGroup, SIZEOF(colourid.group));
+
strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
- _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
@@ -214,46 +218,46 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) void LoadGlobalSettings(void)
{
- ci.pSettings->LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
- ci.pSettings->ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
- ci.pSettings->SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
- ci.pSettings->ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
- ci.pSettings->TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
- ci.pSettings->iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
- ci.pSettings->dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
- ci.pSettings->dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
- ci.pSettings->dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
- ci.pSettings->LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
- ci.pSettings->LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
- ci.pSettings->FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
- ci.pSettings->HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
- ci.pSettings->crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0, 0, 0));
- ci.pSettings->crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170, 170, 170));
- ci.pSettings->StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
- ci.pSettings->TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
- ci.pSettings->PopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1);
- ci.pSettings->AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
- ci.pSettings->iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
- ci.pSettings->iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
- ci.pSettings->crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
- ci.pSettings->ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
- ci.pSettings->ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
+ g_Settings->LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
+ g_Settings->ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
+ g_Settings->SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
+ g_Settings->ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
+ g_Settings->TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
+ g_Settings->iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
+ g_Settings->dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings->dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings->dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings->LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
+ g_Settings->LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
+ g_Settings->FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
+ g_Settings->HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
+ g_Settings->crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0, 0, 0));
+ g_Settings->crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170, 170, 170));
+ g_Settings->StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
+ g_Settings->TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings->PopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1);
+ g_Settings->AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
+ g_Settings->iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
+ g_Settings->iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
+ g_Settings->crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
+ g_Settings->ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
+ g_Settings->ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
LoadColors();
if (ci.OnLoadSettings)
ci.OnLoadSettings();
- InitSetting(&ci.pSettings->pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
- InitSetting(&ci.pSettings->pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
- InitSetting(&ci.pSettings->pszIncomingNick, "HeaderIncoming", _T("%n:"));
- InitSetting(&ci.pSettings->pszOutgoingNick, "HeaderOutgoing", _T("%n:"));
- InitSetting(&ci.pSettings->pszHighlightWords, "HighlightWords", _T("%m"));
+ InitSetting(&g_Settings->pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
+ InitSetting(&g_Settings->pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
+ InitSetting(&g_Settings->pszIncomingNick, "HeaderIncoming", _T("%n:"));
+ InitSetting(&g_Settings->pszOutgoingNick, "HeaderOutgoing", _T("%n:"));
+ InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", _T("%m"));
TCHAR pszTemp[MAX_PATH];
DBVARIANT dbv;
- ci.pSettings->pszLogDir = (TCHAR *)mir_realloc(ci.pSettings->pszLogDir, MAX_PATH*sizeof(TCHAR));
+ g_Settings->pszLogDir = (TCHAR *)mir_realloc(g_Settings->pszLogDir, MAX_PATH*sizeof(TCHAR));
if (!db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(pszTemp, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
@@ -264,54 +268,56 @@ void LoadGlobalSettings(void) mir_free(tmpPath);
}
- PathToAbsoluteT(pszTemp, ci.pSettings->pszLogDir);
+ PathToAbsoluteT(pszTemp, g_Settings->pszLogDir);
- 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;
LOGFONT lf;
- if (ci.pSettings->MessageBoxFont)
- DeleteObject(ci.pSettings->MessageBoxFont);
+ if (g_Settings->MessageBoxFont)
+ DeleteObject(g_Settings->MessageBoxFont);
LoadMsgDlgFont(17, &lf, NULL);
- ci.pSettings->MessageBoxFont = CreateFontIndirect(&lf);
+ g_Settings->MessageBoxFont = CreateFontIndirect(&lf);
- if (ci.pSettings->UserListFont)
- DeleteObject(ci.pSettings->UserListFont);
+ if (g_Settings->UserListFont)
+ DeleteObject(g_Settings->UserListFont);
LoadMsgDlgFont(18, &lf, NULL);
- ci.pSettings->UserListFont = CreateFontIndirect(&lf);
+ g_Settings->UserListFont = CreateFontIndirect(&lf);
- if (ci.pSettings->UserListHeadingsFont)
- DeleteObject(ci.pSettings->UserListHeadingsFont);
+ if (g_Settings->UserListHeadingsFont)
+ DeleteObject(g_Settings->UserListHeadingsFont);
LoadMsgDlgFont(19, &lf, NULL);
- ci.pSettings->UserListHeadingsFont = CreateFontIndirect(&lf);
+ g_Settings->UserListHeadingsFont = CreateFontIndirect(&lf);
+
+ SetIndentSize();
}
static void FreeGlobalSettings(void)
{
- mir_free(ci.pSettings->pszTimeStamp);
- mir_free(ci.pSettings->pszTimeStampLog);
- mir_free(ci.pSettings->pszIncomingNick);
- mir_free(ci.pSettings->pszOutgoingNick);
- mir_free(ci.pSettings->pszHighlightWords);
- mir_free(ci.pSettings->pszLogDir);
- if (ci.pSettings->MessageBoxFont)
- DeleteObject(ci.pSettings->MessageBoxFont);
- if (ci.pSettings->UserListFont)
- DeleteObject(ci.pSettings->UserListFont);
- if (ci.pSettings->UserListHeadingsFont)
- DeleteObject(ci.pSettings->UserListHeadingsFont);
+ mir_free(g_Settings->pszTimeStamp);
+ mir_free(g_Settings->pszTimeStampLog);
+ mir_free(g_Settings->pszIncomingNick);
+ mir_free(g_Settings->pszOutgoingNick);
+ mir_free(g_Settings->pszHighlightWords);
+ mir_free(g_Settings->pszLogDir);
+ if (g_Settings->MessageBoxFont)
+ DeleteObject(g_Settings->MessageBoxFont);
+ if (g_Settings->UserListFont)
+ DeleteObject(g_Settings->UserListFont);
+ if (g_Settings->UserListHeadingsFont)
+ DeleteObject(g_Settings->UserListHeadingsFont);
}
void SetIndentSize()
{
- if (ci.pSettings->ShowTime) {
+ if (g_Settings->ShowTime) {
LOGFONT lf;
LoadMsgDlgFont(0, &lf, NULL);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(NULL)), hFont, TRUE);
DeleteObject(hFont);
- ci.pSettings->LogTextIndent = iText * 12 / 10;
+ g_Settings->LogTextIndent = iText * 12 / 10;
}
- else ci.pSettings->LogTextIndent = 0;
+ else g_Settings->LogTextIndent = 0;
}
int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
@@ -339,21 +345,21 @@ int OptionsInit(void) lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
- ci.pSettings->NameFont = CreateFontIndirect(&lf);
- ci.pSettings->UserListFont = NULL;
- ci.pSettings->UserListHeadingsFont = NULL;
- ci.pSettings->MessageBoxFont = NULL;
- ci.pSettings->iX = db_get_dw(NULL, "Chat", "roomx", -1);
- ci.pSettings->iY = db_get_dw(NULL, "Chat", "roomy", -1);
- ci.pSettings->iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1);
- ci.pSettings->iHeight = db_get_dw(NULL, "Chat", "roomheight", -1);
-
- ci.pSettings->iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
- if (ci.pSettings->iSplitterX <= 50)
- ci.pSettings->iSplitterX = 105;
- ci.pSettings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
- if (ci.pSettings->iSplitterY <= 65)
- ci.pSettings->iSplitterY = 90;
+ g_Settings->NameFont = CreateFontIndirect(&lf);
+ g_Settings->UserListFont = NULL;
+ g_Settings->UserListHeadingsFont = NULL;
+ g_Settings->MessageBoxFont = NULL;
+ g_Settings->iX = db_get_dw(NULL, "Chat", "roomx", -1);
+ g_Settings->iY = db_get_dw(NULL, "Chat", "roomy", -1);
+ g_Settings->iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1);
+ g_Settings->iHeight = db_get_dw(NULL, "Chat", "roomheight", -1);
+
+ g_Settings->iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
+ if (g_Settings->iSplitterX <= 50)
+ g_Settings->iSplitterX = 105;
+ g_Settings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
+ if (g_Settings->iSplitterY <= 65)
+ g_Settings->iSplitterY = 90;
LoadGlobalSettings();
@@ -369,16 +375,14 @@ int OptionsInit(void) SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
- if (ci.pSettings->LoggingEnabled)
- CreateDirectoryTreeT(ci.pSettings->pszLogDir);
-
- SetIndentSize();
+ if (g_Settings->LoggingEnabled)
+ CreateDirectoryTreeT(g_Settings->pszLogDir);
return 0;
}
int OptionsUnInit(void)
{
FreeGlobalSettings();
- DeleteObject(ci.pSettings->NameFont);
+ DeleteObject(g_Settings->NameFont);
return 0;
}
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);
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index c8fd06a5a9..18a95b518b 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -146,7 +146,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff case 'c':
case 'f':
- if (ci.pSettings->StripFormat || streamData->bStripFormat)
+ if (g_Settings->StripFormat || streamData->bStripFormat)
line += 2;
else if ( line[1] != '\0' && line[2] != '\0') {
@@ -164,7 +164,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff break;
case 'C':
case 'F':
- if ( !ci.pSettings->StripFormat && !streamData->bStripFormat) {
+ if ( !g_Settings->StripFormat && !streamData->bStripFormat) {
int j = streamData->lin->bIsHighlighted ? 16 : EventToIndex(streamData->lin);
if ( *line == 'C' )
mir_snprintf(szTemp, SIZEOF(szTemp), "\\cf%u ", j+1);
@@ -225,7 +225,7 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
if (streamData->lin->ptszNick) {
- if (ci.pSettings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
+ if (g_Settings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
lstrcpyn(szTemp2, streamData->lin->ptszNick, 20);
lstrcpyn(szTemp2 + 20, _T("..."), 4);
}
@@ -346,8 +346,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\par%s ", Log_SetStyle(0, 0));
// Insert icon
- if (lin->iType & ci.pSettings->dwIconFlags || lin->bIsHighlighted&&ci.pSettings->dwIconFlags & GC_EVENT_HIGHLIGHT) {
- int iIndex = (lin->bIsHighlighted && ci.pSettings->dwIconFlags & GC_EVENT_HIGHLIGHT) ? ICON_HIGHLIGHT : EventToIcon(lin);
+ if (lin->iType & g_Settings->dwIconFlags || lin->bIsHighlighted&&g_Settings->dwIconFlags & GC_EVENT_HIGHLIGHT) {
+ int iIndex = (lin->bIsHighlighted && g_Settings->dwIconFlags & GC_EVENT_HIGHLIGHT) ? ICON_HIGHLIGHT : EventToIcon(lin);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < logIconBmpSize[0])
bufferAlloced += 4096;
@@ -356,7 +356,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) bufferEnd += logIconBmpSize[iIndex];
}
- if (ci.pSettings->TimeStampEventColour) {
+ if (g_Settings->TimeStampEventColour) {
LOGFONT &lf = ci.aFonts[0].lf;
// colored timestamps
@@ -376,16 +376,16 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0, 0));
// insert a TAB if necessary to put the timestamp in the right position
- if (ci.pSettings->dwIconFlags)
+ if (g_Settings->dwIconFlags)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
//insert timestamp
- if (ci.pSettings->ShowTime) {
+ if (g_Settings->ShowTime) {
TCHAR szTimeStamp[30], szOldTimeStamp[30];
- lstrcpyn(szTimeStamp, MakeTimeStamp(ci.pSettings->pszTimeStamp, lin->time), 30);
- lstrcpyn(szOldTimeStamp, MakeTimeStamp(ci.pSettings->pszTimeStamp, streamData->si->LastTime), 30);
- if (!ci.pSettings->ShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
+ lstrcpyn(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
+ lstrcpyn(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
+ if (!g_Settings->ShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
}
@@ -397,7 +397,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) TCHAR pszTemp[300], *p1;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1, lin->bIsMe ? 2 : 1));
- lstrcpyn(pszTemp, lin->bIsMe ? ci.pSettings->pszOutgoingNick : ci.pSettings->pszIncomingNick, 299);
+ lstrcpyn(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
p1 = _tcsstr(pszTemp, _T("%n"));
if (p1)
p1[1] = 's';
@@ -458,14 +458,14 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) // set tabs and indents
int iIndent = 0;
- if (ci.pSettings->dwIconFlags) {
+ if (g_Settings->dwIconFlags) {
iIndent += (14 * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
- if (ci.pSettings->ShowTime) {
- int iSize = (ci.pSettings->LogTextIndent * 1440) / ci.logPixelSX;
+ if (g_Settings->ShowTime) {
+ int iSize = (g_Settings->LogTextIndent * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
- if (ci.pSettings->LogIndentEnabled)
+ if (g_Settings->LogIndentEnabled)
iIndent += iSize;
}
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;
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index c34c1064bb..182861b422 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -142,18 +142,18 @@ int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName cli.pfnGetContactDisplayName(hContact, 0));
lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
- pd.iSeconds = ci.pSettings->iPopupTimeout;
+ pd.iSeconds = g_Settings->iPopupTimeout;
- if (ci.pSettings->iPopupStyle == 2) {
+ if (g_Settings->iPopupStyle == 2) {
pd.colorBack = 0;
pd.colorText = 0;
}
- else if (ci.pSettings->iPopupStyle == 3) {
- pd.colorBack = ci.pSettings->crPUBkgColour;
- pd.colorText = ci.pSettings->crPUTextColour;
+ else if (g_Settings->iPopupStyle == 3) {
+ pd.colorBack = g_Settings->crPUBkgColour;
+ pd.colorText = g_Settings->crPUTextColour;
}
else {
- pd.colorBack = ci.pSettings->crLogBackground;
+ pd.colorBack = g_Settings->crLogBackground;
pd.colorText = crBkg;
}
@@ -166,7 +166,7 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) {
int iEvent = gce->pDest->iType;
- if (iEvent&ci.pSettings->dwTrayIconFlags) {
+ if (iEvent&g_Settings->dwTrayIconFlags) {
switch (iEvent) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
@@ -218,7 +218,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) {
int iEvent = gce->pDest->iType;
- if (iEvent & ci.pSettings->dwPopupFlags) {
+ if (iEvent & g_Settings->dwPopupFlags) {
switch (iEvent) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
ShowPopup(si->hContact, si, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, ci.aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
@@ -291,13 +291,13 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (bHighlight) {
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatHighlight");
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
DoTrayIcon(si, gce);
- if (bInactive || !ci.pSettings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->PopupInactiveOnly)
DoPopup(si, gce);
if (ci.OnFlashWindow)
ci.OnFlashWindow(si, bInactive);
@@ -305,40 +305,40 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight }
// do blinking icons in tray
- if (bInactive || !ci.pSettings->TrayIconInactiveOnly)
+ if (bInactive || !g_Settings->TrayIconInactiveOnly)
DoTrayIcon(si, gce);
// stupid thing to not create multiple popups for a QUIT event for instance
if (bManyFix == 0) {
// do popups
- if (bInactive || !ci.pSettings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->PopupInactiveOnly)
DoPopup(si, gce);
// do sounds and flashing
switch (iEvent) {
case GC_EVENT_JOIN:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatJoin");
break;
case GC_EVENT_PART:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatPart");
break;
case GC_EVENT_QUIT:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatQuit");
break;
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatMode");
break;
case GC_EVENT_KICK:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatKick");
break;
case GC_EVENT_MESSAGE:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatMessage");
if (bInactive && !(si->wState & STATE_TALK)) {
@@ -349,19 +349,19 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight ci.OnFlashWindow(si, bInactive);
break;
case GC_EVENT_ACTION:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatAction");
break;
case GC_EVENT_NICK:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatNick");
break;
case GC_EVENT_NOTICE:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatNotice");
break;
case GC_EVENT_TOPIC:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatTopic");
break;
}
@@ -425,8 +425,8 @@ const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
{
- if (ci.pSettings->HighlightEnabled && ci.pSettings->pszHighlightWords && pszText && si->pMe) {
- TCHAR* p1 = ci.pSettings->pszHighlightWords;
+ if (g_Settings->HighlightEnabled && g_Settings->pszHighlightWords && pszText && si->pMe) {
+ TCHAR* p1 = g_Settings->pszHighlightWords;
TCHAR* p2 = NULL;
const TCHAR* p3 = pszText;
static TCHAR szWord1[1000];
@@ -521,7 +521,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) mir_sntprintf(szName, MAX_PATH, _T("%s"), mi->ptszModDispName ? mi->ptszModDispName : (szModName = mir_a2t(si->pszModule)));
mir_free(szModName);
ValidateFilename(szName);
- mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), ci.pSettings->pszLogDir, szName );
+ mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), g_Settings->pszLogDir, szName );
CreateDirectoryTreeT(szFolder);
@@ -529,14 +529,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) ValidateFilename(szName);
mir_sntprintf(szFile, MAX_PATH, _T("%s\\%s"), szFolder, szName );
- lstrcpyn(szTime, MakeTimeStamp(ci.pSettings->pszTimeStampLog, gce->time), 99);
+ lstrcpyn(szTime, MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _tfopen(szFile, _T("at+"));
if (hFile) {
TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
if ( gce->ptszNick ) {
- if ( ci.pSettings->LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
+ if ( g_Settings->LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
lstrcpyn(szTemp2+20, _T("..."), 4);
}
@@ -622,23 +622,23 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) fputs(p, hFile);
mir_free(p);
- if (ci.pSettings->LoggingLimit > 0) {
+ if (g_Settings->LoggingLimit > 0) {
DWORD dwSize;
DWORD trimlimit;
fseek(hFile, 0, SEEK_END);
dwSize = ftell(hFile);
rewind(hFile);
- trimlimit = ci.pSettings->LoggingLimit * 1024 + 1024 * 10;
+ trimlimit = g_Settings->LoggingLimit * 1024 + 1024 * 10;
if (dwSize > trimlimit) {
BYTE * pBuffer = 0;
BYTE * pBufferTemp = 0;
int read = 0;
- pBuffer = (BYTE *)mir_alloc(ci.pSettings->LoggingLimit * 1024 + 1);
- pBuffer[ci.pSettings->LoggingLimit * 1024] = '\0';
- fseek(hFile, -ci.pSettings->LoggingLimit * 1024, SEEK_END);
- read = (int)fread(pBuffer, 1, ci.pSettings->LoggingLimit * 1024, hFile);
+ pBuffer = (BYTE *)mir_alloc(g_Settings->LoggingLimit * 1024 + 1);
+ pBuffer[g_Settings->LoggingLimit * 1024] = '\0';
+ fseek(hFile, -g_Settings->LoggingLimit * 1024, SEEK_END);
+ read = (int)fread(pBuffer, 1, g_Settings->LoggingLimit * 1024, hFile);
fclose(hFile);
hFile = NULL;
@@ -671,7 +671,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) return FALSE;
}
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = ci.SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -691,7 +691,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int return TRUE;
}
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = ci.SM_FindSession(pszID, pszModule);
if (si == NULL)
|