summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/msglog.cpp
diff options
context:
space:
mode:
authorMataes <mataes2007@gmail.com>2020-04-04 17:25:28 +0300
committerMataes <mataes2007@gmail.com>2020-04-04 17:25:28 +0300
commit479016d6aea04b12a48c2258607acf70a57bc099 (patch)
tree0c116bf4a7e12a51f059e75a21ac899cf0cb119b /plugins/NewStory/src/msglog.cpp
parent2fb222dfb7740081c6f457e9e564d5d1cd0a7824 (diff)
newstory: preparation for logging class
Diffstat (limited to 'plugins/NewStory/src/msglog.cpp')
-rw-r--r--plugins/NewStory/src/msglog.cpp220
1 files changed, 220 insertions, 0 deletions
diff --git a/plugins/NewStory/src/msglog.cpp b/plugins/NewStory/src/msglog.cpp
new file mode 100644
index 0000000000..fb93264d00
--- /dev/null
+++ b/plugins/NewStory/src/msglog.cpp
@@ -0,0 +1,220 @@
+#include "stdafx.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CNewStoryLogWindow class
+
+class CNewStoryLogWindow : public CSrmmLogWindow
+{
+ HWND m_hwnd = nullptr;
+
+public:
+ CNewStoryLogWindow(CMsgDialog& pDlg) :
+ CSrmmLogWindow(pDlg)
+ {
+ }
+
+ void Attach() override
+ {
+ /*IEVIEWWINDOW ieWindow = {};
+ ieWindow.iType = IEW_CREATE;
+ ieWindow.dwMode = IEWM_TABSRMM;
+ ieWindow.parent = m_pDlg.GetHwnd();
+ ieWindow.cx = 200;
+ ieWindow.cy = 200;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
+ m_hwnd = ieWindow.hwnd;*/
+ }
+
+ void Detach() override
+ {
+ /*IEVIEWWINDOW ieWindow = {};
+ ieWindow.iType = IEW_DESTROY;
+ ieWindow.hwnd = m_hwnd;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);*/
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////
+
+ bool AtBottom() override
+ {
+ return false;
+ }
+
+ void Clear() override
+ {
+ /*IEVIEWEVENT event = {};
+ event.iType = IEE_CLEAR_LOG;
+ event.hwnd = m_hwnd;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);*/
+ }
+
+ HWND GetHwnd() override
+ {
+ return m_hwnd;
+ }
+
+ wchar_t* GetSelection() override
+ {
+ return (wchar_t*)1;
+ /*IEVIEWEVENT event = {};
+ event.hwnd = m_hwnd;
+ event.iType = IEE_GET_SELECTION;
+ event.hContact = m_pDlg.m_hContact;
+ return (wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);*/
+ }
+
+ int GetType() override
+ {
+ return 1;
+ }
+
+ void LogEvents(MEVENT hDbEventFirst, int count, bool bAppend) override
+ {
+ /*if (!bAppend)
+ Clear();
+
+ IEVIEWEVENT event = {};
+ event.iType = IEE_LOG_DB_EVENTS;
+ event.hwnd = m_hwnd;
+ event.hDbEventFirst = hDbEventFirst;
+ event.hContact = m_pDlg.m_hContact;
+ event.count = count;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);*/
+ }
+
+ void CNewStoryLogWindow::LogEvents(DBEVENTINFO* dbei_s, bool bAppend)
+ {
+ if (dbei_s == nullptr)
+ return;
+
+ /*if (!bAppend)
+ Clear();
+
+ IEVIEWEVENT event = {};
+ event.hwnd = m_hwnd;
+ event.iType = IEE_LOG_MEM_EVENTS;
+ event.count = 1;
+
+ IEVIEWEVENTDATA evData = {};
+ if (dbei_s->flags & DBEF_SENT) {
+ evData.dwFlags = IEEDF_SENT;
+ evData.bIsMe = true;
+ }
+ else {
+ evData.dwFlags = IEEDF_UNICODE_NICK;
+ evData.szNick.w = Clist_GetContactDisplayName(m_pDlg.m_hContact);
+ }
+ switch (dbei_s->eventType) {
+ case EVENTTYPE_STATUSCHANGE: evData.iType = IEED_EVENT_STATUSCHANGE; break;
+ case EVENTTYPE_FILE: evData.iType = IEED_EVENT_FILE; break;
+ case EVENTTYPE_ERRMSG: evData.iType = IEED_EVENT_ERRMSG; break;
+ default: evData.iType = IEED_EVENT_MESSAGE; break;
+ }
+ evData.szText.a = (char*)dbei_s->pBlob;
+ evData.time = dbei_s->timestamp;
+ event.eventData = &evData;
+ event.codepage = CP_UTF8;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);*/
+ }
+
+ void LogEvents(LOGINFO* pLog, bool) override
+ {
+ /*IEVIEWEVENTDATA ied = {};
+ ied.dwFlags = IEEDF_UNICODE_NICK;
+
+ IEVIEWEVENT event = {};
+ event.hwnd = m_hwnd;
+ event.hContact = m_pDlg.m_hContact;
+ event.codepage = CP_UTF8;
+ event.iType = IEE_LOG_MEM_EVENTS;
+ event.eventData = &ied;
+ event.count = 1;
+
+ while (pLog) {
+ T2Utf szText(pLog->ptszText);
+ ied.szNick.w = pLog->ptszNick;
+ ied.szText.a = szText;
+ ied.time = pLog->time;
+ ied.bIsMe = pLog->bIsMe;
+
+ switch (pLog->iType) {
+ case GC_EVENT_MESSAGE:
+ ied.iType = IEED_GC_EVENT_MESSAGE;
+ ied.dwData = IEEDD_GC_SHOW_NICK;
+ break;
+ case GC_EVENT_ACTION:
+ ied.iType = IEED_GC_EVENT_ACTION;
+ break;
+ case GC_EVENT_JOIN:
+ ied.iType = IEED_GC_EVENT_JOIN;
+ break;
+ case GC_EVENT_PART:
+ ied.iType = IEED_GC_EVENT_PART;
+ break;
+ case GC_EVENT_QUIT:
+ ied.iType = IEED_GC_EVENT_QUIT;
+ break;
+ case GC_EVENT_NICK:
+ ied.iType = IEED_GC_EVENT_NICK;
+ break;
+ case GC_EVENT_KICK:
+ ied.iType = IEED_GC_EVENT_KICK;
+ break;
+ case GC_EVENT_NOTICE:
+ ied.iType = IEED_GC_EVENT_NOTICE;
+ break;
+ case GC_EVENT_TOPIC:
+ ied.iType = IEED_GC_EVENT_TOPIC;
+ break;
+ case GC_EVENT_INFORMATION:
+ ied.iType = IEED_GC_EVENT_INFORMATION;
+ break;
+ case GC_EVENT_ADDSTATUS:
+ ied.iType = IEED_GC_EVENT_ADDSTATUS;
+ break;
+ case GC_EVENT_REMOVESTATUS:
+ ied.iType = IEED_GC_EVENT_REMOVESTATUS;
+ break;
+ }
+
+ ied.dwData |= IEEDD_GC_SHOW_TIME | IEEDD_GC_SHOW_ICON;
+ ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
+ CallService(MS_IEVIEW_EVENT, 0, (LPARAM) & event);
+
+ pLog = pLog->prev;
+ }*/
+ }
+
+ void Resize() override
+ {
+ /*RECT rcRichEdit;
+ GetWindowRect(GetDlgItem(m_pDlg.GetHwnd(), IDC_SRMM_LOG), &rcRichEdit);
+
+ POINT pt = { rcRichEdit.left, rcRichEdit.top };
+ ScreenToClient(GetParent(m_hwnd), &pt);
+
+ IEVIEWWINDOW ieWindow = { sizeof(ieWindow) };
+ ieWindow.iType = IEW_SETPOS;
+ ieWindow.parent = m_hwnd;
+ ieWindow.hwnd = m_hwnd;
+ ieWindow.x = pt.x;
+ ieWindow.y = pt.y;
+ ieWindow.cx = rcRichEdit.right - rcRichEdit.left;
+ ieWindow.cy = rcRichEdit.bottom - rcRichEdit.top;
+ if (ieWindow.cx != 0 && ieWindow.cy != 0)
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);*/
+ }
+
+ void ScrollToBottom() override
+ {
+ /*IEVIEWWINDOW iew = { sizeof(iew) };
+ iew.iType = IEW_SCROLLBOTTOM;
+ iew.hwnd = m_hwnd;
+ CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&iew);*/
+ }
+};
+
+CSrmmLogWindow *logBuilder(CMsgDialog &pDlg)
+{
+ return new CNewStoryLogWindow(pDlg);
+} \ No newline at end of file