summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-03-25 18:06:08 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-03-25 18:06:08 +0300
commitbdff86736fb1d45f7cdaa216307bf2e38ca407aa (patch)
tree78e7838f11f37b6af7db5e72ec05316da99f761a /plugins
parentcf40caf28964e665c3391d91c64f9ba2c09605a7 (diff)
NewStory: fixes #4301 (invalid reply author's nick in Telegram group chats)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/src/history_array.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 191790475c..6bc1d6e0d2 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -429,16 +429,22 @@ void ItemData::load(bool bLoadAlways)
if (MEVENT hReply = db_event_getById(dbe.szModule, dbe.szReplyId)) {
DB::EventInfo dbei(hReply);
if (dbei) {
- CMStringW str;
+ CMStringW str, wszNick;
wchar_t wszTime[100];
TimeZone_PrintTimeStamp(0, dbe.timestamp, L"D t", wszTime, _countof(wszTime), 0);
- if (dbei.flags & DBEF_SENT) {
+ if (Contact::IsGroupChat(hContact) && dbe.szUserId)
+ wszNick = Utf2T(dbe.szUserId);
+ else if (dbei.flags & DBEF_SENT) {
if (char *szProto = Proto_GetBaseAccountName(hContact))
- str.AppendFormat(L"%s %s %s:\n", wszTime, ptrW(Contact::GetInfo(CNF_DISPLAY, 0, szProto)).get(), TranslateT("wrote"));
+ wszNick = ptrW(Contact::GetInfo(CNF_DISPLAY, 0, szProto));
+ else
+ wszNick = TranslateT("I"); // shall never happen
}
- else str.AppendFormat(L"%s %s %s:\n", wszTime, Clist_GetContactDisplayName(hContact, 0), TranslateT("wrote"));
+ else wszNick = Clist_GetContactDisplayName(hContact, 0);
+
+ str.AppendFormat(L"%s %s %s:\n", wszTime, wszNick.c_str(), TranslateT("wrote"));
ptrW wszText(DbEvent_GetTextW(&dbei));
if (mir_wstrlen(wszText) > 43)