diff options
Diffstat (limited to 'protocols/Tox/src')
39 files changed, 514 insertions, 2186 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 de5356a18a..99cd7607a1 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -4,7 +4,7 @@ int hLangpack; CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hInstance; -HMODULE g_hToxLibrary = nullptr; +HANDLE hProfileFolderPath; PLUGININFOEX pluginInfo = { @@ -13,7 +13,6 @@ PLUGININFOEX pluginInfo = PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), __DESCRIPTION, __AUTHOR, - __AUTHOREMAIL, __COPYRIGHT, __AUTHORWEB, UNICODE_AWARE, @@ -35,24 +34,26 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; -extern "C" int __declspec(dllexport) Load(void) +int OnModulesLoaded(WPARAM, LPARAM) { - g_hToxLibrary = LoadLibrary(TOX_LIBRARY); - if (g_hToxLibrary == nullptr) - return 1; + CToxProto::InitIcons(); + CToxProto::InitContactMenu(); + + hProfileFolderPath = FoldersRegisterCustomPathT("Tox", "ProfilesFolder", MIRANDA_USERDATAT, TranslateT("Profiles folder")); - 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); - CToxProto::ShowNotification(message, MB_ICONERROR); - FreeLibrary(g_hToxLibrary); - return 2; + if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { + CreateServiceFunction(MODULE "/ParseUri", CToxProto::ParseToxUri); + AssocMgr_AddNewUrlTypeT("tox:", TranslateT("Tox URI scheme"), g_hInstance, IDI_TOX, MODULE "/ParseUri", 0); } + return 0; +} + +extern "C" int __declspec(dllexport) Load(void) +{ + mir_getLP(&pluginInfo); pci = Chat_GetInterface(); pcli = Clist_GetInterface(); - mir_getLP(&pluginInfo); PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); @@ -62,15 +63,12 @@ extern "C" int __declspec(dllexport) Load(void) pd.fnUninit = (pfnUninitProto)CToxProto::UninitAccount; Proto_RegisterModule(&pd); - HookEvent(ME_SYSTEM_MODULESLOADED, &CToxProto::OnModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); return 0; } 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..4ea9d24d31 100644 --- a/protocols/Tox/src/resource.h +++ b/protocols/Tox/src/resource.h @@ -1,73 +1,61 @@ //{{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
-#define IDD_PASSWORD 102
+#define IDD_PASSWORD_ENTER 102
+#define IDD_PASSWORD_CHANGE 103
#define IDD_ACCOUNT_MANAGER 104
#define IDD_SEARCH 105
#define IDD_OPTIONS_MAIN 106
#define IDD_OPTIONS_NODES 107
+#define IDD_PASSWORD_CHANGE2 107
#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 IDD_PASSWORD_CREATE 110
#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_ENABLE_HOLEPUNCHING 1010
#define IDC_PROFILE_NEW 1011
-#define IDC_SAVEPERMANENT 1012
+#define IDC_ENABLE_LOCALDISCOVERY 1012
#define IDC_PROFILE_IMPORT 1013
#define IDC_SAVEPERMANENTLY 1014
#define IDC_NODESLIST 1015
#define IDC_ADDNODE 1016
#define IDC_IPV4 1017
#define IDC_IPV6 1018
+#define IDC_PASSWORD_REMOVE 1018
#define IDC_PORT 1019
+#define IDC_PASSWORD_CHANGE 1019
#define IDC_PKEY 1020
-#define IDC_COMBO_AUDIOINPUT 1021
-#define IDC_AUDIOINPUT 1021
-#define IDC_COMBO_AUDIOOUTPUT 1022
-#define IDC_AUDIOOUTPUT 1022
-#define IDC_AUDIOFILTER 1023
-#define IDC_COMBO_VIDEOINPUT 1024
+#define IDC_PASSWORD_CHANGE2 1020
+#define IDC_PASSWORD_CREATE 1020
+#define IDC_UPDATENODES 1021
#define IDC_MAXCONNECTRETRIES 1025
#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
+#define IDC_PASSWORD_NEW 1029
+#define IDC_PASSWORD_CONFIRM 1030
+#define IDC_PASSWORD_VALIDATION 1031
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 117
+#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1029
+#define _APS_NEXT_CONTROL_VALUE 1032
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h index c403b787ce..501eeb96cf 100644 --- a/protocols/Tox/src/stdafx.h +++ b/protocols/Tox/src/stdafx.h @@ -7,13 +7,6 @@ #include <commctrl.h>
#include <msapi/comptr.h>
-#include <mmreg.h>
-#include <MMDeviceAPI.h>
-
-#define EXIT_ON_ERROR(hres) if (FAILED(hres)) { goto Exit; }
-
-DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
-
#include <vector>
#include <regex>
#include <map>
@@ -30,7 +23,7 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0 #include <m_popup.h>
#include <m_icolib.h>
#include <m_userinfo.h>
-#include <m_addcontact.h>
+#include <m_contacts.h>
#include <m_message.h>
#include <m_avatars.h>
#include <m_skin.h>
@@ -45,7 +38,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 +52,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"
@@ -79,14 +69,13 @@ extern HINSTANCE g_hInstance; #define TOX_MAX_CONNECT_RETRIES 10
#define TOX_MAX_RECONNECT_RETRIES 10
-#define TOX_MAX_CALLS 1
-
#define TOX_INI_PATH "%miranda_path%\\Plugins\\tox.ini"
#define TOX_JSON_PATH "%miranda_userdata%\\tox.json"
#define TOX_SETTINGS_ID "ToxID"
#define TOX_SETTINGS_DNS "DnsID"
#define TOX_SETTINGS_CHAT_ID "ChatID"
+#define TOX_SETTINGS_PASSWORD "Password"
#define TOX_SETTINGS_GROUP "DefaultGroup"
#define TOX_SETTINGS_AVATAR_HASH "AvatarHash"
@@ -97,23 +86,9 @@ extern HINSTANCE g_hInstance; #define TOX_SETTINGS_NODE_PKEY TOX_SETTINGS_NODE_PREFIX"%d_PubKey"
#define TOX_SETTINGS_NODE_COUNT TOX_SETTINGS_NODE_PREFIX"Count"
-enum TOX_DB_EVENT
-{
- DB_EVENT_ACTION = 10001,
- DB_EVENT_CALL = 20001
-};
-
-#define PSR_AUDIO "/RecvAudio"
-
+#define DB_EVENT_ACTION 10001
#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));
-}
+extern HANDLE hProfileFolderPath;
#endif //_COMMON_H_
\ No newline at end of file diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index b1bfa58490..866a0dbd3b 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -36,19 +36,18 @@ int CToxProto::OnAccountLoaded(WPARAM, LPARAM) HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
InitCustomDbEvents();
-
return 0;
}
int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
{
- mir_cslock locker(profileLock);
+ mir_cslock lock(m_profileLock);
ptrW newPath(GetToxProfilePath());
wchar_t oldPath[MAX_PATH];
- mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), wszAccountName);
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%"), m_accountName);
_wrename(oldPath, newPath);
- wszAccountName = mir_wstrdup(m_tszUserName);
+ m_accountName = mir_wstrdup(m_tszUserName);
return 0;
}
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index 3e41c796f6..9d234b1dd8 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -77,7 +77,7 @@ void CToxProto::SetToxAvatar(const wchar_t* path) debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
+ uint32_t fileNumber = tox_file_send(m_toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
mir_free(data);
debugLogA(__FUNCTION__": failed to set new avatar (%d)", error);
@@ -173,7 +173,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, &error);
+ tox_file_send(m_toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to unset avatar (%d)", error);
return 0;
diff --git a/protocols/Tox/src/tox_bootstrap.cpp b/protocols/Tox/src/tox_bootstrap.cpp index 5f1ae93dc1..f144c0af16 100644 --- a/protocols/Tox/src/tox_bootstrap.cpp +++ b/protocols/Tox/src/tox_bootstrap.cpp @@ -2,7 +2,7 @@ void CToxProto::BootstrapUdpNode(Tox *tox, const char *address, int port, const char *hexKey) { - if (!toxThread) + if (!m_toxThread) return; if (address == nullptr || hexKey == nullptr) @@ -16,7 +16,7 @@ void CToxProto::BootstrapUdpNode(Tox *tox, const char *address, int port, const void CToxProto::BootstrapTcpRelay(Tox *tox, const char *address, int port, const char *hexKey) { - if (!toxThread) + if (!m_toxThread) return; if (address == nullptr || hexKey == nullptr) 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_connection.cpp b/protocols/Tox/src/tox_connection.cpp index 4c578a9696..80a84b74c0 100644 --- a/protocols/Tox/src/tox_connection.cpp +++ b/protocols/Tox/src/tox_connection.cpp @@ -2,7 +2,7 @@ bool CToxProto::IsOnline() { - return toxThread && m_iStatus >= ID_STATUS_ONLINE; + return m_toxThread && m_iStatus >= ID_STATUS_ONLINE; } void CToxProto::TryConnect(Tox *tox) @@ -99,7 +99,7 @@ void CToxProto::PollingThread(void*) } tox_options_free(options); - this->toxThread = &toxThread; + m_toxThread = &toxThread; InitToxCore(toxThread.Tox()); BootstrapNodes(toxThread.Tox()); ForkThread(&CToxProto::CheckingThread, toxThread.Tox()); @@ -113,7 +113,7 @@ void CToxProto::PollingThread(void*) } UninitToxCore(toxThread.Tox()); - this->toxThread = nullptr; + m_toxThread = nullptr; hPollingThread = nullptr; debugLogA(__FUNCTION__": leaving"); diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 3b76b37407..4e1ee4abf4 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -96,8 +96,8 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char if (mir_strlen(dnsId))
setWString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId)));
- if (wszGroup)
- db_set_ws(hContact, "CList", "Group", wszGroup);
+ if (m_defaultGroup)
+ db_set_ws(hContact, "CList", "Group", m_defaultGroup);
setByte(hContact, "Auth", 1);
setByte(hContact, "Grant", 1);
@@ -112,7 +112,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(toxThread->Tox(), pubKey.GetPubKey(), &error);
+ uint32_t friendNumber = tox_friend_by_public_key(m_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;
@@ -123,7 +123,7 @@ void CToxProto::LoadFriendList(Tox *tox) size_t count = tox_self_get_friend_list_size(tox);
if (count > 0) {
uint32_t *friends = (uint32_t*)mir_alloc(count * sizeof(uint32_t));
- tox_self_get_friend_list(toxThread->Tox(), friends);
+ tox_self_get_friend_list(m_toxThread->Tox(), friends);
for (size_t i = 0; i < count; i++) {
uint32_t friendNumber = friends[i];
@@ -139,13 +139,13 @@ void CToxProto::LoadFriendList(Tox *tox) TOX_ERR_FRIEND_QUERY getNameResult;
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
- if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &getNameResult))
+ if (tox_friend_get_name(m_toxThread->Tox(), friendNumber, nick, &getNameResult))
setWString(hContact, "Nick", ptrW(mir_utf8decodeW((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(toxThread->Tox(), friendNumber, &getLastOnlineResult);
+ uint64_t timestamp = tox_friend_get_last_online(m_toxThread->Tox(), friendNumber, &getLastOnlineResult);
if (getLastOnlineResult == TOX_ERR_FRIEND_GET_LAST_ONLINE_OK)
setDword(hContact, "LastEventDateTS", timestamp);
else
@@ -166,7 +166,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(toxThread->Tox(), address, (uint8_t*)reason, length, &addFriendResult);
+ int32_t friendNumber = tox_friend_add(m_toxThread->Tox(), address, (uint8_t*)reason, length, &addFriendResult);
if (addFriendResult != TOX_ERR_FRIEND_ADD_OK) {
debugLogA(__FUNCTION__": failed to request auth(%d)", addFriendResult);
return addFriendResult;
@@ -192,7 +192,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(toxThread->Tox(), pubKey, &error);
+ tox_friend_add_norequest(m_toxThread->Tox(), pubKey, &error);
if (error != TOX_ERR_FRIEND_ADD_OK) {
debugLogA(__FUNCTION__": failed to grant auth (%d)", error);
return error;
@@ -201,7 +201,7 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM) db_unset(hContact, "CList", "NotOnList");
delSetting(hContact, "Grant");
- SaveToxProfile(toxThread->Tox());
+ SaveToxProfile(m_toxThread->Tox());
return 0;
}
@@ -214,21 +214,12 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM) if (!isChatRoom(hContact)) {
int32_t friendNumber = GetToxFriendNumber(hContact);
TOX_ERR_FRIEND_DELETE error;
- if (!tox_friend_delete(toxThread->Tox(), friendNumber, &error)) {
+ if (!tox_friend_delete(m_toxThread->Tox(), friendNumber, &error)) {
debugLogA(__FUNCTION__": failed to delete friend (%d)", error);
return error;
}
- SaveToxProfile(toxThread->Tox());
+ SaveToxProfile(m_toxThread->Tox());
}
- /*else
- {
- OnLeaveChatRoom(hContact, 0);
- int groupNumber = 0; // ???
- if (groupNumber == TOX_ERROR || tox_del_groupchat(tox, groupNumber) == TOX_ERROR)
- {
- return 1;
- }
- }*/
return 0;
}
@@ -339,7 +330,7 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C proto->debugLogA(__FUNCTION__": send avatar to friend (%d)", friendNumber);
TOX_ERR_FILE_SEND error;
- uint32_t fileNumber = tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
+ uint32_t fileNumber = tox_file_send(proto->m_toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, length, hash, nullptr, 0, &error);
if (error != TOX_ERR_FILE_SEND_OK) {
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": failed to set new avatar");
fclose(hFile);
@@ -355,7 +346,7 @@ void CToxProto::OnConnectionStatusChanged(Tox *tox, uint32_t friendNumber, TOX_C }
else {
proto->debugLogA(__FUNCTION__": unset avatar for friend (%d)", friendNumber);
- tox_file_send(proto->toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, nullptr);
+ tox_file_send(proto->m_toxThread->Tox(), friendNumber, TOX_FILE_KIND_AVATAR, 0, nullptr, nullptr, 0, nullptr);
}
}
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index ab2e4ceb1d..de977b090f 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -10,7 +10,10 @@ Tox_Options* CToxProto::GetToxOptions() }
options->udp_enabled = getBool("EnableUDP", 1);
+ if (options->udp_enabled && getBool("EnableUDPHolePunching", 1))
+ options->hole_punching_enabled = true;
options->ipv6_enabled = getBool("EnableIPv6", 0);
+ options->local_discovery_enabled = getBool("EnableLocalDiscovery", 0);
if (m_hNetlibUser != nullptr) {
NETLIBUSERSETTINGS nlus = { sizeof(nlus) };
@@ -58,22 +61,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_events.cpp b/protocols/Tox/src/tox_events.cpp deleted file mode 100644 index f0afe46dbd..0000000000 --- a/protocols/Tox/src/tox_events.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "stdafx.h"
-
-int CToxProto::OnModulesLoaded(WPARAM, LPARAM)
-{
- CToxProto::InitIcons();
- CToxProto::InitMenus();
-
- hProfileFolderPath = FoldersRegisterCustomPathT("Tox", "ProfilesFolder", MIRANDA_USERDATAT, TranslateT("Profiles folder"));
-
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
- CreateServiceFunction(MODULE "/ParseUri", CToxProto::ParseToxUri);
- AssocMgr_AddNewUrlTypeT("tox:", TranslateT("Tox URI scheme"), g_hInstance, IDI_TOX, MODULE "/ParseUri", 0);
- }
-
- return 0;
-}
-
-void CToxProto::InitCustomDbEvents()
-{
- DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
- dbEventType.module = m_szModuleName;
- dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
-
- dbEventType.eventType = DB_EVENT_ACTION;
- dbEventType.descr = Translate("Action");
- DbEvent_RegisterType(&dbEventType);
-
- dbEventType.eventType = DB_EVENT_CALL;
- dbEventType.descr = Translate("Call");
- dbEventType.eventIcon = GetIconHandle(IDI_AUDIO_START);
- DbEvent_RegisterType(&dbEventType);
-}
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..34b3047fb4 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;
}
@@ -35,7 +32,7 @@ int CToxProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam) return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
}
-void CToxProto::InitMenus()
+void CToxProto::InitContactMenu()
{
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::PrebuildContactMenu);
@@ -59,19 +56,29 @@ void CToxProto::InitMenus() mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT);
ContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, GlobalService<&CToxProto::OnGrantAuth>);
+}
+
+int CToxProto::PrebuildStatusMenu(WPARAM, LPARAM)
+{
+ bool isOnline = IsOnline();
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD], isOnline);
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_CREATE], isOnline);
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_CHANGE], isOnline);
+ Menu_EnableItem(StatusMenuItems[SMI_PASSWORD_REMOVE], isOnline);
+
+ pass_ptrW password(getWStringA(TOX_SETTINGS_PASSWORD));
+ bool passwordExists = mir_wstrlen(password) > 0;
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_CREATE], !passwordExists);
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_CHANGE], passwordExists);
+ Menu_ShowItem(StatusMenuItems[SMI_PASSWORD_REMOVE], passwordExists);
- // 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>);
+ return 0;
}
int CToxProto::OnInitStatusMenu()
{
+ HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CToxProto::PrebuildStatusMenu);
+
CMenuItem mi;
mi.flags = CMIF_UNICODE;
mi.root = Menu_GetProtocolRoot(this);
@@ -81,16 +88,34 @@ int CToxProto::OnInitStatusMenu() CreateProtoService(mi.pszService, &CToxProto::OnCopyToxID);
mi.name.w = LPGENW("Copy Tox ID");
mi.position = SMI_POSITION + SMI_TOXID_COPY;
- Menu_AddProtoMenuItem(&mi, m_szModuleName);
-
- // Create group chat command
- /*
- mi.pszService = "/CreateChatRoom";
- CreateProtoService(mi.pszService, &CToxProto::OnCreateChatRoom);
- mi.name.w = LPGENW("Create group chat");
- mi.position = SMI_POSITION + SMI_GROUPCHAT_CREATE;
- mi.hIcolibItem = Skin_GetIconHandle("conference");
- HGENMENU hCreateChatRoom = Menu_AddProtoMenuItem(&mi, m_szModuleName);*/
+ StatusMenuItems[SMI_TOXID_COPY] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
+ // Password
+ mi.pszService = nullptr;
+ mi.name.w = LPGENW("Password");
+ StatusMenuItems[SMI_PASSWORD] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+ mi.root = StatusMenuItems[SMI_PASSWORD];
+
+ // Create password command
+ mi.pszService = "/CreatePassword";
+ CreateProtoService(mi.pszService, &CToxProto::OnCreatePassword);
+ mi.name.w = LPGENW("Create password");
+ mi.position = SMI_PASSWORD_CREATE;
+ StatusMenuItems[SMI_PASSWORD_CREATE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
+ // Change password command
+ mi.pszService = "/ChangePassword";
+ CreateProtoService(mi.pszService, &CToxProto::OnChangePassword);
+ mi.name.w = LPGENW("Change password");
+ mi.position = SMI_PASSWORD_CHANGE;
+ StatusMenuItems[SMI_PASSWORD_CHANGE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
+
+ // Remove password command
+ mi.pszService = "/RemovePassword";
+ CreateProtoService(mi.pszService, &CToxProto::OnRemovePassword);
+ mi.name.w = LPGENW("Remove password");
+ mi.position = SMI_PASSWORD_REMOVE;
+ StatusMenuItems[SMI_PASSWORD_REMOVE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
return 0;
}
diff --git a/protocols/Tox/src/tox_menus.h b/protocols/Tox/src/tox_menus.h index f4930265a2..85b9f55055 100644 --- a/protocols/Tox/src/tox_menus.h +++ b/protocols/Tox/src/tox_menus.h @@ -7,7 +7,6 @@ enum CMI_MENU_ITEMS {
CMI_AUTH_REQUEST,
CMI_AUTH_GRANT,
- CMI_AUDIO_CALL,
CMI_MAX // this item shall be the last one
};
@@ -16,7 +15,10 @@ enum CMI_MENU_ITEMS enum SMI_MENU_ITEMS
{
SMI_TOXID_COPY,
- SMI_GROUPCHAT_CREATE,
+ SMI_PASSWORD,
+ SMI_PASSWORD_CREATE,
+ SMI_PASSWORD_CHANGE,
+ SMI_PASSWORD_REMOVE,
SMI_MAX // this item shall be the last one
};
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 761294cbf7..0d7ad78b04 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -1,5 +1,16 @@ #include "stdafx.h"
+void CToxProto::InitCustomDbEvents()
+{
+ DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
+ dbEventType.module = m_szModuleName;
+ dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
+
+ dbEventType.eventType = DB_EVENT_ACTION;
+ dbEventType.descr = Translate("Action");
+ DbEvent_RegisterType(&dbEventType);
+}
+
/* MESSAGE RECEIVING */
// incoming message flow
@@ -58,7 +69,7 @@ void CToxProto::SendMessageAsync(void *arg) }
TOX_ERR_FRIEND_SEND_MESSAGE sendError;
- int messageNumber = tox_friend_send_message(toxThread->Tox(), friendNumber, type, msg, msgLen, &sendError);
+ int messageNumber = tox_friend_send_message(m_toxThread->Tox(), friendNumber, type, msg, msgLen, &sendError);
if (sendError != TOX_ERR_FRIEND_SEND_MESSAGE_OK) {
debugLogA(__FUNCTION__": failed to send message for %d (%d)", friendNumber, sendError);
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)param->hMessage, (LPARAM)_T2A(ToxErrorToString(sendError)));
@@ -138,7 +149,7 @@ void CToxProto::GetStatusMessageAsync(void* arg) }
TOX_ERR_FRIEND_QUERY error;
- size_t size = tox_friend_get_status_message_size(toxThread->Tox(), friendNumber, &error);
+ size_t size = tox_friend_get_status_message_size(m_toxThread->Tox(), friendNumber, &error);
if (error != TOX_ERR_FRIEND_QUERY::TOX_ERR_FRIEND_QUERY_OK) {
debugLogA(__FUNCTION__": failed to get status message for (%d) (%d)", friendNumber, error);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)hContact, 0);
@@ -146,7 +157,7 @@ void CToxProto::GetStatusMessageAsync(void* arg) }
ptrA statusMessage((char*)mir_calloc(size + 1));
- if (!tox_friend_get_status_message(toxThread->Tox(), friendNumber, (uint8_t*)(char*)statusMessage, &error)) {
+ if (!tox_friend_get_status_message(m_toxThread->Tox(), friendNumber, (uint8_t*)(char*)statusMessage, &error)) {
debugLogA(__FUNCTION__": failed to get status message for (%d) (%d)", friendNumber, error);
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)hContact, 0);
return;
@@ -164,7 +175,7 @@ int CToxProto::OnUserIsTyping(MCONTACT hContact, int type) return 0;
TOX_ERR_SET_TYPING error;
- if (!tox_self_set_typing(toxThread->Tox(), friendNumber, type == PROTOTYPE_SELFTYPING_ON, &error))
+ if (!tox_self_set_typing(m_toxThread->Tox(), friendNumber, type == PROTOTYPE_SELFTYPING_ON, &error))
debugLogA(__FUNCTION__": failed to send typing (%d)", error);
return 0;
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_options.cpp b/protocols/Tox/src/tox_options.cpp index bf4aeea940..71353d3263 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -5,23 +5,33 @@ CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog) m_toxAddress(this, IDC_TOXID), m_toxAddressCopy(this, IDC_CLIPBOARD),
m_profileCreate(this, IDC_PROFILE_NEW), m_profileImport(this, IDC_PROFILE_IMPORT),
m_profileExport(this, IDC_PROFILE_EXPORT), m_nickname(this, IDC_NAME),
- m_password(this, IDC_PASSWORD), m_group(this, IDC_GROUP),
- m_enableUdp(this, IDC_ENABLE_UDP), m_enableIPv6(this, IDC_ENABLE_IPV6),
+ m_passwordCreate(this, IDC_PASSWORD_CREATE), m_passwordChange(this, IDC_PASSWORD_CHANGE),
+ m_passwordRemove(this, IDC_PASSWORD_REMOVE), m_group(this, IDC_GROUP),
+ m_enableUdp(this, IDC_ENABLE_UDP), m_enableUdpHolePunching(this, IDC_ENABLE_HOLEPUNCHING),
+ m_enableIPv6(this, IDC_ENABLE_IPV6), m_enableLocalDiscovery(this, IDC_ENABLE_LOCALDISCOVERY),
m_maxConnectRetries(this, IDC_MAXCONNECTRETRIES), m_maxConnectRetriesSpin(this, IDC_MAXCONNECTRETRIESSPIN),
m_maxReconnectRetries(this, IDC_MAXRECONNECTRETRIES), m_maxReconnectRetriesSpin(this, IDC_MAXRECONNECTRETRIESSPIN)
{
CreateLink(m_toxAddress, TOX_SETTINGS_ID, L"");
CreateLink(m_nickname, "Nick", L"");
- CreateLink(m_password, "Password", L"");
CreateLink(m_group, TOX_SETTINGS_GROUP, L"Tox");
CreateLink(m_enableUdp, "EnableUDP", DBVT_BYTE, TRUE);
+ CreateLink(m_enableUdpHolePunching, "EnableUDPHolePunching", DBVT_BYTE, TRUE);
CreateLink(m_enableIPv6, "EnableIPv6", DBVT_BYTE, FALSE);
+ CreateLink(m_enableLocalDiscovery, "EnableLocalDiscovery", DBVT_BYTE, FALSE);
if (idDialog == IDD_OPTIONS_MAIN) {
CreateLink(m_maxConnectRetries, "MaxConnectRetries", DBVT_BYTE, TOX_MAX_CONNECT_RETRIES);
CreateLink(m_maxReconnectRetries, "MaxReconnectRetries", DBVT_BYTE, TOX_MAX_RECONNECT_RETRIES);
}
+ m_passwordCreate.OnClick = Callback(this, &CToxOptionsMain::PasswordCreate_OnClick);
+ m_passwordChange.OnClick = Callback(this, &CToxOptionsMain::PasswordChange_OnClick);
+ m_passwordRemove.OnClick = Callback(this, &CToxOptionsMain::PasswordRemove_OnClick);
+
+ m_enableUdp.OnChange = Callback(this, &CToxOptionsMain::EnableUdp_OnClick);
+ m_enableUdpHolePunching.Enable(m_enableUdp.GetState());
+
m_toxAddressCopy.OnClick = Callback(this, &CToxOptionsMain::ToxAddressCopy_OnClick);
m_profileCreate.OnClick = Callback(this, &CToxOptionsMain::ProfileCreate_OnClick);
m_profileImport.OnClick = Callback(this, &CToxOptionsMain::ProfileImport_OnClick);
@@ -36,17 +46,26 @@ void CToxOptionsMain::OnInitDialog() if (CToxProto::IsFileExists(profilePath)) {
m_toxAddress.Enable();
- ShowWindow(m_profileCreate.GetHwnd(), FALSE);
- ShowWindow(m_profileImport.GetHwnd(), FALSE);
+ m_profileCreate.Hide();
+ m_profileImport.Hide();
- ShowWindow(m_toxAddressCopy.GetHwnd(), TRUE);
- ShowWindow(m_profileExport.GetHwnd(), TRUE);
+ m_toxAddressCopy.Show();
+ m_profileExport.Show();
}
- SendMessage(m_toxAddress.GetHwnd(), EM_LIMITTEXT, TOX_ADDRESS_SIZE * 2, 0);
- SendMessage(m_nickname.GetHwnd(), EM_LIMITTEXT, TOX_MAX_NAME_LENGTH, 0);
- SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 32, 0);
- SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
+ m_passwordCreate.Enable(m_proto->IsOnline());
+ m_passwordChange.Enable(m_proto->IsOnline());
+ m_passwordRemove.Enable(m_proto->IsOnline());
+
+ pass_ptrW password(m_proto->getWStringA(TOX_SETTINGS_PASSWORD));
+ bool passwordExists = mir_wstrlen(password) > 0;
+ m_passwordCreate.Show(!passwordExists);
+ m_passwordChange.Show(passwordExists);
+ m_passwordRemove.Show(passwordExists);
+
+ m_toxAddress.SetMaxLength(TOX_ADDRESS_SIZE * 2);
+ m_nickname.SetMaxLength(TOX_MAX_NAME_LENGTH);
+ m_group.SetMaxLength(64);
m_maxConnectRetriesSpin.SetRange(255, 1);
m_maxConnectRetriesSpin.SetPosition(m_proto->getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES));
@@ -54,6 +73,31 @@ void CToxOptionsMain::OnInitDialog() m_maxReconnectRetriesSpin.SetPosition(m_proto->getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES));
}
+void CToxOptionsMain::PasswordCreate_OnClick(CCtrlButton*)
+{
+ m_proto->OnCreatePassword(0, 0);
+}
+
+void CToxOptionsMain::PasswordChange_OnClick(CCtrlButton*)
+{
+ m_proto->OnChangePassword(0, 0);
+}
+
+void CToxOptionsMain::PasswordRemove_OnClick(CCtrlButton*)
+{
+ m_proto->OnRemovePassword(0, 0);
+ pass_ptrW password(m_proto->getWStringA(TOX_SETTINGS_PASSWORD));
+ bool passwordExists = mir_wstrlen(password) > 0;
+ m_passwordCreate.Show(!passwordExists);
+ m_passwordChange.Show(passwordExists);
+ m_passwordRemove.Show(passwordExists);
+}
+
+void CToxOptionsMain::EnableUdp_OnClick(CCtrlBase*)
+{
+ m_enableUdpHolePunching.Enable(m_enableUdp.GetState());
+}
+
void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*)
{
char *toxAddress = m_toxAddress.GetTextA();
@@ -94,7 +138,6 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID)));
m_nickname.SetText(ptrW(m_proto->getWStringA("Nick")));
- m_password.SetText(ptrW(m_proto->getWStringA("Password")));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -189,8 +232,8 @@ void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*) void CToxOptionsMain::OnApply()
{
ptrW group(m_group.GetText());
- if (mir_wstrcmp(group, m_proto->wszGroup)) {
- m_proto->wszGroup = mir_wstrdup(group);
+ if (mir_wstrcmp(group, m_proto->m_defaultGroup)) {
+ m_proto->m_defaultGroup = mir_wstrdup(group);
Clist_GroupCreate(0, group);
}
@@ -198,111 +241,9 @@ void CToxOptionsMain::OnApply() CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_UNICODE, (LPARAM)ptrW(m_nickname.GetText()));
// todo: add checkbox
- m_proto->setWString("Password", pass_ptrT(m_password.GetText()));
-
- m_proto->SaveToxProfile(m_proto->toxThread->Tox());
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-
-CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto)
- : CToxDlgBase(proto, IDD_OPTIONS_MULTIMEDIA, false),
- m_audioInput(this, IDC_AUDIOINPUT),
- m_audioOutput(this, IDC_AUDIOOUTPUT)
-{}
-
-void CToxOptionsMultimedia::EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator *pEnumerator, EDataFlow dataFlow, const char* setting)
-{
- LPWSTR pwszDefID = nullptr;
- ptrW wszDefID(m_proto->getWStringA(setting));
- if (wszDefID != NULL) {
- size_t len = mir_wstrlen(wszDefID) + 1;
- pwszDefID = (LPWSTR)CoTaskMemAlloc(len * 2);
- mir_wstrncpy(pwszDefID, wszDefID, len);
- }
- else {
- CComPtr<IMMDevice> pDevice = nullptr;
- if (FAILED(pEnumerator->GetDefaultAudioEndpoint(dataFlow, eConsole, &pDevice))) return;
- if (FAILED(pDevice->GetId(&pwszDefID))) return;
- }
-
- CComPtr<IMMDeviceCollection> pDevices = nullptr;
- EXIT_ON_ERROR(pEnumerator->EnumAudioEndpoints(dataFlow, DEVICE_STATE_ACTIVE, &pDevices));
-
- UINT count;
- EXIT_ON_ERROR(pDevices->GetCount(&count));
-
- for (UINT i = 0; i < count; i++) {
- CComPtr<IMMDevice> pDevice = nullptr;
- EXIT_ON_ERROR(pDevices->Item(i, &pDevice));
-
- CComPtr<IPropertyStore> pProperties = nullptr;
- EXIT_ON_ERROR(pDevice->OpenPropertyStore(STGM_READ, &pProperties));
-
- PROPVARIANT varName;
- PropVariantInit(&varName);
- EXIT_ON_ERROR(pProperties->GetValue(PKEY_Device_FriendlyName, &varName));
-
- LPWSTR pwszID = nullptr;
- EXIT_ON_ERROR(pDevice->GetId(&pwszID));
- combo.InsertString(varName.pwszVal, i, (LPARAM)mir_wstrdup(pwszID));
- if (mir_wstrcmpi(pwszID, pwszDefID) == 0)
- combo.SetCurSel(i);
- CoTaskMemFree(pwszID);
-
- PropVariantClear(&varName);
- }
-
-Exit:
- CoTaskMemFree(pwszDefID);
-}
-
-void CToxOptionsMultimedia::OnInitDialog()
-{
- CToxDlgBase::OnInitDialog();
-
- CComPtr<IMMDeviceEnumerator> pEnumerator = nullptr;
- if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&pEnumerator)))
- return;
-
- EnumDevices(m_audioInput, pEnumerator, eCapture, "AudioInputDeviceID");
- EnumDevices(m_audioOutput, pEnumerator, eRender, "AudioOutputDeviceID");
-}
-
-void CToxOptionsMultimedia::OnApply()
-{
- int i = m_audioInput.GetCurSel();
- if (i == -1)
- m_proto->delSetting("AudioInputDeviceID");
- else {
- wchar_t* data = (wchar_t*)m_audioInput.GetItemData(i);
- m_proto->setWString("AudioInputDeviceID", data);
- }
-
- i = m_audioOutput.GetCurSel();
- if (i == -1)
- m_proto->delSetting("AudioOutputDeviceID");
- else {
- wchar_t* data = (wchar_t*)m_audioOutput.GetItemData(i);
- m_proto->setWString("AudioOutputDeviceID", data);
- }
-}
-
-void CToxOptionsMultimedia::OnDestroy()
-{
- int count = m_audioInput.GetCount();
- for (int i = 0; i < count; i++) {
- wchar_t* data = (wchar_t*)m_audioInput.GetItemData(i);
- mir_free(data);
-
- }
-
- count = m_audioOutput.GetCount();
- for (int i = 0; i < count; i++) {
- wchar_t* data = (wchar_t*)m_audioOutput.GetItemData(i);
- mir_free(data);
+ //m_proto->setWString("Password", pass_ptrW(m_password.GetText()));
+ m_proto->SaveToxProfile(m_proto->m_toxThread->Tox());
}
}
diff --git a/protocols/Tox/src/tox_options.h b/protocols/Tox/src/tox_options.h index f134e3d554..5a85edea61 100644 --- a/protocols/Tox/src/tox_options.h +++ b/protocols/Tox/src/tox_options.h @@ -13,11 +13,16 @@ private: CCtrlButton m_profileExport;
CCtrlEdit m_nickname;
- CCtrlEdit m_password;
CCtrlEdit m_group;
+ CCtrlButton m_passwordCreate;
+ CCtrlButton m_passwordChange;
+ CCtrlButton m_passwordRemove;
+
CCtrlCheck m_enableUdp;
+ CCtrlCheck m_enableUdpHolePunching;
CCtrlCheck m_enableIPv6;
+ CCtrlCheck m_enableLocalDiscovery;
CCtrlEdit m_maxConnectRetries;
CCtrlSpin m_maxConnectRetriesSpin;
@@ -27,6 +32,12 @@ private: protected:
void OnInitDialog();
+ void PasswordCreate_OnClick(CCtrlButton*);
+ void PasswordChange_OnClick(CCtrlButton*);
+ void PasswordRemove_OnClick(CCtrlButton*);
+
+ void EnableUdp_OnClick(CCtrlBase*);
+
void ToxAddressCopy_OnClick(CCtrlButton*);
void ProfileCreate_OnClick(CCtrlButton*);
void ProfileImport_OnClick(CCtrlButton*);
@@ -50,29 +61,6 @@ public: /////////////////////////////////////////////////////////////////////////////////
-class CToxOptionsMultimedia : public CToxDlgBase
-{
-private:
- typedef CToxDlgBase CSuper;
-
- CCtrlCombo m_audioInput;
- CCtrlCombo m_audioOutput;
-
-protected:
- void EnumDevices(CCtrlCombo &combo, IMMDeviceEnumerator *pEnumerator, EDataFlow dataFlow, const char* setting);
-
- void OnInitDialog();
- void OnApply();
- void OnDestroy();
-
-public:
- CToxOptionsMultimedia(CToxProto *proto);
-
- static CDlgBase *CreateOptionsPage(void *param) { return new CToxOptionsMultimedia((CToxProto*)param); }
-};
-
-/////////////////////////////////////////////////////////////////////////////////
-
class CToxNodeEditor : public CDlgBase
{
private:
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index a144eebee2..77f9285050 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -16,11 +16,25 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName) return profilePath;
}
+static INT_PTR CALLBACK EnterPassword(void *param)
+{
+ CToxProto *proto = (CToxProto*)param;
+
+ pass_ptrW password(proto->getWStringA(TOX_SETTINGS_PASSWORD));
+ if (mir_wstrlen(password) == 0) {
+ CToxEnterPasswordDlg passwordDlg(proto);
+ if (!passwordDlg.DoModal())
+ return 0;
+ password = proto->getWStringA(TOX_SETTINGS_PASSWORD);
+ }
+ return (INT_PTR)password.detach();
+}
+
bool CToxProto::LoadToxProfile(Tox_Options *options)
{
debugLogA(__FUNCTION__": loading tox profile");
- mir_cslock locker(profileLock);
+ mir_cslock lock(m_profileLock);
ptrW profilePath(GetToxProfilePath());
if (!IsFileExists(profilePath))
@@ -57,25 +71,25 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) fclose(profile);
if (tox_is_data_encrypted(data)) {
- pass_ptrA password(mir_utf8encodeW(pass_ptrT(getWStringA("Password"))));
- if (password == NULL || mir_strlen(password) == 0) {
- CToxPasswordEditor passwordEditor(this);
- if (!passwordEditor.DoModal()) {
- mir_free(data);
- return false;
- }
+ pass_ptrA password(mir_utf8encodeW(pass_ptrW((wchar_t*)CallFunctionSync(EnterPassword, this))));
+ if (mir_strlen(password) == 0) {
+ mir_free(data);
+ return false;
}
- uint8_t *encryptedData = (uint8_t*)mir_calloc(size - TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
+
+ size_t decryptedSize = size - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
+ uint8_t *decryptedData = (uint8_t*)mir_calloc(decryptedSize);
TOX_ERR_DECRYPTION coreDecryptError;
- if (!tox_pass_decrypt(data, size, (uint8_t*)(char*)password, mir_strlen(password), encryptedData, &coreDecryptError)) {
+ if (!tox_pass_decrypt(data, size, (uint8_t*)(char*)password, mir_strlen(password), decryptedData, &coreDecryptError)) {
ShowNotification(TranslateT("Unable to decrypt Tox profile"), MB_ICONERROR);
debugLogA(__FUNCTION__": failed to decrypt tox profile (%d)", coreDecryptError);
+ delSetting(TOX_SETTINGS_PASSWORD);
mir_free(data);
return false;
}
mir_free(data);
- data = encryptedData;
- size -= TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
+ data = decryptedData;
+ size = decryptedSize;
}
if (data) {
@@ -90,24 +104,29 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) void CToxProto::SaveToxProfile(Tox *tox)
{
- mir_cslock locker(profileLock);
+ mir_cslock lock(m_profileLock);
size_t size = tox_get_savedata_size(tox);
- uint8_t *data = (uint8_t*)mir_calloc(size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
+ uint8_t *data = (uint8_t*)mir_calloc(size);
tox_get_savedata(tox, data);
- /*pass_ptrA password(mir_utf8encodeW(pass_ptrT(getWStringA("Password"))));
+ pass_ptrA password(mir_utf8encodeW(pass_ptrW(getWStringA(TOX_SETTINGS_PASSWORD))));
if (password && mir_strlen(password))
{
TOX_ERR_ENCRYPTION coreEncryptError;
- if (!tox_pass_encrypt(data, size, (uint8_t*)(char*)password, mir_strlen(password), data, &coreEncryptError))
+ size_t encryptedSize = size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
+ uint8_t *encryptedData = (uint8_t*)mir_calloc(encryptedSize);
+ if (!tox_pass_encrypt(data, size, (uint8_t*)(char*)password, mir_strlen(password), encryptedData, &coreEncryptError))
{
debugLogA(__FUNCTION__": failed to encrypt tox profile");
mir_free(data);
+ mir_free(encryptedData);
return;
}
- size += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
- }*/
+ mir_free(data);
+ data = encryptedData;
+ size = encryptedSize;
+ }
ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
@@ -125,6 +144,13 @@ void CToxProto::SaveToxProfile(Tox *tox) mir_free(data);
}
+int CToxProto::OnDeleteToxProfile()
+{
+ ptrW profilePath(GetToxProfilePath());
+ _wunlink(profilePath);
+ return 0;
+}
+
INT_PTR CToxProto::OnCopyToxID(WPARAM, LPARAM)
{
ptrA address(getStringA(TOX_SETTINGS_ID));
@@ -140,18 +166,169 @@ INT_PTR CToxProto::OnCopyToxID(WPARAM, LPARAM) return 0;
}
-CToxPasswordEditor::CToxPasswordEditor(CToxProto *proto) :
- CToxDlgBase(proto, IDD_PASSWORD, false), ok(this, IDOK),
- password(this, IDC_PASSWORD), savePermanently(this, IDC_SAVEPERMANENTLY)
+INT_PTR CToxProto::OnCreatePassword(WPARAM, LPARAM)
+{
+ pass_ptrW password(getWStringA(TOX_SETTINGS_PASSWORD));
+ CToxCreatePasswordDlg passwordDlg(this);
+ passwordDlg.DoModal();
+ return 0;
+}
+
+INT_PTR CToxProto::OnChangePassword(WPARAM, LPARAM)
+{
+ CToxChangePasswordDlg passwordDlg(this);
+ passwordDlg.DoModal();
+ return 0;
+}
+
+INT_PTR CToxProto::OnRemovePassword(WPARAM, LPARAM)
+{
+ const wchar_t *message = TranslateT("Removing the password will lead to decryption of the profile.\r\nAre you sure to remove password?");
+ int result = MessageBox(NULL, message, TranslateT("Remove password"), MB_YESNO | MB_ICONQUESTION);
+ if (result == IDYES) {
+ delSetting(TOX_SETTINGS_PASSWORD);
+ SaveToxProfile(m_toxThread->Tox());
+ }
+ return 0;
+}
+
+/* ENTER PASSWORD */
+
+CToxEnterPasswordDlg::CToxEnterPasswordDlg(CToxProto *proto)
+ : CToxDlgBase(proto, IDD_PASSWORD_ENTER, false),
+ m_password(this, IDC_PASSWORD),
+ m_ok(this, IDOK)
+{
+ m_password.OnChange = Callback(this, &CToxEnterPasswordDlg::Password_OnChange);
+ m_ok.OnClick = Callback(this, &CToxEnterPasswordDlg::OnOk);
+}
+
+void CToxEnterPasswordDlg::OnInitDialog()
+{
+ m_ok.Disable();
+}
+
+void CToxEnterPasswordDlg::Password_OnChange(CCtrlBase*)
+{
+ m_ok.Enable(GetWindowTextLength(m_password.GetHwnd()) != 0);
+}
+
+void CToxEnterPasswordDlg::OnOk(CCtrlButton*)
{
- ok.OnClick = Callback(this, &CToxPasswordEditor::OnOk);
+ m_proto->setWString(TOX_SETTINGS_PASSWORD, pass_ptrW(m_password.GetText()));
+ EndDialog(m_hwnd, 1);
+}
+
+/* CREATE PASSWORD */
+
+CToxCreatePasswordDlg::CToxCreatePasswordDlg(CToxProto *proto)
+ : CToxDlgBase(proto, IDD_PASSWORD_CREATE, false),
+ m_newPassword(this, IDC_PASSWORD_NEW),
+ m_confirmPassword(this, IDC_PASSWORD_CONFIRM),
+ m_passwordValidation(this, IDC_PASSWORD_VALIDATION),
+ m_ok(this, IDOK)
+{
+ m_newPassword.OnChange = Callback(this, &CToxCreatePasswordDlg::Password_OnChange);
+ m_confirmPassword.OnChange = Callback(this, &CToxCreatePasswordDlg::Password_OnChange);
+ m_ok.OnClick = Callback(this, &CToxCreatePasswordDlg::OnOk);
}
-void CToxPasswordEditor::OnOk(CCtrlButton*)
+void CToxCreatePasswordDlg::OnInitDialog()
{
- pass_ptrT tszPassword(password.GetText());
- if (savePermanently.Enabled())
- m_proto->setWString("Password", tszPassword);
+ LOGFONT lf;
+ HFONT hFont = (HFONT)m_passwordValidation.SendMsg(WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ m_passwordValidation.SendMsg(WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
+
+ m_ok.Disable();
+}
+
+void CToxCreatePasswordDlg::Password_OnChange(CCtrlBase*)
+{
+ pass_ptrW newPassword(m_newPassword.GetText());
+ if (mir_wstrlen(newPassword) == 0) {
+ m_ok.Disable();
+ m_passwordValidation.SetText(TranslateT("New password is empty"));
+ return;
+ }
+
+ pass_ptrW confirmPassword(m_confirmPassword.GetText());
+ if (mir_wstrcmp(newPassword, confirmPassword) != 0) {
+ m_ok.Disable();
+ m_passwordValidation.SetText(TranslateT("New password is not equal to confirmation"));
+ return;
+ }
+
+ m_passwordValidation.SetText(L"");
+ m_ok.Enable();
+}
+
+void CToxCreatePasswordDlg::OnOk(CCtrlButton*)
+{
+ m_proto->setWString(TOX_SETTINGS_PASSWORD, pass_ptrW(m_newPassword.GetText()));
+ m_proto->SaveToxProfile(m_proto->m_toxThread->Tox());
+ EndDialog(m_hwnd, 1);
+}
+
+/* CHANGE PASSWORD */
+CToxChangePasswordDlg::CToxChangePasswordDlg(CToxProto *proto)
+ : CToxDlgBase(proto, IDD_PASSWORD_CHANGE, false),
+ m_oldPassword(this, IDC_PASSWORD),
+ m_newPassword(this, IDC_PASSWORD_NEW),
+ m_confirmPassword(this, IDC_PASSWORD_CONFIRM),
+ m_passwordValidation(this, IDC_PASSWORD_VALIDATION),
+ m_ok(this, IDOK)
+{
+ m_oldPassword.OnChange = Callback(this, &CToxChangePasswordDlg::Password_OnChange);
+ m_newPassword.OnChange = Callback(this, &CToxChangePasswordDlg::Password_OnChange);
+ m_confirmPassword.OnChange = Callback(this, &CToxChangePasswordDlg::Password_OnChange);
+ m_ok.OnClick = Callback(this, &CToxChangePasswordDlg::OnOk);
+}
+
+void CToxChangePasswordDlg::OnInitDialog()
+{
+ LOGFONT lf;
+ HFONT hFont = (HFONT)m_passwordValidation.SendMsg(WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ m_passwordValidation.SendMsg(WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
+
+ m_ok.Disable();
+}
+
+void CToxChangePasswordDlg::Password_OnChange(CCtrlBase*)
+{
+ pass_ptrW dbPassword(m_proto->getWStringA(TOX_SETTINGS_PASSWORD));
+ pass_ptrW oldPassword(m_oldPassword.GetText());
+ if (mir_wstrlen(dbPassword) > 0 && mir_wstrcmp(dbPassword, oldPassword) != 0) {
+ m_ok.Disable();
+ m_passwordValidation.SetText(TranslateT("Old password is not valid"));
+ return;
+ }
+
+ pass_ptrW newPassword(m_newPassword.GetText());
+ if (mir_wstrlen(newPassword) == 0) {
+ m_ok.Disable();
+ m_passwordValidation.SetText(TranslateT("New password is empty"));
+ return;
+ }
+
+ pass_ptrW confirmPassword(m_confirmPassword.GetText());
+ if (mir_wstrcmp(newPassword, confirmPassword) != 0) {
+ m_ok.Disable();
+ m_passwordValidation.SetText(TranslateT("New password is not equal to confirmation"));
+ return;
+ }
+
+ m_passwordValidation.SetText(L"");
+ m_ok.Enable();
+}
+
+void CToxChangePasswordDlg::OnOk(CCtrlButton*)
+{
+ m_proto->setWString(TOX_SETTINGS_PASSWORD, pass_ptrW(m_newPassword.GetText()));
+ m_proto->SaveToxProfile(m_proto->m_toxThread->Tox());
EndDialog(m_hwnd, 1);
}
diff --git a/protocols/Tox/src/tox_profile.h b/protocols/Tox/src/tox_profile.h index 796f264d5b..4aedae071f 100644 --- a/protocols/Tox/src/tox_profile.h +++ b/protocols/Tox/src/tox_profile.h @@ -1,19 +1,66 @@ #ifndef _TOX_PROFILE_H_
#define _TOX_PROFILE_H_
-class CToxPasswordEditor : public CToxDlgBase
+/* ENTER PASSWORD */
+
+class CToxEnterPasswordDlg : public CToxDlgBase
{
private:
- CCtrlEdit password;
- CCtrlCheck savePermanently;
+ CCtrlEdit m_password;
+
+ CCtrlButton m_ok;
+
+protected:
+ void OnInitDialog();
+ void Password_OnChange(CCtrlBase*);
+ void OnOk(CCtrlButton*);
+
+public:
+ CToxEnterPasswordDlg(CToxProto *proto);
+};
+
+/* CREATE PASSWORD */
+
+class CToxCreatePasswordDlg : public CToxDlgBase
+{
+private:
+ CCtrlEdit m_newPassword;
+ CCtrlEdit m_confirmPassword;
+
+ CCtrlBase m_passwordValidation;
+
+ CCtrlButton m_ok;
+
+protected:
+ void OnInitDialog();
+ void Password_OnChange(CCtrlBase*);
+ void OnOk(CCtrlButton*);
+
+public:
+ CToxCreatePasswordDlg(CToxProto *proto);
+};
+
+/* CHANGE PASSWORD */
+
+class CToxChangePasswordDlg : public CToxDlgBase
+{
+private:
+ CCtrlEdit m_oldPassword;
+
+ CCtrlEdit m_newPassword;
+ CCtrlEdit m_confirmPassword;
- CCtrlButton ok;
+ CCtrlBase m_passwordValidation;
+
+ CCtrlButton m_ok;
protected:
+ void OnInitDialog();
+ void Password_OnChange(CCtrlBase*);
void OnOk(CCtrlButton*);
public:
- CToxPasswordEditor(CToxProto *proto);
+ CToxChangePasswordDlg(CToxProto *proto);
};
#endif //_TOX_PROFILE_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..60864594e7 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -2,26 +2,22 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
: PROTO<CToxProto>(protoName, userName),
- toxThread(nullptr), isTerminated(false),
+ m_toxThread(nullptr), isTerminated(false),
hCheckingThread(nullptr), hPollingThread(nullptr),
hMessageProcess(1)
{
InitNetlib();
- wszAccountName = mir_wstrdup(userName);
- wszGroup = getWStringA(TOX_SETTINGS_GROUP);
- if (wszGroup == nullptr)
- wszGroup = mir_wstrdup(L"Tox");
- Clist_GroupCreate(0, wszGroup);
+ m_accountName = mir_wstrdup(userName);
+ m_defaultGroup = getWStringA(TOX_SETTINGS_GROUP);
+ if (m_defaultGroup == nullptr)
+ m_defaultGroup = mir_wstrdup(L"Tox");
+ Clist_GroupCreate(0, m_defaultGroup);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
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();
}
@@ -151,15 +143,13 @@ int CToxProto::SetStatus(int iNewStatus) int old_status = m_iStatus;
m_iDesiredStatus = iNewStatus;
+ // logout
if (iNewStatus == ID_STATUS_OFFLINE) {
- // logout
isTerminated = true;
SetEvent(hTerminateEvent);
- if (!Miranda_IsTerminated()) {
+ if (!Miranda_IsTerminated())
SetAllContactsStatus(ID_STATUS_OFFLINE);
- //CloseAllChatChatSessions();
- }
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
@@ -169,19 +159,20 @@ int CToxProto::SetStatus(int iNewStatus) if (old_status >= ID_STATUS_CONNECTING && old_status < ID_STATUS_OFFLINE)
return 0;
+ // login
if (old_status == ID_STATUS_OFFLINE && !IsOnline()) {
- // login
isTerminated = false;
m_iStatus = ID_STATUS_CONNECTING;
hPollingThread = ForkThreadEx(&CToxProto::PollingThread, nullptr, nullptr);
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ return 0;
}
- else {
- // set tox status
- m_iStatus = iNewStatus;
- tox_self_set_status(toxThread->Tox(), MirandaToToxStatus(iNewStatus));
- }
-
+
+ // change status
+ m_iStatus = iNewStatus;
+ tox_self_set_status(m_toxThread->Tox(), MirandaToToxStatus(iNewStatus));
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+
return 0;
}
@@ -200,7 +191,7 @@ int CToxProto::SetAwayMsg(int, const wchar_t *msg) if (IsOnline()) {
T2Utf statusMessage(msg);
TOX_ERR_SET_INFO error;
- if (!tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, min(TOX_MAX_STATUS_MESSAGE_LENGTH, mir_strlen(statusMessage)), &error))
+ if (!tox_self_set_status_message(m_toxThread->Tox(), (uint8_t*)(char*)statusMessage, min(TOX_MAX_STATUS_MESSAGE_LENGTH, mir_strlen(statusMessage)), &error))
debugLogA(__FUNCTION__": failed to set status status message %s (%d)", msg, error);
}
@@ -228,9 +219,7 @@ int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) return OnInitStatusMenu();
case EV_PROTO_ONERASE:
- ptrW profilePath(GetToxProfilePath());
- _wunlink(profilePath);
- break;
+ return OnDeleteToxProfile();
}
return 1;
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 810479ab30..24896724d7 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -3,13 +3,11 @@ struct CToxProto : public PROTO<CToxProto>
{
- friend CToxPasswordEditor;
+ friend CToxEnterPasswordDlg;
+ friend CToxCreatePasswordDlg;
+ friend CToxChangePasswordDlg;
friend CToxOptionsMain;
friend CToxOptionsNodeList;
- friend CToxCallDlgBase;
- friend CToxIncomingCall;
- friend CToxOutgoingCall;
- friend CToxCallDialog;
public:
//////////////////////////////////////////////////////////////////////////////////////
@@ -58,20 +56,18 @@ public: static void InitIcons();
// menus
- static void InitMenus();
-
- // events
- void InitCustomDbEvents();
-
- static int OnModulesLoaded(WPARAM, LPARAM);
+ static void InitContactMenu();
// utils
static void ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL);
+ static INT_PTR ParseToxUri(WPARAM, LPARAM lParam);
+
private:
- CToxThread *toxThread;
- mir_cs profileLock;
- ptrW wszAccountName, wszGroup;
+ CToxThread *m_toxThread;
+ mir_cs m_profileLock;
+ ptrW m_accountName;
+ ptrW m_defaultGroup;
CTransferList transfers;
ULONG hMessageProcess;
@@ -90,8 +86,12 @@ private: bool LoadToxProfile(Tox_Options *options);
void SaveToxProfile(Tox *tox);
+ int OnDeleteToxProfile();
INT_PTR __cdecl OnCopyToxID(WPARAM, LPARAM);
+ INT_PTR __cdecl OnCreatePassword(WPARAM, LPARAM);
+ INT_PTR __cdecl OnChangePassword(WPARAM, LPARAM);
+ INT_PTR __cdecl OnRemovePassword(WPARAM, LPARAM);
// tox core
Tox_Options* GetToxOptions();
@@ -141,7 +141,9 @@ private: int OnPrebuildContactMenu(WPARAM hContact, LPARAM);
static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam);
+ HGENMENU StatusMenuItems[SMI_MAX];
int OnInitStatusMenu();
+ int __cdecl PrebuildStatusMenu(WPARAM, LPARAM);
//services
INT_PTR __cdecl SetMyNickname(WPARAM wParam, LPARAM lParam);
@@ -149,8 +151,6 @@ private: // options
int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
- // events
-
// userinfo
static INT_PTR CALLBACK UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int __cdecl OnUserInfoInit(WPARAM wParam, LPARAM lParam);
@@ -193,35 +193,11 @@ private: HWND __cdecl OnSearchAdvanced(HWND owner);
HWND __cdecl OnCreateExtendedSearchUI(HWND owner);
- // chat rooms
- //MCONTACT GetChatRoom(const char *pubKey);
- MCONTACT GetChatRoom(int groupNumber);
-
- //MCONTACT GetChatRoom(const char *pubKey);
- MCONTACT AddChatRoom(int groupNumber);
-
- void __cdecl LoadChatRoomList(void*);
-
- int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam);
- int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam);
-
- INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnCreateChatRoom(WPARAM, LPARAM);
-
- //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);
-
- void ChatValidateContact(HWND hwndList, const std::vector<MCONTACT> &contacts, MCONTACT hContact = NULL);
- void ChatPrepare(HWND hwndList, const std::vector<MCONTACT> &contacts, MCONTACT hContact = NULL);
- static std::vector<MCONTACT> GetInvitedContacts(HWND hwndList, MCONTACT hContact = NULL);
- static INT_PTR CALLBACK ChatRoomInviteProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
// messages
std::map<uint64_t, UINT> messages;
+ void InitCustomDbEvents();
+
void __cdecl SendMessageAsync(void *arg);
int OnSendMessage(MCONTACT hContact, const char *message);
@@ -266,30 +242,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,15 +250,12 @@ 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);
MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, PBYTE pBlob, size_t cbBlob);
- static INT_PTR ParseToxUri(WPARAM, LPARAM lParam);
-
template<INT_PTR(__cdecl CToxProto::*Service)(WPARAM, LPARAM)>
static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam)
{
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index d03d3a091a..d8077fedd1 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -226,12 +226,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
psr.id.a = mir_strdup(query.c_str());
-
- ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
- acs.szProto = m_szModuleName;
- acs.psr = &psr;
-
- CallService(MS_ADDCONTACT_SHOW, (WPARAM)owner, (LPARAM)&acs);
+ Contact_AddBySearch(m_szModuleName, &psr, owner);
ForkThread(&CToxProto::SearchFailedAsync, nullptr);
}
diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp index 532eef79d7..a2c9e549a9 100644 --- a/protocols/Tox/src/tox_services.cpp +++ b/protocols/Tox/src/tox_services.cpp @@ -8,7 +8,7 @@ INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam) if (IsOnline()) {
T2Utf szNick8(nickname);
TOX_ERR_SET_INFO error;
- if (!tox_self_set_name(toxThread->Tox(), szNick8, mir_strlen(szNick8), &error))
+ if (!tox_self_set_name(m_toxThread->Tox(), szNick8, mir_strlen(szNick8), &error))
debugLogA(__FUNCTION__": failed to set nick name");
}
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/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 3fb9ad77b7..6becdc1a26 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -96,7 +96,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil FileTransferParam *transfer = (FileTransferParam*)hTransfer;
if (*action == FILERESUME_SKIP) {
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
}
@@ -104,22 +104,22 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil if (*action == FILERESUME_RENAME)
transfer->ChangeName(*szFilename);
- ToxHexAddress pubKey = GetContactPublicKey(toxThread->Tox(), transfer->friendNumber);
+ ToxHexAddress pubKey = GetContactPublicKey(m_toxThread->Tox(), transfer->friendNumber);
wchar_t *mode = *action == FILERESUME_OVERWRITE ? L"wb" : L"ab";
if (!transfer->OpenFile(mode)) {
debugLogA(__FUNCTION__": failed to open file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return NULL;
}
TOX_ERR_FILE_CONTROL error;
debugLogA(__FUNCTION__": start receiving file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
- if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
+ if (!tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
debugLogA(__FUNCTION__": failed to start receiving of file(%d) from %s(%d) cause (%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
}
@@ -128,7 +128,7 @@ int CToxProto::OnFileResume(HANDLE hTransfer, int *action, const wchar_t **szFil void CToxProto::OnTransferCompleted(FileTransferParam *transfer)
{
- ToxHexAddress pubKey = GetContactPublicKey(toxThread->Tox(), transfer->friendNumber);
+ ToxHexAddress pubKey = GetContactPublicKey(m_toxThread->Tox(), transfer->friendNumber);
debugLogA(__FUNCTION__": finised the transfer of file (%d) from %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
bool isFileFullyTransfered = transfer->pfts.currentFileProgress == transfer->pfts.currentFileSize;
@@ -177,7 +177,7 @@ void CToxProto::OnDataReceiving(Tox *tox, uint32_t friendNumber, uint32_t fileNu if (fwrite(data, sizeof(uint8_t), length, transfer->hFile) != length) {
proto->debugLogA(__FUNCTION__": failed write to file (%d)", fileNumber);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(proto->m_toxThread->Tox(), friendNumber, fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@@ -210,11 +210,11 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const wchar_t*, wchar_t **ppszFi uint64_t fileSize = _ftelli64(hFile);
rewind(hFile);
- ToxHexAddress pubKey = GetContactPublicKey(toxThread->Tox(), friendNumber);
+ ToxHexAddress pubKey = GetContactPublicKey(m_toxThread->Tox(), friendNumber);
char *name = mir_utf8encodeW(fileName);
TOX_ERR_FILE_SEND sendError;
- uint32_t fileNumber = tox_file_send(toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, nullptr, (uint8_t*)name, mir_strlen(name), &sendError);
+ uint32_t fileNumber = tox_file_send(m_toxThread->Tox(), friendNumber, TOX_FILE_KIND_DATA, fileSize, nullptr, (uint8_t*)name, mir_strlen(name), &sendError);
if (sendError != TOX_ERR_FILE_SEND_OK) {
debugLogA(__FUNCTION__": failed to send file (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, sendError);
mir_free(fileDir);
@@ -272,14 +272,14 @@ void CToxProto::OnFileSendData(Tox *tox, uint32_t friendNumber, uint32_t fileNum }
TOX_ERR_FILE_SEND_CHUNK error;
- if (!tox_file_send_chunk(proto->toxThread->Tox(), friendNumber, fileNumber, position, data, length, &error)) {
+ if (!tox_file_send_chunk(proto->m_toxThread->Tox(), friendNumber, fileNumber, position, data, length, &error)) {
if (error == TOX_ERR_FILE_SEND_CHUNK_FRIEND_NOT_CONNECTED) {
mir_free(data);
return;
}
proto->debugLogA(__FUNCTION__": failed to send file chunk (%d) to %s(%d) cause (%d)", fileNumber, (const char*)pubKey, friendNumber, error);
proto->ProtoBroadcastAck(transfer->pfts.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)transfer, 0);
- tox_file_control(proto->toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(proto->m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
mir_free(data);
return;
}
@@ -296,7 +296,7 @@ int CToxProto::CancelTransfer(MCONTACT, HANDLE hTransfer) {
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
debugLogA(__FUNCTION__": Transfer (%d) is canceled", transfer->fileNumber);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
transfers.Remove(transfer);
return 0;
@@ -308,13 +308,13 @@ void CToxProto::PauseOutgoingTransfers(uint32_t friendNumber) // only for sending
FileTransferParam *transfer = transfers.GetAt(i);
if (transfer->friendNumber == friendNumber && transfer->GetDirection() == 0) {
- ToxHexAddress pubKey = GetContactPublicKey(toxThread->Tox(), friendNumber);
+ ToxHexAddress pubKey = GetContactPublicKey(m_toxThread->Tox(), friendNumber);
debugLogA(__FUNCTION__": sending ask to pause the transfer of file (%d) to %s(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
TOX_ERR_FILE_CONTROL error;
- if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_PAUSE, &error)) {
+ if (!tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_PAUSE, &error)) {
debugLogA(__FUNCTION__": failed to pause the transfer (%d) to %s(%d) cause(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
- tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
+ tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_CANCEL, nullptr);
}
}
}
@@ -326,11 +326,11 @@ void CToxProto::ResumeIncomingTransfers(uint32_t friendNumber) // only for receiving
FileTransferParam *transfer = transfers.GetAt(i);
if (transfer->friendNumber == friendNumber && transfer->GetDirection() == 1) {
- ToxHexAddress pubKey = GetContactPublicKey(toxThread->Tox(), friendNumber);
+ ToxHexAddress pubKey = GetContactPublicKey(m_toxThread->Tox(), friendNumber);
debugLogA(__FUNCTION__": sending ask to resume the transfer of file (%d) from %s(%d) cause(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber);
TOX_ERR_FILE_CONTROL error;
- if (!tox_file_control(toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
+ if (!tox_file_control(m_toxThread->Tox(), transfer->friendNumber, transfer->fileNumber, TOX_FILE_CONTROL_RESUME, &error)) {
debugLogA(__FUNCTION__": failed to resume the transfer (%d) from %s(%d) cause(%d)", transfer->fileNumber, (const char*)pubKey, transfer->friendNumber, error);
CancelTransfer(NULL, transfer);
}
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 722517c427..130e08eaec 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -165,11 +165,6 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
psr.id.a = mir_u2a(&uri[4]);
-
- ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
- acs.szProto = proto->m_szModuleName;
- acs.psr = &psr;
-
- CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
+ Contact_AddBySearch(proto->m_szModuleName, &psr);
return 0;
}
diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h index ba58f1f238..9e50bf1249 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 3
+#define __BUILD_NUM 0
#include <stdver.h>
@@ -9,6 +9,5 @@ #define __FILENAME "Tox.dll"
#define __DESCRIPTION "Tox protocol support for Miranda NG."
#define __AUTHOR "Miranda NG Team"
-#define __AUTHOREMAIL ""
#define __AUTHORWEB "https://miranda-ng.org/p/Tox/"
#define __COPYRIGHT "© 2014-17 Miranda NG Team"
|