summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-23 19:36:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-23 19:36:38 +0300
commitc8a01589f0570bc9f630c4b498c6fb0cc54c79a4 (patch)
treebc55a0f16aed3e113b595251f5c5ee2d10c3689a /src
parent1d193f3a887f84ea657f39f9bb3a2e4537426a61 (diff)
Telegram: file events to store server message id & groupchat user id, if present
Diffstat (limited to 'src')
-rw-r--r--src/core/stdfile/src/file.cpp2
-rw-r--r--src/mir_app/src/chat_tools.cpp11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index e8573eca6b..159a421fe6 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -321,6 +321,8 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
DB::EventInfo dbei;
dbei.szModule = Proto_GetBaseAccountName(ccs->hContact);
dbei.timestamp = pre->timestamp;
+ dbei.szId = pre->szId;
+ dbei.szUserId = pre->szUserId;
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_UTF;
if (pre->dwFlags & PREF_CREATEREAD)
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 4ed79d4cc7..e06e4ab30f 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -733,13 +733,14 @@ void Chat_EventToGC(SESSION_INFO *si, MEVENT hDbEvent)
if (mir_strcmp(szProto, dbei.szModule) || !g_chatApi.DbEventIsShown(dbei) || !dbei.szUserId)
return;
- CMStringA szText((char *)dbei.pBlob);
- szText.Replace("%", "%%");
+ Utf2T wszUserId(dbei.szUserId);
+ CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ wszText.Replace(L"%", L"%%");
GCEVENT gce = { si, GC_EVENT_MESSAGE };
- gce.dwFlags = GCEF_ADDTOLOG | GCEF_UTF8;
- gce.pszUID.a = dbei.szUserId;
- gce.pszText.a = szText;
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.pszUID.w = wszUserId;
+ gce.pszText.w = wszText;
gce.time = dbei.timestamp;
gce.hEvent = hDbEvent;
Chat_Event(&gce);