summaryrefslogtreecommitdiff
path: root/plugins/NewStory
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-25 17:41:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-25 17:41:47 +0300
commit079515ab7c42cde601dd7c3ccc7fff82d3304355 (patch)
treed26c0b70853877df2458abfa429c53cc3448f32f /plugins/NewStory
parent147122758513993f4fd8bdc6c341f21d9d8beaca (diff)
NSM_ADDHISTORY - useless event removed
Diffstat (limited to 'plugins/NewStory')
-rw-r--r--plugins/NewStory/src/history.cpp4
-rw-r--r--plugins/NewStory/src/history_control.cpp10
-rw-r--r--plugins/NewStory/src/history_control.h3
-rw-r--r--plugins/NewStory/src/history_log.cpp7
4 files changed, 6 insertions, 18 deletions
diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index 548c387501..6e52e486dd 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -559,8 +559,8 @@ public:
SetWindowText(m_hwnd, TranslateT("System history"));
}
- if (m_hContact != INVALID_CONTACT_ID)
- PostMessage(m_histControl.GetHwnd(), NSM_ADDHISTORY, m_hContact, 0);
+ ADDEVENTS tmp = { m_hContact, 0, -1 };
+ SendMessage(m_histControl.GetHwnd(), NSM_ADDEVENTS, WPARAM(&tmp), 0);
Window_SetIcon_IcoLib(m_hwnd, g_plugin.getIconHandle(ICO_NEWSTORY));
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 8891a91f8c..6cd513f4dd 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -451,17 +451,11 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
break;
// History list control messages
- case NSM_ADDHISTORY:
- data->items.addEvent((MCONTACT)wParam, db_event_first((MCONTACT)wParam), -1);
- RecalcScrollBar(hwnd, data);
- data->scrollTopItem = data->items.getCount();
- FixScrollPosition(hwnd, data);
- InvalidateRect(hwnd, 0, FALSE);
- break;
-
case NSM_ADDEVENTS:
{
auto *p = (ADDEVENTS *)wParam;
+ if (p->eventCount == -1)
+ p->hFirstEVent = db_event_first(p->hContact);
data->items.addEvent(p->hContact, p->hFirstEVent, p->eventCount);
}
RecalcScrollBar(hwnd, data);
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index 80a95047ac..b1ca830877 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -43,9 +43,6 @@ enum
// result = id
NSM_GETITEMFROMPIXEL,
- // add history for a contact
- NSM_ADDHISTORY,
-
// add one or more events
NSM_ADDEVENTS,
diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp
index 1bcd86ab24..edbacc3190 100644
--- a/plugins/NewStory/src/history_log.cpp
+++ b/plugins/NewStory/src/history_log.cpp
@@ -48,11 +48,8 @@ public:
void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override
{
- if (count != -1) {
- ADDEVENTS tmp = { m_pDlg.m_hContact, hDbEventFirst, count };
- SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
- }
- else SendMessage(m_hwnd, NSM_ADDHISTORY, m_pDlg.m_hContact, 0);
+ ADDEVENTS tmp = { m_pDlg.m_hContact, hDbEventFirst, count };
+ SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
}
void LogEvents(DBEVENTINFO *dbei_s, bool bAppend)