summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-29 21:33:17 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-29 21:33:17 +0000
commita66281d8453edde56145e032e8d38db91580ba08 (patch)
treeefdddb6f765cf020502eed9139dab6767adb5d0b /protocols/Tox/src/tox_contacts.cpp
parent6c5621e08b28ff3c3db26726aafd827d354d6934 (diff)
Tox:
- reworked code related with address/public key - added tox_add_tcp_relay to bootstrap - updated tox core - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@13900 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_contacts.cpp')
-rw-r--r--protocols/Tox/src/tox_contacts.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index dfd9159fcc..3ec9c3b1d5 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -87,9 +87,7 @@ MCONTACT CToxProto::AddContact(const char *address, const TCHAR *dnsId, bool isT
setByte(hContact, "Grant", 1);
if (isTemporary)
- {
db_set_b(hContact, "CList", "NotOnList", 1);
- }
}
return hContact;
}
@@ -98,7 +96,7 @@ uint32_t CToxProto::GetToxFriendNumber(MCONTACT hContact)
{
ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
TOX_ERR_FRIEND_BY_PUBLIC_KEY error;
- uint32_t friendNumber = tox_friend_by_public_key(tox, pubKey, &error);
+ uint32_t friendNumber = tox_friend_by_public_key(tox, pubKey.GetPubKey(), &error);
if (error != TOX_ERR_FRIEND_BY_PUBLIC_KEY_OK)
debugLogA(__FUNCTION__": failed to get friend number (%d)", error);
return friendNumber;
@@ -151,13 +149,11 @@ void CToxProto::LoadFriendList(void*)
INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
{
if (!IsOnline())
- {
- return -1; // ???
- }
+ return 0;
char *reason = lParam ? (char*)lParam : " ";
size_t length = mir_strlen(reason);
- ToxBinAddress address(ptrA(getStringA(hContact, TOX_SETTINGS_ID)));
+ ToxBinAddress address = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
TOX_ERR_FRIEND_ADD addFriendResult;
int32_t friendNumber = tox_friend_add(tox, address, (uint8_t*)reason, length, &addFriendResult);
@@ -185,12 +181,9 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM)
{
if (!IsOnline())
- {
- // TODO: warn
return 0;
- }
- ToxBinAddress pubKey(ptrA(getStringA(hContact, TOX_SETTINGS_ID)));
+ ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
TOX_ERR_FRIEND_ADD error;
tox_friend_add_norequest(tox, pubKey, &error);
if (error != TOX_ERR_FRIEND_ADD_OK)
@@ -226,6 +219,7 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
debugLogA(__FUNCTION__": failed to delete friend (%d)", error);
return error;
}
+ SaveToxProfile();
}
/*else
{
@@ -244,7 +238,7 @@ void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *mess
{
CToxProto *proto = (CToxProto*)arg;
- ToxHexAddress address(pubKey, TOX_ADDRESS_SIZE);
+ ToxHexAddress address(pubKey);
MCONTACT hContact = proto->AddContact(address, _T(""));
if (!hContact)
{