diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-09-12 19:17:35 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-09-12 19:17:35 +0000 |
commit | f4ddf8de528cb486816ed9a4e9e51b51a7b1b142 (patch) | |
tree | b617a29803b21e1912e92feb6cc0d2644c3d6da3 /protocols/Tox/src/tox_accounts.cpp | |
parent | 124c695427c4999bd6a4ec97735b6fcac8975474 (diff) |
Tox: rename tox profile together with miranda account
git-svn-id: http://svn.miranda-ng.org/main/trunk@10440 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_accounts.cpp')
-rw-r--r-- | protocols/Tox/src/tox_accounts.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index 147c328656..95b7284e93 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -27,16 +27,32 @@ int CToxProto::OnAccountListChanged(WPARAM wParam, LPARAM lParam) {
PROTOACCOUNT* account = (PROTOACCOUNT*)lParam;
- if (wParam == PRAC_ADDED && !strcmp(account->szModuleName, m_szModuleName))
+ if (!strcmp(account->szModuleName, m_szModuleName))
{
- UninitToxCore();
- DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_PROFILE_MANAGER),
- account->hwndAccMgrUI,
- CToxProto::ToxProfileManagerProc,
- (LPARAM)this);
- InitToxCore();
+ switch (wParam)
+ {
+ case PRAC_ADDED:
+ UninitToxCore();
+ DialogBoxParam(
+ g_hInstance,
+ MAKEINTRESOURCE(IDD_PROFILE_MANAGER),
+ account->hwndAccMgrUI,
+ CToxProto::ToxProfileManagerProc,
+ (LPARAM)this);
+ InitToxCore();
+ break;
+
+ case PRAC_CHANGED:
+ UninitToxCore();
+ std::tstring newPath = GetToxProfilePath();
+ TCHAR oldPath[MAX_PATH];
+ mir_sntprintf(oldPath, MAX_PATH, _T("%s\\%s.tox"), VARST(_T("%miranda_userdata%")), accountName);
+ MoveFileEx(oldPath, newPath.c_str(), MOVEFILE_REPLACE_EXISTING);
+ mir_free(accountName);
+ accountName = mir_tstrdup(m_tszUserName);
+ InitToxCore();
+ break;
+ }
}
return 0;
|