summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/bin/x64/libtox.dllbin4033647 -> 4033135 bytes
-rw-r--r--protocols/Tox/bin/x64/libtox.pdbbin650240 -> 650240 bytes
-rw-r--r--protocols/Tox/bin/x86/libtox.dllbin3374703 -> 3372655 bytes
-rw-r--r--protocols/Tox/bin/x86/libtox.pdbbin642048 -> 642048 bytes
-rw-r--r--protocols/Tox/src/tox_avatars.cpp22
-rw-r--r--protocols/Tox/src/tox_contacts.cpp2
-rw-r--r--protocols/Tox/src/tox_core.cpp4
-rw-r--r--protocols/Tox/src/tox_menus.cpp10
-rw-r--r--protocols/Tox/src/tox_network.cpp3
-rw-r--r--protocols/Tox/src/tox_transfer.cpp10
-rw-r--r--protocols/Tox/src/tox_transfer.h2
-rw-r--r--protocols/Tox/src/version.h2
12 files changed, 25 insertions, 30 deletions
diff --git a/protocols/Tox/bin/x64/libtox.dll b/protocols/Tox/bin/x64/libtox.dll
index 5a03e34ae7..df55ba49d0 100644
--- a/protocols/Tox/bin/x64/libtox.dll
+++ b/protocols/Tox/bin/x64/libtox.dll
Binary files differ
diff --git a/protocols/Tox/bin/x64/libtox.pdb b/protocols/Tox/bin/x64/libtox.pdb
index 4cf8649a9e..fadd0cbd88 100644
--- a/protocols/Tox/bin/x64/libtox.pdb
+++ b/protocols/Tox/bin/x64/libtox.pdb
Binary files differ
diff --git a/protocols/Tox/bin/x86/libtox.dll b/protocols/Tox/bin/x86/libtox.dll
index bd2ebab4ac..52001d8a5f 100644
--- a/protocols/Tox/bin/x86/libtox.dll
+++ b/protocols/Tox/bin/x86/libtox.dll
Binary files differ
diff --git a/protocols/Tox/bin/x86/libtox.pdb b/protocols/Tox/bin/x86/libtox.pdb
index 0445618ea1..c11e80feb8 100644
--- a/protocols/Tox/bin/x86/libtox.pdb
+++ b/protocols/Tox/bin/x86/libtox.pdb
Binary files differ
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index 20d7681454..40854b3b83 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -9,14 +9,14 @@ std::tstring CToxProto::GetAvatarFilePath(MCONTACT hContact)
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- ptrT id(getTStringA(hContact, TOX_SETTINGS_ID));
- if (hContact != NULL)
- mir_sntprintf(path, MAX_PATH, _T("%s\\%s.png"), path, id);
- else if (id != NULL)
- mir_sntprintf(path, MAX_PATH, _T("%s\\%s avatar.png"), path, id);
- else
+ ptrT address(getTStringA(hContact, TOX_SETTINGS_ID));
+ if (address == NULL)
return _T("");
+ if (hContact && mir_tstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
+ address[TOX_PUBLIC_KEY_SIZE * 2] = 0;
+ mir_sntprintf(path, MAX_PATH, _T("%s\\%s.png"), path, address);
+
return path;
}
@@ -197,7 +197,8 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
}
TOX_ERR_FILE_SEND error;
- if (!tox_file_send(tox, friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error))
+ tox_file_send(tox, friendNumber, TOX_FILE_KIND_AVATAR, 0, NULL, NULL, 0, &error);
+ if (error != TOX_ERR_FILE_SEND_OK)
{
debugLogA(__FUNCTION__": failed to unset avatar");
return -1;
@@ -218,13 +219,14 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer)
{
if (transfer->pfts.totalBytes == 0)
{
- std::tstring path = GetAvatarFilePath(transfer->pfts.hContact);
+ MCONTACT hConact = transfer->pfts.hContact;
+ std::tstring path = GetAvatarFilePath(hConact);
if (IsFileExists(path))
DeleteFile(path.c_str());
- ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
- delSetting(transfer->pfts.hContact, TOX_SETTINGS_AVATAR_HASH);
transfers.Remove(transfer);
+ delSetting(hConact, TOX_SETTINGS_AVATAR_HASH);
+ ProtoBroadcastAck(hConact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, 0, 0);
return;
}
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 2e123ca6a3..0cda5f4783 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -415,9 +415,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
{
if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName))
- {
return 0;
- }
MCONTACT hContact = lParam;
char *szProto = GetContactProto(hContact);
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp
index a08ca0a57b..078c16d984 100644
--- a/protocols/Tox/src/tox_core.cpp
+++ b/protocols/Tox/src/tox_core.cpp
@@ -60,7 +60,7 @@ bool CToxProto::InitToxCore()
// group chats
//tox_callback_group_invite(tox, OnGroupChatInvite, this);
// a/v
- toxAv = toxav_new(tox, TOX_MAX_CALLS);
+ /*toxAv = toxav_new(tox, TOX_MAX_CALLS);
toxav_register_audio_callback(toxAv, OnFriendAudio, this);
toxav_register_callstate_callback(toxAv, OnAvInvite, av_OnInvite, this);
toxav_register_callstate_callback(toxAv, OnAvStart, av_OnStart, this);
@@ -68,7 +68,7 @@ bool CToxProto::InitToxCore()
toxav_register_callstate_callback(toxAv, OnAvReject, av_OnReject, this);
toxav_register_callstate_callback(toxAv, OnAvEnd, av_OnEnd, this);
toxav_register_callstate_callback(toxAv, OnAvCallTimeout, av_OnRequestTimeout, this);
- toxav_register_callstate_callback(toxAv, OnAvPeerTimeout, av_OnPeerTimeout, this);
+ toxav_register_callstate_callback(toxAv, OnAvPeerTimeout, av_OnPeerTimeout, this);*/
uint8_t data[TOX_ADDRESS_SIZE];
tox_self_get_address(tox, data);
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index 247ba54378..6338b74767 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -14,17 +14,15 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
return 0;
bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool isAuthNeed = getByte(hContact, "Auth", 0) > 0;
- bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
- //bool isOffline = GetContactStatus(hContact) == ID_STATUS_OFFLINE;
- //bool isLongOffline = ((time(NULL) - getDword(hContact, "LastEventDateTS", 0)) / (1000 * 60 * 60 * 24 * 7)) > 0;
- //bool hasDnsID = mir_strlen(ptrA(getStringA(hContact, TOX_SETTINGS_DNS))) > 0;
+ bool isAuthNeed = getByte(hContact, "Auth", 0) > 0;
Menu_ShowItem(ContactMenuItems[CMI_AUTH_REQUEST], isCtrlPressed || isAuthNeed);
+
+ bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
Menu_ShowItem(ContactMenuItems[CMI_AUTH_GRANT], isCtrlPressed || isGrantNeed);
bool isContactOnline = GetContactStatus(hContact) > ID_STATUS_OFFLINE;
- Menu_ShowItem(ContactMenuItems[CMI_AUDIO_CALL], isContactOnline);
+ Menu_ShowItem(ContactMenuItems[CMI_AUDIO_CALL], toxAv && isContactOnline);
return 0;
}
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index ec79f22747..d97496b856 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -143,7 +143,8 @@ void CToxProto::DoTox()
{
mir_cslock lock(toxLock);
tox_iterate(tox);
- toxav_do(toxAv);
+ if (toxAv)
+ toxav_do(toxAv);
}
uint32_t interval = tox_iteration_interval(tox);
Sleep(interval);
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index 90d61a4d87..1c56c24081 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -14,9 +14,9 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
{
case TOX_FILE_KIND_AVATAR:
{
- ptrT id(proto->getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrT address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
TCHAR avatarName[MAX_PATH];
- mir_sntprintf(avatarName, MAX_PATH, _T("%s.png"), id);
+ mir_sntprintf(avatarName, MAX_PATH, _T("%s.png"), address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
transfer->pfts.hContact = hContact;
@@ -246,9 +246,7 @@ void CToxProto::OnFileSendData(Tox*, uint32_t friendNumber, uint32_t fileNumber,
proto->debugLogA(__FUNCTION__": finised the transfer of file (%d)", fileNumber);
bool isFileFullyTransfered = transfer->pfts.currentFileProgress == transfer->pfts.currentFileSize;
if (!isFileFullyTransfered)
- {
- proto->debugLogA(__FUNCTION__": file (%d) is transferred not completely", fileNumber);
- }
+ proto->debugLogA(__FUNCTION__": file (%d) is not completely transferred", fileNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, isFileFullyTransfered ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, (HANDLE)transfer, 0);
proto->transfers.Remove(transfer);
return;
@@ -278,7 +276,7 @@ void CToxProto::OnFileSendData(Tox*, uint32_t friendNumber, uint32_t fileNumber,
return;
}
- transfer->pfts.totalProgress = transfer->pfts.currentFileProgress = length;
+ transfer->pfts.totalProgress = transfer->pfts.currentFileProgress += length;
mir_free(data);
}
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h
index 12d651339a..110fe4ab65 100644
--- a/protocols/Tox/src/tox_transfer.h
+++ b/protocols/Tox/src/tox_transfer.h
@@ -51,9 +51,7 @@ struct FileTransferParam
~FileTransferParam()
{
if (pfts.tszWorkingDir != NULL)
- {
mir_free(pfts.tszWorkingDir);
- }
mir_free(pfts.pszFiles[0]);
mir_free(pfts.pszFiles);
if (hFile != NULL)
diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h
index 20350753fa..e6fbbb213f 100644
--- a/protocols/Tox/src/version.h
+++ b/protocols/Tox/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 1
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>