summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_accounts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src/tox_accounts.cpp')
-rw-r--r--protocols/Tox/src/tox_accounts.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp
index afcac8e4a6..edefe94051 100644
--- a/protocols/Tox/src/tox_accounts.cpp
+++ b/protocols/Tox/src/tox_accounts.cpp
@@ -30,4 +30,27 @@ int CToxProto::UninitAccount(CToxProto *proto)
delete proto;
return 0;
+}
+
+int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
+{
+ HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
+ HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
+ HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
+
+ return 0;
+}
+
+int CToxProto::OnAccountRenamed(WPARAM, LPARAM lParam)
+{
+ PROTOACCOUNT *account = (PROTOACCOUNT*)lParam;
+
+ std::tstring newPath = GetToxProfilePath();
+ TCHAR oldPath[MAX_PATH];
+ mir_sntprintf(oldPath, MAX_PATH, _T("%s\\%s.tox"), VARST(_T("%miranda_userdata%")), accountName);
+ _trename(oldPath, newPath.c_str());
+ mir_free(accountName);
+ accountName = mir_tstrdup(m_tszUserName);
+
+ return 0;
} \ No newline at end of file