summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-25 19:07:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-25 19:07:12 +0300
commit21c9f2d5e82fc4c54f367051caec6d627624d770 (patch)
tree10f47f372fcb5a34fd4054b19eb15f13b4c6a356 /plugins/NewStory/src
parente20cb1fed6dafc7fa414476acde502e999088aab (diff)
fixes #2353 (NewStory: add groupchats support)
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history_array.cpp11
-rw-r--r--plugins/NewStory/src/history_array.h1
-rw-r--r--plugins/NewStory/src/history_control.cpp8
-rw-r--r--plugins/NewStory/src/history_control.h1
-rw-r--r--plugins/NewStory/src/history_log.cpp8
-rw-r--r--plugins/NewStory/src/stdafx.h2
6 files changed, 26 insertions, 5 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index f1770c6cab..5ffc175cff 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -128,6 +128,17 @@ void HistoryArray::clear()
iLastPageCounter = 0;
}
+void HistoryArray::addChatEvent(MCONTACT hContact, LOGINFO *pEvent)
+{
+ auto &p = allocateItem();
+ p.hContact = hContact;
+ p.wtext = mir_wstrdup(pEvent->ptszText);
+ p.dbeOk = true;
+ p.dbe.pBlob = (BYTE *)p.wtext;
+ p.dbe.eventType = EVENTTYPE_MESSAGE;
+ p.dbe.timestamp = pEvent->time;
+}
+
bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count, ItemData::EventLoadMode mode)
{
if (count == -1)
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index c6a28dc99a..019e54db09 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -129,6 +129,7 @@ public:
~HistoryArray();
bool addEvent(MCONTACT hContact, MEVENT hEvent, int count, ItemData::EventLoadMode mode = ItemData::ELM_NOTHING);
+ void addChatEvent(MCONTACT hContact, LOGINFO *pEvent);
void clear();
int getCount() const;
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 6cd513f4dd..e843906dff 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -464,6 +464,14 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
InvalidateRect(hwnd, 0, FALSE);
break;
+ case NSM_ADDCHATEVENT:
+ data->items.addChatEvent((MCONTACT)wParam, (LOGINFO*)lParam);
+ RecalcScrollBar(hwnd, data);
+ data->scrollTopItem = data->items.getCount();
+ FixScrollPosition(hwnd, data);
+ InvalidateRect(hwnd, 0, FALSE);
+ break;
+
case NSM_GETCOUNT:
return data->items.getCount();
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index b1ca830877..0d0650aaaa 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -45,6 +45,7 @@ enum
// add one or more events
NSM_ADDEVENTS,
+ NSM_ADDCHATEVENT,
// wParam = id
NSM_SETCARET,
diff --git a/plugins/NewStory/src/history_log.cpp b/plugins/NewStory/src/history_log.cpp
index edbacc3190..277557d0f9 100644
--- a/plugins/NewStory/src/history_log.cpp
+++ b/plugins/NewStory/src/history_log.cpp
@@ -52,12 +52,12 @@ public:
SendMessage(m_hwnd, NSM_ADDEVENTS, (LPARAM)&tmp, 0);
}
- void LogEvents(DBEVENTINFO *dbei_s, bool bAppend)
- {
- }
-
void LogEvents(LOGINFO *pLog, bool) override
{
+ while (pLog) {
+ SendMessage(m_hwnd, NSM_ADDCHATEVENT, m_pDlg.m_hContact, (LPARAM)pLog);
+ pLog = pLog->prev;
+ }
}
void Resize() override
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index 8316520318..49924ade86 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA.
//Miranda headers
#include "newpluginapi.h"
#include "win2k.h"
-#include "m_system.h"
+#include "m_chat_int.h"
#include "m_clc.h"
#include "m_clist.h"
#include "m_options.h"