summaryrefslogtreecommitdiff
path: root/plugins/Sessions/Src/Main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
commit39390b02dbd5aa7eb21a83773fa561b39f8828bc (patch)
tree7982eda1257f7466b5663c2865fdb7804c397257 /plugins/Sessions/Src/Main.cpp
parent5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff)
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'plugins/Sessions/Src/Main.cpp')
-rw-r--r--plugins/Sessions/Src/Main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp
index 303fcf3fd5..6ee67026ad 100644
--- a/plugins/Sessions/Src/Main.cpp
+++ b/plugins/Sessions/Src/Main.cpp
@@ -204,7 +204,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM l
GetDlgItemText(hdlg, IDC_LIST, szUserSessionName, _countof(szUserSessionName));
szUserSessionName[length + 1] = '\0';
if (IsDlgButtonChecked(hdlg, IDC_SELCONTACTS) && bSC) {
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
BYTE res = (BYTE)SendMessage(hClistControl, CLM_GETCHECKMARK, SendMessage(hClistControl, CLM_FINDCONTACT, hContact, 0), 0);
if (res) {
user_session_list[i] = hContact;
@@ -408,7 +408,7 @@ int SaveSessionHandles(WPARAM, LPARAM lparam)
return 1;
int k = 0;
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
if ((k = CheckForDuplicate(session_list, hContact)) != -1 && !(g_bExclHidden && !CheckContactVisibility(hContact))) {
AddSessionMark(hContact, lparam, '1');
AddInSessionOrder(hContact, lparam, k, 1);
@@ -528,7 +528,7 @@ int LoadSession(WPARAM, LPARAM lparam)
if (session_list_recovered[0] && lparam == 256 && mode == 0)
memcpy(session_list_t, session_list_recovered, sizeof(session_list_t));
else
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
if (LoadContactsFromMask(hContact, mode, lparam)) {
int i = GetInSessionOrder(hContact, mode, lparam);
session_list_t[i] = hContact;
@@ -577,7 +577,7 @@ int LoadSession(WPARAM, LPARAM lparam)
int DelUserDefSession(int ses_count)
{
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
RemoveSessionMark(hContact, 1, ses_count);
SetInSessionOrder(hContact, 1, ses_count, 0);
}
@@ -613,7 +613,7 @@ int DelUserDefSession(int ses_count)
int DeleteAutoSession(int ses_count)
{
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
RemoveSessionMark(hContact, 0, ses_count);
SetInSessionOrder(hContact, 0, ses_count, 0);
}
@@ -841,7 +841,7 @@ extern "C" __declspec(dllexport) int Load(void)
int i = 0;
memset(session_list_recovered, 0, sizeof(session_list_recovered));
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
if (db_get_b(hContact, MODNAME, "wasInLastSession", 0))
session_list_recovered[i++] = hContact;
}