diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-02 13:37:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-02 13:37:32 +0300 |
commit | f415d65108ca2e4af803e44dddb94cecbaf6dc15 (patch) | |
tree | fb69eb6b429797400333961afd51a07f6a30c02b /plugins | |
parent | 38a9c911e744be9b226afbc5a71b959f63557e70 (diff) |
fixes #1243 (Groups and metacontacts state don't save during profile convertation)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Import/src/import.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 8b3a8d4c03..c1ad7c19d5 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -567,16 +567,17 @@ struct ImportContactData {
MCONTACT from, to;
const char *szSrcProto, *szDstProto;
+ bool bSkipProto;
};
int ModulesEnumProc(const char *szModuleName, void *pParam)
{
ImportContactData *icd = (ImportContactData*)pParam;
- if (!mir_strcmp(icd->szSrcProto, szModuleName))
- CopySettings(icd->from, szModuleName, icd->to, icd->szDstProto);
- else if (!mir_strcmp(szModuleName, "Protocol"))
- return 0;
- else
+ if (!mir_strcmp(icd->szSrcProto, szModuleName)) {
+ if (!icd->bSkipProto)
+ CopySettings(icd->from, szModuleName, icd->to, icd->szDstProto);
+ }
+ else if (0 != mir_strcmp(szModuleName, "Protocol"))
CopySettings(icd->from, szModuleName, icd->to, szModuleName);
return 0;
}
@@ -586,7 +587,7 @@ void ImportContactSettings(AccountMap *pda, MCONTACT hSrc, MCONTACT hDst) if (pda->pa == nullptr)
return;
- ImportContactData icd = { hSrc, hDst, pda->szSrcAcc, pda->pa->szModuleName };
+ ImportContactData icd = { hSrc, hDst, pda->szSrcAcc, pda->pa->szModuleName, false };
db_enum_modules(ModulesEnumProc, &icd);
}
@@ -615,21 +616,15 @@ static int ImportGroups() OBJLIST<MImportGroup> arGroups(10, NumericKeySortT);
srcDb->EnumContactSettings(NULL, ImportGroup, "CListGroups", &arGroups);
- int nGroups = 0;
for (auto &it : arGroups) {
- if (Clist_GroupExists(it->wszName.get() + 1))
+ MGROUP group_id = Clist_GroupCreate(0, it->wszName.get() + 1);
+ if (group_id <= 0)
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++;
- }
+ Clist_GroupSetExpanded(group_id, (it->wszName[0] & GROUPF_EXPANDED));
}
- return nGroups;
+ return arGroups.getCount();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -759,11 +754,8 @@ void ImportMeta(DBCachedContact *ccSrc) else AddMessage(LPGENW("Added metacontact"));
}
- PROTOACCOUNT *pa = Proto_GetAccount(META_PROTO);
- if (pa) {
- AccountMap pda(META_PROTO, 0, META_PROTOW);
- ImportContactSettings(&pda, ccSrc->contactID, ccDst->contactID);
- }
+ ImportContactData icd = { ccSrc->contactID, ccDst->contactID, META_PROTO, META_PROTO, true };
+ db_enum_modules(ModulesEnumProc, &icd);
arContactMap.insert(new ContactMap(ccSrc->contactID, ccDst->contactID));
}
|