diff options
author | Alex <aunsane@gmail.com> | 2017-12-16 20:26:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-16 20:26:23 +0300 |
commit | 41a5dbf4d9d937b5fe9df3c700e8c43c82f2343c (patch) | |
tree | d765c53432332e29b4e088d12db500e8aea6f2cb /protocols/Tox/src | |
parent | fa47233bca994ad009ad3536e1eeea3abd03ca39 (diff) |
Tox: (#1068)
- moved to self compiled libtox
- removed unused code (multimedia & chatrooms)
- removed unneeded files & tools
- version bump
Diffstat (limited to 'protocols/Tox/src')
23 files changed, 5 insertions, 1797 deletions
diff --git a/protocols/Tox/src/api_av.cpp b/protocols/Tox/src/api_av.cpp deleted file mode 100644 index c46e549a35..0000000000 --- a/protocols/Tox/src/api_av.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "stdafx.h"
-
-/* COMMON A/V FUNCTIONS */
-
-ToxAV *toxav_new(Tox *tox, TOXAV_ERR_NEW *error)
-{
- return CreateFunction<ToxAV*(*)(Tox*, TOXAV_ERR_NEW*)>(__FUNCTION__)(tox, error);
-}
-
-void toxav_kill(ToxAV *toxAV)
-{
- CreateFunction<void(*)(ToxAV*)>(__FUNCTION__)(toxAV);
-}
-
-Tox *toxav_get_tox(const ToxAV *toxAV)
-{
- return CreateFunction<Tox*(*)(const ToxAV*)>(__FUNCTION__)(toxAV);
-}
-
-uint32_t toxav_iteration_interval(ToxAV *toxAV)
-{
- return CreateFunction<uint32_t(*)(ToxAV*)>(__FUNCTION__)(toxAV);
-}
-
-void toxav_iterate(ToxAV *toxAV)
-{
- CreateFunction<void(*)(ToxAV*)>(__FUNCTION__)(toxAV);
-}
-
-bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, TOXAV_ERR_CALL *error)
-{
- return CreateFunction<bool(*)(ToxAV*, int32_t, uint32_t, uint32_t, TOXAV_ERR_CALL*)>(__FUNCTION__)(toxAV, friend_number, audio_bit_rate, video_bit_rate, error);
-}
-
-void toxav_callback_call(ToxAV *toxAV, toxav_call_cb *callback, void *user_data)
-{
- CreateFunction<void(*)(ToxAV*, toxav_call_cb, void*)>(__FUNCTION__)(toxAV, callback, user_data);
-}
-
-bool toxav_answer(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, TOXAV_ERR_ANSWER *error)
-{
- return CreateFunction<bool(*)(ToxAV*, int32_t, uint32_t, uint32_t, TOXAV_ERR_ANSWER*)>(__FUNCTION__)(toxAV, friend_number, audio_bit_rate, video_bit_rate, error);
-}
-
-void toxav_callback_call_state(ToxAV *toxAV, toxav_call_state_cb *callback, void *user_data)
-{
- CreateFunction<void(*)(ToxAV*, toxav_call_state_cb, void*)>(__FUNCTION__)(toxAV, callback, user_data);
-}
-
-bool toxav_call_control(ToxAV *toxAV, uint32_t friend_number, TOXAV_CALL_CONTROL control, TOXAV_ERR_CALL_CONTROL *error)
-{
- return CreateFunction<bool(*)(ToxAV*, uint32_t, TOXAV_CALL_CONTROL, TOXAV_ERR_CALL_CONTROL*)>(__FUNCTION__)(toxAV, friend_number, control, error);
-}
-
-bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate, TOXAV_ERR_BIT_RATE_SET *error)
-{
- return CreateFunction<bool(*)(ToxAV*, int32_t, uint32_t, uint32_t, TOXAV_ERR_BIT_RATE_SET*)>(__FUNCTION__)(toxAV, friend_number, audio_bit_rate, video_bit_rate, error);
-}
-
-void toxav_callback_bit_rate_status(ToxAV *toxAV, toxav_bit_rate_status_cb *callback, void *user_data)
-{
- CreateFunction<void(*)(ToxAV*, toxav_bit_rate_status_cb, void*)>(__FUNCTION__)(toxAV, callback, user_data);
-}
-
-bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error)
-{
- return CreateFunction<bool(*)(ToxAV*, int32_t, const int16_t*, size_t, uint8_t, uint32_t, TOXAV_ERR_SEND_FRAME*)>(__FUNCTION__)(toxAV, friend_number, pcm, sample_count, channels, sampling_rate, error);
-}
-
-bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error)
-{
- return CreateFunction<bool(*)(ToxAV*, int32_t, int16_t, uint16_t, const uint8_t*, const uint8_t*, const uint8_t*, TOXAV_ERR_SEND_FRAME*)>(__FUNCTION__)(toxAV, friend_number, width, height, y, u, v, error);
-}
-
-void toxav_callback_audio_receive_frame(ToxAV *toxAV, toxav_audio_receive_frame_cb *callback, void *user_data)
-{
- CreateFunction<void(*)(ToxAV*, toxav_audio_receive_frame_cb, void*)>(__FUNCTION__)(toxAV, callback, user_data);
-}
-
-void toxav_callback_video_receive_frame(ToxAV *toxAV, toxav_video_receive_frame_cb *callback, void *user_data)
-{
- CreateFunction<void(*)(ToxAV*, toxav_video_receive_frame_cb, void*)>(__FUNCTION__)(toxAV, callback, user_data);
-}
-
-int toxav_add_av_groupchat(Tox *tox, void(*audio_callback)(void *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *), void *userdata)
-{
- return CreateFunction<int(*)(Tox*, void(*)(void*, int, int, const int16_t*, unsigned int, uint8_t, unsigned int, void*), void*)>(__FUNCTION__)(tox, audio_callback, userdata);
-}
-
-int toxav_join_av_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length, void(*audio_callback)(void *, int, int, const int16_t *, unsigned int, uint8_t, unsigned int, void *), void *userdata)
-{
- return CreateFunction<int(*)(Tox*, int32_t, const uint8_t*, uint16_t, void(*)(void*, int, int, const int16_t*, unsigned int, uint8_t, unsigned int, void*), void*)>(__FUNCTION__)(tox, friendnumber, data, length, audio_callback, userdata);
-}
-
-int toxav_group_send_audio(Tox *tox, int groupnumber, const int16_t *pcm, unsigned int samples, uint8_t channels, unsigned int sample_rate)
-{
- return CreateFunction<int(*)(Tox*, int, const int16_t*, unsigned int, uint8_t, unsigned int)>(__FUNCTION__)(tox, groupnumber, pcm, samples, channels, sample_rate);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_avatars.cpp b/protocols/Tox/src/api_avatars.cpp deleted file mode 100644 index 658b835a68..0000000000 --- a/protocols/Tox/src/api_avatars.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "stdafx.h"
-
-/* AVATAR FUNCTIONS */
-
-void tox_callback_avatar_info(Tox *tox, void(*function)(Tox *tox, int32_t, uint8_t, uint8_t *, void *), void *userdata)
-{
- CreateFunction<int(*)(Tox*, void(*)(Tox*, int32_t, uint8_t, uint8_t*, void*), void*)>(__FUNCTION__)(tox, function, userdata);
-}
-
-void tox_callback_avatar_data(Tox *tox, void(*function)(Tox *tox, int32_t, uint8_t, uint8_t *, uint8_t *, uint32_t, void *), void *userdata)
-{
- CreateFunction<int(*)(Tox*, void(*)(Tox*, int32_t, uint8_t, uint8_t*, uint8_t*, uint32_t, void*), void*)>(__FUNCTION__)(tox, function, userdata);
-}
-
-int tox_set_avatar(Tox *tox, uint8_t format, const uint8_t *data, uint32_t length)
-{
- return CreateFunction<int(*)(Tox*, uint8_t, const uint8_t*, uint32_t)>(__FUNCTION__)(tox, format, data, length);
-}
-
-int tox_unset_avatar(Tox *tox)
-{
- return CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-int tox_get_self_avatar(const Tox *tox, uint8_t *format, uint8_t *buf, uint32_t *length, uint32_t maxlen, uint8_t *hash)
-{
- return CreateFunction<int(*)(const Tox*, uint8_t*, uint8_t*, uint32_t*, uint32_t, uint8_t*)>(__FUNCTION__)(tox, format, buf, length, maxlen, hash);
-}
-
-int tox_request_avatar_info(const Tox *tox, const int32_t friendnumber)
-{
- return CreateFunction<int(*)(const Tox*, const int32_t)>(__FUNCTION__)(tox, friendnumber);
-}
-
-int tox_send_avatar_info(Tox *tox, const int32_t friendnumber)
-{
- return CreateFunction<int(*)(const Tox*, const int32_t)>(__FUNCTION__)(tox, friendnumber);
-}
-
-int tox_request_avatar_data(const Tox *tox, const int32_t friendnumber)
-{
- return CreateFunction<int(*)(const Tox*, const int32_t)>(__FUNCTION__)(tox, friendnumber);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_connection.cpp b/protocols/Tox/src/api_connection.cpp deleted file mode 100644 index 1ed6b51d40..0000000000 --- a/protocols/Tox/src/api_connection.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "stdafx.h"
-
-/* CONNECTION FUNCTIONS */
-
-bool tox_bootstrap(Tox *tox, const char *host, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error)
-{
- return CreateFunction<bool(*)(Tox*, const char*, uint16_t, const uint8_t*, TOX_ERR_BOOTSTRAP*)>(__FUNCTION__)(tox, host, port, public_key, error);
-}
-
-bool tox_add_tcp_relay(Tox *tox, const char *host, uint16_t port, const uint8_t *public_key, TOX_ERR_BOOTSTRAP *error)
-{
- return CreateFunction<bool(*)(Tox*, const char*, uint16_t, const uint8_t*, TOX_ERR_BOOTSTRAP*)>(__FUNCTION__)(tox, host, port, public_key, error);
-}
-
-TOX_CONNECTION tox_self_get_connection_status(const Tox *tox)
-{
- return CreateFunction<TOX_CONNECTION(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-uint32_t tox_iteration_interval(const Tox *tox)
-{
- return CreateFunction<uint32_t(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-void tox_iterate(Tox *tox, void *user_data)
-{
- CreateFunction<int(*)(const Tox*, void*)>(__FUNCTION__)(tox, user_data);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_dns.cpp b/protocols/Tox/src/api_dns.cpp deleted file mode 100644 index 57db01e57c..0000000000 --- a/protocols/Tox/src/api_dns.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "stdafx.h"
-
-/* DNS TOXID RESOILVING FUNCTIONS */
-
-void *tox_dns3_new(uint8_t *server_public_key)
-{
- return CreateFunction<void*(*)(uint8_t*)>(__FUNCTION__)(server_public_key);
-}
-
-void tox_dns3_kill(void *dns3_object)
-{
- CreateFunction<void(*)(void*)>(__FUNCTION__)(dns3_object);
-}
-
-int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id, uint8_t *name, uint8_t name_len)
-{
- return CreateFunction<int(*)(void*, uint8_t*, uint16_t, uint32_t*, uint8_t*, uint8_t)>(__FUNCTION__)(dns3_object, string, string_max_len, request_id, name, name_len);
-}
-
-int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, uint32_t request_id)
-{
- return CreateFunction<int(*)(void*, uint8_t*, uint8_t*, uint32_t, uint32_t)>(__FUNCTION__)(dns3_object, tox_id, id_record, id_record_len, request_id);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_encryption.cpp b/protocols/Tox/src/api_encryption.cpp deleted file mode 100644 index 85e77c06ad..0000000000 --- a/protocols/Tox/src/api_encryption.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "stdafx.h"
-
-/* ENCRYPTION FUNCTIONS */
-
-bool tox_pass_decrypt(const uint8_t *data, size_t length, const uint8_t *passphrase, size_t pplength, uint8_t *out, TOX_ERR_DECRYPTION *error)
-{
- return CreateFunction<bool(*)(const uint8_t *, size_t, const uint8_t*, size_t, uint8_t*, TOX_ERR_DECRYPTION*)>(__FUNCTION__)(data, length, passphrase, pplength, out, error);
-}
-
-bool tox_pass_encrypt(const uint8_t *data, size_t data_len, const uint8_t *passphrase, size_t pplength, uint8_t *out, TOX_ERR_ENCRYPTION *error)
-{
- return CreateFunction<bool(*)(const uint8_t *, size_t, const uint8_t*, size_t, uint8_t*, TOX_ERR_ENCRYPTION*)>(__FUNCTION__)(data, data_len, passphrase, pplength, out, error);
-}
-
-bool tox_is_data_encrypted(const uint8_t *data)
-{
- return CreateFunction<bool(*)(const uint8_t*)>(__FUNCTION__)(data);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_friends.cpp b/protocols/Tox/src/api_friends.cpp deleted file mode 100644 index caa133feb7..0000000000 --- a/protocols/Tox/src/api_friends.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include "stdafx.h"
-
-/* FRIEND FUNCTIONS */
-
-uint32_t tox_friend_add(Tox *tox, const uint8_t *address, const uint8_t *message, size_t length, TOX_ERR_FRIEND_ADD *error)
-{
- return CreateFunction<uint32_t(*)(Tox*, const uint8_t*, const uint8_t*, size_t, TOX_ERR_FRIEND_ADD*)>(__FUNCTION__)(tox, address, message, length, error);
-}
-
-uint32_t tox_friend_add_norequest(Tox *tox, const uint8_t *public_key, TOX_ERR_FRIEND_ADD *error)
-{
- return CreateFunction<uint32_t(*)(Tox*, const uint8_t*, TOX_ERR_FRIEND_ADD*)>(__FUNCTION__)(tox, public_key, error);
-}
-
-bool tox_friend_delete(Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_DELETE *error)
-{
- return CreateFunction<bool(*)(Tox*, uint32_t, TOX_ERR_FRIEND_DELETE*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-uint32_t tox_friend_by_public_key(const Tox *tox, const uint8_t *public_key, TOX_ERR_FRIEND_BY_PUBLIC_KEY *error)
-{
- return CreateFunction<uint32_t(*)(const Tox*, const uint8_t*, TOX_ERR_FRIEND_BY_PUBLIC_KEY*)>(__FUNCTION__)(tox, public_key, error);
-}
-
-int tox_friend_exists(const Tox *tox, int32_t friendnumber)
-{
- return CreateFunction<int(*)(const Tox*, int32_t)>(__FUNCTION__)(tox, friendnumber);
-}
-
-size_t tox_self_get_friend_list_size(const Tox *tox)
-{
- return CreateFunction<size_t(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-void tox_self_get_friend_list(const Tox *tox, uint32_t *list)
-{
- CreateFunction<void(*)(const Tox*, uint32_t*)>(__FUNCTION__)(tox, list);
-}
-
-bool tox_friend_get_public_key(const Tox *tox, uint32_t friend_number, uint8_t *public_key, TOX_ERR_FRIEND_GET_PUBLIC_KEY *error)
-{
- return CreateFunction<bool(*)(const Tox*, int32_t, uint8_t*, TOX_ERR_FRIEND_GET_PUBLIC_KEY*)>(__FUNCTION__)(tox, friend_number, public_key, error);
-}
-
-uint64_t tox_friend_get_last_online(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_GET_LAST_ONLINE *error)
-{
- return CreateFunction<uint64_t(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_GET_LAST_ONLINE*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-size_t tox_friend_get_name_size(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<size_t(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-bool tox_friend_get_name(const Tox *tox, uint32_t friend_number, uint8_t *name, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<bool(*)(const Tox*, uint32_t, uint8_t*, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, name, error);
-}
-
-void tox_callback_friend_name(Tox *tox, tox_friend_name_cb *function)
-{
- CreateFunction<void(*)(Tox*tox, tox_friend_name_cb)>(__FUNCTION__)(tox, function);
-}
-
-size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<size_t(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8_t *status_message, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<bool(*)(const Tox*, uint32_t, uint8_t*, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, status_message, error);
-}
-
-void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_status_message_cb)>(__FUNCTION__)(tox, function);
-}
-
-TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<TOX_USER_STATUS(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_status_cb)>(__FUNCTION__)(tox, function);
-}
-
-TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<TOX_CONNECTION(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_status_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_connection_status_cb)>(__FUNCTION__)(tox, function);
-}
-
-bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
-{
- return CreateFunction<bool(*)(const Tox*, uint32_t, TOX_ERR_FRIEND_QUERY*)>(__FUNCTION__)(tox, friend_number, error);
-}
-
-void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_typing_cb)>(__FUNCTION__)(tox, function);
-}
-
-/* */
-
-bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool is_typing, TOX_ERR_SET_TYPING *error)
-{
- return CreateFunction<bool(*)(Tox*, uint32_t, bool, TOX_ERR_SET_TYPING*)>(__FUNCTION__)(tox, friend_number, is_typing, error);
-}
-
-uint32_t tox_friend_send_message(Tox *tox, uint32_t friend_number, TOX_MESSAGE_TYPE type, const uint8_t *message, size_t length, TOX_ERR_FRIEND_SEND_MESSAGE *error)
-{
- return CreateFunction<uint32_t(*)(Tox*, uint32_t, TOX_MESSAGE_TYPE, const uint8_t*, size_t, TOX_ERR_FRIEND_SEND_MESSAGE*)>(__FUNCTION__)(tox, friend_number, type, message, length, error);
-}
-
-void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_read_receipt_cb)>(__FUNCTION__)(tox, function);
-}
-
-void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_request_cb)>(__FUNCTION__)(tox, function);
-}
-
-void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_friend_message_cb)>(__FUNCTION__)(tox, function);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_groupchats.cpp b/protocols/Tox/src/api_groupchats.cpp deleted file mode 100644 index 9919eee92c..0000000000 --- a/protocols/Tox/src/api_groupchats.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "stdafx.h"
-
-/* GROUP CHAT FUNCTIONS: WARNING Group chats will be rewritten so this might change */
-
-void tox_callback_group_invite(Tox *tox, void(*function)(Tox *tox, int32_t, uint8_t, const uint8_t *, uint16_t, void *), void *userdata)
-{
- CreateFunction<int(*)(Tox*, void(*)(Tox*, int32_t, uint8_t, const uint8_t*, uint16_t, void*), void*)>(__FUNCTION__)(tox, function, userdata);
-}
-
-/*void tox_callback_group_message(Tox *tox, void(*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), void *userdata)
-{
-}
-
-void tox_callback_group_action(Tox *tox, void(*function)(Tox *tox, int, int, const uint8_t *, uint16_t, void *), void *userdata)
-{
-}
-
-void tox_callback_group_title(Tox *tox, void(*function)(Tox *tox, int, int, const uint8_t *, uint8_t, void *), void *userdata)
-{
-}
-
-void tox_callback_group_namelist_change(Tox *tox, void(*function)(Tox *tox, int, int, uint8_t, void *), void *userdata)
-{
-}*/
-
-int tox_add_groupchat(Tox *tox)
-{
- return CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-int tox_del_groupchat(Tox *tox, int groupnumber)
-{
- return CreateFunction<int(*)(Tox*, int)>(__FUNCTION__)(tox, groupnumber);
-}
-
-/*int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name)
-{
-}
-
-int tox_group_peer_pubkey(const Tox *tox, int groupnumber, int peernumber, uint8_t *pk)
-{
-}*/
-
-int tox_invite_friend(Tox *tox, int32_t friendnumber, int groupnumber)
-{
- return CreateFunction<int(*)(Tox*, int32_t, int)>(__FUNCTION__)(tox, friendnumber, groupnumber);
-}
-
-int tox_join_groupchat(Tox *tox, int32_t friendnumber, const uint8_t *data, uint16_t length)
-{
- return CreateFunction<int(*)(Tox*, int32_t, const uint8_t*, uint32_t)>(__FUNCTION__)(tox, friendnumber, data, length);
-}
-
-/*int tox_group_message_send(Tox *tox, int groupnumber, const uint8_t *message, uint16_t length)
-{
-}
-
-int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint16_t length)
-{
-}
-
-int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t length)
-{
-}*/
-
-int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title, uint32_t max_length)
-{
- return CreateFunction<int(*)(Tox*, int, uint8_t*, uint32_t)>(__FUNCTION__)(tox, groupnumber, title, max_length);
-}
-
-/*unsigned int tox_group_peernumber_is_ours(const Tox *tox, int groupnumber, int peernumber)
-{
-}
-
-int tox_group_number_peers(const Tox *tox, int groupnumber)
-{
-}
-
-int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX_NAME_LENGTH], uint16_t lengths[], uint16_t length)
-{
-}*/
-
-uint32_t tox_count_chatlist(const Tox *tox)
-{
- return CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size)
-{
- return CreateFunction<int(*)(const Tox*, int32_t*, uint32_t)>(__FUNCTION__)(tox, out_list, list_size);
-}
-
-int tox_group_get_type(const Tox *tox, int groupnumber)
-{
- return CreateFunction<int(*)(const Tox*, int)>(__FUNCTION__)(tox, groupnumber);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/api_main.cpp b/protocols/Tox/src/api_main.cpp deleted file mode 100644 index 3d46576925..0000000000 --- a/protocols/Tox/src/api_main.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "stdafx.h"
-
-/* MAIN FUNCTIONS */
-
-bool tox_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch)
-{
- return CreateFunction<bool(*)(uint32_t, uint32_t, uint32_t)>(__FUNCTION__)(major, minor, patch);
-}
-
-struct Tox_Options *tox_options_new(TOX_ERR_OPTIONS_NEW *error)
-{
- return CreateFunction<struct Tox_Options*(*)(TOX_ERR_OPTIONS_NEW*)>(__FUNCTION__)(error);
-}
-
-void tox_options_default(struct Tox_Options *options)
-{
- CreateFunction<void(*)(struct Tox_Options*)>(__FUNCTION__)(options);
-}
-
-void tox_options_free(struct Tox_Options *options)
-{
- CreateFunction<void(*)(struct Tox_Options*)>(__FUNCTION__)(options);
-}
-
-Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error)
-{
- return CreateFunction<Tox*(*)(const struct Tox_Options*, TOX_ERR_NEW*)>(__FUNCTION__)(options, error);
-}
-
-void tox_kill(Tox *tox)
-{
- CreateFunction<int(*)(Tox*)>(__FUNCTION__)(tox);
-}
-
-void tox_self_get_address(const Tox *tox, uint8_t *address)
-{
- CreateFunction<void(*)(const Tox*, uint8_t*)>(__FUNCTION__)(tox, address);
-}
-
-bool tox_self_set_name(Tox *tox, const uint8_t *name, size_t length, TOX_ERR_SET_INFO *error)
-{
- return CreateFunction<bool(*)(Tox*, const uint8_t*, size_t, TOX_ERR_SET_INFO*)>(__FUNCTION__)(tox, name, length, error);
-}
-
-void tox_self_get_name(const Tox *tox, uint8_t *name)
-{
- CreateFunction<void(*)(const Tox*, uint8_t*)>(__FUNCTION__)(tox, name);
-}
-
-int tox_get_self_name_size(const Tox *tox)
-{
- return CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-size_t tox_self_get_status_message_size(const Tox *tox)
-{
- return CreateFunction<size_t(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-bool tox_self_set_status_message(Tox *tox, const uint8_t *status, size_t length, TOX_ERR_SET_INFO *error)
-{
- return CreateFunction<bool(*)(Tox*, const uint8_t*, size_t, TOX_ERR_SET_INFO*)>(__FUNCTION__)(tox, status, length, error);
-}
-
-void tox_self_set_status(Tox *tox, TOX_USER_STATUS user_status)
-{
- CreateFunction<void(*)(Tox*, TOX_USER_STATUS)>(__FUNCTION__)(tox, user_status);
-}
-
-void tox_self_get_status_message(const Tox *tox, uint8_t *status)
-{
- CreateFunction<void(*)(const Tox*, uint8_t*)>(__FUNCTION__)(tox, status);
-}
-
-int tox_get_self_status_message(const Tox *tox, uint8_t *buf, uint32_t maxlen)
-{
- return CreateFunction<int(*)(const Tox*, uint8_t*, uint32_t)>(__FUNCTION__)(tox, buf, maxlen);
-}
-
-uint8_t tox_get_self_user_status(const Tox *tox)
-{
- return CreateFunction<int(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-/* SAVING AND LOADING FUNCTIONS */
-
-size_t tox_get_savedata_size(const Tox *tox)
-{
- return CreateFunction<size_t(*)(const Tox*)>(__FUNCTION__)(tox);
-}
-
-void tox_get_savedata(const Tox *tox, uint8_t *data)
-{
- CreateFunction<int(*)(const Tox*, uint8_t*)>(__FUNCTION__)(tox, data);
-}
-
-int tox_load(Tox *tox, const uint8_t *data, uint32_t length)
-{
- return CreateFunction<int(*)(Tox*, const uint8_t*, uint32_t)>(__FUNCTION__)(tox, data, length);
-}
-
-/* ADVANCED FUNCTIONS (If you don't know what they do you can safely ignore them.) */
-/*
-uint32_t tox_get_nospam(const Tox *tox)
-{
-}
-
-void tox_set_nospam(Tox *tox, uint32_t nospam)
-{
-}
-
-void tox_get_keys(Tox *tox, uint8_t *public_key, uint8_t *secret_key)
-{
-}
-
-int tox_lossy_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, int(*packet_handler_callback)(Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object), void *object)
-{
-}
-
-int tox_send_lossy_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length)
-{
-}
-
-int tox_lossless_packet_registerhandler(Tox *tox, int32_t friendnumber, uint8_t byte, int(*packet_handler_callback)(Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t len, void *object), void *object)
-{
-}
-
-int tox_send_lossless_packet(const Tox *tox, int32_t friendnumber, const uint8_t *data, uint32_t length)
-{
-}
-*/
\ No newline at end of file diff --git a/protocols/Tox/src/api_transfer.cpp b/protocols/Tox/src/api_transfer.cpp deleted file mode 100644 index 446a2ccc80..0000000000 --- a/protocols/Tox/src/api_transfer.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "stdafx.h"
-
-/* FILE SENDING FUNCTIONS */
-
-bool tox_hash(uint8_t *hash, const uint8_t *data, size_t datalen)
-{
- return CreateFunction<bool(*)(uint8_t*, const uint8_t*, size_t)>(__FUNCTION__)(hash, data, datalen);
-}
-
-bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, TOX_ERR_FILE_GET *error)
-{
- return CreateFunction<bool(*)(const Tox*, uint32_t, uint32_t, uint8_t*, TOX_ERR_FILE_GET*)>(__FUNCTION__)(tox, friend_number, file_number, file_id, error);
-}
-
-uint32_t tox_file_send(Tox *tox, uint32_t friend_number, uint32_t kind, uint64_t file_size, const uint8_t *file_id, const uint8_t *filename, size_t filename_length, TOX_ERR_FILE_SEND *error)
-{
- return CreateFunction<uint32_t(*)(Tox*, uint32_t, uint32_t, uint64_t, const uint8_t*, const uint8_t*, size_t, TOX_ERR_FILE_SEND*)>(__FUNCTION__)(tox, friend_number, kind, file_size, file_id, filename, filename_length, error);
-}
-
-bool tox_file_send_chunk(Tox *tox, uint32_t friend_number, uint32_t file_number, uint64_t position, const uint8_t *data, size_t length, TOX_ERR_FILE_SEND_CHUNK *error)
-{
- return CreateFunction<bool(*)(Tox*, uint32_t, uint32_t, uint64_t, const uint8_t*, size_t, TOX_ERR_FILE_SEND_CHUNK*)>(__FUNCTION__)(tox, friend_number, file_number, position, data, length, error);
-}
-
-void tox_callback_file_chunk_request(Tox *tox, tox_file_chunk_request_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_file_chunk_request_cb)>(__FUNCTION__)(tox, function);
-}
-
-void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_file_recv_cb)>(__FUNCTION__)(tox, function);
-}
-
-void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_file_recv_control_cb)>(__FUNCTION__)(tox, function);
-}
-
-void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function)
-{
- CreateFunction<void(*)(Tox*, tox_file_recv_chunk_cb)>(__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)
-{
- return CreateFunction<bool(*)(Tox*, uint32_t, uint32_t, TOX_FILE_CONTROL, TOX_ERR_FILE_CONTROL*)>(__FUNCTION__)(tox, friend_number, file_number, control, error);
-}
-
-int tox_file_send_data(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length)
-{
- return CreateFunction<int(*)(Tox*, int32_t, uint8_t, const uint8_t*, uint16_t)>(__FUNCTION__)(tox, friendnumber, filenumber, data, length);
-}
-
-int tox_file_data_size(const Tox *tox, int32_t friendnumber)
-{
- return CreateFunction<int(*)(const Tox*, int32_t)>(__FUNCTION__)(tox, friendnumber);
-}
-
-uint64_t tox_file_data_remaining(const Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t send_receive)
-{
- return CreateFunction<int(*)(const Tox*, int32_t, uint8_t, uint8_t)>(__FUNCTION__)(tox, friendnumber, filenumber, send_receive);
-}
\ No newline at end of file diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index 90f3cf8efc..95c14d25f4 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -36,14 +36,10 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC extern "C" int __declspec(dllexport) Load(void) { - g_hToxLibrary = LoadLibrary(TOX_LIBRARY); - if (g_hToxLibrary == nullptr) - return 1; - if (!TOX_VERSION_IS_ABI_COMPATIBLE()) { wchar_t message[100]; - mir_snwprintf(message, TranslateT("Current version of plugin is support Tox API version %i.%i.%i which is incompatible with %s"), TOX_VERSION_MAJOR, TOX_VERSION_MINOR, TOX_VERSION_PATCH, TOX_LIBRARY); + mir_snwprintf(message, TranslateT("Current version of plugin is support Tox API version %i.%i.%i which is incompatible with %s"), TOX_VERSION_MAJOR, TOX_VERSION_MINOR, TOX_VERSION_PATCH, ""); CToxProto::ShowNotification(message, MB_ICONERROR); FreeLibrary(g_hToxLibrary); return 2; @@ -68,8 +64,5 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - if (g_hToxLibrary) - FreeLibrary(g_hToxLibrary); - return 0; }
\ No newline at end of file diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h index 78d9fad660..a036587e91 100644 --- a/protocols/Tox/src/resource.h +++ b/protocols/Tox/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by C:\Users\unsane\Projects\c++\miranda-ng\protocols\Tox\res\resource.rc
+// Used by D:\Projects\c++\miranda-ng\protocols\Tox\res\resource.rc
//
#define IDI_TOX 100
#define IDD_USER_INFO 101
@@ -12,28 +12,20 @@ #define IDD_ADDNODE 108
#define IDD_NODE_EDITOR 109
#define IDD_OPTIONS_MULTIMEDIA 110
-#define IDD_CALL 111
#define IDI_AUDIO_END 112
#define IDI_AUDIO_RING 113
#define IDI_AUDIO_START 114
#define IDI_AUDIO_CALL 115
-#define IDD_CHATROOM_INVITE 172
-#define IDC_CCLIST 173
#define IDC_EDITSCR 174
-#define IDD_CALL_RECEIVE 175
-#define IDD_CALL_SEND 176
#define IDC_TOXID 1001
#define IDC_CLIPBOARD 1002
#define IDC_SEARCH 1003
#define IDC_PASSWORD 1004
#define IDC_NAME 1005
-#define IDC_FROM 1005
#define IDC_GROUP 1006
-#define IDC_DATE 1006
#define IDC_ENABLE_UDP 1007
#define IDC_ENABLE_IPV6 1008
#define IDC_PROFILE_EXPORT 1009
-#define IDC_NAME2 1009
#define IDC_DNS_ID 1010
#define IDC_PROFILE_NEW 1011
#define IDC_SAVEPERMANENT 1012
@@ -55,11 +47,7 @@ #define IDC_MAXRECONNECTRETRIES 1026
#define IDC_MAXCONNECTRETRIESSPIN 1027
#define IDC_MAXRECONNECTRETRIESSPIN 1028
-#define IDC_DETAILS 1069
-#define IDC_USERMENU 1071
-#define IDC_HISTORY 1080
#define IDC_UPDATENODES 1081
-#define IDC_PROTOCOL 1580
// Next default values for new objects
//
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h index c403b787ce..b69c0fd629 100644 --- a/protocols/Tox/src/stdafx.h +++ b/protocols/Tox/src/stdafx.h @@ -45,7 +45,6 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0 #include <m_http.h>
#include <tox.h>
-#include <ToxAV.h>
#include <toxdns.h>
#include <toxencryptsave.h>
@@ -60,8 +59,6 @@ struct CToxProto; #include "tox_profile.h"
#include "tox_options.h"
#include "tox_transfer.h"
-#include "tox_multimedia.h"
-#include "tox_chatrooms.h"
#include "tox_proto.h"
#include "http_request.h"
@@ -107,13 +104,4 @@ enum TOX_DB_EVENT #define TOX_MAX_AVATAR_SIZE 1 << 16 // 2 ^ 16 bytes
-#define TOX_LIBRARY L"libtox.dll"
-extern HMODULE g_hToxLibrary;
-
-template<typename T>
-T CreateFunction(LPCSTR functionName)
-{
- return reinterpret_cast<T>(GetProcAddress(g_hToxLibrary, functionName));
-}
-
#endif //_COMMON_H_
\ No newline at end of file diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp deleted file mode 100644 index 5ca9895fcb..0000000000 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ /dev/null @@ -1,326 +0,0 @@ -#include "stdafx.h"
-/*
-MCONTACT CToxProto::GetChatRoom(int groupNumber)
-{
- MCONTACT hContact = NULL;
- for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
- {
- if (!isChatRoom(hContact))
- {
- continue;
- }
- int chatRoumNumber = getWord(hContact, TOX_SETTINGS_CHAT_ID, TOX_ERROR);
- if (groupNumber == chatRoumNumber)
- {
- break;
- }
- }
- return hContact;
-}
-
-MCONTACT CToxProto::AddChatRoom(int groupNumber)
-{
- MCONTACT hContact = GetChatRoom(groupNumber);
- if (!hContact)
- {
- hContact = db_add_contact();
- Proto_AddToContact(hContact, m_szModuleName);
-
- setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
-
- wchar_t title[MAX_PATH];
- mir_snwprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
- setWString(hContact, "Nick", title);
-
- DBVARIANT dbv;
- if (!db_get_s(NULL, "Chat", "AddToGroup", &dbv, DBVT_WCHAR))
- {
- db_set_ws(hContact, "CList", "Group", dbv.ptszVal);
- db_free(&dbv);
- }
-
- setByte(hContact, "ChatRoom", 1);
- }
- return hContact;
-}
-
-void CToxProto::LoadChatRoomList(void*)
-{
- uint32_t count = tox_count_chatlist(toxThread->Tox());
- if (count == 0)
- {
- debugLogA(__FUNCTION__": your group chat list is empty");
- return;
- }
- int32_t *groupChats = (int32_t*)mir_alloc(count * sizeof(int32_t));
- tox_get_chatlist(toxThread->Tox(), groupChats, count);
- for (uint32_t i = 0; i < count; i++)
- {
- int32_t groupNumber = groupChats[i];
- int type = tox_group_get_type(toxThread->Tox(), groupNumber);
- if (type == TOX_GROUPCHAT_TYPE_AV)
- {
- continue;
- }
- MCONTACT hContact = AddChatRoom(groupNumber);
- if (hContact)
- {
- uint8_t title[TOX_MAX_NAME_LENGTH] = { 0 };
- tox_group_get_title(toxThread->Tox(), groupNumber, title, TOX_MAX_NAME_LENGTH);
- setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)title)));
- }
- }
- mir_free(groupChats);
-}
-
-int CToxProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
-{
- GCHOOK *gch = (GCHOOK*)lParam;
- if (!gch)
- {
- return 1;
- }
- else
- return 0;
-}
-
-int CToxProto::OnGroupChatMenuHook(WPARAM, LPARAM)
-{
- return 0;
-}
-
-INT_PTR CToxProto::OnJoinChatRoom(WPARAM, LPARAM)
-{
- return 0;
-}
-
-INT_PTR CToxProto::OnLeaveChatRoom(WPARAM, LPARAM)
-{
- return 0;
-}
-
-INT_PTR CToxProto::OnCreateChatRoom(WPARAM, LPARAM)
-{
- ChatRoomInviteParam param = { this };
-
- if (DialogBoxParam(
- g_hInstance,
- MAKEINTRESOURCE(IDD_CHATROOM_INVITE),
- NULL,
- CToxProto::ChatRoomInviteProc,
- (LPARAM)¶m) == IDOK && !param.invitedContacts.empty())
- {
- int groupNumber = tox_add_groupchat(toxThread->Tox());
- if (groupNumber == TOX_ERROR)
- {
- return 1;
- }
- for (std::vector<MCONTACT>::iterator it = param.invitedContacts.begin(); it != param.invitedContacts.end(); ++it)
- {
- int32_t friendNumber = GetToxFriendNumber(*it);
- if (friendNumber == TOX_ERROR || tox_invite_friend(toxThread->Tox(), friendNumber, groupNumber) == TOX_ERROR)
- {
- return 1;
- }
- }
- MCONTACT hContact = AddChatRoom(groupNumber);
- if (!hContact)
- {
- return 1;
- }
- return 0;
- }
-
- return 1;
-}
-
-void CToxProto::InitGroupChatModule()
-{
- GCREGISTER gcr = {};
- gcr.iMaxText = 0;
- gcr.ptszDispName = this->m_tszUserName;
- gcr.pszModule = this->m_szModuleName;
- Chat_Register(&gcr);
-
- HookProtoEvent(ME_GC_EVENT, &CToxProto::OnGroupChatEventHook);
- HookProtoEvent(ME_GC_BUILDMENU, &CToxProto::OnGroupChatMenuHook);
-
- CreateProtoService(PS_JOINCHAT, &CToxProto::OnJoinChatRoom);
- CreateProtoService(PS_LEAVECHAT, &CToxProto::OnLeaveChatRoom);
-}
-
-void CToxProto::CloseAllChatChatSessions()
-{
- GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_ID;
- gci.pszModule = m_szModuleName;
-
- int count = pci->SM_GetCount(m_szModuleName);
- for (int i = 0; i < count; i++)
- {
- gci.iItem = i;
- if (!Chat_GetInfo(&gci))
- {
- Chat_Control(m_szModuleName, gci.pszID, SESSION_OFFLINE);
- Chat_Terminate(m_szModuleName, gci.pszID);
- }
- }
-}
-
-void CToxProto::OnGroupChatInvite(Tox *tox, int32_t friendNumber, uint8_t type, const uint8_t *data, uint16_t length, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- if (type == TOX_GROUPCHAT_TYPE_AV)
- {
- Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": audio chat is not supported yet");
- return;
- }
-
- int groupNumber = tox_join_groupchat(tox, friendNumber, data, length);
- if (groupNumber == TOX_ERROR)
- {
- Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to join to group chat");
- return;
- }
-
- MCONTACT hContact = proto->AddChatRoom(groupNumber);
- if (!hContact)
- {
- Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to create group chat");
- }
-}
-
-void CToxProto::ChatValidateContact(HWND hwndList, const std::vector<MCONTACT> &contacts, MCONTACT hContact)
-{
- bool isProtoContact = mir_strcmpi(GetContactProto(hContact), m_szModuleName) == 0;
- if (isProtoContact && !isChatRoom(hContact))
- {
- if (std::find(contacts.begin(), contacts.end(), hContact) != contacts.end())
- {
- SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hContact, 0);
- }
- return;
- }
- SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hContact, 0);
-}
-
-void CToxProto::ChatPrepare(HWND hwndList, const std::vector<MCONTACT> &contacts, MCONTACT hContact)
-{
- if (hContact == NULL)
- {
- hContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- }
- while (hContact)
- {
- if (IsHContactGroup(hContact))
- {
- MCONTACT hSubContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hContact);
- if (hSubContact)
- {
- ChatPrepare(hwndList, contacts, hSubContact);
- }
- }
- else if (IsHContactContact(hContact))
- {
- ChatValidateContact(hwndList, contacts, hContact);
- }
- hContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hContact);
- }
-}
-
-std::vector<MCONTACT> CToxProto::GetInvitedContacts(HWND hwndList, MCONTACT hContact)
-{
- std::vector<MCONTACT> contacts;
- if (hContact == NULL)
- {
- hContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
- }
- while (hContact)
- {
- if (IsHContactGroup(hContact))
- {
- MCONTACT hSubContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hContact);
- if (hSubContact)
- {
- std::vector<MCONTACT> subContacts = GetInvitedContacts(hwndList, hSubContact);
- contacts.insert(contacts.end(), subContacts.begin(), subContacts.end());
- }
- }
- else
- {
- int cheked = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hContact, 0);
- if (cheked)
- {
- contacts.push_back(hContact);
- }
- }
- hContact = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hContact);
- }
- return contacts;
-}
-
-INT_PTR CALLBACK CToxProto::ChatRoomInviteProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
- ChatRoomInviteParam *param = (ChatRoomInviteParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- param = (ChatRoomInviteParam*)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- {
- //HWND hwndClist = GetDlgItem(hwndDlg, IDC_CCLIST);
- //SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);
- }
- }
- break;
-
- case WM_CLOSE:
- EndDialog(hwndDlg, 0);
- break;
-
- case WM_NOTIFY:
- {
- NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam;
- if (nmc->hdr.idFrom == IDC_CCLIST)
- {
- switch (nmc->hdr.code)
- {
- case CLN_NEWCONTACT:
- if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
- {
- param->proto->ChatValidateContact(nmc->hdr.hwndFrom, param->invitedContacts, (UINT_PTR)nmc->hItem);
- }
- break;
-
- case CLN_LISTREBUILT:
- {
- param->proto->ChatPrepare(nmc->hdr.hwndFrom, param->invitedContacts);
- }
- break;
- }
- }
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDOK:
- //SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
- param->invitedContacts = param->proto->GetInvitedContacts(hwndList);
- EndDialog(hwndDlg, IDOK);
- break;
-
- case IDCANCEL:
- EndDialog(hwndDlg, IDCANCEL);
- break;
- }
- break;
- }
- return FALSE;
-}
-*/
\ No newline at end of file diff --git a/protocols/Tox/src/tox_chatrooms.h b/protocols/Tox/src/tox_chatrooms.h deleted file mode 100644 index 0f51a7391e..0000000000 --- a/protocols/Tox/src/tox_chatrooms.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _TOX_CHATROOMS_H_
-#define _TOX_CHATROOMS_H_
-
-struct ChatRoomInviteParam
-{
- CToxProto *proto;
- std::vector<MCONTACT> invitedContacts;
-};
-
-#endif //_TOX_CHATROOMS_H_
\ No newline at end of file diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index ab2e4ceb1d..735bcd0f3f 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -58,22 +58,6 @@ void CToxProto::InitToxCore(Tox *tox) tox_callback_file_recv(tox, OnFriendFile);
tox_callback_file_recv_chunk(tox, OnDataReceiving);
tox_callback_file_chunk_request(tox, OnFileSendData);
- // group chats
- //tox_callback_group_invite(tox, OnGroupChatInvite, this);
- // a/v
- //if (IsWinVerVistaPlus())
- //{
- // TOXAV_ERR_NEW avInitError;
- // toxThread->Tox()AV = toxav_new(toxThread->Tox(), &avInitError);
- // if (initError != TOX_ERR_NEW_OK)
- // {
- // toxav_callback_call(toxThread->Tox()AV, OnFriendCall, this);
- // toxav_callback_call_state(toxThread->Tox()AV, OnFriendCallState, this);
- // toxav_callback_bit_rate_status(toxThread->Tox()AV, OnBitrateChanged, this);
- // toxav_callback_audio_receive_frame(toxThread->Tox()AV, OnFriendAudioFrame, this);
- // //toxav_callback_video_receive_frame(toxThread->Tox()AV, , this);
- // }
- //}
uint8_t data[TOX_ADDRESS_SIZE];
tox_self_get_address(tox, data);
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index a96e7984d4..928685ebf3 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -3,10 +3,6 @@ IconItemT CToxProto::Icons[] =
{
{ LPGENW("Protocol icon"), "main", IDI_TOX },
- { LPGENW("Audio call"), "audio_call", IDI_AUDIO_CALL },
- { LPGENW("Audio ring"), "audio_ring", IDI_AUDIO_RING },
- { LPGENW("Audio start"), "audio_start", IDI_AUDIO_START },
- { LPGENW("Audio end"), "audio_end", IDI_AUDIO_END },
};
void CToxProto::InitIcons()
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index ed70ad8a7b..205fb11979 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -21,9 +21,6 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) 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], toxThread->ToxAV() && isContactOnline);
-
return 0;
}
@@ -59,15 +56,6 @@ void CToxProto::InitMenus() mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT);
ContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnGrantAuth>);
-
- // Start audio call
- SET_UID(mi, 0x116cb7fe, 0xce37, 0x429c, 0xb0, 0xa9, 0x7d, 0xe7, 0x70, 0x59, 0xc3, 0x95);
- mi.pszService = MODULE"/Audio/Call";
- mi.name.w = LPGENW("Call");
- mi.position = -2000020000 + CMI_AUDIO_CALL;
- mi.hIcolibItem = GetIconHandle(IDI_AUDIO_START);
- ContactMenuItems[CMI_AUDIO_CALL] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnSendAudioCall>);
}
int CToxProto::OnInitStatusMenu()
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp deleted file mode 100644 index c9c840274a..0000000000 --- a/protocols/Tox/src/tox_multimedia.cpp +++ /dev/null @@ -1,626 +0,0 @@ -#include "stdafx.h"
-
-CToxCallDlgBase::CToxCallDlgBase(CToxProto *proto, int idDialog, MCONTACT hContact) :
- CToxDlgBase(proto, idDialog, false), hContact(hContact)
-{}
-
-void CToxCallDlgBase::OnInitDialog()
-{
- WindowList_Add(m_proto->hAudioDialogs, m_hwnd, hContact);
-}
-
-void CToxCallDlgBase::OnClose()
-{
- WindowList_Remove(m_proto->hAudioDialogs, m_hwnd);
-}
-
-INT_PTR CToxCallDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
-{
- if (msg == WM_CALL_END)
- if (wParam == hContact)
- Close();
-
- return CToxDlgBase::DlgProc(msg, wParam, lParam);
-}
-
-void CToxCallDlgBase::SetIcon(const char *name)
-{
- char iconName[100];
- mir_snprintf(iconName, "%s_%s", MODULE, name);
- Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName));
-}
-
-void CToxCallDlgBase::SetTitle(const wchar_t *title)
-{
- SetWindowText(m_hwnd, title);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-
-CToxIncomingCall::CToxIncomingCall(CToxProto *proto, MCONTACT hContact) :
- CToxCallDlgBase(proto, IDD_CALL_RECEIVE, hContact),
- from(this, IDC_FROM), date(this, IDC_DATE),
- answer(this, IDOK), reject(this, IDCANCEL)
-{
- answer.OnClick = Callback(this, &CToxIncomingCall::OnAnswer);
-}
-
-void CToxIncomingCall::OnInitDialog()
-{
- CToxCallDlgBase::OnInitDialog();
- Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "IncomingCallWindow_");
-
- wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, 0);
- from.SetText(nick);
-
- wchar_t title[MAX_PATH];
- mir_snwprintf(title, TranslateT("Incoming call from %s"), nick);
- SetTitle(title);
- SetIcon("audio_ring");
-}
-
-void CToxIncomingCall::OnClose()
-{
- toxav_call_control(m_proto->toxThread->ToxAV(), m_proto->calls[hContact], TOXAV_CALL_CONTROL_CANCEL, nullptr);
- Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "IncomingCallWindow_");
- CToxCallDlgBase::OnClose();
-}
-
-void CToxIncomingCall::OnAnswer(CCtrlBase*)
-{
- /*ToxAvCSettings *cSettings = m_proto->GetAudioCSettings();
- if (cSettings == NULL)
- return;*/
-
- int friendNumber = m_proto->GetToxFriendNumber(hContact);
- if (friendNumber == UINT32_MAX) {
- //mir_free(cSettings);
- Close();
- return;
- }
-
- TOXAV_ERR_ANSWER error;
- if (!toxav_answer(m_proto->toxThread->ToxAV(), friendNumber, 0, 0, &error)) {
- m_proto->debugLogA(__FUNCTION__": failed to answer the call (%d)", error);
- Close();
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-
-CToxOutgoingCall::CToxOutgoingCall(CToxProto *proto, MCONTACT hContact) :
- CToxCallDlgBase(proto, IDD_CALL_SEND, hContact),
- to(this, IDC_FROM), call(this, IDOK), cancel(this, IDCANCEL)
-{
- m_autoClose = CLOSE_ON_CANCEL;
- call.OnClick = Callback(this, &CToxOutgoingCall::OnCall);
- cancel.OnClick = Callback(this, &CToxOutgoingCall::OnCancel);
-}
-
-void CToxOutgoingCall::OnInitDialog()
-{
- CToxCallDlgBase::OnInitDialog();
- Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "OutgoingCallWindow_");
-
- wchar_t *nick = pcli->pfnGetContactDisplayName(hContact, 0);
- to.SetText(nick);
-
- wchar_t title[MAX_PATH];
- mir_snwprintf(title, TranslateT("Outgoing call to %s"), nick);
- SetTitle(title);
- SetIcon("audio_end");
-}
-
-void CToxOutgoingCall::OnClose()
-{
- Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "OutgoingCallWindow_");
- CToxCallDlgBase::OnClose();
-}
-
-void CToxOutgoingCall::OnCall(CCtrlBase*)
-{
- /*ToxAvCSettings *cSettings = m_proto->GetAudioCSettings();
- if (cSettings == NULL)
- {
- Close();
- return;
- }*/
-
- int friendNumber = m_proto->GetToxFriendNumber(hContact);
- if (friendNumber == UINT32_MAX) {
- //mir_free(cSettings);
- Close();
- return;
- }
-
- TOXAV_ERR_CALL error;
- if (!toxav_call(m_proto->toxThread->ToxAV(), friendNumber, 0, 0, &error)) {
- //mir_free(cSettings);
- m_proto->debugLogA(__FUNCTION__": failed to make a call (%d)", error);
- return;
- }
- //mir_free(cSettings);
-
- char *message = nullptr;
- wchar_t title[MAX_PATH];
- if (GetWindowText(m_hwnd, title, _countof(title)))
- message = mir_utf8encodeW(title);
- else
- message = mir_utf8encode("Outgoing call");
- m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(nullptr), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
- call.Enable(FALSE);
- SetIcon("audio_call");
-}
-
-void CToxOutgoingCall::OnCancel(CCtrlBase*)
-{
- int friendNumber = m_proto->GetToxFriendNumber(hContact);
- if (friendNumber == UINT32_MAX) {
- //mir_free(cSettings);
- Close();
- return;
- }
-
- if (!call.Enabled())
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-
-CToxCallDialog::CToxCallDialog(CToxProto *proto, MCONTACT hContact) :
- CToxCallDlgBase(proto, IDD_CALL, hContact), end(this, IDCANCEL)
-{}
-
-void CToxCallDialog::OnInitDialog()
-{
- CToxCallDlgBase::OnInitDialog();
- Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CallWindow_");
- SetIcon("audio_start");
-}
-
-void CToxCallDialog::OnClose()
-{
- int friendNumber = m_proto->GetToxFriendNumber(hContact);
- if (friendNumber == UINT32_MAX) {
- //mir_free(cSettings);
- Close();
- return;
- }
-
- toxav_call_control(m_proto->toxThread->ToxAV(), friendNumber, TOXAV_CALL_CONTROL_CANCEL, nullptr);
- Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CallWindow_");
- CToxCallDlgBase::OnClose();
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-
-/*ToxAvCSettings* CToxProto::GetAudioCSettings()
-{
- ToxAvCSettings *cSettings = (ToxAvCSettings*)mir_calloc(sizeof(ToxAvCSettings));
- cSettings->audio_frame_duration = 20;
-
- DWORD deviceId = getDword("AudioInputDeviceID", WAVE_MAPPER);
-
- WAVEINCAPS wic;
- MMRESULT error = waveInGetDevCaps(deviceId, &wic, sizeof(WAVEINCAPS));
- if (error != MMSYSERR_NOERROR)
- {
- debugLogA(__FUNCTION__": failed to get input device caps (%d)", error);
-
- wchar_t errorMessage[MAX_PATH];
- waveInGetErrorText(error, errorMessage, _countof(errorMessage));
- CToxProto::ShowNotification(
- TranslateT("Unable to find input audio device"),
- errorMessage);
-
- mir_free(cSettings);
- return NULL;
- }
-
- cSettings->audio_channels = wic.wChannels;
- if ((wic.dwFormats & WAVE_FORMAT_48S16) || (wic.dwFormats & WAVE_FORMAT_48M16))
- {
- cSettings->audio_bitrate = 16 * 1000;
- cSettings->audio_sample_rate = 48000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_48S08) || (wic.dwFormats & WAVE_FORMAT_48M08))
- {
- cSettings->audio_bitrate = 8 * 1000;
- cSettings->audio_sample_rate = 48000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_4S16) || (wic.dwFormats & WAVE_FORMAT_4M16))
- {
- cSettings->audio_bitrate = 16 * 1000;
- cSettings->audio_sample_rate = 24000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_4S08) || (wic.dwFormats & WAVE_FORMAT_4S08))
- {
- cSettings->audio_bitrate = 8 * 1000;
- cSettings->audio_sample_rate = 24000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_2M16) || (wic.dwFormats & WAVE_FORMAT_2S16))
- {
- cSettings->audio_bitrate = 16 * 1000;
- cSettings->audio_sample_rate = 16000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_2M08) || (wic.dwFormats & WAVE_FORMAT_2S08))
- {
- cSettings->audio_bitrate = 8 * 1000;
- cSettings->audio_sample_rate = 16000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_1M16) || (wic.dwFormats & WAVE_FORMAT_1S16))
- {
- cSettings->audio_bitrate = 16 * 1000;
- cSettings->audio_sample_rate = 8000;
- }
- else if ((wic.dwFormats & WAVE_FORMAT_1M08) || (wic.dwFormats & WAVE_FORMAT_1S08))
- {
- cSettings->audio_bitrate = 8 * 1000;
- cSettings->audio_sample_rate = 8000;
- }
- else
- {
- debugLogA(__FUNCTION__": failed to parse input device caps");
- mir_free(cSettings);
- return NULL;
- }
-
- return cSettings;
-}*/
-
-/* INCOMING CALL */
-
-// incoming call flow
-void CToxProto::OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *arg)
-{
- /*CToxProto *proto = (CToxProto*)arg;
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- toxav_reject(proto->toxThread->Tox()AV, callId, NULL);
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- toxav_reject(proto->toxThread->Tox()AV, callId, NULL);
- return;
- }
-
- ToxAvCSettings cSettings;
- if (toxav_get_peer_csettings(proto->toxThread->Tox()AV, callId, 0, &cSettings) != av_ErrorNone)
- {
- proto->debugLogA(__FUNCTION__": failed to get codec settings");
- toxav_reject(proto->toxThread->Tox()AV, callId, NULL);
- return;
- }
-
- if (cSettings.call_type != av_TypeAudio)
- {
- proto->debugLogA(__FUNCTION__": video call is unsupported");
- toxav_reject(proto->toxThread->Tox()AV, callId, Translate("Video call is unsupported"));
- return;
- }
-
- wchar_t message[MAX_PATH];
- mir_snwprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
- T2Utf szMessage(message);
-
- PROTORECVEVENT recv = { 0 };
- recv.timestamp = time(NULL);
- recv.lParam = callId;
- recv.szMessage = szMessage;
- ProtoChainRecv(hContact, PSR_AUDIO, hContact, (LPARAM)&recv);*/
-}
-
-void CToxProto::OnFriendCallState(ToxAV *toxAV, uint32_t friend_number, uint32_t state, void *user_data)
-{}
-
-void CToxProto::OnBitrateChanged(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, void *arg)
-{}
-
-// save event to db
-INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam)
-{
- PROTORECVEVENT *pre = (PROTORECVEVENT*)lParam;
-
- calls[hContact] = pre->lParam;
-
- MEVENT hEvent = AddEventToDb(hContact, DB_EVENT_CALL, pre->timestamp, DBEF_UTF, (PBYTE)pre->szMessage, mir_strlen(pre->szMessage));
-
- CLISTEVENT cle = {};
- cle.flags = CLEF_UNICODE;
- cle.hContact = hContact;
- cle.hDbEvent = hEvent;
- cle.lParam = DB_EVENT_CALL;
- cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
-
- wchar_t szTooltip[MAX_PATH];
- mir_snwprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
- cle.szTooltip.w = szTooltip;
-
- char szService[MAX_PATH];
- mir_snprintf(szService, "%s/Audio/Ring", GetContactProto(hContact));
- cle.pszService = szService;
- pcli->pfnAddEvent(&cle);
-
- return hEvent;
-}
-
-// react on clist event click
-INT_PTR CToxProto::OnAudioRing(WPARAM, LPARAM lParam)
-{
- CLISTEVENT *cle = (CLISTEVENT*)lParam;
- CDlgBase *incomingCallDlg = new CToxIncomingCall(this, cle->hContact);
- incomingCallDlg->Show();
-
- return 0;
-}
-
-/*void CToxProto::OnAvCancel(void*, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- return;
- }
-
- CLISTEVENT *cle = NULL;
- while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, hContact, 0)))
- {
- if (cle->lParam == DB_EVENT_CALL)
- {
- CallService(MS_CLIST_REMOVEEVENT, hContact, cle->hDbEvent);
- break;
- }
- }
-
- char *message = mir_utf8encodeW(TranslateT("Call canceled"));
- proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
- WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
-}*/
-
-/* OUTGOING CALL */
-
-// outcoming audio flow
-INT_PTR CToxProto::OnSendAudioCall(WPARAM hContact, LPARAM)
-{
- CDlgBase *outgoingCallDlg = new CToxOutgoingCall(this, hContact);
- outgoingCallDlg->Show();
-
- return 0;
-}
-
-/*void CToxProto::OnAvReject(void*, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- return;
- }
-
- char *message = mir_utf8encodeW(TranslateT("Call canceled"));
- proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
- WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
-}
-
-void CToxProto::OnAvCallTimeout(void*, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- return;
- }
-
- char *message = mir_utf8encodeW(TranslateT("Call canceled"));
- proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
- WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
-}*/
-
-/* --- */
-
-static void CALLBACK WaveOutCallback(HWAVEOUT hOutDevice, UINT uMsg, DWORD/* dwInstance*/, DWORD dwParam1, DWORD/* dwParam2*/)
-{
- if (uMsg == WOM_DONE) {
- WAVEHDR *header = (WAVEHDR*)dwParam1;
- if (header->dwFlags & WHDR_PREPARED)
- waveOutUnprepareHeader(hOutDevice, header, sizeof(WAVEHDR));
- mir_free(header->lpData);
- mir_free(header);
- }
-}
-
-static void CALLBACK ToxShowDialogApcProc(void *arg)
-{
- CDlgBase *callDlg = (CDlgBase*)arg;
- callDlg->Show();
-}
-
-/*void CToxProto::OnAvStart(void*, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- ToxAvCSettings cSettings;
- int cSettingsError = toxav_get_peer_csettings(proto->toxThread->Tox()AV, callId, 0, &cSettings);
- if (cSettingsError != av_ErrorNone)
- {
- proto->debugLogA(__FUNCTION__": failed to get codec settings (%d)", cSettingsError);
- toxav_hangup(proto->toxThread->Tox()AV, callId);
- return;
- }
-
- if (cSettings.call_type != av_TypeAudio)
- {
- proto->debugLogA(__FUNCTION__": video call is unsupported");
- toxav_hangup(proto->toxThread->Tox()AV, callId);
- return;
- }
-
- WAVEFORMATEX wfx = { 0 };
- wfx.wFormatTag = WAVE_FORMAT_PCM;
- wfx.nChannels = cSettings.audio_channels;
- wfx.wBitsPerSample = cSettings.audio_bitrate / 1000;
- wfx.nSamplesPerSec = cSettings.audio_sample_rate;
- wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8;
- wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
-
- DWORD deviceId = proto->getDword("AudioOutputDeviceID", WAVE_MAPPER);
- MMRESULT error = waveOutOpen(&proto->hOutDevice, deviceId, &wfx, (DWORD_PTR)WaveOutCallback, (DWORD_PTR)proto, CALLBACK_FUNCTION);
- if (error != MMSYSERR_NOERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to open audio device (%d)", error);
- toxav_hangup(proto->toxThread->Tox()AV, callId);
-
- wchar_t errorMessage[MAX_PATH];
- waveInGetErrorText(error, errorMessage, _countof(errorMessage));
- CToxProto::ShowNotification(
- TranslateT("Unable to find output audio device"),
- errorMessage);
-
- return;
- }
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- toxav_hangup(proto->toxThread->Tox()AV, callId);
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- toxav_hangup(proto->toxThread->Tox()AV, callId);
- return;
- }
-
- if (toxav_prepare_transmission(proto->toxThread->Tox()AV, callId, false) == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to prepare audio transmition");
- toxav_hangup(proto->toxThread->Tox()AV, callId);
- return;
- }
-
- char *message = mir_utf8encodeW(TranslateT("Call started"));
- proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
-
- WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
- CDlgBase *callDlg = new CToxCallDialog(proto, hContact);
- CallFunctionAsync(ToxShowDialogApcProc, callDlg);
-}
-
-void CToxProto::OnAvEnd(void*, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- waveOutReset(proto->hOutDevice);
- waveOutClose(proto->hOutDevice);
- toxav_kill_transmission(proto->toxThread->Tox()AV, callId);
-
- int friendNumber = toxav_get_peer_id(proto->toxThread->Tox()AV, callId, 0);
- if (friendNumber == TOX_ERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to get friend number");
- return;
- }
-
- MCONTACT hContact = proto->GetContact(friendNumber);
- if (hContact == NULL)
- {
- proto->debugLogA(__FUNCTION__": failed to find contact");
- return;
- }
-
- char *message = mir_utf8encodeW(TranslateT("Call ended"));
- proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
-
- WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
-}
-
-void CToxProto::OnAvPeerTimeout(void *av, int32_t callId, void *arg)
-{
- CToxProto *proto = (CToxProto*)arg;
-
- ToxAvCallState callState = toxav_get_call_state(proto->toxThread->Tox()AV, callId);
- switch (callState)
- {
- case av_CallStarting:
- proto->OnAvCancel(av, callId, arg);
- return;
-
- case av_CallActive:
- proto->OnAvEnd(av, callId, arg);
- return;
-
- default:
- proto->debugLogA(__FUNCTION__": failed to handle callState");
- break;
- }
-}*/
-
-//////
-
-void CToxProto::OnFriendAudioFrame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, void *user_data)
-{
- /*CToxProto *proto = (CToxProto*)arg;
-
- WAVEHDR *header = (WAVEHDR*)mir_calloc(sizeof(WAVEHDR));
- header->dwBufferLength = size * sizeof(int16_t);
- header->lpData = (LPSTR)mir_alloc(header->dwBufferLength);
- memcpy(header->lpData, (PBYTE)PCM, header->dwBufferLength);
-
- MMRESULT error = waveOutPrepareHeader(proto->hOutDevice, header, sizeof(WAVEHDR));
- if (error != MMSYSERR_NOERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to prepare audio buffer (%d)", error);
- return;
- }
-
- error = waveOutWrite(proto->hOutDevice, header, sizeof(WAVEHDR));
- if (error != MMSYSERR_NOERROR)
- {
- proto->debugLogA(__FUNCTION__": failed to play audio samples (%d)", error);
- return;
- }*/
-}
diff --git a/protocols/Tox/src/tox_multimedia.h b/protocols/Tox/src/tox_multimedia.h deleted file mode 100644 index 922b9b406f..0000000000 --- a/protocols/Tox/src/tox_multimedia.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _TOX_MULTIMEDIA_H_
-#define _TOX_MULTIMEDIA_H_
-
-#define WM_CALL_END (WM_PROTO_LAST + 100)
-
-class CToxCallDlgBase : public CToxDlgBase
-{
-protected:
- MCONTACT hContact;
-
- virtual void OnInitDialog();
- virtual void OnClose();
-
- INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam);
-
- void SetIcon(const char *name);
- void SetTitle(const wchar_t *title);
-
-public:
- CToxCallDlgBase(CToxProto *proto, int idDialog, MCONTACT hContact);
-};
-
-///////////////////////////////////////////////
-
-class CToxIncomingCall : public CToxCallDlgBase
-{
-private:
- CCtrlLabel from;
- CCtrlLabel date;
-
- CCtrlButton answer;
- CCtrlButton reject;
-
-protected:
- void OnInitDialog();
- void OnClose();
-
- void OnAnswer(CCtrlBase*);
-
-public:
- CToxIncomingCall(CToxProto *proto, MCONTACT hContact);
-};
-
-///////////////////////////////////////////////
-
-class CToxOutgoingCall : public CToxCallDlgBase
-{
-private:
- CCtrlLabel to;
- CCtrlButton call;
- CCtrlButton cancel;
-
-protected:
- void OnInitDialog();
- void OnClose();
-
- void OnCall(CCtrlBase*);
- void OnCancel(CCtrlBase*);
-
-public:
- CToxOutgoingCall(CToxProto *proto, MCONTACT hContact);
-};
-
-///////////////////////////////////////////////
-
-struct ToxCallDialogParam
-{
- CToxProto *proto;
- MCONTACT hContact;
-};
-
-class CToxCallDialog : public CToxCallDlgBase
-{
-protected:
- CCtrlButton end;
-
- void OnInitDialog();
- void OnClose();
-
-public:
- CToxCallDialog(CToxProto *proto, MCONTACT hContact);
-};
-
-#endif //_TOX_MULTIMEDIA_H_
\ No newline at end of file diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 5b6d345c9c..7e4036f92a 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -18,10 +18,6 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) SetAllContactsStatus(ID_STATUS_OFFLINE);
- // services
- CreateProtoService(PSR_AUDIO, &CToxProto::OnRecvAudioCall);
- CreateProtoService("/Audio/Ring", &CToxProto::OnAudioRing);
-
// avatars
CreateProtoService(PS_GETAVATARCAPS, &CToxProto::GetAvatarCaps);
CreateProtoService(PS_GETAVATARINFO, &CToxProto::GetAvatarInfo);
@@ -31,15 +27,11 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName) // nick
CreateProtoService(PS_SETMYNICKNAME, &CToxProto::SetMyNickname);
- // hAudioDialogs = WindowList_Create();
-
hTerminateEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
}
CToxProto::~CToxProto()
{
- WindowList_Destroy(hAudioDialogs);
-
UninitNetlib();
}
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 810479ab30..4eb2bee085 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -6,10 +6,6 @@ struct CToxProto : public PROTO<CToxProto> friend CToxPasswordEditor;
friend CToxOptionsMain;
friend CToxOptionsNodeList;
- friend CToxCallDlgBase;
- friend CToxIncomingCall;
- friend CToxOutgoingCall;
- friend CToxCallDialog;
public:
//////////////////////////////////////////////////////////////////////////////////////
@@ -266,30 +262,6 @@ private: void OnGotFriendAvatarInfo(AvatarTransferParam *transfer);
void OnGotFriendAvatarData(AvatarTransferParam *transfer);
- // multimedia
- MWindowList hAudioDialogs;
- HWAVEOUT hOutDevice;
- std::map<MCONTACT, int32_t> calls;
-
- //ToxAvCSettings* GetAudioCSettings();
-
-
- INT_PTR __cdecl OnRecvAudioCall(WPARAM wParam, LPARAM lParam);
- INT_PTR __cdecl OnAudioRing(WPARAM wParam, LPARAM lParam);
-
- INT_PTR __cdecl OnSendAudioCall(WPARAM wParam, LPARAM);
-
- static void OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *arg);
- static void OnFriendCallState(ToxAV *toxAV, uint32_t friend_number, uint32_t state, void *user_data);
- static void OnBitrateChanged(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, void *arg);
- static void OnFriendAudioFrame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count, uint8_t channels, uint32_t sampling_rate, void *user_data);
-
- //static void OnAvEnd(void*, int32_t callId, void *arg);
- //static void OnAvReject(void*, int32_t callId, void *arg);
- //static void OnAvCancel(void*, int32_t callId, void *arg);
- //static void OnAvCallTimeout(void*, int32_t callId, void *arg);
- //static void OnAvPeerTimeout(void*, int32_t callId, void *arg);
-
// utils
static int MapStatus(int status);
static TOX_USER_STATUS MirandaToToxStatus(int status);
@@ -298,7 +270,6 @@ private: static wchar_t* ToxErrorToString(TOX_ERR_NEW error);
static wchar_t* ToxErrorToString(TOX_ERR_FRIEND_SEND_MESSAGE error);
-
static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
static bool IsFileExists(const wchar_t* path);
diff --git a/protocols/Tox/src/tox_thread.h b/protocols/Tox/src/tox_thread.h index ae0f4225f8..37372177dc 100644 --- a/protocols/Tox/src/tox_thread.h +++ b/protocols/Tox/src/tox_thread.h @@ -5,22 +5,16 @@ class CToxThread {
private:
Tox *tox;
- ToxAV *toxAV;
public:
CToxThread(Tox_Options *options, TOX_ERR_NEW *error = NULL)
- : tox(NULL), toxAV(NULL)
+ : tox(NULL)
{
tox = tox_new(options, error);
}
~CToxThread()
{
- if (toxAV)
- {
- toxav_kill(toxAV);
- toxAV = NULL;
- }
if (tox)
{
@@ -33,11 +27,6 @@ public: {
return tox;
}
-
- ToxAV* ToxAV()
- {
- return toxAV;
- }
};
#endif //_TOX_THREAD_H_
\ No newline at end of file diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h index a2ecd46c33..8db7b7f76a 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 26
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 0
#include <stdver.h>
|