From 6e1c3bb16e5b0d396810a1a534f4854d55bcf4ac Mon Sep 17 00:00:00 2001 From: aunsane Date: Thu, 23 Feb 2017 15:04:09 +0300 Subject: Tox: it seems that irungentoo/toxcore no longer be updated, so we switch to TokTok/c-toxcore --- protocols/Tox/src/api_connection.cpp | 4 ++-- protocols/Tox/src/api_friends.cpp | 32 ++++++++++++++--------------- protocols/Tox/src/api_transfer.cpp | 16 +++++++-------- protocols/Tox/src/tox_chatrooms.cpp | 3 ++- protocols/Tox/src/tox_core.cpp | 39 +++++++++++------------------------- protocols/Tox/src/tox_network.cpp | 2 +- protocols/Tox/src/tox_proto.cpp | 2 +- protocols/Tox/src/tox_proto.h | 4 ++-- protocols/Tox/src/tox_thread.h | 4 ++-- 9 files changed, 46 insertions(+), 60 deletions(-) (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/api_connection.cpp b/protocols/Tox/src/api_connection.cpp index 3803411fa3..1ed6b51d40 100644 --- a/protocols/Tox/src/api_connection.cpp +++ b/protocols/Tox/src/api_connection.cpp @@ -22,7 +22,7 @@ uint32_t tox_iteration_interval(const Tox *tox) return CreateFunction(__FUNCTION__)(tox); } -void tox_iterate(Tox *tox) +void tox_iterate(Tox *tox, void *user_data) { - CreateFunction(__FUNCTION__)(tox); + CreateFunction(__FUNCTION__)(tox, user_data); } \ No newline at end of file diff --git a/protocols/Tox/src/api_friends.cpp b/protocols/Tox/src/api_friends.cpp index 9856007bc8..caa133feb7 100644 --- a/protocols/Tox/src/api_friends.cpp +++ b/protocols/Tox/src/api_friends.cpp @@ -57,9 +57,9 @@ bool tox_friend_get_name(const Tox *tox, uint32_t friend_number, uint8_t *name, return CreateFunction(__FUNCTION__)(tox, friend_number, name, error); } -void tox_callback_friend_name(Tox *tox, tox_friend_name_cb *function, void *user_data) +void tox_callback_friend_name(Tox *tox, tox_friend_name_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) @@ -72,9 +72,9 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8 return CreateFunction(__FUNCTION__)(tox, friend_number, status_message, error); } -void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function, void *user_data) +void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) @@ -82,9 +82,9 @@ TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TO return CreateFunction(__FUNCTION__)(tox, friend_number, error); } -void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *function, void *user_data) +void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) @@ -92,9 +92,9 @@ TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_ return CreateFunction(__FUNCTION__)(tox, friend_number, error); } -void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_status_cb *function, void *user_data) +void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_status_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) @@ -102,9 +102,9 @@ bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEN return CreateFunction(__FUNCTION__)(tox, friend_number, error); } -void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *function, void *user_data) +void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } /* */ @@ -119,17 +119,17 @@ uint32_t tox_friend_send_message(Tox *tox, uint32_t friend_number, TOX_MESSAGE_T return CreateFunction(__FUNCTION__)(tox, friend_number, type, message, length, error); } -void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function, void *user_data) +void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } -void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *function, void *user_data) +void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } -void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function, void *user_data) +void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } \ No newline at end of file diff --git a/protocols/Tox/src/api_transfer.cpp b/protocols/Tox/src/api_transfer.cpp index 8906436084..446a2ccc80 100644 --- a/protocols/Tox/src/api_transfer.cpp +++ b/protocols/Tox/src/api_transfer.cpp @@ -22,24 +22,24 @@ bool tox_file_send_chunk(Tox *tox, uint32_t friend_number, uint32_t file_number, return CreateFunction(__FUNCTION__)(tox, friend_number, file_number, position, data, length, error); } -void tox_callback_file_chunk_request(Tox *tox, tox_file_chunk_request_cb *function, void *user_data) +void tox_callback_file_chunk_request(Tox *tox, tox_file_chunk_request_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } -void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function, void *user_data) +void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } -void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data) +void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } -void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function, void *user_data) +void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function) { - CreateFunction(__FUNCTION__)(tox, function, user_data); + CreateFunction(__FUNCTION__)(tox, function); } bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control, TOX_ERR_FILE_CONTROL *error) diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index 146a225419..5ca9895fcb 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" - +/* MCONTACT CToxProto::GetChatRoom(int groupNumber) { MCONTACT hContact = NULL; @@ -323,3 +323,4 @@ INT_PTR CALLBACK CToxProto::ChatRoomInviteProc(HWND hwndDlg, UINT msg, WPARAM wP } return FALSE; } +*/ \ No newline at end of file diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index bae27a52e7..d18885fc9b 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -55,20 +55,20 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) if (toxThread == NULL) return false; - tox_callback_friend_request(toxThread->Tox(), OnFriendRequest, this); - tox_callback_friend_message(toxThread->Tox(), OnFriendMessage, this); - tox_callback_friend_read_receipt(toxThread->Tox(), OnReadReceipt, this); - tox_callback_friend_typing(toxThread->Tox(), OnTypingChanged, this); + tox_callback_friend_request(toxThread->Tox(), OnFriendRequest); + tox_callback_friend_message(toxThread->Tox(), OnFriendMessage); + tox_callback_friend_read_receipt(toxThread->Tox(), OnReadReceipt); + tox_callback_friend_typing(toxThread->Tox(), OnTypingChanged); // - tox_callback_friend_name(toxThread->Tox(), OnFriendNameChange, this); - tox_callback_friend_status_message(toxThread->Tox(), OnStatusMessageChanged, this); - tox_callback_friend_status(toxThread->Tox(), OnUserStatusChanged, this); - tox_callback_friend_connection_status(toxThread->Tox(), OnConnectionStatusChanged, this); + tox_callback_friend_name(toxThread->Tox(), OnFriendNameChange); + tox_callback_friend_status_message(toxThread->Tox(), OnStatusMessageChanged); + tox_callback_friend_status(toxThread->Tox(), OnUserStatusChanged); + tox_callback_friend_connection_status(toxThread->Tox(), OnConnectionStatusChanged); // transfers - tox_callback_file_recv_control(toxThread->Tox(), OnFileRequest, this); - tox_callback_file_recv(toxThread->Tox(), OnFriendFile, this); - tox_callback_file_recv_chunk(toxThread->Tox(), OnDataReceiving, this); - tox_callback_file_chunk_request(toxThread->Tox(), OnFileSendData, this); + tox_callback_file_recv_control(toxThread->Tox(), OnFileRequest); + tox_callback_file_recv(toxThread->Tox(), OnFriendFile); + tox_callback_file_recv_chunk(toxThread->Tox(), OnDataReceiving); + tox_callback_file_chunk_request(toxThread->Tox(), OnFileSendData); // group chats //tox_callback_group_invite(tox, OnGroupChatInvite, this); // a/v @@ -127,19 +127,4 @@ void CToxProto::UninitToxCore(CToxThread *toxThread) CancelAllTransfers(toxThread); SaveToxProfile(toxThread); - - tox_callback_friend_request(toxThread->Tox(), OnFriendRequest, NULL); - tox_callback_friend_message(toxThread->Tox(), OnFriendMessage, NULL); - tox_callback_friend_read_receipt(toxThread->Tox(), OnReadReceipt, NULL); - tox_callback_friend_typing(toxThread->Tox(), OnTypingChanged, NULL); - // - tox_callback_friend_name(toxThread->Tox(), OnFriendNameChange, NULL); - tox_callback_friend_status_message(toxThread->Tox(), OnStatusMessageChanged, NULL); - tox_callback_friend_status(toxThread->Tox(), OnUserStatusChanged, NULL); - tox_callback_friend_connection_status(toxThread->Tox(), OnConnectionStatusChanged, NULL); - // transfers - tox_callback_file_recv_control(toxThread->Tox(), OnFileRequest, NULL); - tox_callback_file_recv(toxThread->Tox(), OnFriendFile, NULL); - tox_callback_file_recv_chunk(toxThread->Tox(), OnDataReceiving, NULL); - tox_callback_file_chunk_request(toxThread->Tox(), OnFileSendData, NULL); } \ No newline at end of file diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index e895f04dde..a576740d8e 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -291,7 +291,7 @@ void CToxProto::PollingThread(void*) while (!toxThread.IsTerminated()) { CheckConnection(retriesCount); - toxThread.Iterate(); + toxThread.Iterate(this); } toxThread.Disconnect(); diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 7efbe6c7a6..e441cd7655 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -160,7 +160,7 @@ int CToxProto::SetStatus(int iNewStatus) if (!Miranda_IsTerminated()) { SetAllContactsStatus(ID_STATUS_OFFLINE); - CloseAllChatChatSessions(); + //CloseAllChatChatSessions(); } m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 4380c2d98d..65ab3c2c15 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -198,8 +198,8 @@ private: INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM); INT_PTR __cdecl OnCreateChatRoom(WPARAM, LPARAM); - void InitGroupChatModule(); - void CloseAllChatChatSessions(); + //void InitGroupChatModule(); + //void CloseAllChatChatSessions(); static void OnGroupChatInvite(Tox *tox, int32_t friendNumber, uint8_t type, const uint8_t *data, const uint16_t length, void *arg); diff --git a/protocols/Tox/src/tox_thread.h b/protocols/Tox/src/tox_thread.h index 59caa7ee30..a60d0246e3 100644 --- a/protocols/Tox/src/tox_thread.h +++ b/protocols/Tox/src/tox_thread.h @@ -69,11 +69,11 @@ public: isConnected = false; } - void Iterate() + void Iterate(void* data) { { mir_cslock lock(toxLock); - tox_iterate(tox); + tox_iterate(tox, data); //if (toxAV) // toxav_iterate(toxAV); } -- cgit v1.2.3