diff options
author | George Hazan <george.hazan@gmail.com> | 2014-12-01 22:08:23 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-12-01 22:08:23 +0000 |
commit | c5b2c7be9f6e35e739ad2aeb5e6d8447bd449a60 (patch) | |
tree | b4afec6413d9fa3ef932f9ee3f904114bcf876a3 /src/modules | |
parent | a4570b58a7efb3b61db6d03b86d51d7be85a5f03 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@11205 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/chat/log.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index 11e990b27f..153e01e7cd 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -323,19 +323,17 @@ TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time) char* Log_CreateRTF(LOGSTREAMDATA *streamData)
{
- char *buffer, *header;
- int bufferAlloced, bufferEnd, me = 0;
LOGINFO *lin = streamData->lin;
MODULEINFO *mi = ci.MM_FindModule(streamData->si->pszModule);
// guesstimate amount of memory for the RTF
- bufferEnd = 0;
- bufferAlloced = streamData->bRedraw ? 1024 * (streamData->si->iEventCount + 2) : 2048;
- buffer = (char *)mir_alloc(bufferAlloced);
+ int bufferEnd = 0;
+ int bufferAlloced = streamData->bRedraw ? 1024 * (streamData->si->iEventCount + 2) : 2048;
+ char *buffer = (char *)mir_alloc(bufferAlloced);
buffer[0] = '\0';
// ### RTF HEADER
- header = mi->pszHeader;
+ char *header = mi->pszHeader;
if (header)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, header);
@@ -344,7 +342,9 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) // filter
if ((streamData->si->iType != GCW_CHATROOM && streamData->si->iType != GCW_PRIVMESS) || !streamData->si->bFilterEnabled || (streamData->si->iLogFilterFlags&lin->iType) != 0) {
// create new line, and set font and color
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\par%s ", Log_SetStyle(0));
+ if (lin->next != NULL)
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\par ");
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0));
// Insert icon
if ((lin->iType & g_Settings->dwIconFlags) || lin->bIsHighlighted && (g_Settings->dwIconFlags & GC_EVENT_HIGHLIGHT)) {
@@ -362,23 +362,21 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) // colored timestamps
static char szStyle[256];
- int iii;
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
- iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
+ int iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
else {
- iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
+ int iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
}
else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0));
- // insert a TAB if necessary to put the timestamp in the right position
if (g_Settings->dwIconFlags)
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, " ");
//insert timestamp
if (g_Settings->bShowTime) {
@@ -390,7 +388,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
}
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
+ Log_Append(&buffer, &bufferEnd, &bufferAlloced, " ");
}
// Insert the nick
|