summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_utils.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-14 19:56:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-14 19:56:42 +0000
commit29fcbd4c970c7b2aba1539519b8ec68f0370a1e2 (patch)
treeed4139f9b0ab7eb9d41ae2416a5cfd562ccea22f /protocols/Tox/src/tox_utils.cpp
parent14001c799e72b8eefa523f8ff7ce44c443c78db8 (diff)
Tox: more point to save tox data
git-svn-id: http://svn.miranda-ng.org/main/trunk@10184 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_utils.cpp')
-rw-r--r--protocols/Tox/src/tox_utils.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index 95743b9412..f9e315c9d3 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -13,7 +13,7 @@ TOX_USERSTATUS CToxProto::MirandaToToxStatus(int status)
break;
case ID_STATUS_OCCUPIED:
userstatus = TOX_USERSTATUS_BUSY;
- break;
+break;
default:
userstatus = TOX_USERSTATUS_INVALID;
break;
@@ -61,7 +61,7 @@ void CToxProto::RaiseAuthRequestEvent(DWORD timestamp, const char* toxId, const
/*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ)*/
DWORD cbBlob = (DWORD)
- (sizeof(DWORD) * 2 +
+ (sizeof(DWORD)* 2 +
strlen(toxId) +
strlen(reason) +
5);
@@ -109,8 +109,14 @@ std::string CToxProto::DataToHexString(std::vector<uint8_t> data)
return ss.str();
}
-int CToxProto::LoadToxData(const char *path)
+int CToxProto::LoadToxData()
{
+ ptrA path(getStringA("DataPath"));
+ if (!path)
+ {
+ return 0;
+ }
+
FILE *hFile = fopen(path, "rb");
if (hFile)
@@ -146,8 +152,14 @@ int CToxProto::LoadToxData(const char *path)
return 0;
}
-int CToxProto::SaveToxData(const char *path)
+int CToxProto::SaveToxData()
{
+ ptrA path(getStringA("DataPath"));
+ if (!path)
+ {
+ return 0;
+ }
+
FILE *hFile = fopen(path, "wb");
if (!hFile)