diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-14 19:59:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-14 19:59:06 +0300 |
commit | dad59528ccd770301b29c7db8148ff8ab8e89c92 (patch) | |
tree | b93aa1b9149ddf20d6317d44cf924be8d0be276a /plugins/NewXstatusNotify/src | |
parent | 1a3f9ca88310cb9080a4c0073087bebc4c1e3a0a (diff) |
reverse iterators for LIST<>
Diffstat (limited to 'plugins/NewXstatusNotify/src')
-rw-r--r-- | plugins/NewXstatusNotify/src/main.cpp | 6 | ||||
-rw-r--r-- | plugins/NewXstatusNotify/src/xstatus.cpp | 36 |
2 files changed, 18 insertions, 24 deletions
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 70a7303963..7345ebb3e0 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -25,9 +25,9 @@ CLIST_INTERFACE *pcli; HINSTANCE hInst;
-LIST<DBEVENT> eventListXStatus(10);
-LIST<DBEVENT> eventListStatus(10);
-LIST<DBEVENT> eventListSMsg(10);
+LIST<DBEVENT> eventListXStatus(10, PtrKeySortT);
+LIST<DBEVENT> eventListStatus(10, PtrKeySortT);
+LIST<DBEVENT> eventListSMsg(10, PtrKeySortT);
HANDLE hStatusModeChange, hHookContactStatusChanged, hToolbarButton;
HGENMENU hEnableDisableMenu;
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index a3cacaecb0..a582c8e5c7 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -42,38 +42,32 @@ void FreeXSC(XSTATUSCHANGE *xsc) void RemoveLoggedEventsXStatus(MCONTACT hContact)
{
- for (int i = eventListXStatus.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListXStatus[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListXStatus.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListXStatus.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListXStatus.remove(it);
+ mir_free(it);
}
- }
}
void RemoveLoggedEventsStatus(MCONTACT hContact)
{
- for (int i = eventListStatus.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListStatus[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListStatus.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListStatus.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListStatus.remove(it);
+ mir_free(it);
}
- }
}
void RemoveLoggedEventsSMsg(MCONTACT hContact)
{
- for (int i = eventListSMsg.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListSMsg[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListSMsg.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListSMsg.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListSMsg.remove(it);
+ mir_free(it);
}
- }
}
wchar_t* GetStatusTypeAsString(int type, wchar_t *buff)
|