diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 47 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.h | 10 | ||||
-rw-r--r-- | plugins/NewStory/src/templates.cpp | 7 | ||||
-rw-r--r-- | plugins/NewStory/src/templates.h | 1 |
4 files changed, 49 insertions, 16 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index bd12438503..6b3f34d4de 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -49,6 +49,7 @@ bool Filter::check(ItemData *item) const ItemData::ItemData() { memset(this, 0, sizeof(*this)); + m_grouping = g_plugin.bMsgGrouping ? -1 : GROUPING_NONE; savedHeight = -1; } @@ -59,27 +60,41 @@ ItemData::~ItemData() MTextDestroy(data); } +void ItemData::checkPrev() +{ + // not set yet + if (m_grouping != (uint8_t)-1) + return; + + m_grouping = GROUPING_NONE; + if (!pPrev) + return; + + // we don't group anything but messages + load(false); + if (dbe.eventType != EVENTTYPE_MESSAGE) + return; + + pPrev->load(false); + if (pPrev->hContact == hContact && pPrev->dbe.eventType == dbe.eventType && (pPrev->dbe.flags & DBEF_SENT) == (dbe.flags & DBEF_SENT)) { + if (pPrev->m_grouping != GROUPING_ITEM) { + pPrev->m_grouping = GROUPING_HEAD; + pPrev->setText(); + } + m_grouping = GROUPING_ITEM; + } +} + void ItemData::checkCreate(HWND hwnd) { if (data == nullptr) { + checkPrev(); setText(); MTextSetParent(data, hwnd); MTextActivate(data, true); } } -bool ItemData::isGrouped() const -{ - if (pPrev && g_plugin.bMsgGrouping) { - if (!pPrev->m_bLoaded) - pPrev->load(true); - - if (pPrev->hContact == hContact && (pPrev->dbe.flags & DBEF_SENT) == (dbe.flags & DBEF_SENT)) - return true; - } - return false; -} - bool ItemData::isLink(POINT pt, CMStringW &url) const { int cp = MTextSendMessage(0, data, EM_CHARFROMPOS, 0, LPARAM(&pt)); @@ -127,7 +142,13 @@ bool ItemData::isLinkChar(int idx) const int ItemData::getTemplate() const { switch (dbe.eventType) { - case EVENTTYPE_MESSAGE: return isGrouped() ? TPL_MSG_GRP : TPL_MESSAGE; + case EVENTTYPE_MESSAGE: + switch (m_grouping) { + case GROUPING_HEAD: return TPL_MSG_HEAD; + case GROUPING_ITEM: return TPL_MSG_GRP; + } + return TPL_MESSAGE; + case EVENTTYPE_FILE: return TPL_FILE; case EVENTTYPE_STATUSCHANGE: return TPL_SIGN; case EVENTTYPE_AUTHREQUEST: return TPL_AUTH; diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 8f24cd49dc..d7e55433fa 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -1,6 +1,13 @@ #ifndef __history_array__ #define __history_array__ +enum +{ + GROUPING_NONE = 0, + GROUPING_HEAD = 1, + GROUPING_ITEM = 2, +}; + struct ItemData { MCONTACT hContact; @@ -10,6 +17,7 @@ struct ItemData bool m_bSelected; bool m_bLoaded; bool m_bOfflineFile, m_bOfflineDownloaded; + uint8_t m_grouping; int savedTop, savedHeight; @@ -23,11 +31,11 @@ struct ItemData ItemData(); ~ItemData(); + void checkPrev(); void checkCreate(HWND hwnd); void setText(); void load(bool bFullLoad); - bool isGrouped() const; bool isLink(POINT pt, CMStringW &url) const; bool isLinkChar(int idx) const; diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index ee0375e595..451342034e 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -307,10 +307,13 @@ TemplateInfo templates[TPL_COUNT] = { vfGlobal, vfContact, 0, 0, 0 } }, { "tpl/msglog/msg", LPGENW("Message log"), IDI_SENDMSG, LPGENW("Messages"), - L"%I%i%B[b][color=red]%N[/color], %t:[/b]\x0d\x0a%M", 0, 0, + L"%I%i%B[b]%N, %t:[/b]\r\n%M", 0, 0, + { vfGlobal, vfContact, vfEvent, vfMessage, 0 } }, + { "tpl/msglog/msg_head", LPGENW("Message log"), IDI_SENDMSG, LPGENW("Group head"), + L"%I%i%B[b]%N, %t:[/b] %M", 0, 0, { vfGlobal, vfContact, vfEvent, vfMessage, 0 } }, { "tpl/msglog/msg_grp", LPGENW("Message log"), IDI_SENDMSG, LPGENW("Grouped messages"), - L"%I%i%B[b]%t:[/b] %M", 0, 0, + L"%I%i%B[b]%h:%m:%s:[/b] %M", 0, 0, { vfGlobal, vfContact, vfEvent, vfMessage, 0 } }, { "tpl/msglog/file", LPGENW("Message log"), -SKINICON_EVENT_FILE, LPGENW("Files"), L"%I%i%B[b]%N, %t:[/b]%n%M", 0, 0, diff --git a/plugins/NewStory/src/templates.h b/plugins/NewStory/src/templates.h index 2368aa731b..a2564940c4 100644 --- a/plugins/NewStory/src/templates.h +++ b/plugins/NewStory/src/templates.h @@ -51,6 +51,7 @@ enum TPL_TITLE, TPL_MESSAGE, + TPL_MSG_HEAD, TPL_MSG_GRP, TPL_FILE, TPL_SIGN, |