summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-09-27 18:39:23 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-09-27 18:39:23 +0000
commit05b7974f9c3c5222a6ebc01ec4895081ef6459e2 (patch)
tree9c1a0af5a8950642f51bd13e74966116df9f42b1 /protocols/Tox
parent4896bb4af6312343cec0ade365e9bf8115c50ffc (diff)
temp fix for creating profile
git-svn-id: http://svn.miranda-ng.org/main/trunk@10615 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/src/tox_account.cpp10
-rw-r--r--protocols/Tox/src/tox_accounts.cpp3
-rw-r--r--protocols/Tox/src/tox_proto.cpp3
-rw-r--r--protocols/Tox/src/tox_utils.cpp8
4 files changed, 10 insertions, 14 deletions
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp
index bc9255ad36..8921a5c437 100644
--- a/protocols/Tox/src/tox_account.cpp
+++ b/protocols/Tox/src/tox_account.cpp
@@ -20,11 +20,6 @@ int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
void CToxProto::InitToxCore()
{
- if (ptrA(this->getStringA("ToxID")) == NULL)
- {
- return;
- }
-
Tox_Options options = { 0 };
options.udp_disabled = getByte("DisableUDP", 0);
options.ipv6enabled = !getByte("DisableIPv6", 0);
@@ -86,11 +81,6 @@ void CToxProto::InitToxCore()
void CToxProto::UninitToxCore()
{
- if (ptrA(this->getStringA("ToxID")) == NULL)
- {
- return;
- }
-
SaveToxData();
tox_kill(tox);
}
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp
index 95b7284e93..acab9db206 100644
--- a/protocols/Tox/src/tox_accounts.cpp
+++ b/protocols/Tox/src/tox_accounts.cpp
@@ -32,7 +32,8 @@ int CToxProto::OnAccountListChanged(WPARAM wParam, LPARAM lParam)
switch (wParam)
{
case PRAC_ADDED:
- UninitToxCore();
+ if (this->getStringA("ToxID"))
+ UninitToxCore();
DialogBoxParam(
g_hInstance,
MAKEINTRESOURCE(IDD_PROFILE_MANAGER),
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 3016a400ee..0d3ab920f6 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -5,7 +5,8 @@ PROTO<CToxProto>(protoName, userName)
{
accountName = mir_tstrdup(userName);
- InitToxCore();
+ if (this->getStringA("ToxID"))
+ InitToxCore();
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index d294be81cd..854d59f40d 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -176,9 +176,13 @@ void CToxProto::SaveToxData()
return;
}
- uint32_t size = tox_encrypted_size(tox);
- uint8_t *data = (uint8_t*)mir_alloc(size);
ptrT password(getTStringA("Password"));
+ uint32_t size;
+ if (password && _tcslen(password))
+ size = tox_encrypted_size(tox);
+ else
+ size = tox_size(tox);
+ uint8_t *data = (uint8_t*)mir_alloc(size);
if (password && _tcslen(password))
{
char *password_utf8 = mir_utf8encodeW(password);