summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat.h1
-rw-r--r--src/mir_app/src/chat_loginfo.cpp11
-rw-r--r--src/mir_app/src/chat_manager.cpp1
-rw-r--r--src/mir_app/src/chat_svc.cpp33
-rw-r--r--src/mir_app/src/chat_tools.cpp53
5 files changed, 24 insertions, 75 deletions
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 430c694e8c..9b2564bad0 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -120,7 +120,6 @@ void UnloadChatModule(void);
// tools.c
int DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pColors);
-wchar_t* RemoveFormatting(const wchar_t* pszText);
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
int GetRichTextLength(HWND hwnd);
bool IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
diff --git a/src/mir_app/src/chat_loginfo.cpp b/src/mir_app/src/chat_loginfo.cpp
index fff834d8d0..2a72a77e32 100644
--- a/src/mir_app/src/chat_loginfo.cpp
+++ b/src/mir_app/src/chat_loginfo.cpp
@@ -96,13 +96,9 @@ void LOGINFO::write(RtfChatLogStreamData *streamData, bool simpleMode, CMStringA
else if (*line == '\n') {
buf.Append("\\line ");
}
+ /*
else if (*line == '%' && !simpleMode) {
switch (*++line) {
- case '\0':
- case '%':
- buf.AppendChar('%');
- break;
-
case 'c':
case 'f':
if (g_Settings->bStripFormat || streamData->bStripFormat)
@@ -149,8 +145,13 @@ void LOGINFO::write(RtfChatLogStreamData *streamData, bool simpleMode, CMStringA
if (!streamData->bStripFormat)
buf.AppendFormat("%s ", Log_SetStyle(getIndex()));
break;
+
+ default:
+ buf.AppendChar('%');
+ break;
}
}
+ */
else if (*line == '\t' && !streamData->bStripFormat) {
buf.Append("\\tab ");
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 07e53b5969..cf3dcfba39 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -787,7 +787,6 @@ static void ResetApi()
g_chatApi.CreateNick = ::CreateNick;
g_chatApi.IsHighlighted = ::IsHighlighted;
- g_chatApi.RemoveFormatting = ::RemoveFormatting;
g_chatApi.ReloadSettings = ::LoadGlobalSettings;
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 2bf0745e90..ec7b44be06 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -462,27 +462,24 @@ static BOOL HandleChatEvent(GCEVENT &gce, int bManyFix)
return SM_SetContactStatus(si, gce.pszUID.w, (uint16_t)gce.dwItemData);
case GC_EVENT_TOPIC:
- {
- wchar_t *pwszNew = RemoveFormatting(gce.pszText.w);
- if (!mir_wstrcmp(si->ptszTopic, pwszNew)) // nothing changed? exiting
- return 0;
+ if (!mir_wstrcmp(si->ptszTopic, gce.pszText.w)) // nothing changed? exiting
+ return 0;
- si->bIsDirty = true;
- replaceStrW(si->ptszTopic, pwszNew);
- if (pwszNew != nullptr)
- db_set_ws(si->hContact, si->pszModule, "Topic", si->ptszTopic);
- else
- db_unset(si->hContact, si->pszModule, "Topic");
+ si->bIsDirty = true;
+ replaceStrW(si->ptszTopic, gce.pszText.w);
+ if (gce.pszText.w != nullptr)
+ db_set_ws(si->hContact, si->pszModule, "Topic", si->ptszTopic);
+ else
+ db_unset(si->hContact, si->pszModule, "Topic");
- if (g_chatApi.OnSetTopic)
- g_chatApi.OnSetTopic(si);
+ if (g_chatApi.OnSetTopic)
+ g_chatApi.OnSetTopic(si);
- if (Chat::bTopicOnClist) {
- if (pwszNew != nullptr)
- db_set_ws(si->hContact, "CList", "StatusMsg", si->ptszTopic);
- else
- db_unset(si->hContact, "CList", "StatusMsg");
- }
+ if (Chat::bTopicOnClist) {
+ if (gce.pszText.w != nullptr)
+ db_set_ws(si->hContact, "CList", "StatusMsg", si->ptszTopic);
+ else
+ db_unset(si->hContact, "CList", "StatusMsg");
}
break;
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index dd0c7d9895..2c4ba34ddc 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -38,53 +38,6 @@ int GetRichTextLength(HWND hwnd)
/////////////////////////////////////////////////////////////////////////////////////////
-wchar_t* RemoveFormatting(const wchar_t *pszWord)
-{
- static wchar_t szTemp[10000];
-
- if (pszWord == nullptr)
- return nullptr;
-
- wchar_t *d = szTemp;
- size_t cbLen = mir_wstrlen(pszWord);
- if (cbLen > _countof(szTemp))
- cbLen = _countof(szTemp)-1;
-
- for (size_t i = 0; i < cbLen;) {
- if (pszWord[i] == '%') {
- switch (pszWord[i+1]) {
- case '%':
- *d++ = '%';
- __fallthrough;
-
- case 'b':
- case 'u':
- case 'i':
- case 'B':
- case 'U':
- case 'I':
- case 'r':
- case 'C':
- case 'F':
- i += 2;
- continue;
-
- case 'c':
- case 'f':
- i += 4;
- continue;
- }
- }
-
- *d++ = pszWord[i++];
- }
- *d = 0;
-
- return szTemp;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
HICON CHAT_MANAGER::getIcon(int iEventType) const
{
if (iEventType & GC_EVENT_HIGHLIGHT)
@@ -343,7 +296,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
if (!bTextUsed && lin.ptszText) {
if (!wszText.IsEmpty())
wszText.AppendChar(' ');
- wszText.Append(RemoveFormatting(gce->pszText.w));
+ wszText.Append(gce->pszText.w);
}
g_chatApi.ShowPopup(si->hContact, si, g_chatApi.getIcon(gce->iType), si->pszModule, si->ptszName, dwColor, L"%s", wszText.c_str());
@@ -422,7 +375,7 @@ bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
if (pMe == nullptr)
return FALSE;
- wchar_t *buf = RemoveFormatting(NEWWSTR_ALLOCA(gce->pszText.w));
+ wchar_t *buf = NEWWSTR_ALLOCA(gce->pszText.w);
int iStart = 0;
CMStringW tszHighlightWords(g_Settings->pszHighlightWords);
@@ -543,7 +496,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (!bTextUsed && lin.ptszText) {
if (!buf.IsEmpty())
buf.AppendChar(' ');
- buf.Append(RemoveFormatting(gce->pszText.w));
+ buf.Append(gce->pszText.w);
}
// formatting strings don't need to be translatable - changing them via language pack would