diff options
Diffstat (limited to 'plugins/NewStory/src/history_array.h')
-rw-r--r-- | plugins/NewStory/src/history_array.h | 109 |
1 files changed, 52 insertions, 57 deletions
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 640548e84d..bf688aefdb 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -12,19 +12,19 @@ enum { HIF_SELECTED = 0x01, - FILTER_TIME = 0x01, - FILTER_TYPE = 0x02, + FILTER_TIME = 0x01, + FILTER_TYPE = 0x02, FILTER_DIRECTION = 0x04, - FILTER_TEXT = 0x08, - FILTER_UNICODE = 0x10, - - FTYPE_MESSAGE = 0x01, - FTYPE_FILE = 0x02, - FTYPE_URL = 0x04, - FTYPE_STATUS = 0x08, - FTYPE_OTHER = 0x10, - FTYPE_INCOMING = 0x20, - FTYPE_OUTGOING = 0x40 + FILTER_TEXT = 0x08, + FILTER_UNICODE = 0x10, + + FTYPE_MESSAGE = 0x01, + FTYPE_FILE = 0x02, + FTYPE_URL = 0x04, + FTYPE_STATUS = 0x08, + FTYPE_OTHER = 0x10, + FTYPE_INCOMING = 0x20, + FTYPE_OUTGOING = 0x40 }; class HistoryArray @@ -46,7 +46,7 @@ public: HANDLE data; - ItemData(): flags(0), hContact(0), hEvent(0), atext(0), wtext(0), atext_del(false), wtext_del(false), data(0), dbeOk(false) {} + ItemData() : flags(0), hContact(0), hEvent(0), atext(0), wtext(0), atext_del(false), wtext_del(false), data(0), dbeOk(false) {} ~ItemData(); bool load(EventLoadMode mode); inline bool loadInline(EventLoadMode mode) @@ -59,9 +59,9 @@ public: { loadInline(ELM_DATA); #ifdef UNICODE - return wtext; + return wtext; #else - return atext; + return atext; #endif } inline char *getBuf() @@ -88,13 +88,13 @@ public: public: enum { - INCOMING = 0x001, - OUTGOING = 0x002, - MESSAGES = 0x004, - FILES = 0x008, - URLS = 0x010, - STATUS = 0x020, - OTHER = 0x040, + INCOMING = 0x001, + OUTGOING = 0x002, + MESSAGES = 0x004, + FILES = 0x008, + URLS = 0x010, + STATUS = 0x020, + OTHER = 0x040, EVENTTEXT = 0x080, EVENTONLY = 0x100, }; @@ -102,7 +102,7 @@ public: { refCount = new int(0); flags = aFlags; - text = new TCHAR[lstrlen(aText)+1]; + text = new TCHAR[lstrlen(aText) + 1]; lstrcpy(text, aText); } Filter(const Filter &other) @@ -121,51 +121,46 @@ public: } ~Filter() { - if (!--*refCount) - { + if (!--*refCount) { delete refCount; - if (text) delete [] text; + if (text) delete[] text; } } inline bool check(ItemData *item) { if (!item) return false; - if (!(flags & EVENTONLY)) - { - if (item->dbe.flags & DBEF_SENT) - { + if (!(flags & EVENTONLY)) { + if (item->dbe.flags & DBEF_SENT) { if (!(flags & OUTGOING)) return false; - } else - { + } + 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_URL: - if (!(flags & URLS)) - return false; - break; - case EVENTTYPE_STATUSCHANGE: - if (!(flags & STATUS)) - return false; - break; - default: - if (!(flags & OTHER)) - 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_URL: + if (!(flags & URLS)) + return false; + break; + case EVENTTYPE_STATUSCHANGE: + if (!(flags & STATUS)) + return false; + break; + default: + if (!(flags & OTHER)) + return false; } } - if (flags & (EVENTTEXT|EVENTONLY)) - { + if (flags & (EVENTTEXT | EVENTONLY)) { item->loadInline(ELM_DATA); return CheckFilter(item->getTBuf(), text); } @@ -197,7 +192,7 @@ public: bool addHistory(MCONTACT hContact, EventLoadMode mode = ELM_NOTHING); bool addEvent(MCONTACT hContact, MEVENT hEvent, EventLoadMode mode = ELM_NOTHING); -// bool preloadEvents(int count = 10); + // bool preloadEvents(int count = 10); ItemData *get(int id, EventLoadMode mode = ELM_NOTHING); ItemData *operator[] (int id) { return get(id, ELM_DATA); } @@ -206,7 +201,7 @@ public: int FindRel(int id, int dir, Filter filter) { int count = getCount(); - for (int i = id+dir; (i >= 0) && (i < count); i += dir) + for (int i = id + dir; (i >= 0) && (i < count); i += dir) if (filter.check(get(i))) return i; return -1; |