diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-03 16:30:25 +0300 |
commit | 9613f96e6a6f96ad02a0fc926054132811ae2bb1 (patch) | |
tree | f8fe94a3efe7598a2af926f264d354f7a08fb943 /plugins/UserInfoEx/src/dlg_propsheet.cpp | |
parent | 2f880bda3aa2d8817ce43481df9d99b12ed82a58 (diff) |
Accounts() : iterator for accounts
Diffstat (limited to 'plugins/UserInfoEx/src/dlg_propsheet.cpp')
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index b5142bdcd4..3e4807a5ee 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -562,15 +562,12 @@ void DlgContactInfoInitTreeIcons() psh._dwFlags |= PSF_PROTOPAGESONLY_INIT;
// enumerate all protocols
- PROTOACCOUNT **pd;
- int ProtoCount = 0;
- Proto_EnumAccounts(&ProtoCount, &pd);
- for (int i = 0; i < ProtoCount; i++) {
+ for (auto &pa : Accounts()) {
// enumerate all contacts
for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) {
// compare contact's protocol to the current one, to add
LPCSTR pszContactProto = Proto_GetBaseAccountName(psh._hContact);
- if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pd[i]->szModuleName, pszContactProto)) {
+ if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pa->szModuleName, pszContactProto)) {
// call a notification for the contact to retrieve all protocol specific tree items
NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact);
if (psh._pPages) {
@@ -630,12 +627,10 @@ void DlgContactInfoLoadModule() // check whether changing my details via UserInfoEx is basically possible
myGlobals.CanChangeDetails = FALSE;
- PROTOACCOUNT **pAcc;
- int nAccCount;
- Proto_EnumAccounts(&nAccCount, &pAcc);
- for (int i = 0; (i < nAccCount) && !myGlobals.CanChangeDetails; i++)
- if (IsProtoAccountEnabled(pAcc[i])) // update my contact information on icq server
- myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pAcc[i]->szModuleName, PS_CHANGEINFOEX, NULL, NULL));
+ for (auto &pa : Accounts())
+ if (IsProtoAccountEnabled(pa)) // update my contact information on icq server
+ if (myGlobals.CanChangeDetails = MIREXISTS(CallProtoService(pa->szModuleName, PS_CHANGEINFOEX, NULL, NULL)))
+ break;
}
static void ResetUpdateInfo(LPPS pPs)
|