summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp2
3 files changed, 8 insertions, 8 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 266ff97786..f34163ad81 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -1373,7 +1373,7 @@ void GaduProto::setalloffline()
debugLogA("setalloffline(): started. Setting buddies offline");
setWord(GG_KEY_STATUS, 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()) {
setWord(hContact, GG_KEY_STATUS, ID_STATUS_OFFLINE);
// Clear IP and port settings
delSetting(hContact, GG_KEY_CLIENTIP);
@@ -1437,7 +1437,7 @@ void GaduProto::notifyall()
debugLogA("notifyall(): Subscribing notification to all users");
// Readup count
int count = 0;
- for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ for (auto &hContact : acc_contact_iter())
count++;
// Readup list
@@ -1454,7 +1454,7 @@ void GaduProto::notifyall()
char *types = (char*)calloc(sizeof(char), count);
int cc = 0;
- for (hContact = db_find_first(m_szModuleName); hContact && cc < count; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if (uins[cc] = getDword(hContact, GG_KEY_UIN, 0)) {
if ((getWord(hContact, GG_KEY_APPARENT, (WORD)ID_STATUS_ONLINE) == ID_STATUS_OFFLINE) ||
db_get_b(hContact, "CList", "NotOnList", 0))
@@ -1490,7 +1490,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic
debugLogA("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist);
#endif
// Look for contact in DB
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !isChatRoom(hContact)) {
if (inlist) {
db_unset(hContact, "CList", "NotOnList");
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 2126cfdb53..7e6d7a823f 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -407,7 +407,7 @@ static void gg_gc_resetclistopts(HWND hwndList)
static int gg_gc_countcheckmarks(HWND hwndList)
{
int count = 0;
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0))
++count;
@@ -459,7 +459,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
// Create new participiants table
uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t));
gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count);
- for (MCONTACT hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
MCONTACT hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support
@@ -508,7 +508,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
break;
// Delete non-gg contacts
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
MCONTACT hItem = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
if (hItem) {
MCONTACT hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index 23c621ead5..ae8c96764f 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -25,7 +25,7 @@ char *gg_makecontacts(GaduProto *gg, int cr)
string_t s = string_init(nullptr);
// Readup contacts
- for (MCONTACT hContact = db_find_first(gg->m_szModuleName); hContact; hContact = db_find_next(hContact, gg->m_szModuleName)) {
+ for (auto &hContact : gg->acc_contact_iter()) {
if (gg->isChatRoom(hContact))
continue;