summaryrefslogtreecommitdiff
path: root/plugins/NewStory
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-25 16:25:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-25 16:25:33 +0300
commit555d5d02725f7f81562bdcdb7c2c5ae27230a4f4 (patch)
treef88d6766e834099910f33cd9486b7b82ee0cdbf7 /plugins/NewStory
parentca0f88fea7e2c6cc3eaf506b897ebad95239d4c1 (diff)
NewStory: major code cleaning
Diffstat (limited to 'plugins/NewStory')
-rw-r--r--plugins/NewStory/src/history_array.cpp144
-rw-r--r--plugins/NewStory/src/history_array.h248
-rw-r--r--plugins/NewStory/src/history_control.cpp30
-rw-r--r--plugins/NewStory/src/options.cpp4
-rw-r--r--plugins/NewStory/src/templates.cpp30
-rw-r--r--plugins/NewStory/src/templates.h6
6 files changed, 214 insertions, 248 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 4412584479..f1770c6cab 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -1,12 +1,49 @@
#include "stdafx.h"
+bool Filter::check(ItemData *item)
+{
+ if (!item) return false;
+ if (!(flags & EVENTONLY)) {
+ if (item->dbe.flags & DBEF_SENT) {
+ if (!(flags & OUTGOING))
+ return false;
+ }
+ else {
+ if (!(flags & INCOMING))
+ return false;
+ }
+ switch (item->dbe.eventType) {
+ case EVENTTYPE_MESSAGE:
+ if (!(flags & MESSAGES))
+ return false;
+ break;
+ case EVENTTYPE_FILE:
+ if (!(flags & FILES))
+ return false;
+ break;
+ case EVENTTYPE_STATUSCHANGE:
+ if (!(flags & STATUS))
+ return false;
+ break;
+ default:
+ if (!(flags & OTHER))
+ return false;
+ }
+ }
+ if (flags & (EVENTTEXT | EVENTONLY)) {
+ item->loadInline(ItemData::ELM_DATA);
+ return CheckFilter(item->getWBuf(), text);
+ }
+ return true;
+};
+
// Event
-bool HistoryArray::ItemData::load(EventLoadMode mode)
+bool ItemData::load(EventLoadMode mode)
{
- if (mode == ELM_NOTHING)
+ if (mode == ItemData::ELM_NOTHING)
return true;
- if ((mode == ELM_INFO) && !dbeOk) {
+ if ((mode == ItemData::ELM_INFO) && !dbeOk) {
dbeOk = true;
dbe.cbBlob = 0;
dbe.pBlob = 0;
@@ -14,7 +51,7 @@ bool HistoryArray::ItemData::load(EventLoadMode mode)
return true;
}
- if ((mode == ELM_DATA) && (!dbeOk || !dbe.cbBlob)) {
+ if ((mode == ItemData::ELM_DATA) && (!dbeOk || !dbe.cbBlob)) {
dbeOk = true;
dbe.cbBlob = db_event_getBlobSize(hEvent);
dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob + 1);
@@ -63,7 +100,7 @@ bool HistoryArray::ItemData::load(EventLoadMode mode)
return false;
}
-HistoryArray::ItemData::~ItemData()
+ItemData::~ItemData()
{
if (dbeOk && dbe.pBlob) {
mir_free(dbe.pBlob);
@@ -74,8 +111,10 @@ HistoryArray::ItemData::~ItemData()
}
// Array
-HistoryArray::HistoryArray()
+HistoryArray::HistoryArray() :
+ pages(50)
{
+ pages.insert(new ItemBlock());
}
HistoryArray::~HistoryArray()
@@ -83,77 +122,48 @@ HistoryArray::~HistoryArray()
clear();
}
-bool HistoryArray::allocateBlock(int count)
-{
- ItemBlock *newBlock = new ItemBlock;
- newBlock->items = new ItemData[count];
- newBlock->count = count;
- newBlock->prev = tail;
- newBlock->next = 0;
-
- if (tail) {
- tail->next = newBlock;
- }
- else {
- head = newBlock;
- }
- tail = newBlock;
-
- return true;
-}
-
void HistoryArray::clear()
{
- while (head) {
- ItemBlock *next = head->next;
- // for (int i = 0; i < head->count; ++i)
- // destroyEvent(head->items[i]);
- delete[] head->items;
- head = next;
- }
-
- head = tail = 0;
- preBlock = 0;
- preIndex = 0;
+ pages.destroy();
+ iLastPageCounter = 0;
}
-bool HistoryArray::addHistory(MCONTACT hContact, EventLoadMode)
+bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count, ItemData::EventLoadMode mode)
{
- int count = db_event_count(hContact);
- allocateBlock(count);
+ if (count == -1)
+ count = MAXINT;
- int i = 0;
- MEVENT hEvent = db_event_first(hContact);
- while (hEvent) {
- tail->items[i].hContact = hContact;
- tail->items[i].hEvent = hEvent;
+ for (int i = 0; hEvent && i < count; i++) {
+ auto &p = allocateItem();
+ p.hContact = hContact;
+ p.hEvent = hEvent;
- ++i;
+ if (mode != ItemData::ELM_NOTHING)
+ p.load(mode);
+
hEvent = db_event_next(hContact, hEvent);
}
+
return true;
}
-bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count, EventLoadMode mode)
+ItemData& HistoryArray::allocateItem()
{
- allocateBlock(count);
-
- for (int i = 0; i < count; i++) {
- tail->items[i].hContact = hContact;
- tail->items[i].hEvent = hEvent;
- if (mode != ELM_NOTHING)
- tail->items[i].load(mode);
- hEvent = db_event_next(hContact, hEvent);
+ if (iLastPageCounter == HIST_BLOCK_SIZE - 1) {
+ pages.insert(new ItemBlock());
+ iLastPageCounter = 0;
}
- return true;
+ auto &p = pages[pages.getCount() - 1];
+ return p.data[iLastPageCounter++];
}
+
/*
bool HistoryArray::preloadEvents(int count)
{
for (int i = 0; i < count; ++i)
{
- preBlock->items[preIndex].load(ELM_DATA);
+ preBlock->items[preIndex].load(ItemData::ELM_DATA);
if (++preIndex == preBlock->count)
{
preBlock = preBlock->next;
@@ -165,17 +175,17 @@ bool HistoryArray::preloadEvents(int count)
return true;
}
*/
-HistoryArray::ItemData *HistoryArray::get(int id, EventLoadMode mode)
+
+ItemData* HistoryArray::get(int id, ItemData::EventLoadMode mode)
{
- int offset = 0;
- for (ItemBlock *p = head; p; p = p->next) {
- if (id < offset + p->count) {
- if (mode != ELM_NOTHING)
- p->items[id - offset].load(mode);
+ int pageNo = id / HIST_BLOCK_SIZE;
+ if (pageNo >= pages.getCount())
+ return nullptr;
- return p->items + id - offset;
- }
- offset += p->count;
- }
- return 0;
+ return &pages[pageNo].data[id % HIST_BLOCK_SIZE];
+}
+
+int HistoryArray::getCount() const
+{
+ return (pages.getCount() - 1) * HIST_BLOCK_SIZE + iLastPageCounter;
}
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index 3141c3146f..c6a28dc99a 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -1,11 +1,94 @@
#ifndef __history_array__
#define __history_array__
-enum EventLoadMode
+struct ItemData
{
- ELM_NOTHING,
- ELM_INFO,
- ELM_DATA
+ enum EventLoadMode
+ {
+ ELM_NOTHING,
+ ELM_INFO,
+ ELM_DATA
+ };
+
+ BYTE flags = 0;
+
+ MCONTACT hContact = 0;
+ MEVENT hEvent = 0;
+
+ bool dbeOk = false;
+ DBEVENTINFO dbe;
+
+ bool wtext_del = false;
+ wchar_t *wtext = 0;
+
+ HANDLE data = 0;
+
+ ItemData() { memset(&dbe, 0, sizeof(dbe)); }
+ ~ItemData();
+
+ bool load(EventLoadMode mode);
+ inline bool loadInline(EventLoadMode mode)
+ {
+ if (((mode >= ItemData::ELM_INFO) && !dbeOk) || ((mode == ItemData::ELM_DATA) && !dbe.pBlob))
+ return load(mode);
+ return true;
+ }
+ inline wchar_t *getWBuf()
+ {
+ loadInline(ItemData::ELM_DATA);
+ return wtext;
+ }
+};
+
+class Filter
+{
+ WORD flags;
+ int *refCount;
+ wchar_t *text;
+
+public:
+ enum
+ {
+ INCOMING = 0x001,
+ OUTGOING = 0x002,
+ MESSAGES = 0x004,
+ FILES = 0x008,
+ STATUS = 0x020,
+ OTHER = 0x040,
+ EVENTTEXT = 0x080,
+ EVENTONLY = 0x100,
+ };
+
+ Filter(WORD aFlags, wchar_t *wText)
+ {
+ refCount = new int(0);
+ flags = aFlags;
+ text = new wchar_t[mir_wstrlen(wText) + 1];
+ mir_wstrcpy(text, wText);
+ }
+ Filter(const Filter &other)
+ {
+ flags = other.flags;
+ refCount = other.refCount;
+ text = other.text;
+ ++ *refCount;
+ }
+ Filter &operator=(const Filter &other)
+ {
+ flags = other.flags;
+ refCount = other.refCount;
+ text = other.text;
+ ++ *refCount;
+ }
+ ~Filter()
+ {
+ if (!-- * refCount) {
+ delete refCount;
+ if (text) delete[] text;
+ }
+ }
+
+ bool check(ItemData *item);
};
enum
@@ -27,152 +110,33 @@ enum
FTYPE_OUTGOING = 0x40
};
-class HistoryArray
-{
-public:
- struct ItemData
- {
- BYTE flags = 0;
-
- MCONTACT hContact = 0;
- MEVENT hEvent = 0;
-
- bool dbeOk = false;
- DBEVENTINFO dbe;
-
- bool wtext_del = false;
- wchar_t* wtext = 0;
+#define HIST_BLOCK_SIZE 1000
- HANDLE data = 0;
-
- ItemData() { memset(&dbe, 0, sizeof(dbe)); }
- ~ItemData();
-
- bool load(EventLoadMode mode);
- inline bool loadInline(EventLoadMode mode)
- {
- if (((mode >= ELM_INFO) && !dbeOk) || ((mode == ELM_DATA) && !dbe.pBlob))
- return load(mode);
- return true;
- }
- inline wchar_t* getWBuf()
- {
- loadInline(ELM_DATA);
- return wtext;
- }
- };
-
- struct ItemBlock
- {
- ItemData* items;
- int count;
- ItemBlock* prev, * next;
- };
+struct ItemBlock : public MZeroedObject
+{
+ ItemData data[HIST_BLOCK_SIZE];
+};
- class Filter
- {
- public:
- enum
- {
- INCOMING = 0x001,
- OUTGOING = 0x002,
- MESSAGES = 0x004,
- FILES = 0x008,
- STATUS = 0x020,
- OTHER = 0x040,
- EVENTTEXT = 0x080,
- EVENTONLY = 0x100,
- };
- Filter(WORD aFlags, wchar_t* wText)
- {
- refCount = new int(0);
- flags = aFlags;
- text = new wchar_t[mir_wstrlen(wText) + 1];
- mir_wstrcpy(text, wText);
- }
- Filter(const Filter& other)
- {
- flags = other.flags;
- refCount = other.refCount;
- text = other.text;
- ++* refCount;
- }
- Filter& operator=(const Filter& other)
- {
- flags = other.flags;
- refCount = other.refCount;
- text = other.text;
- ++* refCount;
- }
- ~Filter()
- {
- if (!-- * refCount) {
- delete refCount;
- if (text) delete[] text;
- }
- }
- inline bool check(ItemData* item)
- {
- if (!item) return false;
- if (!(flags & EVENTONLY)) {
- if (item->dbe.flags & DBEF_SENT) {
- if (!(flags & OUTGOING))
- return false;
- }
- else {
- if (!(flags & INCOMING))
- return false;
- }
- switch (item->dbe.eventType) {
- case EVENTTYPE_MESSAGE:
- if (!(flags & MESSAGES))
- return false;
- break;
- case EVENTTYPE_FILE:
- if (!(flags & FILES))
- return false;
- break;
- case EVENTTYPE_STATUSCHANGE:
- if (!(flags & STATUS))
- return false;
- break;
- default:
- if (!(flags & OTHER))
- return false;
- }
- }
- if (flags & (EVENTTEXT | EVENTONLY)) {
- item->loadInline(ELM_DATA);
- return CheckFilter(item->getWBuf(), text);
- }
- return true;
- };
-
- private:
- WORD flags;
- int* refCount;
- wchar_t* text;
- };
+class HistoryArray
+{
+ OBJLIST<ItemBlock> pages;
+ int iLastPageCounter = 0;
-private:
- ItemBlock* head = 0, * tail = 0;
- ItemBlock* preBlock = 0;
- int preIndex = 0;
- bool allocateBlock(int count);
+ ItemData& allocateItem(void);
public:
HistoryArray();
~HistoryArray();
+ bool addEvent(MCONTACT hContact, MEVENT hEvent, int count, ItemData::EventLoadMode mode = ItemData::ELM_NOTHING);
void clear();
- bool addHistory(MCONTACT hContact, EventLoadMode mode = ELM_NOTHING);
- bool addEvent(MCONTACT hContact, MEVENT hEvent, int count, EventLoadMode mode = ELM_NOTHING);
+ int getCount() const;
// bool preloadEvents(int count = 10);
- ItemData* get(int id, EventLoadMode mode = ELM_NOTHING);
- ItemData* operator[] (int id) { return get(id, ELM_DATA); }
- ItemData* operator() (int id) { return get(id, ELM_INFO); }
+ ItemData* get(int id, ItemData::EventLoadMode mode = ItemData::ELM_NOTHING);
+ ItemData* operator[] (int id) { return get(id, ItemData::ELM_DATA); }
+ ItemData* operator() (int id) { return get(id, ItemData::ELM_INFO); }
int FindRel(int id, int dir, Filter filter)
{
@@ -184,14 +148,6 @@ public:
}
int FindNext(int id, Filter filter) { return FindRel(id, +1, filter); }
int FindPrev(int id, Filter filter) { return FindRel(id, -1, filter); }
-
- int getCount()
- {
- int res = 0;
- for (ItemBlock* p = head; p; p = p->next)
- res += p->count;
- return res;
- }
};
#endif // __history_array__
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 56e814718d..8891a91f8c 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -195,7 +195,7 @@ static void BeginEditItem(HWND hwnd, NewstoryListData *data, int index)
int itemHeight = LayoutItem(hwnd, &data->items, idx);
while (top < height) {
if (idx == index) {
- HistoryArray::ItemData *item = data->items.get(index, ELM_DATA);
+ ItemData *item = data->items.get(index, ItemData::ELM_DATA);
int tpl;
int fontid;
@@ -272,7 +272,7 @@ static int LayoutItem(HWND hwnd, HistoryArray *items, int index)
RECT rc; GetClientRect(hwnd, &rc);
int width = rc.right - rc.left;
- HistoryArray::ItemData *item = items->get(index, ELM_DATA);
+ ItemData *item = items->get(index, ItemData::ELM_DATA);
if (!item) return 0;
int tpl;
@@ -331,7 +331,7 @@ static int LayoutItem(HWND hwnd, HistoryArray *items, int index)
static int PaintItem(HDC hdc, HistoryArray *items, int index, int top, int width)
{
if (!items) return 0;
- HistoryArray::ItemData *item = items->get(index, ELM_DATA);
+ ItemData *item = items->get(index, ItemData::ELM_DATA);
// LOGFONT lfText;
COLORREF clText, clBack, clLine;
@@ -452,7 +452,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
// History list control messages
case NSM_ADDHISTORY:
- data->items.addHistory((MCONTACT)wParam);
+ data->items.addEvent((MCONTACT)wParam, db_event_first((MCONTACT)wParam), -1);
RecalcScrollBar(hwnd, data);
data->scrollTopItem = data->items.getCount();
FixScrollPosition(hwnd, data);
@@ -483,7 +483,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
start ^= end;
}
for (int i = start; i <= end; ++i)
- data->items.get(i, ELM_NOTHING)->flags |= HIF_SELECTED;
+ data->items.get(i, ItemData::ELM_NOTHING)->flags |= HIF_SELECTED;
InvalidateRect(hwnd, 0, FALSE);
return 0;
}
@@ -498,11 +498,11 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
start ^= end;
}
for (int i = start; i <= end; ++i) {
- if (data->items.get(i, ELM_NOTHING)->flags & HIF_SELECTED) {
- data->items.get(i, ELM_NOTHING)->flags &= ~HIF_SELECTED;
+ if (data->items.get(i, ItemData::ELM_NOTHING)->flags & HIF_SELECTED) {
+ data->items.get(i, ItemData::ELM_NOTHING)->flags &= ~HIF_SELECTED;
}
else {
- data->items.get(i, ELM_NOTHING)->flags |= HIF_SELECTED;
+ data->items.get(i, ItemData::ELM_NOTHING)->flags |= HIF_SELECTED;
}
}
InvalidateRect(hwnd, 0, FALSE);
@@ -521,10 +521,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int count = data->items.getCount();
for (int i = 0; i < count; ++i) {
if ((i >= start) && (i <= end)) {
- data->items.get(i, ELM_NOTHING)->flags |= HIF_SELECTED;
+ data->items.get(i, ItemData::ELM_NOTHING)->flags |= HIF_SELECTED;
}
else {
- data->items.get(i, ELM_NOTHING)->flags &= ~((DWORD)HIF_SELECTED);
+ data->items.get(i, ItemData::ELM_NOTHING)->flags &= ~((DWORD)HIF_SELECTED);
}
}
InvalidateRect(hwnd, 0, FALSE);
@@ -541,7 +541,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
start ^= end;
}
for (int i = start; i <= end; ++i)
- data->items.get(i, ELM_NOTHING)->flags &= ~((DWORD)HIF_SELECTED);
+ data->items.get(i, ItemData::ELM_NOTHING)->flags &= ~((DWORD)HIF_SELECTED);
InvalidateRect(hwnd, 0, FALSE);
return 0;
}
@@ -582,7 +582,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_FINDNEXT:
{
- int id = data->items.FindNext(SendMessage(hwnd, NSM_GETCARET, 0, 0), HistoryArray::Filter(HistoryArray::Filter::EVENTONLY, (wchar_t *)wParam));
+ int id = data->items.FindNext(SendMessage(hwnd, NSM_GETCARET, 0, 0), Filter(Filter::EVENTONLY, (wchar_t *)wParam));
if (id >= 0) {
SendMessage(hwnd, NSM_SELECTITEMS2, id, id);
SendMessage(hwnd, NSM_SETCARET, id, TRUE);
@@ -592,7 +592,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_FINDPREV:
{
- int id = data->items.FindPrev(SendMessage(hwnd, NSM_GETCARET, 0, 0), HistoryArray::Filter(HistoryArray::Filter::EVENTONLY, (wchar_t *)wParam));
+ int id = data->items.FindPrev(SendMessage(hwnd, NSM_GETCARET, 0, 0), Filter(Filter::EVENTONLY, (wchar_t *)wParam));
if (id >= 0) {
SendMessage(hwnd, NSM_SELECTITEMS2, id, id);
SendMessage(hwnd, NSM_SETCARET, id, TRUE);
@@ -604,7 +604,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
int eventCount = data->items.getCount();
for (int i = 0; i < eventCount; i++) {
- auto *item = data->items.get(i, ELM_NOTHING);
+ auto *item = data->items.get(i, ItemData::ELM_NOTHING);
if (item->dbe.timestamp >= wParam) {
SendMessage(hwnd, NSM_SELECTITEMS2, i, i);
SendMessage(hwnd, NSM_SETCARET, i, TRUE);
@@ -629,7 +629,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int eventCount = data->items.getCount();
for (int i = 0; i < eventCount; i++) {
- HistoryArray::ItemData *item = data->items.get(i, ELM_NOTHING);
+ ItemData *item = data->items.get(i, ItemData::ELM_NOTHING);
if (item->flags & HIF_SELECTED)
res.Append(ptrW(TplFormatString(TPL_COPY_MESSAGE, item->hContact, item)));
}
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp
index f873699eec..62d99ce804 100644
--- a/plugins/NewStory/src/options.cpp
+++ b/plugins/NewStory/src/options.cpp
@@ -10,7 +10,7 @@ class COptionsDlg : public CDlgBase
{
replaceStrW(m_curr->tmpValue, m_edit.GetText());
- HistoryArray::ItemData item;
+ ItemData item;
item.hContact = db_find_first();
while (item.hContact && !item.hEvent) {
item.hEvent = db_event_first(item.hContact);
@@ -19,7 +19,7 @@ class COptionsDlg : public CDlgBase
}
if (item.hContact && item.hEvent) {
- item.load(ELM_DATA);
+ item.load(ItemData::ELM_DATA);
ptrW wszText(TplFormatStringEx(int(m_curr-templates), m_curr->tmpValue, item.hContact, &item));
preview.SetText(wszText);
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp
index a0eb2bfa94..1d033d1254 100644
--- a/plugins/NewStory/src/templates.cpp
+++ b/plugins/NewStory/src/templates.cpp
@@ -2,7 +2,7 @@
int TplMeasureVars(TemplateVars* vars, wchar_t* str);
-wchar_t *TplFormatStringEx(int tpl, wchar_t *sztpl, MCONTACT hContact, HistoryArray::ItemData *item)
+wchar_t *TplFormatStringEx(int tpl, wchar_t *sztpl, MCONTACT hContact, ItemData *item)
{
if ((tpl < 0) || (tpl >= TPL_COUNT) || !sztpl)
return mir_wstrdup(L"");
@@ -31,7 +31,7 @@ wchar_t *TplFormatStringEx(int tpl, wchar_t *sztpl, MCONTACT hContact, HistoryAr
return buf;
}
-wchar_t *TplFormatString(int tpl, MCONTACT hContact, HistoryArray::ItemData *item)
+wchar_t *TplFormatString(int tpl, MCONTACT hContact, ItemData *item)
{
if ((tpl < 0) || (tpl >= TPL_COUNT))
return mir_wstrdup(L"");
@@ -102,7 +102,7 @@ int TplMeasureVars(TemplateVars *vars, wchar_t *str)
}
// Loading variables
-void vfGlobal(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemData *)
+void vfGlobal(int, TemplateVars *vars, MCONTACT hContact, ItemData *)
{
// %%: simply % character
vars->SetVar('%', L"%", false);
@@ -116,7 +116,7 @@ void vfGlobal(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemData
vars->SetVar('S', nick, false);
}
-void vfContact(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemData *)
+void vfContact(int, TemplateVars *vars, MCONTACT hContact, ItemData *)
{
// %N: buddy's nick (not for messages)
wchar_t *nick = Clist_GetContactDisplayName(hContact, 0);
@@ -128,7 +128,7 @@ void vfContact(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemDat
vars->SetVar('c', buf, false);
}
-void vfSystem(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemData *)
+void vfSystem(int, TemplateVars *vars, MCONTACT hContact, ItemData *)
{
// %N: buddy's nick (not for messages)
vars->SetVar('N', LPGENW("System event"), false);
@@ -139,7 +139,7 @@ void vfSystem(int, TemplateVars *vars, MCONTACT hContact, HistoryArray::ItemData
vars->SetVar('c', buf, false);
}
-void vfEvent(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfEvent(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
HICON hIcon;
wchar_t buf[100];
@@ -233,55 +233,55 @@ void vfEvent(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
vars->SetVar('O', TranslateW(buf), false);
}
-void vfMessage(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfMessage(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfFile(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfFile(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfUrl(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfUrl(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfSign(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfSign(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfAuth(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfAuth(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfAdded(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfAdded(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfPresence(int, TemplateVars* vars, MCONTACT, HistoryArray::ItemData* item)
+void vfPresence(int, TemplateVars* vars, MCONTACT, ItemData* item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfDeleted(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *item)
+void vfDeleted(int, TemplateVars *vars, MCONTACT, ItemData *item)
{
// %M: the message string itself
vars->SetVar('M', item->getWBuf(), false);
}
-void vfOther(int, TemplateVars *vars, MCONTACT, HistoryArray::ItemData *)
+void vfOther(int, TemplateVars *vars, MCONTACT, ItemData *)
{
// %M: the message string itself
vars->SetVar('M', LPGENW("Unknown event"), false);
diff --git a/plugins/NewStory/src/templates.h b/plugins/NewStory/src/templates.h
index 222ebd22f6..69491a4a3c 100644
--- a/plugins/NewStory/src/templates.h
+++ b/plugins/NewStory/src/templates.h
@@ -24,7 +24,7 @@ struct TemplateVars
}
};
-typedef void(*VarFunc)(int mode, TemplateVars* vars, MCONTACT hContact, HistoryArray::ItemData* item);
+typedef void(*VarFunc)(int mode, TemplateVars* vars, MCONTACT hContact, ItemData* item);
struct TemplateInfo
{
@@ -73,7 +73,7 @@ extern TemplateInfo templates[TPL_COUNT];
void LoadTemplates();
void SaveTemplates();
-wchar_t* TplFormatString(int tpl, MCONTACT hContact, HistoryArray::ItemData* args);
-wchar_t* TplFormatStringEx(int tpl, wchar_t* sztpl, MCONTACT hContact, HistoryArray::ItemData* args);
+wchar_t* TplFormatString(int tpl, MCONTACT hContact, ItemData *args);
+wchar_t* TplFormatStringEx(int tpl, wchar_t *sztpl, MCONTACT hContact, ItemData *args);
#endif // __templates_h__ \ No newline at end of file