summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-10 16:10:24 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-10 16:10:24 +0000
commit40ca3f169e61d1273d47ddcee277bbc5bcb6ffdf (patch)
treeb9065bc63cd527321ff41b91f1ca457716b63384 /protocols/Tox/src/tox_proto.cpp
parentb3a63d4e727b8552f8cf2b321cc68d2631ef3179 (diff)
Tox: first approach to saving and restoring data
git-svn-id: http://svn.miranda-ng.org/main/trunk@10145 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r--protocols/Tox/src/tox_proto.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 3123640ec2..41abbb673a 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -5,6 +5,17 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
{
tox = tox_new(TOX_ENABLE_IPV6_DEFAULT);
+ char idstring[200] = { 0 };
+ get_id(tox, idstring);
+
+ char dataPath[MAX_PATH];
+ mir_snprintf(dataPath, MAX_PATH, "%s\\%s.tox", VARS("%miranda_profile%\\%miranda_profilename%"), m_tszUserName);
+
+ LoadToxData(dataPath);
+
+ char idstring2[200] = { 0 };
+ get_id(tox, idstring2);
+
tox_callback_friend_request(tox, OnFriendRequest, this);
tox_callback_friend_message(tox, OnFriendMessage, this);
tox_callback_friend_action(tox, OnAction, this);
@@ -18,6 +29,11 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
CToxProto::~CToxProto()
{
+ char dataPath[MAX_PATH];
+ mir_snprintf(dataPath, MAX_PATH, "%s\\%s.tox", VARS("%miranda_profile%\\%miranda_profilename%"), m_tszUserName);
+
+ SaveToxData(dataPath);
+
tox_kill(tox);
}