diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-21 18:35:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-21 18:40:14 +0300 |
commit | 429c0d0524e7197a593209468fef530344f5ee05 (patch) | |
tree | 71df95fdf71c52a956de69b6f31f3a6528053442 /plugins/TabSRMM/src/chat_manager.cpp | |
parent | 5b6db3290cb9c9817cba126bd7aea798a610c31d (diff) |
tabsrmm: C++'11 iterators
Diffstat (limited to 'plugins/TabSRMM/src/chat_manager.cpp')
-rw-r--r-- | plugins/TabSRMM/src/chat_manager.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/plugins/TabSRMM/src/chat_manager.cpp b/plugins/TabSRMM/src/chat_manager.cpp index aa325e6026..4b582ee06e 100644 --- a/plugins/TabSRMM/src/chat_manager.cpp +++ b/plugins/TabSRMM/src/chat_manager.cpp @@ -77,30 +77,26 @@ int UM_CompareItem(USERINFO *u1, const wchar_t* pszNick, WORD wStatus) BOOL SM_ReconfigureFilters()
{
- for (int i = 0; i < pci->arSessions.getCount(); i++)
- Chat_SetFilters(pci->arSessions[i]);
+ for (auto &si : pci->arSessions)
+ Chat_SetFilters(si);
return TRUE;
}
SESSION_INFO* SM_FindSessionByHWND(HWND hWnd)
{
- for (int i = 0; i < pci->arSessions.getCount(); i++) {
- SESSION_INFO *si = pci->arSessions[i];
+ for (auto &si : pci->arSessions)
if (si->pDlg && si->pDlg->GetHwnd() == hWnd)
return si;
- }
return nullptr;
}
SESSION_INFO* SM_FindSessionByHCONTACT(MCONTACT h)
{
- for (int i = 0; i < pci->arSessions.getCount(); i++) {
- SESSION_INFO *si = pci->arSessions[i];
+ for (auto &si : pci->arSessions)
if (si->hContact == h)
return si;
- }
return nullptr;
}
@@ -115,17 +111,13 @@ SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* cu pszCurrent = pszOriginal;
SESSION_INFO *pResult = nullptr;
- for (int i = 0; i < pci->arSessions.getCount(); i++) {
- SESSION_INFO *si = pci->arSessions[i];
- if (si != currSession && !mir_strcmpi(pszModule, si->pszModule)) {
- if (my_strstri(si->ptszName, pszOriginal) == si->ptszName) {
+ for (auto &si : pci->arSessions)
+ if (si != currSession && !mir_strcmpi(pszModule, si->pszModule))
+ if (my_strstri(si->ptszName, pszOriginal) == si->ptszName)
if (prevSession != si && mir_wstrcmpi(si->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(si->ptszName, pszName) < 0)) {
pResult = si;
pszName = si->ptszName;
}
- }
- }
- }
return pResult;
}
|