summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat/log.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-02-21 21:19:12 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-02-21 21:19:12 +0000
commitb84f891f0dac03a170637a1cf54bd1e25a87eb1f (patch)
tree36c797c65524fa2d4a1ae71921a1b987063f7403 /plugins/TabSRMM/src/chat/log.cpp
parent4ba2455da24ecbe9f0c623945e7add2696cdc81b (diff)
code formatting
git-svn-id: http://svn.miranda-ng.org/main/trunk@12236 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat/log.cpp')
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp541
1 files changed, 273 insertions, 268 deletions
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index b81df0ce41..7582af711f 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -42,279 +42,279 @@ static char *szDivider = "\\strike----------------------------------------------
/*
static char* u2a( const wchar_t* src, int codepage ) {
- int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
- char* result = ( char* )mir_alloc( cbLen+1 );
- if ( result == NULL )
- return NULL;
-
- WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
- result[ cbLen ] = 0;
- return result;
+int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
+char* result = ( char* )mir_alloc( cbLen+1 );
+if ( result == NULL )
+return NULL;
+
+WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
+result[ cbLen ] = 0;
+return result;
}
static char* t2acp( const TCHAR* src, int codepage ) {
- return u2a( src, codepage );
+return u2a( src, codepage );
}
static TCHAR *a2tcp(const char *text, int cp) {
- if ( text != NULL ) {
- int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
- TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
- if ( result == NULL )
- return NULL;
- MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
- return result;
- }
- return NULL;
+if ( text != NULL ) {
+int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
+TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
+if ( result == NULL )
+return NULL;
+MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
+return result;
+}
+return NULL;
}
static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR **buffer, int *cbBufferEnd, int *cbBufferAlloced, const TCHAR *fmt, ...)
{
- va_list va;
- int lineLen, textCharsCount=0;
- TCHAR* line = (TCHAR*)_alloca( 8001 * sizeof(TCHAR));
- TCHAR* d;
- MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
-
- va_start(va, fmt);
- lineLen = mir_vsntprintf( line, 8000, fmt, va);
- if (lineLen < 0)
- return 0;
- line[lineLen] = 0;
- va_end(va);
- lineLen = lineLen*9 + 8;
- if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
- cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
- *buffer = (TCHAR*) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR));
- }
-
- d = *buffer + *cbBufferEnd;
-
- for (; *line; line++, textCharsCount++) {
- if (*line == '%' && !simpleMode ) {
- TCHAR szTemp[200];
-
- szTemp[0] = '\0';
- switch ( *++line ) {
- case '\0':
- case '%':
- *d++ = '%';
- break;
+va_list va;
+int lineLen, textCharsCount=0;
+TCHAR* line = (TCHAR*)_alloca( 8001 * sizeof(TCHAR));
+TCHAR* d;
+MODULEINFO *mi = pci->MM_FindModule(streamData->si->pszModule);
+
+va_start(va, fmt);
+lineLen = mir_vsntprintf( line, 8000, fmt, va);
+if (lineLen < 0)
+return 0;
+line[lineLen] = 0;
+va_end(va);
+lineLen = lineLen*9 + 8;
+if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
+cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
+*buffer = (TCHAR*) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR));
+}
- case 'c':
- case 'f':
- if (!g_Settings.bStripFormat && !streamData->bStripFormat) {
- if ( line[1] != '\0' && line[2] != '\0') {
- TCHAR szTemp3[3], c = *line;
- int col;
- szTemp3[0] = line[1];
- szTemp3[1] = line[2];
- szTemp3[2] = '\0';
- col = _ttoi(szTemp3);
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c#%02X%02X%02X"), c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
- }
- }
- line += 2;
- break;
- case 'C':
- case 'F':
- if ( !g_Settings.bStripFormat && !streamData->bStripFormat) {
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
- }
- break;
- case 'b':
- case 'u':
- case 'i':
- case 'B':
- case 'U':
- case 'I':
- case 'r':
- if ( !streamData->bStripFormat ) {
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
- }
- break;
- }
+d = *buffer + *cbBufferEnd;
+
+for (; *line; line++, textCharsCount++) {
+if (*line == '%' && !simpleMode ) {
+TCHAR szTemp[200];
+
+szTemp[0] = '\0';
+switch ( *++line ) {
+case '\0':
+case '%':
+*d++ = '%';
+break;
+
+case 'c':
+case 'f':
+if (!g_Settings.bStripFormat && !streamData->bStripFormat) {
+if ( line[1] != '\0' && line[2] != '\0') {
+TCHAR szTemp3[3], c = *line;
+int col;
+szTemp3[0] = line[1];
+szTemp3[1] = line[2];
+szTemp3[2] = '\0';
+col = _ttoi(szTemp3);
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c#%02X%02X%02X"), c, GetRValue(mi->crColors[col]), GetGValue(mi->crColors[col]), GetBValue(mi->crColors[col]));
+}
+}
+line += 2;
+break;
+case 'C':
+case 'F':
+if ( !g_Settings.bStripFormat && !streamData->bStripFormat) {
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
+}
+break;
+case 'b':
+case 'u':
+case 'i':
+case 'B':
+case 'U':
+case 'I':
+case 'r':
+if ( !streamData->bStripFormat ) {
+mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%%%c"), *line );
+}
+break;
+}
- if ( szTemp[0] ) {
- size_t iLen = mir_tstrlen(szTemp);
- memcpy( d, szTemp, iLen * sizeof(TCHAR));
- d += iLen;
- }
- }
- else if (*line == '%') {
- *d++ = '%';
- *d++ = (char) *line;
- }
- else {
- *d++ = (TCHAR) *line;
- }
- }
- *d = '\0';
- *cbBufferEnd = (int) (d - *buffer);
- return textCharsCount;
+if ( szTemp[0] ) {
+size_t iLen = mir_tstrlen(szTemp);
+memcpy( d, szTemp, iLen * sizeof(TCHAR));
+d += iLen;
+}
+}
+else if (*line == '%') {
+*d++ = '%';
+*d++ = (char) *line;
+}
+else {
+*d++ = (TCHAR) *line;
+}
+}
+*d = '\0';
+*cbBufferEnd = (int) (d - *buffer);
+return textCharsCount;
}
static void AddEventTextToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAlloced, LOGSTREAMDATA *streamData)
{
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T(": %s"), streamData->lin->ptszText);
}
static void AddEventToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAlloced, LOGSTREAMDATA *streamData, TCHAR *pszNick)
{
- if ( streamData && streamData->lin ) {
- switch ( streamData->lin->iType ) {
- case GC_EVENT_MESSAGE:
- if ( streamData->lin->ptszText ) {
- TCHAR *ptszTemp = NULL;
- TCHAR *ptszText = streamData->lin->ptszText;
- if (streamData->dat->codePage != CP_ACP) {
- char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
- ptszText = ptszTemp = a2tcp(aText, streamData->dat->codePage);
- mir_free(aText);
- }
- Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
- mir_free(ptszTemp);
- }
- break;
- case GC_EVENT_ACTION:
- if ( pszNick && streamData->lin->ptszText) {
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_JOIN:
- if (pszNick) {
- if (!streamData->lin->bIsMe)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
- else
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
- }
- break;
- case GC_EVENT_PART:
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_QUIT:
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_NICK:
- if (pszNick && streamData->lin->ptszText) {
- if (!streamData->lin->bIsMe)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
- else
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You are now known as %s"), streamData->lin->ptszText);
- }
- break;
- case GC_EVENT_KICK:
- if (pszNick && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s kicked %s"), streamData->lin->ptszStatus, streamData->lin->ptszNick);
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- break;
- case GC_EVENT_NOTICE:
- if (pszNick && streamData->lin->ptszText) {
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s"), pszNick );
- AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
- }
- break;
- case GC_EVENT_TOPIC:
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is '%s%s'"), streamData->lin->ptszText, _T("%r"));
- if (pszNick)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
- streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)"): TranslateT(" (set by %s)"),
- pszNick, streamData->lin->ptszUserInfo);
- break;
- case GC_EVENT_INFORMATION:
- if (streamData->lin->ptszText)
- Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, (streamData->lin->bIsMe) ? _T("--> %s") : _T("%s"), streamData->lin->ptszText);
- break;
- case GC_EVENT_ADDSTATUS:
- if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s enables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
- break;
- case GC_EVENT_REMOVESTATUS:
- if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables '%s' status for %s"), streamData->lin->ptszText , streamData->lin->ptszStatus, streamData->lin->ptszNick);
- break;
- }
- }
+if ( streamData && streamData->lin ) {
+switch ( streamData->lin->iType ) {
+case GC_EVENT_MESSAGE:
+if ( streamData->lin->ptszText ) {
+TCHAR *ptszTemp = NULL;
+TCHAR *ptszText = streamData->lin->ptszText;
+if (streamData->dat->codePage != CP_ACP) {
+char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
+ptszText = ptszTemp = a2tcp(aText, streamData->dat->codePage);
+mir_free(aText);
+}
+Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
+mir_free(ptszTemp);
+}
+break;
+case GC_EVENT_ACTION:
+if ( pszNick && streamData->lin->ptszText) {
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
+}
+break;
+case GC_EVENT_JOIN:
+if (pszNick) {
+if (!streamData->lin->bIsMe)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
+else
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
+}
+break;
+case GC_EVENT_PART:
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has left"), pszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_QUIT:
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has disconnected"), pszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_NICK:
+if (pszNick && streamData->lin->ptszText) {
+if (!streamData->lin->bIsMe)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s is now known as %s"), pszNick, streamData->lin->ptszText);
+else
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You are now known as %s"), streamData->lin->ptszText);
+}
+break;
+case GC_EVENT_KICK:
+if (pszNick && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s kicked %s"), streamData->lin->ptszStatus, streamData->lin->ptszNick);
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+break;
+case GC_EVENT_NOTICE:
+if (pszNick && streamData->lin->ptszText) {
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s"), pszNick );
+AddEventTextToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData);
+}
+break;
+case GC_EVENT_TOPIC:
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is '%s%s'"), streamData->lin->ptszText, _T("%r"));
+if (pszNick)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
+streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)"): TranslateT(" (set by %s)"),
+pszNick, streamData->lin->ptszUserInfo);
+break;
+case GC_EVENT_INFORMATION:
+if (streamData->lin->ptszText)
+Log_AppendIEView(streamData, FALSE, buffer, bufferEnd, bufferAlloced, (streamData->lin->bIsMe) ? _T("--> %s") : _T("%s"), streamData->lin->ptszText);
+break;
+case GC_EVENT_ADDSTATUS:
+if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s enables '%s' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
+break;
+case GC_EVENT_REMOVESTATUS:
+if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
+Log_AppendIEView(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables '%s' status for %s"), streamData->lin->ptszText , streamData->lin->ptszStatus, streamData->lin->ptszNick);
+break;
+}
+}
}
static void LogEventIEView(LOGSTREAMDATA *streamData, TCHAR *ptszNick)
{
- TCHAR *buffer = NULL;
- int bufferEnd = 0;
- int bufferAlloced = 0;
- IEVIEWEVENTDATA ied;
- IEVIEWEVENT event;
- memset(&event, 0, sizeof(event));
- event.cbSize = sizeof(event);
- event.dwFlags = 0;
- event.hwnd = streamData->dat->hwndIEView ? streamData->dat->hwndIEView : streamData->dat->hwndHPP;
- event.hContact = streamData->dat->hContact;
- event.codepage = streamData->dat->codePage;
- event.pszProto = streamData->si->pszModule;
- event.iType = IEE_LOG_MEM_EVENTS;
- event.eventData = &ied;
- event.count = 1;
-
- memset(&ied, 0, sizeof(ied));
- AddEventToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData, ptszNick);
- ied.ptszNick = ptszNick;
- ied.ptszText = buffer;
- ied.time = streamData->lin->time;
- ied.bIsMe = streamData->lin->bIsMe;
-
- switch ( streamData->lin->iType ) {
- case GC_EVENT_MESSAGE:
- ied.iType = IEED_GC_EVENT_MESSAGE;
- ied.dwData = IEEDD_GC_SHOW_NICK;
- break;
- case GC_EVENT_ACTION:
- ied.iType = IEED_GC_EVENT_ACTION;
- break;
- case GC_EVENT_JOIN:
- ied.iType = IEED_GC_EVENT_JOIN;
- break;
- case GC_EVENT_PART:
- ied.iType = IEED_GC_EVENT_PART;
- break;
- case GC_EVENT_QUIT:
- ied.iType = IEED_GC_EVENT_QUIT;
- break;
- case GC_EVENT_NICK:
- ied.iType = IEED_GC_EVENT_NICK;
- break;
- case GC_EVENT_KICK:
- ied.iType = IEED_GC_EVENT_KICK;
- break;
- case GC_EVENT_NOTICE:
- ied.iType = IEED_GC_EVENT_NOTICE;
- break;
- case GC_EVENT_TOPIC:
- ied.iType = IEED_GC_EVENT_TOPIC;
- break;
- case GC_EVENT_INFORMATION:
- ied.iType = IEED_GC_EVENT_INFORMATION;
- break;
- case GC_EVENT_ADDSTATUS:
- ied.iType = IEED_GC_EVENT_ADDSTATUS;
- break;
- case GC_EVENT_REMOVESTATUS:
- ied.iType = IEED_GC_EVENT_REMOVESTATUS;
- break;
- }
- ied.dwData |= g_Settings.bShowTime ? IEEDD_GC_SHOW_TIME : 0;
- ied.dwData |= IEEDD_GC_SHOW_ICON;
- ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
- ied.next = NULL;
- CallService(streamData->dat->hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event);
- mir_free(buffer);
+TCHAR *buffer = NULL;
+int bufferEnd = 0;
+int bufferAlloced = 0;
+IEVIEWEVENTDATA ied;
+IEVIEWEVENT event;
+memset(&event, 0, sizeof(event));
+event.cbSize = sizeof(event);
+event.dwFlags = 0;
+event.hwnd = streamData->dat->hwndIEView ? streamData->dat->hwndIEView : streamData->dat->hwndHPP;
+event.hContact = streamData->dat->hContact;
+event.codepage = streamData->dat->codePage;
+event.pszProto = streamData->si->pszModule;
+event.iType = IEE_LOG_MEM_EVENTS;
+event.eventData = &ied;
+event.count = 1;
+
+memset(&ied, 0, sizeof(ied));
+AddEventToBufferIEView(buffer, bufferEnd, bufferAlloced, streamData, ptszNick);
+ied.ptszNick = ptszNick;
+ied.ptszText = buffer;
+ied.time = streamData->lin->time;
+ied.bIsMe = streamData->lin->bIsMe;
+
+switch ( streamData->lin->iType ) {
+case GC_EVENT_MESSAGE:
+ied.iType = IEED_GC_EVENT_MESSAGE;
+ied.dwData = IEEDD_GC_SHOW_NICK;
+break;
+case GC_EVENT_ACTION:
+ied.iType = IEED_GC_EVENT_ACTION;
+break;
+case GC_EVENT_JOIN:
+ied.iType = IEED_GC_EVENT_JOIN;
+break;
+case GC_EVENT_PART:
+ied.iType = IEED_GC_EVENT_PART;
+break;
+case GC_EVENT_QUIT:
+ied.iType = IEED_GC_EVENT_QUIT;
+break;
+case GC_EVENT_NICK:
+ied.iType = IEED_GC_EVENT_NICK;
+break;
+case GC_EVENT_KICK:
+ied.iType = IEED_GC_EVENT_KICK;
+break;
+case GC_EVENT_NOTICE:
+ied.iType = IEED_GC_EVENT_NOTICE;
+break;
+case GC_EVENT_TOPIC:
+ied.iType = IEED_GC_EVENT_TOPIC;
+break;
+case GC_EVENT_INFORMATION:
+ied.iType = IEED_GC_EVENT_INFORMATION;
+break;
+case GC_EVENT_ADDSTATUS:
+ied.iType = IEED_GC_EVENT_ADDSTATUS;
+break;
+case GC_EVENT_REMOVESTATUS:
+ied.iType = IEED_GC_EVENT_REMOVESTATUS;
+break;
+}
+ied.dwData |= g_Settings.bShowTime ? IEEDD_GC_SHOW_TIME : 0;
+ied.dwData |= IEEDD_GC_SHOW_ICON;
+ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
+ied.next = NULL;
+CallService(streamData->dat->hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event);
+mir_free(buffer);
}
*/
@@ -432,10 +432,10 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r
lPtrn = mir_tstrlen(ptrn);
lRplc = mir_tstrlen(rplc);
if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */
- (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
- (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
- (tszTail = (TCHAR*) mir_alloc(sizeof(TCHAR) *
- (lSrc - (tszFound - src) - lPtrn + 1))) != NULL) {
+ (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
+ (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
+ (tszTail = (TCHAR*)mir_alloc(sizeof(TCHAR) *
+ (lSrc - (tszFound - src) - lPtrn + 1))) != NULL) {
/* save tail */
_tcscpy(tszTail, tszFound + lPtrn);
/* write replacement string */
@@ -491,10 +491,12 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
memcpy(d, "\\par ", 5);
line++;
d += 5;
- } else if (*line == '\n') {
+ }
+ else if (*line == '\n') {
memcpy(d, "\\line ", 6);
d += 6;
- } else if (*line == '%' && !simpleMode) {
+ }
+ else if (*line == '%' && !simpleMode) {
char szTemp[200]; szTemp[0] = '\0';
switch (*++line) {
case '\0':
@@ -558,16 +560,19 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
memcpy(d, szTemp, iLen);
d += iLen;
}
- } else if (*line == '\t' && !streamData->bStripFormat) {
+ }
+ else if (*line == '\t' && !streamData->bStripFormat) {
memcpy(d, "\\tab ", 5);
d += 5;
- } else if ((*line == '\\' || *line == '{' || *line == '}') && !streamData->bStripFormat) {
+ }
+ else if ((*line == '\\' || *line == '{' || *line == '}') && !streamData->bStripFormat) {
*d++ = '\\';
- *d++ = (char) * line;
- } else if (*line > 0 && *line < 128) {
- *d++ = (char) * line;
+ *d++ = (char)* line;
+ }
+ else if (*line > 0 && *line < 128) {
+ *d++ = (char)* line;
}
- else d += sprintf(d, "\\u%u ?", (WORD) * line); //!!!!!!!!!
+ else d += sprintf(d, "\\u%u ?", (WORD)* line); //!!!!!!!!!
}
cbBufferEnd = (int)(d - buffer);
@@ -619,7 +624,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
if (pszNick) {
if (!streamData->lin->bIsMe)
/* replace nick of a newcomer with a link */
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s has joined"), pszNick);
else
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("You have joined %s"), streamData->si->ptszName);
}
@@ -681,7 +686,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
if (pszNick && streamData->lin->ptszText && streamData->lin->ptszStatus) {
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
TranslateT("%s disables '%s' status for %s"),
- streamData->lin->ptszText , streamData->lin->ptszStatus, pszNick);
+ streamData->lin->ptszText, streamData->lin->ptszStatus, pszNick);
}
break;
}
@@ -808,7 +813,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
Log_Append(buffer, bufferEnd, bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < (pci->logIconBmpSize[0] + 20))
bufferAlloced += 4096;
- buffer = (char *) mir_realloc(buffer, bufferAlloced);
+ buffer = (char *)mir_realloc(buffer, bufferAlloced);
memcpy(buffer + bufferEnd, pci->pLogIconBmpBits[iIndex], pci->logIconBmpSize[iIndex]);
bufferEnd += pci->logIconBmpSize[iIndex];
}
@@ -821,13 +826,13 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
- iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0,F.lfItalic,F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
else {
iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\ul%d\\fs%u",
- iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic,F.lfUnderline ,2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
+ iii + 1, F.lfWeight >= FW_BOLD ? 1 : 0, F.lfItalic, F.lfUnderline, 2 * abs(F.lfHeight) * 74 / pci->logPixelSY);
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", szStyle);
}
}
@@ -926,10 +931,10 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw)
{
CHARRANGE oldsel, sel, newsel;
- POINT point = {0};
+ POINT point = { 0 };
TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (hwndDlg == 0 || lin == 0 || si == 0 || dat == 0)
@@ -952,7 +957,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr
EDITSTREAM stream = { 0 };
stream.pfnCallback = Log_StreamCallback;
- stream.dwCookie = (DWORD_PTR) & streamData;
+ stream.dwCookie = (DWORD_PTR)& streamData;
SCROLLINFO scroll = { 0 };
scroll.cbSize = sizeof(SCROLLINFO);