summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-26 15:19:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-26 15:19:43 +0300
commit7c68d8af391e1180f708be495d46c292290c9879 (patch)
treedf460643204a58f6c7cdffbd9cb48dd0bcf27deb /plugins/NewStory/src
parent68f119cb70d7047c20910ea6db33c3bc94149a75 (diff)
fixes #2359 (NewStory: some events in groupchats are missing)
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history_array.cpp25
-rw-r--r--plugins/NewStory/src/history_array.h2
-rw-r--r--plugins/NewStory/src/history_control.cpp2
-rw-r--r--plugins/NewStory/src/history_log.cpp5
4 files changed, 24 insertions, 10 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 984076b92e..2f9089c92b 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -133,21 +133,32 @@ void HistoryArray::clear()
iLastPageCounter = 0;
}
-void HistoryArray::addChatEvent(MCONTACT hContact, LOGINFO *pEvent)
+void HistoryArray::addChatEvent(SESSION_INFO *si, LOGINFO *lin)
{
+ if (si == nullptr)
+ return;
+
+ CMStringW wszText;
+ bool bTextUsed = Chat_GetDefaultEventDescr(si, lin, wszText);
+ if (!bTextUsed && lin->ptszText) {
+ if (!wszText.IsEmpty())
+ wszText.Append(L": ");
+ wszText.Append(g_chatApi.RemoveFormatting(lin->ptszText));
+ }
+
auto &p = allocateItem();
- p.hContact = hContact;
- p.wtext = mir_wstrdup(pEvent->ptszText);
+ p.hContact = si->hContact;
+ p.wtext = wszText.Detach();
p.dbeOk = true;
p.dbe.cbBlob = 1;
p.dbe.pBlob = (BYTE *)p.wtext;
p.dbe.eventType = EVENTTYPE_MESSAGE;
- p.dbe.timestamp = pEvent->time;
+ p.dbe.timestamp = lin->time;
- if (pEvent->ptszNick) {
- p.wszNick = strings.find(pEvent->ptszNick);
+ if (lin->ptszNick) {
+ p.wszNick = strings.find(lin->ptszNick);
if (p.wszNick == nullptr) {
- p.wszNick = mir_wstrdup(pEvent->ptszNick);
+ p.wszNick = mir_wstrdup(lin->ptszNick);
strings.insert(p.wszNick);
}
}
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index 3f5b0fbc1e..ece447676d 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -132,7 +132,7 @@ public:
~HistoryArray();
bool addEvent(MCONTACT hContact, MEVENT hEvent, int count, ItemData::EventLoadMode mode = ItemData::ELM_NOTHING);
- void addChatEvent(MCONTACT hContact, LOGINFO *pEvent);
+ void addChatEvent(SESSION_INFO *si, LOGINFO *pEvent);
void clear();
int getCount() const;
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 7afb4d0556..ba1564b2a4 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -466,7 +466,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
case NSM_ADDCHATEVENT:
- data->items.addChatEvent((MCONTACT)wParam, (LOGINFO*)lParam);
+ data->items.addChatEvent((SESSION_INFO *)wParam, (LOGINFO*)lParam);
RecalcScrollBar(hwnd, data);
data->scrollTopItem = data->items.getCount();
FixScrollPosition(hwnd, data);
diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp
index 277557d0f9..028aeaf819 100644
--- a/plugins/NewStory/src/history_log.cpp
+++ b/plugins/NewStory/src/history_log.cpp
@@ -48,6 +48,9 @@ public:
void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override
{
+ if (!bAppend)
+ Clear();
+
ADDEVENTS tmp = { m_pDlg.m_hContact, hDbEventFirst, count };
SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
}
@@ -55,7 +58,7 @@ public:
void LogEvents(LOGINFO *pLog, bool) override
{
while (pLog) {
- SendMessage(m_hwnd, NSM_ADDCHATEVENT, m_pDlg.m_hContact, (LPARAM)pLog);
+ SendMessage(m_hwnd, NSM_ADDCHATEVENT, (WPARAM)m_pDlg.getChat(), (LPARAM)pLog);
pLog = pLog->prev;
}
}