diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-04 13:03:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-04 13:03:00 +0300 |
commit | 7df671fa2b5260ab25ec456af143ce66e17a43d5 (patch) | |
tree | dbc8f0e348b7662f76ad7bdbf62692447796fb75 /plugins/NewStory/src/history_array.h | |
parent | 1f6bcd03f61b94992bf8171b5271a979f6203828 (diff) |
NewStory:
- mind blowing enum EventLoadMode removed and replaced with the simple bool flag;
- massive memory leak removed;
- wtext_del flag removed (now all strings are allocated via mir_alloc());
- displayed events now are marked as read if needed
Diffstat (limited to 'plugins/NewStory/src/history_array.h')
-rw-r--r-- | plugins/NewStory/src/history_array.h | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 02a2b7f471..22b1327dad 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -3,19 +3,11 @@ struct ItemData { - enum EventLoadMode - { - ELM_NOTHING, - ELM_INFO, - ELM_DATA - }; - MCONTACT hContact = 0; MEVENT hEvent = 0; - bool wtext_del = false; bool bSelected = false; - bool dbeOk = false; + bool bLoaded = false; DBEVENTINFO dbe; wchar_t *wtext = 0; @@ -27,18 +19,12 @@ struct ItemData ItemData() { memset(&dbe, 0, sizeof(dbe)); } ~ItemData(); - bool load(EventLoadMode mode); + void load(bool bFullLoad); bool isGrouped() const; - 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); + load(true); return wtext; } }; @@ -142,9 +128,8 @@ public: // bool preloadEvents(int count = 10); - 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); } + ItemData* get(int id, bool bLoad = false); + ItemData* operator[] (int id) { return get(id, true); } int FindRel(int id, int dir, Filter filter) { |