summaryrefslogtreecommitdiff
path: root/plugins/Import
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:03 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:14 +0300
commit477a6ea70d0bb1b1dfe9cbd9a15b6dad0284ddeb (patch)
tree247eed13a5231c3983e343f0b7fc2a95012353c2 /plugins/Import
parent9d0174ebe2bd005418855b18f737c36d5c20ab4a (diff)
all another C++'11 iterators
Diffstat (limited to 'plugins/Import')
-rw-r--r--plugins/Import/src/import.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 249c998afe..590bce6a5a 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -352,12 +352,11 @@ static char* newStr(const char *s)
static bool FindDestAccount(const char *szProto)
{
- for (int i = 0; i < arAccountMap.getCount(); i++) {
- AccountMap &pam = arAccountMap[i];
- if (pam.pa == nullptr)
+ for (auto &pam : arAccountMap) {
+ if (pam->pa == nullptr)
continue;
- if (!mir_strcmp(pam.pa->szModuleName, szProto))
+ if (!mir_strcmp(pam->pa->szModuleName, szProto))
return true;
}
@@ -458,49 +457,48 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules)
bool bImportSysAll = (nImportOptions & IOPT_SYS_SETTINGS) != 0;
- for (int i = 0; i < arAccountMap.getCount(); i++) {
- AccountMap &p = arAccountMap[i];
- if (p.pa != nullptr || p.szBaseProto == NULL || !mir_strcmp(p.szSrcAcc, META_PROTO))
+ for (auto &p : arAccountMap) {
+ if (p->pa != nullptr || p->szBaseProto == NULL || !mir_strcmp(p->szSrcAcc, META_PROTO))
continue;
- if (!Proto_IsProtocolLoaded(p.szBaseProto)) {
- AddMessage(LPGENW("Protocol %S is not loaded, skipping account %s creation"), p.szBaseProto, p.tszSrcName);
+ if (!Proto_IsProtocolLoaded(p->szBaseProto)) {
+ AddMessage(LPGENW("Protocol %S is not loaded, skipping account %s creation"), p->szBaseProto, p->tszSrcName);
continue;
}
ACC_CREATE newacc;
- newacc.pszBaseProto = p.szBaseProto;
+ newacc.pszBaseProto = p->szBaseProto;
newacc.pszInternal = nullptr;
- newacc.ptszAccountName = p.tszSrcName;
+ newacc.ptszAccountName = p->tszSrcName;
- p.pa = ProtoCreateAccount(&newacc);
- if (p.pa == nullptr) {
- AddMessage(LPGENW("Unable to create an account %s of protocol %S"), p.tszSrcName, p.szBaseProto);
+ p->pa = ProtoCreateAccount(&newacc);
+ if (p->pa == nullptr) {
+ AddMessage(LPGENW("Unable to create an account %s of protocol %S"), p->tszSrcName, p->szBaseProto);
return false;
}
char szSetting[100];
- itoa(400 + p.iSrcIndex, szSetting, 10);
+ itoa(400 + p->iSrcIndex, szSetting, 10);
int iVal = myGetD(NULL, "Protocols", szSetting, 1);
- itoa(400 + p.pa->iOrder, szSetting, 10);
+ itoa(400 + p->pa->iOrder, szSetting, 10);
db_set_dw(NULL, "Protocols", szSetting, iVal);
- p.pa->bIsVisible = iVal != 0;
+ p->pa->bIsVisible = iVal != 0;
- itoa(600 + p.iSrcIndex, szSetting, 10);
+ itoa(600 + p->iSrcIndex, szSetting, 10);
iVal = myGetD(NULL, "Protocols", szSetting, 1);
- itoa(600 + p.pa->iOrder, szSetting, 10);
+ itoa(600 + p->pa->iOrder, szSetting, 10);
db_set_dw(NULL, "Protocols", szSetting, iVal);
- p.pa->bIsEnabled = iVal != 0;
+ p->pa->bIsEnabled = iVal != 0;
- if (p.tszSrcName == NULL) {
- p.pa->tszAccountName = mir_a2u(p.pa->szModuleName);
- itoa(800 + p.pa->iOrder, szSetting, 10);
- db_set_ws(NULL, "Protocols", szSetting, p.pa->tszAccountName);
+ if (p->tszSrcName == NULL) {
+ p->pa->tszAccountName = mir_a2u(p->pa->szModuleName);
+ itoa(800 + p->pa->iOrder, szSetting, 10);
+ db_set_ws(NULL, "Protocols", szSetting, p->pa->tszAccountName);
}
- CopySettings(NULL, p.szSrcAcc, NULL, p.pa->szModuleName);
+ CopySettings(NULL, p->szSrcAcc, NULL, p->pa->szModuleName);
if (bImportSysAll)
- arSkippedModules.insert(newStr(p.szSrcAcc));
+ arSkippedModules.insert(newStr(p->szSrcAcc));
}
CopySettings(NULL, META_PROTO, NULL, META_PROTO);
@@ -1053,8 +1051,8 @@ void MirandaImport(HWND hdlg)
hContact = srcDb->FindNextContact(hContact);
}
- for (i = 0; i < arMetas.getCount(); i++)
- ImportMeta(arMetas[i]);
+ for (auto &it : arMetas)
+ ImportMeta(it);
}
else AddMessage(LPGENW("Skipping new contacts import."));
AddMessage(L"");