diff options
author | George Hazan <ghazan@miranda.im> | 2020-04-26 15:19:01 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-04-26 15:19:09 +0300 |
commit | 68f119cb70d7047c20910ea6db33c3bc94149a75 (patch) | |
tree | 27d17ab42b1e9b8a55df7352b7d8b3e104f89b1c /src | |
parent | 27987283c94b4e9f3f966ca3336d4dfb8c8992be (diff) |
Chat api:
- function Chat_GetDefaultEventDescr() added not to translate the same strings in 5 different places;
- function CHAT_INTERFACE::CreateNick added to process nick name creation for group chats;
- unused variable LOGINFO::dwFlags removed;
- variable LOGINFO::bSimple added for events without possible formatting;
- bunch of duplicate code remoed;
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/chat_log.cpp | 144 | ||||
-rw-r--r-- | src/mir_app/src/chat_manager.cpp | 17 | ||||
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 104 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 |
5 files changed, 134 insertions, 133 deletions
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp index 5308ea58fa..ff61461d4f 100644 --- a/src/mir_app/src/chat_log.cpp +++ b/src/mir_app/src/chat_log.cpp @@ -86,19 +86,9 @@ char* Log_SetStyle(int style) return "";
}
-static int Log_AppendRTF(LOGSTREAMDATA *streamData, bool simpleMode, CMStringA &buf, const wchar_t *fmt, ...)
+static int Log_AppendRTF(LOGSTREAMDATA *streamData, bool simpleMode, CMStringA &buf, const wchar_t *line)
{
- va_list va;
- int lineLen, textCharsCount = 0;
- wchar_t *line = (wchar_t*)alloca(8001 * sizeof(wchar_t));
-
- va_start(va, fmt);
- lineLen = mir_vsnwprintf(line, 8000, fmt, va);
- if (lineLen < 0) lineLen = 8000;
- line[lineLen] = 0;
- va_end(va);
-
- lineLen = lineLen * 20 + 8;
+ int textCharsCount = 0;
for (; *line; line++, textCharsCount++) {
if (*line == '\r' && line[1] == '\n') {
@@ -189,97 +179,89 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, bool simpleMode, CMStringA & return textCharsCount;
}
-static void AddEventToBuffer(CMStringA &buf, LOGSTREAMDATA *streamData)
+MIR_APP_DLL(bool) Chat_GetDefaultEventDescr(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &res)
{
- LOGINFO *lin = streamData->lin;
-
- wchar_t szTemp[512], szTemp2[512];
- wchar_t* pszNick = nullptr;
- if (lin->ptszNick) {
- if (g_Settings->bLogLimitNames && mir_wstrlen(lin->ptszNick) > 20) {
- mir_wstrncpy(szTemp2, lin->ptszNick, 20);
- mir_wstrncpy(szTemp2 + 20, L"...", 4);
- }
- else mir_wstrncpy(szTemp2, lin->ptszNick, 511);
-
- if (lin->ptszUserInfo)
- mir_snwprintf(szTemp, L"%s (%s)", szTemp2, lin->ptszUserInfo);
- else
- wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
- pszNick = szTemp;
- }
+ CMStringW wszNick;
+ g_chatApi.CreateNick(si, lin, wszNick);
switch (lin->iType) {
- case GC_EVENT_MESSAGE:
- if (lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
- break;
case GC_EVENT_ACTION:
- if (lin->ptszNick && lin->ptszText) {
- Log_AppendRTF(streamData, true, buf, L"%s ", lin->ptszNick);
- Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
- }
+ if (lin->ptszNick)
+ res = lin->ptszNick;
break;
+
case GC_EVENT_JOIN:
- if (pszNick) {
- if (!lin->bIsMe)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s has joined"), pszNick);
- else
- Log_AppendRTF(streamData, false, buf, TranslateT("You have joined %s"), streamData->si->ptszName);
+ if (!lin->bIsMe) {
+ if (!wszNick.IsEmpty())
+ res.AppendFormat(TranslateT("%s has joined"), wszNick.c_str());
}
+ else res.AppendFormat(TranslateT("You have joined %s"), si->ptszName);
break;
+
case GC_EVENT_PART:
- if (pszNick)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s has left"), pszNick);
- if (lin->ptszText)
- Log_AppendRTF(streamData, true, buf, L": %s", lin->ptszText);
+ if (!wszNick.IsEmpty())
+ res.AppendFormat(TranslateT("%s has left"), wszNick.c_str());
break;
+
case GC_EVENT_QUIT:
- if (pszNick)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s has disconnected"), pszNick);
- if (lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L": %s", lin->ptszText);
+ if (!wszNick.IsEmpty())
+ res.AppendFormat(TranslateT("%s has disconnected"), wszNick.c_str());
break;
+
case GC_EVENT_NICK:
- if (pszNick && lin->ptszText) {
- if (!lin->bIsMe)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s is now known as %s"), pszNick, lin->ptszText);
- else
- Log_AppendRTF(streamData, true, buf, TranslateT("You are now known as %s"), lin->ptszText);
+ if (!lin->bIsMe) {
+ if (!wszNick.IsEmpty())
+ res.AppendFormat(TranslateT("%s is now known as %s"), wszNick.c_str(), lin->ptszText);
}
- break;
+ else res.AppendFormat(TranslateT("You are now known as %s"), lin->ptszText);
+ return true;
+
case GC_EVENT_KICK:
if (lin->ptszNick && lin->ptszStatus)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s kicked %s"), lin->ptszStatus, lin->ptszNick);
- if (lin->ptszText)
- Log_AppendRTF(streamData, false, buf, L": %s", lin->ptszText);
+ res.AppendFormat(TranslateT("%s kicked %s"), lin->ptszStatus, lin->ptszNick);
break;
+
case GC_EVENT_NOTICE:
- if (pszNick && lin->ptszText) {
- Log_AppendRTF(streamData, true, buf, TranslateT("Notice from %s: "), pszNick);
- Log_AppendRTF(streamData, false, buf, L"%s", lin->ptszText);
- }
+ if (!wszNick.IsEmpty())
+ res.AppendFormat(TranslateT("Notice from %s"), wszNick.c_str());
break;
+
case GC_EVENT_TOPIC:
if (lin->ptszText)
- Log_AppendRTF(streamData, false, buf, TranslateT("The topic is '%s%s'"), lin->ptszText, L"%r");
+ res.AppendFormat(TranslateT("The topic is '%s'"), lin->ptszText);
if (lin->ptszNick)
- Log_AppendRTF(streamData, true, buf,
- lin->ptszUserInfo ? TranslateT(" (set by %s on %s)") : TranslateT(" (set by %s)"),
- lin->ptszNick, lin->ptszUserInfo);
- break;
+ res.AppendFormat((lin->ptszUserInfo) ? TranslateT(" (set by %s on %s)") : TranslateT(" (set by %s)"), lin->ptszNick, lin->ptszUserInfo);
+ return true;
+
case GC_EVENT_INFORMATION:
if (lin->ptszText)
- Log_AppendRTF(streamData, false, buf, (lin->bIsMe) ? L"--> %s" : L"%s", lin->ptszText);
- break;
+ res.AppendFormat((lin->bIsMe) ? L"--> %s" : L"%s", lin->ptszText);
+ return true;
+
case GC_EVENT_ADDSTATUS:
if (lin->ptszNick && lin->ptszText && lin->ptszStatus)
- Log_AppendRTF(streamData, true, buf, TranslateT("%s enables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
- break;
+ res.AppendFormat(TranslateT("%s enables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
+ return true;
+
case GC_EVENT_REMOVESTATUS:
if (lin->ptszNick && lin->ptszText && lin->ptszStatus)
- Log_AppendRTF(streamData, TRUE, buf, TranslateT("%s disables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
- break;
+ res.AppendFormat(TranslateT("%s disables '%s' status for %s"), lin->ptszText, lin->ptszStatus, lin->ptszNick);
+ return true;
+ }
+
+ return false;
+}
+
+static void AddEventToBuffer(CMStringA &buf, LOGSTREAMDATA *streamData)
+{
+ CMStringW wszCaption;
+ bool bTextUsed = Chat_GetDefaultEventDescr(streamData->si, streamData->lin, wszCaption);
+ if (!wszCaption.IsEmpty())
+ Log_AppendRTF(streamData, !bTextUsed, buf, wszCaption);
+ if (!bTextUsed && streamData->lin->ptszText) {
+ if (!wszCaption.IsEmpty())
+ Log_AppendRTF(streamData, false, buf, L": ");
+ Log_AppendRTF(streamData, false, buf, streamData->lin->ptszText);
}
}
@@ -349,22 +331,18 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) wcsncpy_s(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, si->LastTime), _TRUNCATE);
if (!g_Settings->bShowTimeIfChanged || si->LastTime == 0 || mir_wstrcmp(szTimeStamp, szOldTimeStamp)) {
si->LastTime = lin->time;
- Log_AppendRTF(streamData, TRUE, buf, L"%s", szTimeStamp);
+ Log_AppendRTF(streamData, true, buf, szTimeStamp);
}
buf.Append("\\tab ");
}
// Insert the nick
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
- wchar_t pszTemp[300], *p1;
-
buf.AppendFormat("%s ", Log_SetStyle(lin->bIsMe ? 2 : 1));
- mir_wstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
- p1 = wcsstr(pszTemp, L"%n");
- if (p1)
- p1[1] = 's';
- Log_AppendRTF(streamData, TRUE, buf, pszTemp, lin->ptszNick);
+ CMStringW tmp((lin->bIsMe) ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick);
+ tmp.Replace(L"%n", lin->ptszNick);
+ Log_AppendRTF(streamData, TRUE, buf, tmp);
buf.AppendChar(' ');
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index e1b1627741..3111d6f548 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -846,6 +846,22 @@ BOOL UM_RemoveAll(SESSION_INFO *si) /////////////////////////////////////////////////////////////////////////////////////////
+static void CreateNick(const SESSION_INFO *, const LOGINFO *lin, CMStringW &wszNick)
+{
+ if (lin->ptszNick) {
+ wszNick = lin->ptszNick;
+ if (g_Settings->bLogLimitNames && mir_wstrlen(lin->ptszNick) > 20) {
+ wszNick.Truncate(20);
+ wszNick.Append(L"...");
+ }
+
+ if (lin->ptszUserInfo && lin->iType != GC_EVENT_TOPIC)
+ wszNick.AppendFormat(L" (%s)", lin->ptszUserInfo);
+ }
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static void ResetApi()
{
g_chatApi.SetActiveSession = ::SetActiveSession;
@@ -898,6 +914,7 @@ static void ResetApi() g_chatApi.GetChatLogsFilename = ::GetChatLogsFilename;
g_chatApi.Log_SetStyle = ::Log_SetStyle;
+ g_chatApi.CreateNick = ::CreateNick;
g_chatApi.IsHighlighted = ::IsHighlighted;
g_chatApi.RemoveFormatting = ::RemoveFormatting;
g_chatApi.ReloadSettings = ::LoadGlobalSettings;
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 9a514bb6cd..8602f59168 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -26,6 +26,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma comment(lib, "Shlwapi.lib")
+struct fakeLOGINFO : public LOGINFO
+{
+ fakeLOGINFO(const GCEVENT *gce)
+ {
+ bSimple = true;
+ bIsMe = gce->bIsMe;
+ iType = gce->iType;
+ ptszText = (wchar_t *)gce->pszText.w;
+ ptszNick = (wchar_t *)gce->pszNick.w;
+ ptszStatus = (wchar_t *)gce->pszStatus.w;
+ ptszUserInfo = (wchar_t *)gce->pszUserInfo.w;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
int GetRichTextLength(HWND hwnd)
{
GETTEXTLENGTHEX gtl;
@@ -209,63 +225,65 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
+ fakeLOGINFO lin(gce);
+ CMStringW wszText;
+ bool bTextUsed = Chat_GetDefaultEventDescr(si, &lin, wszText);
+
+ HICON hIcon = nullptr;
+ COLORREF dwColor = 0;
+
switch (gce->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
- g_chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, g_chatApi.aFonts[16].color, TranslateT("%s says: %s"), gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); dwColor = g_chatApi.aFonts[16].color; wszText = TranslateT("%s says");
break;
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
- g_chatApi.ShowPopup(si->hContact, si, Skin_LoadIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, g_chatApi.aFonts[16].color, L"%s %s", gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); dwColor = g_chatApi.aFonts[16].color;
break;
case GC_EVENT_MESSAGE:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, g_chatApi.aFonts[9].color, TranslateT("%s says: %s"), gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_MESSAGE]; dwColor = g_chatApi.aFonts[9].color; wszText = TranslateT("%s says");
break;
case GC_EVENT_ACTION:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_ACTION], si->pszModule, si->ptszName, g_chatApi.aFonts[15].color, L"%s %s", gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_ACTION]; dwColor = g_chatApi.aFonts[15].color;
break;
case GC_EVENT_JOIN:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_JOIN], si->pszModule, si->ptszName, g_chatApi.aFonts[3].color, TranslateT("%s has joined"), gce->pszNick.w);
+ hIcon = g_chatApi.hIcons[ICON_JOIN]; dwColor = g_chatApi.aFonts[3].color;
break;
case GC_EVENT_PART:
- if (!gce->pszText.w)
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, g_chatApi.aFonts[4].color, TranslateT("%s has left"), gce->pszNick.w);
- else
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_PART], si->pszModule, si->ptszName, g_chatApi.aFonts[4].color, TranslateT("%s has left (%s)"), gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_PART]; dwColor = g_chatApi.aFonts[4].color;
break;
case GC_EVENT_QUIT:
- if (!gce->pszText.w)
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, g_chatApi.aFonts[5].color, TranslateT("%s has disconnected"), gce->pszNick.w);
- else
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_QUIT], si->pszModule, si->ptszName, g_chatApi.aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_QUIT]; dwColor = g_chatApi.aFonts[5].color;
break;
case GC_EVENT_NICK:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_NICK], si->pszModule, si->ptszName, g_chatApi.aFonts[7].color, TranslateT("%s is now known as %s"), gce->pszNick.w, gce->pszText.w);
+ hIcon = g_chatApi.hIcons[ICON_NICK]; dwColor = g_chatApi.aFonts[7].color;
break;
case GC_EVENT_KICK:
- if (!gce->pszText.w)
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, g_chatApi.aFonts[6].color, TranslateT("%s kicked %s"), gce->pszStatus.w, gce->pszNick.w);
- else
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_KICK], si->pszModule, si->ptszName, g_chatApi.aFonts[6].color, TranslateT("%s kicked %s (%s)"), gce->pszStatus.w, gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_KICK]; dwColor = g_chatApi.aFonts[6].color;
break;
case GC_EVENT_NOTICE:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_NOTICE], si->pszModule, si->ptszName, g_chatApi.aFonts[8].color, TranslateT("Notice from %s: %s"), gce->pszNick.w, RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_NOTICE]; dwColor = g_chatApi.aFonts[8].color;
break;
case GC_EVENT_TOPIC:
- if (!gce->pszNick.w)
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, g_chatApi.aFonts[11].color, TranslateT("The topic is '%s'"), RemoveFormatting(gce->pszText.w));
- else
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_TOPIC], si->pszModule, si->ptszName, g_chatApi.aFonts[11].color, TranslateT("The topic is '%s' (set by %s)"), RemoveFormatting(gce->pszText.w), gce->pszNick.w);
+ hIcon = g_chatApi.hIcons[ICON_TOPIC]; dwColor = g_chatApi.aFonts[11].color;
break;
case GC_EVENT_INFORMATION:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_INFO], si->pszModule, si->ptszName, g_chatApi.aFonts[12].color, L"%s", RemoveFormatting(gce->pszText.w));
+ hIcon = g_chatApi.hIcons[ICON_INFO]; dwColor = g_chatApi.aFonts[12].color;
break;
case GC_EVENT_ADDSTATUS:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_ADDSTATUS], si->pszModule, si->ptszName, g_chatApi.aFonts[13].color, TranslateT("%s enables '%s' status for %s"), gce->pszText.w, (char *)gce->pszStatus.w, gce->pszNick.w);
+ hIcon = g_chatApi.hIcons[ICON_ADDSTATUS]; dwColor = g_chatApi.aFonts[13].color;
break;
case GC_EVENT_REMOVESTATUS:
- g_chatApi.ShowPopup(si->hContact, si, g_chatApi.hIcons[ICON_REMSTATUS], si->pszModule, si->ptszName, g_chatApi.aFonts[14].color, TranslateT("%s disables '%s' status for %s"), gce->pszText.w, (char *)gce->pszStatus.w, gce->pszNick.w);
+ hIcon = g_chatApi.hIcons[ICON_REMSTATUS]; dwColor = g_chatApi.aFonts[14].color;
break;
}
+ if (!bTextUsed && lin.ptszText) {
+ if (!wszText.IsEmpty())
+ wszText.Append(L": ");
+ wszText.Append(RemoveFormatting(gce->pszText.w));
+ }
+
+ g_chatApi.ShowPopup(si->hContact, si, hIcon, si->pszModule, si->ptszName, dwColor, L"%s", wszText.c_str());
return TRUE;
}
@@ -436,72 +454,58 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) pszNick = szTemp;
}
+ fakeLOGINFO lin(gce);
CMStringW buf;
+ bool bTextUsed = Chat_GetDefaultEventDescr(si, &lin, buf);
+
switch (gce->iType) {
case GC_EVENT_MESSAGE:
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
- buf.AppendFormat(L"%s: %s", gce->pszNick.w, g_chatApi.RemoveFormatting(gce->pszText.w));
+ buf = gce->pszNick.w;
break;
case GC_EVENT_ACTION:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
p = '*';
- buf.AppendFormat(L"%s %s", gce->pszNick.w, g_chatApi.RemoveFormatting(gce->pszText.w));
break;
case GC_EVENT_JOIN:
p = '>';
- buf.AppendFormat(TranslateT("%s has joined"), pszNick);
break;
case GC_EVENT_PART:
p = '<';
- if (!gce->pszText.w)
- buf.AppendFormat(TranslateT("%s has left"), pszNick);
- else
- buf.AppendFormat(TranslateT("%s has left (%s)"), pszNick, g_chatApi.RemoveFormatting(gce->pszText.w));
break;
case GC_EVENT_QUIT:
p = '<';
- if (!gce->pszText.w)
- buf.AppendFormat(TranslateT("%s has disconnected"), pszNick);
- else
- buf.AppendFormat(TranslateT("%s has disconnected (%s)"), pszNick, g_chatApi.RemoveFormatting(gce->pszText.w));
break;
case GC_EVENT_NICK:
p = '^';
- buf.AppendFormat(TranslateT("%s is now known as %s"), gce->pszNick.w, gce->pszText.w);
break;
case GC_EVENT_KICK:
p = '~';
- if (!gce->pszText.w)
- buf.AppendFormat(TranslateT("%s kicked %s"), gce->pszStatus.w, gce->pszNick.w);
- else
- buf.AppendFormat(TranslateT("%s kicked %s (%s)"), gce->pszStatus.w, gce->pszNick.w, g_chatApi.RemoveFormatting(gce->pszText.w));
break;
case GC_EVENT_NOTICE:
p = 'o';
- buf.AppendFormat(TranslateT("Notice from %s: %s"), gce->pszNick.w, g_chatApi.RemoveFormatting(gce->pszText.w));
break;
case GC_EVENT_TOPIC:
p = '#';
- if (!gce->pszNick.w)
- buf.AppendFormat(TranslateT("The topic is '%s'"), g_chatApi.RemoveFormatting(gce->pszText.w));
- else
- buf.AppendFormat(TranslateT("The topic is '%s' (set by %s)"), g_chatApi.RemoveFormatting(gce->pszText.w), gce->pszNick.w);
break;
case GC_EVENT_INFORMATION:
p = '!';
- buf = g_chatApi.RemoveFormatting(gce->pszText.w);
break;
case GC_EVENT_ADDSTATUS:
p = '+';
- buf.AppendFormat(TranslateT("%s enables '%s' status for %s"), gce->pszText.w, gce->pszStatus.w, gce->pszNick.w);
break;
case GC_EVENT_REMOVESTATUS:
p = '-';
- buf.AppendFormat(TranslateT("%s disables '%s' status for %s"), gce->pszText.w, gce->pszStatus.w, gce->pszNick.w);
break;
}
+ if (!bTextUsed && lin.ptszText) {
+ if (!buf.IsEmpty())
+ buf.Append(L": ");
+ buf.Append(RemoveFormatting(gce->pszText.w));
+ }
+
// formatting strings don't need to be translatable - changing them via language pack would
// only screw up the log format.
wchar_t *szTime = g_chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8ba3de0e9b..9f21d4237e 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -223,6 +223,7 @@ Profile_GetNameW @291 Profile_GetPathA @292
Profile_GetPathW @293
Profile_SetDefault @294
+Chat_GetDefaultEventDescr @295
FindDatabasePlugin @296
RegisterDatabasePlugin @298
Chat_CustomizeApi @299
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 430ffd6917..be1764ac69 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -223,6 +223,7 @@ Profile_GetNameW @291 Profile_GetPathA @292
Profile_GetPathW @293
Profile_SetDefault @294
+Chat_GetDefaultEventDescr @295
FindDatabasePlugin @296
RegisterDatabasePlugin @298
Chat_CustomizeApi @299
|