diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-26 17:09:02 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-26 17:09:02 +0300 |
commit | 9d38cf95d713574776c4892146b67c69cc96cb2c (patch) | |
tree | e83d710b7751ab4593d8758fb51a33418b69fdca /plugins/Import | |
parent | ab5aebed05900b508d8f4ba9bbc230f119a3ac02 (diff) |
Import: fix to prevent the user-defined accounts' order
Diffstat (limited to 'plugins/Import')
-rw-r--r-- | plugins/Import/src/import.cpp | 14 | ||||
-rw-r--r-- | plugins/Import/src/version.h | 2 |
2 files changed, 14 insertions, 2 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;
diff --git a/plugins/Import/src/version.h b/plugins/Import/src/version.h index 4c1f7bccba..a1521e40d1 100644 --- a/plugins/Import/src/version.h +++ b/plugins/Import/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 95
#define __RELEASE_NUM 8
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>
|