summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-04-09 18:54:23 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-04-09 18:54:23 +0300
commita51716398f6ebc39004cbe6143956b7ce2a62b01 (patch)
tree3132f6a0a0692e1002f50dd1ae9547057f6c5c68 /plugins
parentee563022d5e1a2e19f40bb0ea705d6483aa48403 (diff)
Revert "fixes #4338 (NewStory: реплаи используют формат даты из операционной системы)"
This reverts commit ee563022d5e1a2e19f40bb0ea705d6483aa48403.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/src/history_array.cpp34
-rw-r--r--plugins/NewStory/src/history_array.h5
2 files changed, 18 insertions, 21 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index d426456c4f..09cb998927 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -71,15 +71,7 @@ bool Filter::check(ItemData *item) const
ItemData::ItemData()
{
memset(this, 0, sizeof(*this));
-}
-
-ItemData::ItemData(MEVENT hEvent) :
- dbe(hEvent, true),
- qtext(0),
- pOwner(0)
-{
- if (dbe.szReplyId)
- dbe.szReplyId = mir_strdup(dbe.szReplyId);
+ savedHeight = -1;
}
ItemData::~ItemData()
@@ -383,8 +375,7 @@ void ItemData::load(bool bLoadAlways)
switch (dbe.eventType) {
case EVENTTYPE_MESSAGE:
- if (pOwner)
- pOwner->MarkRead(this);
+ pOwner->MarkRead(this);
__fallthrough;
case EVENTTYPE_STATUSCHANGE:
@@ -447,13 +438,16 @@ void ItemData::load(bool bLoadAlways)
if (dbe.szReplyId)
if (MEVENT hReply = db_event_getById(dbe.szModule, dbe.szReplyId)) {
- ItemData reply(hReply);
- if (reply.dbe) {
+ DB::EventInfo dbei(hReply);
+ if (dbei) {
CMStringW str, wszNick;
- if (Contact::IsGroupChat(hContact) && reply.dbe.szUserId)
- wszNick = Utf2T(reply.dbe.szUserId);
- else if (reply.dbe.flags & DBEF_SENT) {
+ wchar_t wszTime[100];
+ TimeZone_PrintTimeStamp(0, dbei.timestamp, L"D t", wszTime, _countof(wszTime), 0);
+
+ if (Contact::IsGroupChat(hContact) && dbei.szUserId)
+ wszNick = Utf2T(dbei.szUserId);
+ else if (dbei.flags & DBEF_SENT) {
if (char *szProto = Proto_GetBaseAccountName(hContact))
wszNick = ptrW(Contact::GetInfo(CNF_DISPLAY, 0, szProto));
else
@@ -461,9 +455,13 @@ void ItemData::load(bool bLoadAlways)
}
else wszNick = Clist_GetContactDisplayName(hContact, 0);
- reply.wszNick = wszNick.GetBuffer();
+ str.AppendFormat(L"%s %s %s:\n", wszTime, wszNick.c_str(), TranslateT("wrote"));
- qtext = TplFormatString(TPL_MESSAGE, hContact, &reply).Detach();
+ ptrW wszText(DbEvent_GetTextW(&dbei));
+ if (mir_wstrlen(wszText) > 43)
+ wcscpy(wszText.get() + 40, L"...");
+ str.Append(wszText);
+ qtext = str.Detach();
}
}
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index c671d76f53..2fa212c0d6 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -19,7 +19,7 @@ struct ItemData
bool m_bOfflineFile;
uint8_t m_grouping, m_bOfflineDownloaded;
- int savedTop, savedHeight = -1, leftOffset;
+ int savedTop, savedHeight, leftOffset;
DB::EventInfo dbe;
wchar_t *wtext, *qtext;
@@ -28,8 +28,7 @@ struct ItemData
litehtml::document::ptr m_doc;
- explicit ItemData();
- explicit ItemData(MEVENT);
+ ItemData();
~ItemData();
ItemData* checkNext(ItemData *pPrev);