summaryrefslogtreecommitdiff
path: root/plugins/Import
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-23 13:33:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-23 13:33:18 +0300
commit7f61fa6455c42d52633bcc70dff1150ceaa7fa0b (patch)
treeeda361b06e567e478d514725f8ff6c52f1c7948c /plugins/Import
parent7ec9441d255b4361be26705c65eed5819cd0208f (diff)
Import: fix for groups order saving during import
Diffstat (limited to 'plugins/Import')
-rw-r--r--plugins/Import/src/import.cpp39
-rw-r--r--plugins/Import/src/version.h2
2 files changed, 31 insertions, 10 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 895c3d203e..c92deee6ff 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -568,23 +568,43 @@ void ImportContactSettings(AccountMap *pda, MCONTACT hSrc, MCONTACT hDst)
/////////////////////////////////////////////////////////////////////////////////////////
-static int ImportGroup(const char* szSettingName, void *param)
+struct MImportGroup
{
- int *pnGroups = (int*)param;
+ MImportGroup(int _n, wchar_t *_nm) :
+ wszName(_nm),
+ iNumber(_n)
+ {}
- wchar_t *tszGroup = myGetWs(NULL, "CListGroups", szSettingName);
- if (tszGroup != nullptr) {
- if (CreateGroup(tszGroup + 1, NULL))
- pnGroups[0]++;
- mir_free(tszGroup);
- }
+ int iNumber;
+ ptrW wszName;
+};
+
+static int ImportGroup(const char* szSettingName, void *param)
+{
+ OBJLIST<MImportGroup> *pArray = (OBJLIST<MImportGroup>*)param;
+ pArray->insert(new MImportGroup(atoi(szSettingName), myGetWs(NULL, "CListGroups", szSettingName)));
return 0;
}
static int ImportGroups()
{
+ OBJLIST<MImportGroup> arGroups(10, NumericKeySortT);
+ srcDb->EnumContactSettings(NULL, ImportGroup, "CListGroups", &arGroups);
+
int nGroups = 0;
- db_enum_settings(NULL, ImportGroup, "CListGroups", &nGroups);
+ for (auto &it : arGroups) {
+ if (Clist_GroupExists(it->wszName.get() + 1))
+ continue;
+
+ MGROUP group_id = Clist_GroupCreate(0, it->wszName.get() + 1);
+ if (group_id > 0) {
+ char szSetting[20];
+ _itoa_s(group_id - 1, szSetting, 10);
+ db_set_ws(0, "CListGroups", szSetting, it->wszName);
+ nGroups++;
+ }
+ }
+
return nGroups;
}
@@ -1005,6 +1025,7 @@ void MirandaImport(HWND hdlg)
DWORD dwTimer = time(nullptr);
OBJLIST<char> arSkippedAccs(1, CompareModules);
+ arSkippedAccs.insert(newStr("CListGroups"));
if (!ImportAccounts(arSkippedAccs)) {
AddMessage(LPGENW("Error mapping accounts, exiting."));
return;
diff --git a/plugins/Import/src/version.h b/plugins/Import/src/version.h
index 6fc4c509d7..4c1f7bccba 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 2
+#define __BUILD_NUM 3
#include <stdver.h>