summaryrefslogtreecommitdiff
path: root/src/modules/chat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-19 12:02:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-19 12:02:16 +0000
commit085b45f2920353f055b036c00ebb27fb1b8148e9 (patch)
tree9b172d62bdbc8ac065368dd99d843899d9f10580 /src/modules/chat
parentbd79fceb18897a5cf49ac5175882dcbf03673847 (diff)
boolean field names normalization
git-svn-id: http://svn.miranda-ng.org/main/trunk@7753 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/chat')
-rw-r--r--src/modules/chat/chat_opts.cpp33
-rw-r--r--src/modules/chat/chat_svc.cpp4
-rw-r--r--src/modules/chat/log.cpp16
-rw-r--r--src/modules/chat/manager.cpp2
-rw-r--r--src/modules/chat/tools.cpp32
5 files changed, 44 insertions, 43 deletions
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp
index 68f4710827..5396d94f5b 100644
--- a/src/modules/chat/chat_opts.cpp
+++ b/src/modules/chat/chat_opts.cpp
@@ -189,31 +189,32 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
void LoadGlobalSettings(void)
{
- 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->bLogLimitNames = db_get_b(NULL, "Chat", "bLogLimitNames", 1) != 0;
+ g_Settings->bShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1) != 0;
+ g_Settings->bSoundsFocus = db_get_b(NULL, "Chat", "bSoundsFocus", 0) != 0;
+ g_Settings->bShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0) != 0;
+ g_Settings->bTimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "bTimeStampEventColour", 0) != 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->bLoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "bLoggingEnabled", 0) != 0;
+ g_Settings->bFlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0) != 0;
+ g_Settings->bFlashWindowHighlight = (BOOL)db_get_b(NULL, "Chat", "bFlashWindowHighlight", false) != 0;
+ g_Settings->bHighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "bHighlightEnabled", 1) != 0;
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->bStripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0) != 0;
+ g_Settings->bTrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "bTrayIconInactiveOnly", 1) != 0;
+ g_Settings->bPopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1) != 0;
+ g_Settings->bAddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1) != 0;
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);
+ g_Settings->bShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0) != 0;
+ g_Settings->bContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0) != 0;
LoadColors();
@@ -227,7 +228,7 @@ void LoadGlobalSettings(void)
InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", _T("%m"));
InitSetting(&g_Settings->pszLogDir, "LogDirectory", _T("%miranda_logpath%\\%proto%\\%userid%.log"));
- g_Settings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->bLogIndentEnabled = db_get_b(NULL, "Chat", "bLogIndentEnabled", 1) != 0;
LOGFONT lf;
if (g_Settings->MessageBoxFont)
@@ -266,7 +267,7 @@ static void FreeGlobalSettings(void)
void SetIndentSize()
{
- if (g_Settings->ShowTime) {
+ if (g_Settings->bShowTime) {
LOGFONT lf;
LoadMsgDlgFont(0, &lf, NULL);
HFONT hFont = CreateFontIndirect(&lf);
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp
index 49fa9cebc8..215221b394 100644
--- a/src/modules/chat/chat_svc.cpp
+++ b/src/modules/chat/chat_svc.cpp
@@ -76,7 +76,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam)
LoadLogFonts();
SetIndentSize();
- g_Settings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->bLogIndentEnabled = (db_get_b(NULL, "Chat", "bLogIndentEnabled", 1) != 0) ? TRUE : FALSE;
ci.MM_FontsChanged();
ci.MM_FixColors();
@@ -518,7 +518,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
ci.OnAddLog(si, isOk);
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
ci.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
- if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
ci.LogToFile(si, gce);
}
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp
index 01e2c2c1ef..50aa1d2a2e 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 (g_Settings->StripFormat || streamData->bStripFormat)
+ if (g_Settings->bStripFormat || 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 ( !g_Settings->StripFormat && !streamData->bStripFormat) {
+ if ( !g_Settings->bStripFormat && !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 (g_Settings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
+ if (g_Settings->bLogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
lstrcpyn(szTemp2, streamData->lin->ptszNick, 20);
lstrcpyn(szTemp2 + 20, _T("..."), 4);
}
@@ -356,7 +356,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
bufferEnd += logIconBmpSize[iIndex];
}
- if (g_Settings->TimeStampEventColour) {
+ if (g_Settings->bTimeStampEventColour) {
LOGFONT &lf = ci.aFonts[0].lf;
// colored timestamps
@@ -380,12 +380,12 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
//insert timestamp
- if (g_Settings->ShowTime) {
+ if (g_Settings->bShowTime) {
TCHAR szTimeStamp[30], szOldTimeStamp[30];
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)) {
+ if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
}
@@ -462,10 +462,10 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
iIndent += (14 * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
- if (g_Settings->ShowTime) {
+ if (g_Settings->bShowTime) {
int iSize = (g_Settings->LogTextIndent * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
- if (g_Settings->LogIndentEnabled)
+ if (g_Settings->bLogIndentEnabled)
iIndent += iSize;
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index 1888a097e7..d12f27036b 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -250,7 +250,7 @@ static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
ci.DoSoundsFlashPopupTrayStuff(pTemp, gce, FALSE, bManyFix);
bManyFix++;
- if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->bLoggingEnabled)
ci.LogToFile(pTemp, gce);
}
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp
index e3c43e483d..36e25f3e29 100644
--- a/src/modules/chat/tools.cpp
+++ b/src/modules/chat/tools.cpp
@@ -285,13 +285,13 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
if (bHighlight) {
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatHighlight");
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
ci.DoTrayIcon(si, gce);
- if (bInactive || !g_Settings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->bPopupInactiveOnly)
ci.DoPopup(si, gce);
if (ci.OnFlashWindow)
ci.OnFlashWindow(si, bInactive);
@@ -299,40 +299,40 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
}
// do blinking icons in tray
- if (bInactive || !g_Settings->TrayIconInactiveOnly)
+ if (bInactive || !g_Settings->bTrayIconInactiveOnly)
ci.DoTrayIcon(si, gce);
// stupid thing to not create multiple popups for a QUIT event for instance
if (bManyFix == 0) {
// do popups
- if (bInactive || !g_Settings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->bPopupInactiveOnly)
ci.DoPopup(si, gce);
// do sounds and flashing
switch (iEvent) {
case GC_EVENT_JOIN:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatJoin");
break;
case GC_EVENT_PART:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatPart");
break;
case GC_EVENT_QUIT:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatQuit");
break;
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatMode");
break;
case GC_EVENT_KICK:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatKick");
break;
case GC_EVENT_MESSAGE:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatMessage");
if (bInactive && !(si->wState & STATE_TALK)) {
@@ -343,19 +343,19 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
ci.OnFlashWindow(si, bInactive);
break;
case GC_EVENT_ACTION:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatAction");
break;
case GC_EVENT_NICK:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatNick");
break;
case GC_EVENT_NOTICE:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatNotice");
break;
case GC_EVENT_TOPIC:
- if (bInactive || !g_Settings->SoundsFocus)
+ if (bInactive || !g_Settings->bSoundsFocus)
SkinPlaySound("ChatTopic");
break;
}
@@ -419,7 +419,7 @@ const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
{
- if (!g_Settings->HighlightEnabled || !g_Settings->pszHighlightWords || !gce || !si || !si->pMe)
+ if (!g_Settings->bHighlightEnabled || !g_Settings->pszHighlightWords || !gce || !si || !si->pMe)
return FALSE;
TCHAR *p1 = g_Settings->pszHighlightWords;
@@ -523,7 +523,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
if (gce->ptszNick) {
- if (g_Settings->LogLimitNames && lstrlen(gce->ptszNick) > 20) {
+ if (g_Settings->bLogLimitNames && lstrlen(gce->ptszNick) > 20) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
lstrcpyn(szTemp2 + 20, _T("..."), 4);
}