summaryrefslogtreecommitdiff
path: root/plugins/Import/src/import.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-26 17:09:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-26 17:09:02 +0300
commit9d38cf95d713574776c4892146b67c69cc96cb2c (patch)
treee83d710b7751ab4593d8758fb51a33418b69fdca /plugins/Import/src/import.cpp
parentab5aebed05900b508d8f4ba9bbc230f119a3ac02 (diff)
Import: fix to prevent the user-defined accounts' order
Diffstat (limited to 'plugins/Import/src/import.cpp')
-rw-r--r--plugins/Import/src/import.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 6a43144059..84a02428d1 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -38,6 +38,7 @@ struct AccountMap
ptrA szSrcAcc, szBaseProto;
ptrW tszSrcName;
int iSrcIndex;
+ int iOrder;
PROTOACCOUNT *pa;
};
@@ -45,6 +46,10 @@ static int CompareAccs(const AccountMap *p1, const AccountMap *p2)
{ return mir_strcmpi(p1->szSrcAcc, p2->szSrcAcc);
}
+static int CompareAccByIds(const AccountMap *p1, const AccountMap *p2)
+{ return p1->iOrder - p2->iOrder;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
struct ContactMap
@@ -437,6 +442,9 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules)
AccountMap *pNew = new AccountMap(szProto, i, tszName);
arAccountMap.insert(pNew);
+ itoa(200 + i, szSetting, 10);
+ pNew->iOrder = myGetD(NULL, "Protocols", szSetting, 0);
+
// check if it's an account-based proto or an old style proto
char szBaseProto[100];
if (myGetS(NULL, szProto, "AM_BaseProto", szBaseProto))
@@ -466,7 +474,11 @@ bool ImportAccounts(OBJLIST<char> &arSkippedModules)
bool bImportSysAll = (nImportOptions & IOPT_SYS_SETTINGS) != 0;
- for (auto &p : arAccountMap) {
+ LIST<AccountMap> arIndexedMap(arAccountMap.getCount(), CompareAccByIds);
+ for (auto &it : arAccountMap)
+ arIndexedMap.insert(it);
+
+ for (auto &p : arIndexedMap) {
if (p->szBaseProto == NULL || !mir_strcmp(p->szSrcAcc, META_PROTO))
continue;