summaryrefslogtreecommitdiff
path: root/protocols/MRA/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/MRA/src')
-rw-r--r--protocols/MRA/src/MraProto.cpp4
-rw-r--r--protocols/MRA/src/Mra_functions.cpp2
-rw-r--r--protocols/MRA/src/Mra_menus.cpp6
-rw-r--r--protocols/MRA/src/Mra_proto.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index 03cd7f2336..2dd3b590a7 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -90,7 +90,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM)
HookProtoEvent(ME_CLIST_GROUPCHANGE, &CMraProto::OnGroupChanged);
// всех в offline // тк unsaved values сохран¤ютс¤ их нужно инициализировать
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName))
+ for (auto &hContact : acc_contact_iter())
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
// unsaved values
@@ -462,7 +462,7 @@ int CMraProto::SetStatus(int iNewStatus)
// всех в offline, только если мы бывали подключены
if (dwOldStatusMode > ID_STATUS_OFFLINE)
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ for (auto &hContact : acc_contact_iter())
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
if (m_hConnection != nullptr)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index da0902c387..7355eb65b8 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -510,7 +510,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe
//check not already on list
CMStringA szEMailLocal;
- for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if (mraGetStringA(hContact, "e-mail", szEMailLocal))
if (szEMailLocal == szEmail) {
if (bTemporary == FALSE)
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp
index 6d26c956bb..431e42dcea 100644
--- a/protocols/MRA/src/Mra_menus.cpp
+++ b/protocols/MRA/src/Mra_menus.cpp
@@ -31,7 +31,7 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM, LPARAM)
return 0;
if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail);
@@ -43,7 +43,7 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM, LPARAM)
INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM, LPARAM)
{
if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
CMStringA szEmail;
if (mraGetStringA(hContact, "e-mail", szEmail))
if (!IsEMailChatAgent(szEmail))
@@ -59,7 +59,7 @@ INT_PTR CMraProto::MraRequestAuthForAll(WPARAM, LPARAM)
return 0;
if (MessageBox(nullptr, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
DWORD dwContactSeverFlags;
if (GetContactBasicInfoW(hContact, nullptr, nullptr, nullptr, &dwContactSeverFlags, nullptr, nullptr, nullptr, nullptr) == NO_ERROR)
if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1)
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 0cf552080d..ea5663733d 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -1308,7 +1308,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
if (mraGetStringW(NULL, "AuthMessage", wszAuthMessage) == FALSE) // def auth message
wszAuthMessage = TranslateW(MRA_DEFAULT_AUTH_MESSAGE);
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if (GetContactBasicInfoW(hContact, &dwID, nullptr, nullptr, nullptr, nullptr, &email, nullptr, nullptr) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(email)) {// чат: ещё раз запросим авторизацию, пометим как видимый в списке, постоянный
@@ -1337,7 +1337,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
}
else { // контакт лист почемуто не получили
// всех в offline и id в нестандарт
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS),
-1, -2, 0, 0, ID_STATUS_OFFLINE, nullptr, nullptr, nullptr);
// request user info from server