summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_accounts.cpp
blob: c9cb35c921eba4f0715fbf56bf962f2135c1b199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "stdafx.h"

int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
{
	Clist_GroupCreate(0, m_defaultGroup);

	HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
	HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
	HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);

	InitCustomDbEvents();
	return 0;
}

int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
{
	mir_cslock lock(m_profileLock);

	ptrW newPath(GetToxProfilePath());
	wchar_t oldPath[MAX_PATH];
	mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), m_accountName);
	_wrename(oldPath, newPath);
	m_accountName = mir_wstrdup(m_tszUserName);
	return 0;
}

INT_PTR CToxProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
{
	return (INT_PTR)(CToxOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
}