summaryrefslogtreecommitdiff
path: root/src/mir_app/src/chat_svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_app/src/chat_svc.cpp')
-rw-r--r--src/mir_app/src/chat_svc.cpp33
1 files changed, 15 insertions, 18 deletions
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;