summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_contacts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src/tox_contacts.cpp')
-rw-r--r--protocols/Tox/src/tox_contacts.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index d5b166ce75..5bf327f060 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -41,7 +41,7 @@ MCONTACT CToxProto::GetContact(const int friendNumber)
{
uint8_t data[TOX_PUBLIC_KEY_SIZE];
TOX_ERR_FRIEND_GET_PUBLIC_KEY error;
- if (!tox_friend_get_public_key(tox, friendNumber, data, &error))
+ if (!tox_friend_get_public_key(toxThread->tox, friendNumber, data, &error))
{
debugLogA(__FUNCTION__": failed to get friend public key (%d)", error);
return NULL;
@@ -99,7 +99,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.GetPubKey(), &error);
+ uint32_t friendNumber = tox_friend_by_public_key(toxThread->tox, pubKey.GetPubKey(), &error);
if (error != TOX_ERR_FRIEND_BY_PUBLIC_KEY_OK)
debugLogA(__FUNCTION__": failed to get friend number (%d)", error);
return friendNumber;
@@ -107,18 +107,18 @@ uint32_t CToxProto::GetToxFriendNumber(MCONTACT hContact)
void CToxProto::LoadFriendList(void*)
{
- size_t count = tox_self_get_friend_list_size(tox);
+ size_t count = tox_self_get_friend_list_size(toxThread->tox);
if (count > 0)
{
uint32_t *friends = (uint32_t*)mir_alloc(count * sizeof(uint32_t));
- tox_self_get_friend_list(tox, friends);
+ tox_self_get_friend_list(toxThread->tox, friends);
uint8_t data[TOX_PUBLIC_KEY_SIZE];
for (size_t i = 0; i < count; i++)
{
uint32_t friendNumber = friends[i];
TOX_ERR_FRIEND_GET_PUBLIC_KEY getPublicKeyResult;
- if (!tox_friend_get_public_key(tox, friendNumber, data, &getPublicKeyResult))
+ if (!tox_friend_get_public_key(toxThread->tox, friendNumber, data, &getPublicKeyResult))
{
debugLogA(__FUNCTION__": failed to get friend public key (%d)", getPublicKeyResult);
continue;
@@ -132,13 +132,13 @@ void CToxProto::LoadFriendList(void*)
TOX_ERR_FRIEND_QUERY getNameResult;
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
- if (tox_friend_get_name(tox, friendNumber, nick, &getNameResult))
+ if (tox_friend_get_name(toxThread->tox, friendNumber, nick, &getNameResult))
setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", getNameResult);
TOX_ERR_FRIEND_GET_LAST_ONLINE getLastOnlineResult;
- uint64_t timestamp = tox_friend_get_last_online(tox, friendNumber, &getLastOnlineResult);
+ uint64_t timestamp = tox_friend_get_last_online(toxThread->tox, friendNumber, &getLastOnlineResult);
if (getLastOnlineResult == TOX_ERR_FRIEND_GET_LAST_ONLINE_OK)
setDword(hContact, "LastEventDateTS", timestamp);
else
@@ -159,7 +159,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
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);
+ int32_t friendNumber = tox_friend_add(toxThread->tox, address, (uint8_t*)reason, length, &addFriendResult);
if (addFriendResult != TOX_ERR_FRIEND_ADD_OK)
{
debugLogA(__FUNCTION__": failed to request auth (%d)", addFriendResult);
@@ -171,7 +171,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
TOX_ERR_FRIEND_QUERY errorFriendQuery;
- if (tox_friend_get_name(tox, friendNumber, nick, &errorFriendQuery))
+ if (tox_friend_get_name(toxThread->tox, friendNumber, nick, &errorFriendQuery))
setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", errorFriendQuery);
@@ -186,7 +186,7 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM)
ToxBinAddress pubKey(ptrA(getStringA(hContact, TOX_SETTINGS_ID)));
TOX_ERR_FRIEND_ADD error;
- tox_friend_add_norequest(tox, pubKey, &error);
+ tox_friend_add_norequest(toxThread->tox, pubKey, &error);
if (error != TOX_ERR_FRIEND_ADD_OK)
{
debugLogA(__FUNCTION__": failed to grant auth (%d)", error);
@@ -210,7 +210,7 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
int32_t friendNumber = GetToxFriendNumber(hContact);
TOX_ERR_FRIEND_DELETE error;
- if (!tox_friend_delete(tox, friendNumber, &error))
+ if (!tox_friend_delete(toxThread->tox, friendNumber, &error))
{
debugLogA(__FUNCTION__": failed to delete friend (%d)", error);
return error;
@@ -346,7 +346,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
}
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(proto->tox, friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
+ uint32_t fileNumber = tox_file_send(proto->toxThread->tox, friendNumber, TOX_FILE_KIND_AVATAR, length, hash, NULL, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK)
{
proto->debugLogA(__FUNCTION__": failed to set new avatar");
@@ -361,7 +361,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
proto->transfers.Add(transfer);
}
else
- tox_file_send(proto->tox, friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, NULL);
+ tox_file_send(proto->toxThread->tox, friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, NULL);
}
else
{