summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/msglog.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-29 18:42:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-29 18:42:56 +0000
commit38200b7236c5c290d75a36cb431c78beeb98dbbd (patch)
treeaa812c68e65d25d813c337dd4dc46eea320a93f8 /plugins/TabSRMM/src/msglog.cpp
parent4cf90b042594f1a40a123f082ab3f3c37b40ee01 (diff)
code cleaning towards smiley drawing
git-svn-id: http://svn.miranda-ng.org/main/trunk@10336 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/msglog.cpp')
-rw-r--r--plugins/TabSRMM/src/msglog.cpp522
1 files changed, 251 insertions, 271 deletions
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 5ffcf79407..7b4a7312b3 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -60,9 +60,6 @@ wchar_t* months[12] =
LPGENT("July"), LPGENT("August"), LPGENT("September"), LPGENT("October"), LPGENT("November"), LPGENT("December")
};
-static TCHAR *Template_MakeRelativeDate(TWindowData *dat, HANDLE hTimeZone, time_t check, int groupBreak, TCHAR code);
-static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent);
-
static time_t today;
int g_groupBreak = TRUE;
@@ -124,7 +121,7 @@ static void TrimMessage(TCHAR *msg)
i--;
}
if (i < iLen)
- msg[i+1] = '\0';
+ msg[i + 1] = '\0';
}
void TSAPI CacheLogFonts()
@@ -135,9 +132,9 @@ void TSAPI CacheLogFonts()
ReleaseDC(NULL, hdc);
ZeroMemory(logfonts, sizeof(LOGFONTA) * MSGDLGFONTCOUNT + 2);
- for (i=0; i < MSGDLGFONTCOUNT; i++) {
+ for (i = 0; i < MSGDLGFONTCOUNT; i++) {
LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE);
- mir_snprintf(rtfFontsGlobal[i], SIZEOF(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic,logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY);
+ mir_snprintf(rtfFontsGlobal[i], SIZEOF(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic, logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY);
}
mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], SIZEOF(rtfFontsGlobal[MSGDLGFONTCOUNT]), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0);
@@ -152,7 +149,7 @@ void TSAPI CacheLogFonts()
COLORREF clr;
LOGFONTA lf;
- for (i=0; i < IPFONTCOUNT; i++) {
+ for (i = 0; i < IPFONTCOUNT; i++) {
if (CInfoPanel::m_ipConfig.hFonts[i])
DeleteObject(CInfoPanel::m_ipConfig.hFonts[i]);
LoadLogfont(i + 100, &lf, &clr, FONTMODULE);
@@ -185,7 +182,7 @@ void TSAPI CacheLogFonts()
void FreeLogFonts()
{
- for (int i=0; i < IPFONTCOUNT; i++)
+ for (int i = 0; i < IPFONTCOUNT; i++)
if (CInfoPanel::m_ipConfig.hFonts[i])
DeleteObject(CInfoPanel::m_ipConfig.hFonts[i]);
}
@@ -232,7 +229,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA
int lineLen = (int)(wcslen(line)) * 9 + 8;
if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
cbBufferAlloced[0] += (lineLen + 1024UL - lineLen % 1024UL);
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char*)mir_realloc(*buffer, *cbBufferAlloced);
}
char *d = *buffer + *cbBufferEnd;
@@ -333,7 +330,7 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int
if (charsDone >= 0)
break;
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
va_end(va);
*cbBufferEnd += charsDone;
@@ -349,39 +346,38 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int
if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
switch (tag) {
- case 'b':
- CopyMemory(*buffer + i, begin ? "\\b1 " : "\\b0 ", 4);
- continue;
- case 'i':
- CopyMemory(*buffer + i, begin ? "\\i1 " : "\\i0 ", 4);
- continue;
- case 'u':
- MoveMemory(*buffer + i + 2, *buffer + i + 1, *cbBufferEnd - i);
- CopyMemory(*buffer + i, begin ? "\\ul1 " : "\\ul0 ", 5);
- *cbBufferEnd += 1;
- continue;
- case 's':
- *cbBufferAlloced += 20;
- *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
- MoveMemory(*buffer + i + 6, *buffer + i + 1, (*cbBufferEnd - i) + 1);
- CopyMemory(*buffer + i, begin ? "\\strike1 " : "\\strike0 ", begin ? 9 : 9);
- *cbBufferEnd += 5;
- continue;
- case 'c':
- begin = (code == 'x');
- CopyMemory(*buffer + i, "\\cf", 3);
- if (begin) {
- } else {
- char szTemp[10];
- int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0))));
- mir_snprintf(szTemp, 4, "%02d", colindex);
- (*buffer)[i + 3] = szTemp[0];
- (*buffer)[i + 4] = szTemp[1];
- }
- continue;
+ case 'b':
+ CopyMemory(*buffer + i, begin ? "\\b1 " : "\\b0 ", 4);
+ continue;
+ case 'i':
+ CopyMemory(*buffer + i, begin ? "\\i1 " : "\\i0 ", 4);
+ continue;
+ case 'u':
+ MoveMemory(*buffer + i + 2, *buffer + i + 1, *cbBufferEnd - i);
+ CopyMemory(*buffer + i, begin ? "\\ul1 " : "\\ul0 ", 5);
+ *cbBufferEnd += 1;
+ continue;
+ case 's':
+ *cbBufferAlloced += 20;
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
+ MoveMemory(*buffer + i + 6, *buffer + i + 1, (*cbBufferEnd - i) + 1);
+ CopyMemory(*buffer + i, begin ? "\\strike1 " : "\\strike0 ", begin ? 9 : 9);
+ *cbBufferEnd += 5;
+ continue;
+ case 'c':
+ begin = (code == 'x');
+ CopyMemory(*buffer + i, "\\cf", 3);
+ if (!begin) {
+ char szTemp[10];
+ int colindex = GetColorIndex(GetRTFFont(LOWORD(mode) ? (MSGFONTID_MYMSG + (HIWORD(mode) ? 8 : 0)) : (MSGFONTID_YOURMSG + (HIWORD(mode) ? 8 : 0))));
+ mir_snprintf(szTemp, 4, "%02d", colindex);
+ (*buffer)[i + 3] = szTemp[0];
+ (*buffer)[i + 4] = szTemp[1];
+ }
+ continue;
}
}
}
@@ -390,31 +386,34 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int
if ((*buffer)[i] == '\r' && (*buffer)[i + 1] == '\n') {
if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 6, *buffer + i + 2, *cbBufferEnd - i - 1);
CopyMemory(*buffer + i, "\\line ", 6);
*cbBufferEnd += 4;
- } else if ((*buffer)[i] == '\n') {
+ }
+ else if ((*buffer)[i] == '\n') {
if (*cbBufferEnd + 6 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 6, *buffer + i + 1, *cbBufferEnd - i);
CopyMemory(*buffer + i, "\\line ", 6);
*cbBufferEnd += 5;
- } else if ((*buffer)[i] == '\t') {
+ }
+ else if ((*buffer)[i] == '\t') {
if (*cbBufferEnd + 5 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 5, *buffer + i + 1, *cbBufferEnd - i);
CopyMemory(*buffer + i, "\\tab ", 5);
*cbBufferEnd += 4;
- } else if ((*buffer)[i] == '\\' || (*buffer)[i] == '{' || (*buffer)[i] == '}') {
+ }
+ else if ((*buffer)[i] == '\\' || (*buffer)[i] == '{' || (*buffer)[i] == '}') {
if (*cbBufferEnd + 2 > *cbBufferAlloced) {
*cbBufferAlloced += 1024;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
MoveMemory(*buffer + i + 1, *buffer + i, *cbBufferEnd - i + 1);
(*buffer)[i] = '\\';
@@ -427,11 +426,10 @@ static int AppendToBufferWithRTF(int mode, char **buffer, int *cbBufferEnd, int
static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced, TWindowData *dat)
{
- COLORREF colour;
- int i;
- char szTemp[30];
- LOGFONTA* logFonts = dat->pContainer->theme.logFonts;
- COLORREF* fontColors = dat->pContainer->theme.fontColors;
+ int i;
+ char szTemp[30];
+ LOGFONTA *logFonts = dat->pContainer->theme.logFonts;
+ COLORREF *fontColors = dat->pContainer->theme.fontColors;
TLogTheme *theme = &dat->pContainer->theme;
// rtl
@@ -440,20 +438,18 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced,
else
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "{\\rtf1\\ansi\\deff0{\\fonttbl");
- for (i=0; i < MSGDLGFONTCOUNT; i++)
+ for (i = 0; i < MSGDLGFONTCOUNT; i++)
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "{\\f%u\\fnil\\fcharset%u %s;}", i, logFonts[i].lfCharSet, logFonts[i].lfFaceName);
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "{\\f%u\\fnil\\fcharset%u %s;}", MSGDLGFONTCOUNT, logFonts[i].lfCharSet, "Arial");
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "}{\\colortbl ");
- for (i=0; i < MSGDLGFONTCOUNT; i++)
+ for (i = 0; i < MSGDLGFONTCOUNT; i++)
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(fontColors[i]), GetGValue(fontColors[i]), GetBValue(fontColors[i]));
- if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL)
- colour = RGB(0, 0, 255);
- else
- colour = GetSysColor(COLOR_HOTLIGHT);
+
+ COLORREF colour = (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) ? RGB(0, 0, 255) : GetSysColor(COLOR_HOTLIGHT);
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
- /* OnO: Create incoming and outcoming colours */
+ // OnO: Create incoming and outcoming colours
colour = theme->inbg;
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
colour = theme->outbg;
@@ -470,7 +466,6 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced,
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
// custom template colors...
-
for (i = 1; i <= 5; i++) {
mir_snprintf(szTemp, 10, "cc%d", i);
colour = theme->custom_colors[i - 1];
@@ -480,31 +475,25 @@ static void Build_RTF_Header(char **buffer, int *bufferEnd, int *bufferAlloced,
}
// bbcode colors...
-
- for (i=0; i < Utils::rtf_ctable_size; i++)
+ for (i = 0; i < Utils::rtf_ctable_size; i++)
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(Utils::rtf_ctable[i].clr), GetGValue(Utils::rtf_ctable[i].clr), GetBValue(Utils::rtf_ctable[i].clr));
- /*
- * paragraph header
- */
+ // paragraph header
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "}");
- /*
- * indent:
- * real indent is set in msgdialog.c (DM_OPTIONSAPPLIED)
- */
-
+ // indent:
+ // real indent is set in msgdialog.c (DM_OPTIONSAPPLIED)
if (!(dat->dwFlags & MWF_LOG_INDENT))
- AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\li%u\\ri%u\\fi%u\\tx%u", 2*15, 2*15, 0, 70 * 15);
+ AppendToBuffer(buffer, bufferEnd, bufferAlloced, "\\li%u\\ri%u\\fi%u\\tx%u", 2 * 15, 2 * 15, 0, 70 * 15);
}
-//mir_free() the return value
-static char *CreateRTFHeader(TWindowData *dat)
+// mir_free() the return value
+static char* CreateRTFHeader(TWindowData *dat)
{
int bufferEnd = 0;
int bufferAlloced = 1024;
- char *buffer = (char *) mir_alloc(bufferAlloced);
+ char *buffer = (char*)mir_alloc(bufferAlloced);
buffer[0] = '\0';
Build_RTF_Header(&buffer, &bufferEnd, &bufferAlloced, dat);
@@ -512,17 +501,41 @@ static char *CreateRTFHeader(TWindowData *dat)
}
static void AppendTimeStamp(TCHAR *szFinalTimestamp, int isSent, char **buffer, int *bufferEnd, int *bufferAlloced, int skipFont,
- TWindowData *dat, int iFontIDOffset)
+ TWindowData *dat, int iFontIDOffset)
{
if (skipFont)
- AppendUnicodeToBuffer(buffer, bufferEnd, bufferAlloced, szFinalTimestamp, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(buffer, bufferEnd, bufferAlloced, szFinalTimestamp, MAKELONG(isSent, dat->bIsHistory));
else {
AppendToBuffer(buffer, bufferEnd, bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYTIME + iFontIDOffset : MSGFONTID_YOURTIME + iFontIDOffset));
- AppendUnicodeToBuffer(buffer, bufferEnd, bufferAlloced, szFinalTimestamp, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(buffer, bufferEnd, bufferAlloced, szFinalTimestamp, MAKELONG(isSent, dat->bIsHistory));
}
}
-//mir_free() the return value
+static TCHAR* Template_MakeRelativeDate(TWindowData *dat, HANDLE hTimeZone, time_t check, int groupBreak, TCHAR code)
+{
+ static TCHAR szResult[100];
+ const TCHAR *szFormat;
+
+ if ((code == (TCHAR)'R' || code == (TCHAR)'r') && check >= today)
+ _tcscpy(szResult, szToday);
+ else if ((code == (TCHAR)'R' || code == (TCHAR)'r') && check > (today - 86400))
+ _tcscpy(szResult, szYesterday);
+ else {
+ if (code == 'D' || code == 'R')
+ szFormat = _T("D");
+ else if (code == 'T')
+ szFormat = _T("s");
+ else if (code == 't')
+ szFormat = _T("t");
+ else
+ szFormat = _T("d");
+
+ tmi.printTimeStamp(hTimeZone, check, szFormat, szResult, SIZEOF(szResult), 0);
+ }
+ return szResult;
+}
+
+// mir_free() the return value
static char *CreateRTFTail(TWindowData *dat)
{
char *buffer;
@@ -530,7 +543,7 @@ static char *CreateRTFTail(TWindowData *dat)
bufferEnd = 0;
bufferAlloced = 1024;
- buffer = (char *) mir_alloc(bufferAlloced);
+ buffer = (char *)mir_alloc(bufferAlloced);
buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}");
return buffer;
@@ -572,7 +585,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
mir_free(buffer);
return NULL;
}
- dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob);
+ dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
db_event_get(hDbEvent, &dbei);
if (!DbEventIsShown(dat, &dbei)) {
mir_free(dbei.pBlob);
@@ -582,7 +595,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
}
if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.markedRead())
- dat->cache->updateStats(TSessionStats::SET_LAST_RCV, lstrlenA((char *) dbei.pBlob));
+ dat->cache->updateStats(TSessionStats::SET_LAST_RCV, lstrlenA((char *)dbei.pBlob));
TCHAR *formatted = NULL;
if (rtfMessage == NULL) {
@@ -612,8 +625,8 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
DWORD dwEffectiveFlags = dat->dwFlags;
- dat->isHistory = (dbei.timestamp < dat->cache->getSessionStart() && dbei.markedRead());
- int iFontIDOffset = dat->isHistory ? 8 : 0; // offset into the font table for either history (old) or new events... (# of fonts per configuration set)
+ dat->bIsHistory = (dbei.timestamp < dat->cache->getSessionStart() && dbei.markedRead());
+ int iFontIDOffset = dat->bIsHistory ? 8 : 0; // offset into the font table for either history (old) or new events... (# of fonts per configuration set)
BOOL isSent = (dbei.flags & DBEF_SENT);
if (!isSent && (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
@@ -648,7 +661,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
if (bIsStatusChangeEvent)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d\\cf%d", MSGDLGFONTCOUNT + 7, MSGDLGFONTCOUNT + 7);
else
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d\\cf%d", MSGDLGFONTCOUNT + (dat->isHistory?5:1) + ((isSent) ? 1 : 0), MSGDLGFONTCOUNT + (dat->isHistory?5:1) + ((isSent) ? 1 : 0));
+ AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d\\cf%d", MSGDLGFONTCOUNT + (dat->bIsHistory ? 5 : 1) + ((isSent) ? 1 : 0), MSGDLGFONTCOUNT + (dat->bIsHistory ? 5 : 1) + ((isSent) ? 1 : 0));
streamData->isEmpty = FALSE;
@@ -665,7 +678,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
time_t local_time = tmi.timeStampToTimeZoneTimeStamp(hTimeZone, dbei.timestamp);
event_time = *gmtime(&local_time);
}
-
+
TTemplateSet *this_templateset = dbei.flags & DBEF_RTL ? dat->pContainer->rtl_templates : dat->pContainer->ltr_templates;
TCHAR *szTemplate;
@@ -676,7 +689,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
else {
if (dwEffectiveFlags & MWF_LOG_GROUPMODE)
szTemplate = isSent ? (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTOUT] : this_templateset->szTemplates[TMPL_GRPINNEROUT]) :
- (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTIN] : this_templateset->szTemplates[TMPL_GRPINNERIN]);
+ (g_groupBreak ? this_templateset->szTemplates[TMPL_GRPSTARTIN] : this_templateset->szTemplates[TMPL_GRPINNERIN]);
else
szTemplate = isSent ? this_templateset->szTemplates[TMPL_MSGOUT] : this_templateset->szTemplates[TMPL_MSGIN];
}
@@ -695,7 +708,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\ul0\\b0\\i0 ");
- for (size_t i = 0; i < iTemplateLen; ) {
+ for (size_t i = 0; i < iTemplateLen;) {
TCHAR ci = szTemplate[i];
if (ci == '%') {
TCHAR cc = szTemplate[i + 1];
@@ -707,7 +720,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
while (cc == '#' || cc == '$' || cc == '&' || cc == '?' || cc == '\\') {
switch (cc) {
case '#':
- if (!dat->isHistory) {
+ if (!dat->bIsHistory) {
skipToNext = TRUE;
goto skip;
}
@@ -716,7 +729,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
continue;
case '$':
- if (dat->isHistory) {
+ if (dat->bIsHistory) {
skipToNext = TRUE;
goto skip;
}
@@ -844,10 +857,10 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
case 'O': // month (name)
if (showTime && showDate) {
if (skipFont)
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(months[event_time.tm_mon]), MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(months[event_time.tm_mon]), MAKELONG(isSent, dat->bIsHistory));
else {
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYTIME + iFontIDOffset : MSGFONTID_YOURTIME + iFontIDOffset));
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(months[event_time.tm_mon]), MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(months[event_time.tm_mon]), MAKELONG(isSent, dat->bIsHistory));
}
}
else skipToNext = TRUE;
@@ -864,10 +877,10 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
case 'w': // day of week
if (showTime && showDate) {
if (skipFont)
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(weekDays[event_time.tm_wday]), MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(weekDays[event_time.tm_wday]), MAKELONG(isSent, dat->bIsHistory));
else {
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYTIME + iFontIDOffset : MSGFONTID_YOURTIME + iFontIDOffset));
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(weekDays[event_time.tm_wday]), MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, TranslateTS(weekDays[event_time.tm_wday]), MAKELONG(isSent, dat->bIsHistory));
}
}
else skipToNext = TRUE;
@@ -937,21 +950,21 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
if (!skipFont)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYNAME + iFontIDOffset : MSGFONTID_YOURNAME + iFontIDOffset));
if (isSent)
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, szMyName, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, szMyName, MAKELONG(isSent, dat->bIsHistory));
else
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, szYourName, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, szYourName, MAKELONG(isSent, dat->bIsHistory));
break;
case 'U': // UIN
if (!skipFont)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYNAME + iFontIDOffset : MSGFONTID_YOURNAME + iFontIDOffset));
if (!isSent)
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, dat->cache->getUIN(), MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, dat->cache->getUIN(), MAKELONG(isSent, dat->bIsHistory));
else
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, dat->myUin, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, dat->myUin, MAKELONG(isSent, dat->bIsHistory));
break;
case 'e': // error message
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(MSGFONTID_ERROR));
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, (wchar_t *)dbei.szModule, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, (wchar_t *)dbei.szModule, MAKELONG(isSent, dat->bIsHistory));
break;
case 'M': // message
switch (dbei.eventType) {
@@ -975,7 +988,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
if (rtfMessage != NULL)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", rtfMessage);
else
- AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, formatted, MAKELONG(isSent, dat->isHistory));
+ AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, formatted, MAKELONG(isSent, dat->bIsHistory));
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", "\\b0\\ul0\\i0 ");
break;
@@ -1003,7 +1016,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
default:
if (!skipFont)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMSG + iFontIDOffset : MSGFONTID_YOURMSG + iFontIDOffset));
-
+
ptrT tszText(DbGetEventTextT(&dbei, CP_ACP));
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszText, 0);
}
@@ -1037,7 +1050,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact,
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d", MSGDLGFONTCOUNT + 8 + (color - '0'));
i++;
}
- else AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d", (MSGDLGFONTCOUNT + (dat->isHistory ? 5 : 1) + ((isSent) ? 1 : 0)));
+ else AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d", (MSGDLGFONTCOUNT + (dat->bIsHistory ? 5 : 1) + ((isSent) ? 1 : 0)));
break;
case '|': // tab
if (dwEffectiveFlags & MWF_LOG_INDENT)
@@ -1136,7 +1149,7 @@ skip:
static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
- LogStreamData *dat = (LogStreamData *) dwCookie;
+ LogStreamData *dat = (LogStreamData *)dwCookie;
if (dat->buffer == NULL) {
dat->bufferOffset = 0;
@@ -1158,11 +1171,10 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
if (--dat->eventsToInsert == 0)
break;
}
- while (dat->buffer == NULL && dat->hDbEvent);
- if (dat->buffer) {
- //dat->isEmpty = 0;
+ while (dat->buffer == NULL && dat->hDbEvent);
+
+ if (dat->buffer)
break;
- }
}
dat->stage = STREAMSTAGE_TAIL;
@@ -1197,16 +1209,137 @@ static void SetupLogFormatting(TWindowData *dat)
mir_snprintf(dat->szMicroLf, sizeof(dat->szMicroLf), "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT));
}
+static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent)
+{
+ DWORD dwScale = M.GetDword("iconscale", 0);
+
+ TCHAR trbuffer[40];
+ TEXTRANGE tr;
+ tr.lpstrText = trbuffer;
+
+ HWND hwndrtf = GetDlgItem(hwndDlg, IDC_LOG);
+
+ FINDTEXTEX fi;
+ fi.chrg.cpMin = startAt;
+ if (dat->clr_added) {
+ fi.lpstrText = _T("##col##");
+ fi.chrg.cpMax = -1;
+ CHARFORMAT2 cf2;
+ ZeroMemory(&cf2, sizeof(cf2));
+ cf2.cbSize = sizeof(cf2);
+ cf2.dwMask = CFM_COLOR;
+ while (SendMessage(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
+ tr.chrg.cpMin = fi.chrgText.cpMin;
+ tr.chrg.cpMax = tr.chrg.cpMin + 18;
+ trbuffer[0] = 0;
+ SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+ trbuffer[18] = 0;
+
+ CHARRANGE cr;
+ cr.cpMin = fi.chrgText.cpMin;
+ cr.cpMax = cr.cpMin + 18;
+ SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
+ SendMessage(hwndrtf, EM_REPLACESEL, FALSE, (LPARAM)_T(""));
+ UINT length = (unsigned int)_ttol(&trbuffer[7]);
+ int index = _ttol(&trbuffer[14]);
+ if (length > 0 && length < 20000 && index >= RTF_CTABLE_DEFSIZE && index < Utils::rtf_ctable_size) {
+ cf2.crTextColor = Utils::rtf_ctable[index].clr;
+ cr.cpMin = fi.chrgText.cpMin;
+ cr.cpMax = cr.cpMin + length;
+ SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
+ SendMessage(hwndrtf, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ }
+ }
+ }
+
+ fi.chrg.cpMin = startAt;
+ if (dat->dwFlags & MWF_LOG_SHOWICONS) {
+ BYTE bIconIndex = 0;
+ char bDirection = 0;
+ fi.lpstrText = _T("#~#");
+ fi.chrg.cpMax = -1;
+
+ CHARFORMAT2 cf2;
+ ZeroMemory(&cf2, sizeof(cf2));
+ cf2.cbSize = sizeof(cf2);
+ cf2.dwMask = CFM_BACKCOLOR;
+
+ IRichEditOle *ole;
+ SendMessage(hwndrtf, EM_GETOLEINTERFACE, 0, (LPARAM)&ole);
+ while (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
+ CHARRANGE cr;
+ cr.cpMin = fi.chrgText.cpMin;
+ cr.cpMax = fi.chrgText.cpMax + 2;
+ SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
+
+ tr.chrg.cpMin = fi.chrgText.cpMin + 3;
+ tr.chrg.cpMax = fi.chrgText.cpMin + 5;
+ SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
+ bIconIndex = ((BYTE)trbuffer[0] - (BYTE)'0');
+ if (bIconIndex >= NR_LOGICONS) {
+ fi.chrg.cpMin = fi.chrgText.cpMax + 6;
+ continue;
+ }
+ bDirection = trbuffer[1];
+ SendMessage(hwndrtf, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ COLORREF crDefault = cf2.crBackColor == 0 ? (true ? (bDirection == '>' ? (fAppend ? dat->pContainer->theme.outbg : dat->pContainer->theme.oldoutbg) :
+ (fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg)) : dat->pContainer->theme.bg) : cf2.crBackColor;
+
+ TLogIcon theIcon;
+ CacheIconToBMP(&theIcon, Logicons[bIconIndex], crDefault, dwScale, dwScale);
+ ImageDataInsertBitmap(ole, theIcon.hBmp);
+ DeleteCachedIcon(&theIcon);
+ fi.chrg.cpMin = cr.cpMax + 6;
+ }
+ ole->Release();
+ }
+
+ // do smiley replacing, using the service
+ if (PluginConfig.g_SmileyAddAvail) {
+ CHARRANGE sel;
+ sel.cpMin = startAt;
+ sel.cpMax = -1;
+
+ SMADD_RICHEDIT3 smadd = { sizeof(smadd) };
+ smadd.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
+ smadd.Protocolname = const_cast<char *>(dat->cache->getActiveProto());
+ smadd.hContact = dat->cache->getActiveContact();
+ smadd.flags = isSent ? SAFLRE_OUTGOING : 0;
+ if (startAt > 0)
+ smadd.rangeToReplace = &sel;
+ else
+ smadd.rangeToReplace = NULL;
+ smadd.disableRedraw = TRUE;
+ if (dat->bShowSmileys)
+ CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd);
+ }
+
+ if (dat->hHistoryEvents && dat->curHistory == dat->maxHistory) {
+ char szPattern[50];
+ mir_snprintf(szPattern, 40, "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
+
+ FINDTEXTEXA fi;
+ fi.lpstrText = szPattern;
+ fi.chrg.cpMin = 0;
+ fi.chrg.cpMax = -1;
+ if (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) != 0) {
+ CHARRANGE sel;
+ sel.cpMin = 0;
+ sel.cpMax = 20;
+ SendMessage(hwndrtf, EM_SETSEL, 0, fi.chrgText.cpMax + 1);
+ SendMessageA(hwndrtf, EM_REPLACESEL, TRUE, (LPARAM)"");
+ }
+ }
+}
+
void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend, DBEVENTINFO *dbei_s)
{
- TWindowData *dat = (TWindowData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
- POINT pt = {0};
+ POINT pt = { 0 };
BOOL wasFirstAppend = (dat->isAutoRTL & 2) ? TRUE : FALSE;
- /*
- * calc time limit for grouping
- */
+ // calc time limit for grouping
HWND hwndrtf = dat->hwndIEView ? dat->hwndIWebBrowserControl : GetDlgItem(hwndDlg, IDC_LOG);
SCROLLINFO si = { 0 }, *psi = &si;
@@ -1278,7 +1411,6 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
}
// separator strings used for grid lines, message separation and so on...
-
dat->clr_added = FALSE;
if (dat->szMicroLf[0] == 0)
@@ -1289,7 +1421,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXGETSEL, 0, (LPARAM)&oldSel);
-
+
LogStreamData streamData = { 0 };
streamData.hContact = dat->hContact;
streamData.hDbEvent = hDbEventFirst;
@@ -1323,17 +1455,17 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
SendMessage(hwndrtf, WM_SETREDRAW, FALSE, 0);
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&oldSel);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0);
dat->hDbEventLast = streamData.hDbEventLast;
- if (dat->isAutoRTL & 1)
+ if (dat->isAutoRTL & 1)
SendMessage(hwndrtf, EM_SETBKGNDCOLOR, 0, (LOWORD(dat->iLastEventType) & DBEF_SENT) ? (fAppend ? dat->pContainer->theme.outbg : dat->pContainer->theme.oldoutbg) :
(fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg));
if (!(dat->isAutoRTL & 1)) {
- GETTEXTLENGTHEX gtxl = {0};
+ GETTEXTLENGTHEX gtxl = { 0 };
gtxl.codepage = 1200;
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
@@ -1365,141 +1497,13 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
if (streamData.buffer) mir_free(streamData.buffer);
}
-static void ReplaceIcons(HWND hwndDlg, TWindowData *dat, LONG startAt, int fAppend, BOOL isSent)
-{
- DWORD dwScale = M.GetDword("iconscale", 0);
-
- TCHAR trbuffer[40];
- TEXTRANGE tr;
- tr.lpstrText = trbuffer;
-
- HWND hwndrtf = GetDlgItem(hwndDlg, IDC_LOG);
-
- FINDTEXTEX fi;
- fi.chrg.cpMin = startAt;
- if (dat->clr_added) {
- unsigned int length;
- int index;
- CHARRANGE cr;
- fi.lpstrText = _T("##col##");
- fi.chrg.cpMax = -1;
- CHARFORMAT2 cf2;
- ZeroMemory(&cf2, sizeof(cf2));
- cf2.cbSize = sizeof(cf2);
- cf2.dwMask = CFM_COLOR;
- while (SendMessage(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
- tr.chrg.cpMin = fi.chrgText.cpMin;
- tr.chrg.cpMax = tr.chrg.cpMin + 18;
- trbuffer[0] = 0;
- SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- trbuffer[18] = 0;
- cr.cpMin = fi.chrgText.cpMin;
- cr.cpMax = cr.cpMin + 18;
- SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
- SendMessage(hwndrtf, EM_REPLACESEL, FALSE, (LPARAM)_T(""));
- length = (unsigned int)_ttol(&trbuffer[7]);
- index = _ttol(&trbuffer[14]);
- if (length > 0 && length < 20000 && index >= RTF_CTABLE_DEFSIZE && index < Utils::rtf_ctable_size) {
- cf2.crTextColor = Utils::rtf_ctable[index].clr;
- cr.cpMin = fi.chrgText.cpMin;
- cr.cpMax = cr.cpMin + length;
- SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
- SendMessage(hwndrtf, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
- }
- }
- }
- fi.chrg.cpMin = startAt;
- if (dat->dwFlags & MWF_LOG_SHOWICONS) {
- BYTE bIconIndex = 0;
- char bDirection = 0;
- fi.lpstrText = _T("#~#");
- fi.chrg.cpMax = -1;
-
- CHARFORMAT2 cf2;
- ZeroMemory(&cf2, sizeof(cf2));
- cf2.cbSize = sizeof(cf2);
- cf2.dwMask = CFM_BACKCOLOR;
-
- IRichEditOle *ole;
- SendMessage(hwndrtf, EM_GETOLEINTERFACE, 0, (LPARAM)&ole);
- while (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) {
- CHARRANGE cr;
- cr.cpMin = fi.chrgText.cpMin;
- cr.cpMax = fi.chrgText.cpMax + 2;
- SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr);
-
- tr.chrg.cpMin = fi.chrgText.cpMin + 3;
- tr.chrg.cpMax = fi.chrgText.cpMin + 5;
- SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- bIconIndex = ((BYTE)trbuffer[0] - (BYTE)'0');
- if (bIconIndex >= NR_LOGICONS) {
- fi.chrg.cpMin = fi.chrgText.cpMax + 6;
- continue;
- }
- bDirection = trbuffer[1];
- SendMessage(hwndrtf, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
- COLORREF crDefault = cf2.crBackColor == 0 ? (true ? (bDirection == '>' ? (fAppend ? dat->pContainer->theme.outbg : dat->pContainer->theme.oldoutbg) :
- (fAppend ? dat->pContainer->theme.inbg : dat->pContainer->theme.oldinbg)) : dat->pContainer->theme.bg) : cf2.crBackColor;
-
- TLogIcon theIcon;
- CacheIconToBMP(&theIcon, Logicons[bIconIndex], crDefault, dwScale, dwScale);
- ImageDataInsertBitmap(ole, theIcon.hBmp);
- DeleteCachedIcon(&theIcon);
- fi.chrg.cpMin = cr.cpMax + 6;
- }
- ole->Release();
- }
-
- /*
- * do smiley replacing, using the service
- */
- if (PluginConfig.g_SmileyAddAvail) {
- CHARRANGE sel;
- sel.cpMin = startAt;
- sel.cpMax = -1;
-
- SMADD_RICHEDIT3 smadd = { sizeof(smadd) };
- smadd.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
- smadd.Protocolname = const_cast<char *>(dat->cache->getActiveProto());
- smadd.hContact = dat->cache->getActiveContact();
- smadd.flags = isSent ? SAFLRE_OUTGOING : 0;
- if (startAt > 0)
- smadd.rangeToReplace = &sel;
- else
- smadd.rangeToReplace = NULL;
- smadd.disableRedraw = TRUE;
- if (dat->doSmileys)
- CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd);
- }
-
- if (dat->hHistoryEvents && dat->curHistory == dat->maxHistory) {
- char szPattern[50];
- mir_snprintf(szPattern, 40, "~-+%d+-~", (INT_PTR)dat->hHistoryEvents[0]);
-
- FINDTEXTEXA fi;
- fi.lpstrText = szPattern;
- fi.chrg.cpMin = 0;
- fi.chrg.cpMax = -1;
- if (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) != 0) {
- CHARRANGE sel;
- sel.cpMin = 0;
- sel.cpMax = 20;
- SendMessage(hwndrtf, EM_SETSEL, 0, fi.chrgText.cpMax + 1);
- SendMessageA(hwndrtf, EM_REPLACESEL, TRUE, (LPARAM)"");
- }
- }
-}
-
-/*
-* NLS functions (for unicode version only) encoding stuff..
-*/
-
+// NLS functions (for unicode version only) encoding stuff..
static BOOL CALLBACK LangAddCallback(LPTSTR str)
{
int i, count;
UINT cp = _ttoi(str);
count = SIZEOF(cpTable);
- for (i=0; i < count && cpTable[i].cpId != cp; i++);
+ for (i = 0; i < count && cpTable[i].cpId != cp; i++);
if (i < count)
AppendMenu(PluginConfig.g_hMenuEncoding, MF_STRING, cp, TranslateTS(cpTable[i].cpName));
@@ -1513,27 +1517,3 @@ void TSAPI BuildCodePageList()
AppendMenuA(PluginConfig.g_hMenuEncoding, MF_SEPARATOR, 0, 0);
EnumSystemCodePages(LangAddCallback, CP_INSTALLED);
}
-
-static TCHAR *Template_MakeRelativeDate(TWindowData *dat, HANDLE hTimeZone, time_t check, int groupBreak, TCHAR code)
-{
- static TCHAR szResult[100];
- const TCHAR *szFormat;
-
- if ((code == (TCHAR)'R' || code == (TCHAR)'r') && check >= today)
- _tcscpy(szResult, szToday);
- else if ((code == (TCHAR)'R' || code == (TCHAR)'r') && check > (today - 86400))
- _tcscpy(szResult, szYesterday);
- else {
- if (code == 'D' || code == 'R')
- szFormat = _T("D");
- else if (code == 'T')
- szFormat = _T("s");
- else if (code == 't')
- szFormat = _T("t");
- else
- szFormat = _T("d");
-
- tmi.printTimeStamp(hTimeZone, check, szFormat, szResult, SIZEOF(szResult), 0);
- }
- return szResult;
-}