summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat_loginfo.cpp80
1 files changed, 28 insertions, 52 deletions
diff --git a/src/mir_app/src/chat_loginfo.cpp b/src/mir_app/src/chat_loginfo.cpp
index 1c05f5ecb8..e46c2eedc7 100644
--- a/src/mir_app/src/chat_loginfo.cpp
+++ b/src/mir_app/src/chat_loginfo.cpp
@@ -84,7 +84,7 @@ int LOGINFO::getIcon() const
return 0;
}
-void LOGINFO::write(RtfChatLogStreamData *streamData, bool /*simpleMode*/, CMStringA &str, const wchar_t *line) const
+void LOGINFO::write(RtfChatLogStreamData *streamData, bool simpleMode, CMStringA &str, const wchar_t *line) const
{
CMStringA buf;
@@ -96,62 +96,38 @@ void LOGINFO::write(RtfChatLogStreamData *streamData, bool /*simpleMode*/, CMStr
else if (*line == '\n') {
buf.Append("\\line ");
}
- /*
- else if (*line == '%' && !simpleMode) {
- switch (*++line) {
- case 'c':
- case 'f':
- if (g_Settings->bStripFormat || streamData->bStripFormat)
- line += 2;
-
- else if (line[1] != '\0' && line[2] != '\0') {
- wchar_t szTemp3[3], c = *line;
- int col;
- szTemp3[0] = line[1];
- szTemp3[1] = line[2];
- szTemp3[2] = '\0';
- line += 2;
-
- col = _wtoi(szTemp3);
- col += (OPTIONS_FONTCOUNT + 1);
- buf.AppendFormat((c == 'c') ? "\\cf%u " : "\\highlight%u ", col);
- }
- break;
- case 'C':
- case 'F':
- if (!g_Settings->bStripFormat && !streamData->bStripFormat) {
- int j = bIsHighlighted ? 16 : getIndex();
- if (*line == 'C')
- buf.AppendFormat("\\cf%u ", j + 1);
- else
- buf.AppendFormat("\\highlight0 ");
- }
- break;
- case 'b':
- case 'u':
- case 'i':
+ else if (*line == '[' && !simpleMode) {
+ line++;
+ bool bEnable = true;
+ if (*line == '/') {
+ line++;
+ bEnable = false;
+ }
+
+ if (!wcsncmp(line, L"color", 5) || !wcsncmp(line, L"bkcolor", 7))
+ line = wcschr(line, ']');
+ else if (!wcsncmp(line, L"b]", 2)) {
+ line++;
if (!streamData->bStripFormat)
- buf.AppendFormat((*line == 'u') ? "\\%cl " : "\\%c ", *line);
- break;
-
- case 'B':
- case 'U':
- case 'I':
+ buf.Append(bEnable ? "\\b" : "\\b0");
+ }
+ else if (!wcsncmp(line, L"i]", 2)) {
+ line++;
if (!streamData->bStripFormat)
- buf.AppendFormat((*line == 'U') ? "\\%cl0 " : "\\%c0 ", tolower(*line));
- break;
-
- case 'r':
+ buf.Append(bEnable ? "\\i" : "\\i0");
+ }
+ else if (!wcsncmp(line, L"s]", 2)) {
+ line++;
if (!streamData->bStripFormat)
- buf.AppendFormat("%s ", Log_SetStyle(getIndex()));
- break;
-
- default:
- buf.AppendChar('%');
- break;
+ buf.Append(bEnable ? "\\s" : "\\s0");
+ }
+ else if (!wcsncmp(line, L"u]", 2)) {
+ line++;
+ if (!streamData->bStripFormat)
+ buf.Append(bEnable ? "\\ul" : "\\ul0");
}
+ else buf.AppendChar('[');
}
- */
else if (*line == '\t' && !streamData->bStripFormat) {
buf.Append("\\tab ");
}