summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-12-30 00:42:35 +0300
committeraunsane <aunsane@gmail.com>2017-12-30 00:42:49 +0300
commitcc65f8dbead036bfdd29d397195f9152839d4919 (patch)
tree8e8188f7db65f8a538d5e423e1d0b3491706efc4 /protocols
parent81cd378b0a0ee5e26d58c085a3b10bd89a7244c2 (diff)
Tox: project cleanup
- updated libtox - removed deprecated toxDNS support - removed unused references
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/Tox.vcxproj4
-rw-r--r--protocols/Tox/libtox/libtox.vcxproj3
-rw-r--r--protocols/Tox/libtox/src/libtox.def4
-rw-r--r--protocols/Tox/libtox/src/toxcore/network.c14
-rw-r--r--protocols/Tox/libtox/src/toxcore/network.h2
-rw-r--r--protocols/Tox/libtox/src/toxcore/tox.api.h2
-rw-r--r--protocols/Tox/libtox/src/toxcore/tox.h2
-rw-r--r--protocols/Tox/libtox/src/toxdns/toxdns.c243
-rw-r--r--protocols/Tox/libtox/src/toxdns/toxdns.h96
-rw-r--r--protocols/Tox/res/resource.rc7
-rw-r--r--protocols/Tox/src/stdafx.h1
-rw-r--r--protocols/Tox/src/tox_search.cpp130
12 files changed, 10 insertions, 498 deletions
diff --git a/protocols/Tox/Tox.vcxproj b/protocols/Tox/Tox.vcxproj
index bc607b076a..45b896c53a 100644
--- a/protocols/Tox/Tox.vcxproj
+++ b/protocols/Tox/Tox.vcxproj
@@ -27,10 +27,10 @@
</ImportGroup>
<ItemDefinitionGroup>
<ClCompile>
- <AdditionalIncludeDirectories>..\..\include;libtox\src\toxcore;libtox\src\toxdns;libtox\src\toxencryptsave;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\include;libtox\src\toxcore;libtox\src\toxencryptsave;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
- <AdditionalDependencies>Winmm.lib;dnsapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/protocols/Tox/libtox/libtox.vcxproj b/protocols/Tox/libtox/libtox.vcxproj
index c4380e76d9..a298c22005 100644
--- a/protocols/Tox/libtox/libtox.vcxproj
+++ b/protocols/Tox/libtox/libtox.vcxproj
@@ -40,9 +40,6 @@
<ClCompile Include="src\toxcore\*.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\toxdns\*.c">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
<ClCompile Include="src\toxencryptsave\*.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
diff --git a/protocols/Tox/libtox/src/libtox.def b/protocols/Tox/libtox/src/libtox.def
index e1706ad3ae..8c7855296a 100644
--- a/protocols/Tox/libtox/src/libtox.def
+++ b/protocols/Tox/libtox/src/libtox.def
@@ -40,9 +40,6 @@ tox_conference_peer_get_public_key
tox_conference_peer_number_is_ours
tox_conference_send_message
tox_conference_set_title
-tox_decrypt_dns3_TXT
-tox_dns3_kill
-tox_dns3_new
tox_file_control
tox_file_get_file_id
tox_file_id_length
@@ -66,7 +63,6 @@ tox_friend_get_typing
tox_friend_send_lossless_packet
tox_friend_send_lossy_packet
tox_friend_send_message
-tox_generate_dns3_string
tox_get_salt
tox_get_savedata
tox_get_savedata_size
diff --git a/protocols/Tox/libtox/src/toxcore/network.c b/protocols/Tox/libtox/src/toxcore/network.c
index 5c43bf5779..7587826b51 100644
--- a/protocols/Tox/libtox/src/toxcore/network.c
+++ b/protocols/Tox/libtox/src/toxcore/network.c
@@ -1411,20 +1411,6 @@ Socket net_socket(int domain, int type, int protocol)
return socket(platform_domain, platform_type, platform_prot);
}
-/* TODO: Remove, when tox DNS support will be removed.
- * Used only by dns3_test.c
- */
-size_t net_sendto_ip4(Socket sock, const char *buf, size_t n, IP_Port ip_port)
-{
- struct sockaddr_in target;
- size_t addrsize = sizeof(target);
- target.sin_family = make_family(ip_port.ip.family);
- target.sin_port = net_htons(ip_port.port);
- fill_addr4(ip_port.ip.ip4, &target.sin_addr);
-
- return (size_t)sendto(sock, buf, n, 0, (struct sockaddr *)&target, addrsize);
-}
-
uint32_t net_htonl(uint32_t hostlong)
{
return htonl(hostlong);
diff --git a/protocols/Tox/libtox/src/toxcore/network.h b/protocols/Tox/libtox/src/toxcore/network.h
index 0b9da5a40f..41d1307a36 100644
--- a/protocols/Tox/libtox/src/toxcore/network.h
+++ b/protocols/Tox/libtox/src/toxcore/network.h
@@ -403,8 +403,6 @@ void net_freeipport(IP_Port *ip_ports);
*/
int bind_to_port(Socket sock, int family, uint16_t port);
-size_t net_sendto_ip4(Socket sock, const char *buf, size_t n, IP_Port ip_port);
-
/* Initialize networking.
* bind to ip and port.
* ip must be in network order EX: 127.0.0.1 = (7F000001).
diff --git a/protocols/Tox/libtox/src/toxcore/tox.api.h b/protocols/Tox/libtox/src/toxcore/tox.api.h
index 0763c7789d..ce0b3a36c4 100644
--- a/protocols/Tox/libtox/src/toxcore/tox.api.h
+++ b/protocols/Tox/libtox/src/toxcore/tox.api.h
@@ -179,7 +179,7 @@ const VERSION_MINOR = 1;
* The patch or revision number. Incremented when bugfixes are applied without
* changing any functionality or API or ABI.
*/
-const VERSION_PATCH = 10;
+const VERSION_PATCH = 11;
/**
* A macro to check at preprocessing time whether the client code is compatible
diff --git a/protocols/Tox/libtox/src/toxcore/tox.h b/protocols/Tox/libtox/src/toxcore/tox.h
index 30bc950964..cb9c4fa0e0 100644
--- a/protocols/Tox/libtox/src/toxcore/tox.h
+++ b/protocols/Tox/libtox/src/toxcore/tox.h
@@ -180,7 +180,7 @@ uint32_t tox_version_minor(void);
* The patch or revision number. Incremented when bugfixes are applied without
* changing any functionality or API or ABI.
*/
-#define TOX_VERSION_PATCH 10
+#define TOX_VERSION_PATCH 11
uint32_t tox_version_patch(void);
diff --git a/protocols/Tox/libtox/src/toxdns/toxdns.c b/protocols/Tox/libtox/src/toxdns/toxdns.c
deleted file mode 100644
index 96f3081f80..0000000000
--- a/protocols/Tox/libtox/src/toxdns/toxdns.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Tox secure username DNS toxid resolving functions.
- */
-
-/*
- * Copyright © 2016-2017 The TokTok team.
- * Copyright © 2013 Tox project.
- *
- * This file is part of Tox, the free peer to peer instant messenger.
- *
- * Tox is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Tox is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Tox. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "../toxcore/Messenger.h"
-#include "../toxcore/logger.h"
-#include "toxdns.h"
-
-static const char base32[32] = {
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5',
-};
-
-#define _encode(a, b, c) \
-{ \
- uint8_t _i = 0; \
- while (_i != c) { \
- *a++ = base32[((b[0] >> bits) | (b[1] << (8 - bits))) & 0x1F]; \
- bits += 5; \
- if(bits >= 8) { \
- bits -= 8; \
- b++; \
- _i++; \
- } \
- } \
-}
-
-typedef struct {
- uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE];
- uint8_t temp_sk[CRYPTO_SECRET_KEY_SIZE];
- uint8_t server_public_key[CRYPTO_PUBLIC_KEY_SIZE];
- uint8_t shared_key[CRYPTO_SYMMETRIC_KEY_SIZE];
- uint32_t nonce;
- uint32_t nonce_start;
-} DNS_Object;
-
-static void dns_new_temp_keys(DNS_Object *d)
-{
- d->nonce = d->nonce_start = random_int();
- crypto_new_keypair(d->temp_pk, d->temp_sk);
- encrypt_precompute(d->server_public_key, d->temp_sk, d->shared_key);
-}
-
-/* Create a new tox_dns3 object for server with server_public_key.
- *
- * return Null on failure.
- * return pointer object on success.
- */
-void *tox_dns3_new(uint8_t *server_public_key)
-{
- DNS_Object *d = (DNS_Object *)malloc(sizeof(DNS_Object));
-
- if (d == NULL) {
- return NULL;
- }
-
- memcpy(d->server_public_key, server_public_key, CRYPTO_PUBLIC_KEY_SIZE);
- dns_new_temp_keys(d);
- return d;
-}
-
-/* Destroy the tox dns3 object.
- */
-void tox_dns3_kill(void *dns3_object)
-{
- memset(dns3_object, 0, sizeof(DNS_Object));
- free(dns3_object);
-}
-
-/* Generate a dns3 string of string_max_len used to query the dns server referred to by to
- * dns3_object for a tox id registered to user with name of name_len.
- *
- * the uint32_t pointed by request_id will be set to the request id which must be passed to
- * tox_decrypt_dns3_TXT() to correctly decode the response.
- *
- * This is what the string returned looks like:
- * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
- *
- * returns length of string on success.
- * returns -1 on failure.
- */
-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)
-{
-#define DOT_INTERVAL (6 * 5)
- int base = (sizeof(uint32_t) + CRYPTO_PUBLIC_KEY_SIZE + name_len + CRYPTO_MAC_SIZE);
- int end_len = ((base * 8) / 5) + (base / DOT_INTERVAL) + !!(base % 5);
- end_len -= !(base % DOT_INTERVAL);
-
- if (end_len > string_max_len) {
- return -1;
- }
-
- DNS_Object *d = (DNS_Object *)dns3_object;
- uint8_t buffer[1024];
- uint8_t nonce[CRYPTO_NONCE_SIZE] = {0};
- memcpy(nonce, &d->nonce, sizeof(uint32_t));
- memcpy(buffer, &d->nonce, sizeof(uint32_t));
- memcpy(buffer + sizeof(uint32_t), d->temp_pk, CRYPTO_PUBLIC_KEY_SIZE);
- int len = encrypt_data_symmetric(d->shared_key, nonce, name, name_len,
- buffer + sizeof(uint32_t) + CRYPTO_PUBLIC_KEY_SIZE);
-
- if (len == -1) {
- return -1;
- }
-
- int total_len = len + sizeof(uint32_t) + CRYPTO_PUBLIC_KEY_SIZE;
- uint8_t *buff = buffer, *old_str = string;
- buffer[total_len] = 0;
- uint8_t bits = 0;
- int i;
-
- for (i = !(total_len % DOT_INTERVAL); i < (total_len / DOT_INTERVAL); ++i) {
- _encode(string, buff, DOT_INTERVAL);
- *string = '.';
- ++string;
- }
-
- int left = total_len - (buff - buffer);
- _encode(string, buff, left);
-#undef DOT_INTERVAL
- *request_id = d->nonce;
- ++d->nonce;
-
- if (d->nonce == d->nonce_start) {
- dns_new_temp_keys(d);
- }
-
- if (end_len != string - old_str) {
- // TODO(iphydf): This currently has no access to a logger.
- LOGGER_ERROR(NULL, "tox_generate_dns3_string Fail, %u != %lu\n", end_len, string - old_str);
- return -1;
- }
-
- return string - old_str;
-}
-
-
-static int decode(uint8_t *dest, uint8_t *src)
-{
- uint8_t *p = src, *op = dest, bits = 0;
- *op = 0;
-
- while (*p) {
- uint8_t ch = *p++;
-
- if ('A' <= ch && ch <= 'Z') {
- ch = ch - 'A';
- } else if ('a' <= ch && ch <= 'z') {
- ch = ch - 'a';
- } else if ('0' <= ch && ch <= '5') {
- ch = ch - '0' + 26;
- } else {
- return - 1;
- }
-
- *op |= (ch << bits);
- bits += 5;
-
- if (bits >= 8) {
- bits -= 8;
- ++op;
- *op = (ch >> (5 - bits));
- }
- }
-
- return op - dest;
-}
-
-/* Decode and decrypt the id_record returned of length id_record_len into
- * tox_id (needs to be at least TOX_FRIEND_ADDRESS_SIZE).
- *
- * request_id is the request id given by tox_generate_dns3_string() when creating the request.
- *
- * the id_record passed to this function should look somewhat like this:
- * 2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
- *
- * returns -1 on failure.
- * returns 0 on success.
- *
- */
-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)
-{
- DNS_Object *d = (DNS_Object *)dns3_object;
-
- if (id_record_len != 87) {
- return -1;
- }
-
-#if 0
-
- if (id_record_len > 255 || id_record_len <= (sizeof(uint32_t) + CRYPTO_MAC_SIZE)) {
- return -1;
- }
-
-#endif
-
- VLA(uint8_t, id_record_null, id_record_len + 1);
- memcpy(id_record_null, id_record, id_record_len);
- id_record_null[id_record_len] = 0;
- VLA(uint8_t, data, id_record_len);
- int length = decode(data, id_record_null);
-
- if (length == -1) {
- return -1;
- }
-
- uint8_t nonce[CRYPTO_NONCE_SIZE] = {0};
- memcpy(nonce, &request_id, sizeof(uint32_t));
- nonce[sizeof(uint32_t)] = 1;
- int len = decrypt_data_symmetric(d->shared_key, nonce, data, length, tox_id);
-
- if (len != FRIEND_ADDRESS_SIZE) {
- return -1;
- }
-
- return 0;
-}
diff --git a/protocols/Tox/libtox/src/toxdns/toxdns.h b/protocols/Tox/libtox/src/toxdns/toxdns.h
deleted file mode 100644
index b280925eb1..0000000000
--- a/protocols/Tox/libtox/src/toxdns/toxdns.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Tox secure username DNS toxid resolving functions.
- */
-
-/*
- * Copyright © 2016-2017 The TokTok team.
- * Copyright © 2014 Tox project.
- *
- * This file is part of Tox, the free peer to peer instant messenger.
- *
- * Tox is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Tox is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Tox. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef TOXDNS_H
-#define TOXDNS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/* Clients are encouraged to set this as the maximum length names can have. */
-#define TOXDNS_MAX_RECOMMENDED_NAME_LENGTH 32
-
-/* How to use this api to make secure tox dns3 requests:
- *
- * 1. Get the public key of a server that supports tox dns3.
- * 2. use tox_dns3_new() to create a new object to create DNS requests
- * and handle responses for that server.
- * 3. Use tox_generate_dns3_string() to generate a string based on the name we want to query and a request_id
- * that must be stored somewhere for when we want to decrypt the response.
- * 4. take the string and use it for your DNS request like this:
- * _4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc._tox.utox.org
- * 5. The TXT in the DNS you receive should look like this:
- * v=tox3;id=2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
- * 6. Take the id string and use it with tox_decrypt_dns3_TXT() and the request_id corresponding to the
- * request we stored earlier to get the Tox id returned by the DNS server.
- */
-
-/* Create a new tox_dns3 object for server with server_public_key of size TOX_CLIENT_ID_SIZE.
- *
- * return Null on failure.
- * return pointer object on success.
- */
-void *tox_dns3_new(uint8_t *server_public_key);
-
-/* Destroy the tox dns3 object.
- */
-void tox_dns3_kill(void *dns3_object);
-
-/* Generate a dns3 string of string_max_len used to query the dns server referred to by to
- * dns3_object for a tox id registered to user with name of name_len.
- *
- * the uint32_t pointed by request_id will be set to the request id which must be passed to
- * tox_decrypt_dns3_TXT() to correctly decode the response.
- *
- * This is what the string returned looks like:
- * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
- *
- * returns length of string on success.
- * returns -1 on failure.
- */
-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);
-
-/* Decode and decrypt the id_record returned of length id_record_len into
- * tox_id (needs to be at least TOX_FRIEND_ADDRESS_SIZE).
- *
- * request_id is the request id given by tox_generate_dns3_string() when creating the request.
- *
- * the id_record passed to this function should look somewhat like this:
- * 2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
- *
- * returns -1 on failure.
- * returns 0 on success.
- *
- */
-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);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc
index b501959882..04cbcd9cc1 100644
--- a/protocols/Tox/res/resource.rc
+++ b/protocols/Tox/res/resource.rc
@@ -130,7 +130,7 @@ EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_SEARCH,0,4,109,14,ES_AUTOHSCROLL
- LTEXT "If this field contains Tox address (76 hex characters), you will be prompted to add it in your friend list. Otherwise, Miranda will search this query via Tox DNS discovery.",IDC_STATIC,0,20,109,93
+ LTEXT "If this field contains Tox address (76 hex characters), you will be prompted to add it in your friend list. Otherwise, Miranda will search this query via toxme.io.",IDC_STATIC,0,20,109,93
END
IDD_USER_INFO DIALOGEX 0, 0, 221, 152
@@ -325,6 +325,11 @@ BEGIN
0
END
+IDD_SEARCH AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index 501eeb96cf..367108e1ad 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -38,7 +38,6 @@
#include <m_http.h>
#include <tox.h>
-#include <toxdns.h>
#include <toxencryptsave.h>
struct CToxProto;
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp
index d8077fedd1..b395c5c649 100644
--- a/protocols/Tox/src/tox_search.cpp
+++ b/protocols/Tox/src/tox_search.cpp
@@ -1,58 +1,5 @@
#include "stdafx.h"
-ToxHexAddress ResolveToxAddressFromDnsRecordV1(const std::string &dnsRecord)
-{
- std::smatch match;
- std::regex regex("^v=tox1;id=([A-Fa-f0-9]{76})(;sign=(\\S+))?$");
- if (std::regex_search(dnsRecord, match, regex))
- return ToxHexAddress(match[1]);
- return ToxHexAddress::Empty();
-}
-
-ToxHexAddress ResolveToxAddressFromDnsRecordV2(const std::string &/*dnsRecord*/)
-{
- // unsupported
- /*std::smatch match;
- std::regex regex("^v=tox2;pub=([A-Fa-f0-9]{64});check=([A-Fa-f0-9]{8});sign=(\\S+))?$");
- if (std::regex_search(dnsRecord, match, regex))
- {
- }*/
- return ToxHexAddress::Empty();
-}
-
-ToxHexAddress ResolveToxAddressFromDnsRecordV3(void *dns, uint32_t requestId, const std::string &dnsRecord)
-{
- std::smatch match;
- std::regex regex("^v=tox3;id=([a-z0-5.]+)$");
- if (std::regex_search(dnsRecord, match, regex)) {
- std::string id = match[1];
- uint8_t data[TOX_ADDRESS_SIZE];
- if (tox_decrypt_dns3_TXT(dns, data, (uint8_t*)id.c_str(), (uint32_t)id.length(), requestId) != TOX_ERROR) {
- return ToxHexAddress(data, TOX_ADDRESS_SIZE);
- }
- }
- return ToxHexAddress::Empty();
-}
-
-ToxHexAddress ResolveToxAddressFromDns(const char *dnsQuery)
-{
- ToxHexAddress address = ToxHexAddress::Empty();
-
- DNS_RECORDA *record = nullptr;
- DNS_STATUS status = DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, DNS_QUERY_STANDARD, nullptr, (PDNS_RECORD*)&record, nullptr);
- while (status == ERROR_SUCCESS && record) {
- DNS_TXT_DATAA *txt = &record->Data.Txt;
- if (record->wType == DNS_TYPE_TEXT && txt->dwStringCount) {
- address = ResolveToxAddressFromDnsRecordV1(txt->pStringArray[0]);
- break;
- }
- record = record->pNext;
- }
- DnsRecordListFree((PDNS_RECORD*)record, DnsFreeRecordList);
-
- return address;
-}
-
ToxHexAddress ResolveToxAddressFromToxme(HNETLIBUSER hNetlib, const char *query)
{
ToxHexAddress address = ToxHexAddress::Empty();
@@ -83,83 +30,6 @@ void CToxProto::SearchByNameAsync(void *arg)
char *query = (char*)arg;
char *name = strtok(query, "@");
- // char *domain = strtok(NULL, "");
-
- /*int resolved = 0;
-
- if (IsFileExists((wchar_t*)VARSW(_T(TOX_INI_PATH))))
- {
- char fileName[MAX_PATH];
- mir_strcpy(fileName, VARS(TOX_INI_PATH));
-
- char *section, sections[MAX_PATH], value[TOX_PUBLIC_KEY_SIZE * 2];
- GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
- section = sections;
- while (*section != NULL)
- {
- if (strstr(section, "Dns_") == section)
- {
- GetPrivateProfileStringA(section, "Domain", NULL, value, _countof(value), fileName);
- ptrA dnsDomain(mir_strdup(value));
- GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
- ToxBinAddress dnsPubKey = value;
-
- if (domain == NULL || mir_strcmpi(domain, dnsDomain) == 0)
- {
- void *dns = tox_dns3_new((uint8_t*)(const uint8_t*)dnsPubKey);
-
- uint32_t requestId = 0;
- uint8_t dnsString[MAX_PATH];
- size_t length = tox_generate_dns3_string(dns, dnsString, sizeof(dnsString), &requestId, (uint8_t*)CharLowerA(name), (uint8_t)mir_strlen(name));
- if (length != TOX_ERROR)
- {
- dnsString[length] = 0;
- char dnsQuery[MAX_PATH * 2];
- mir_snprintf(dnsQuery, "_%s._tox.%s", dnsString, dnsDomain);
-
- ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery);
- if (!address.IsEmpty())
- {
- PROTOSEARCHRESULT psr = { sizeof(PROTOSEARCHRESULT) };
- psr.flags = PSR_UTF8;
- psr.id.a = mir_strdup(address);
- psr.nick.a = mir_strdup(name);
-
- char email[MAX_PATH];
- mir_snprintf(email, "%s@%s", name, domain);
- psr.email.a = mir_strdup(email);
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
- break;
- }
- }
- tox_dns3_kill(dns);
- }
- }
- section += mir_strlen(section) + 1;
- }
- }
-
- if (resolved == 0 && domain)
- {
- char dnsQuery[MAX_PATH];
- mir_snprintf(dnsQuery, "%s._tox.%s", name, domain);
-
- ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery);
- if (!address.IsEmpty())
- {
- PROTOSEARCHRESULT psr = { sizeof(PROTOSEARCHRESULT) };
- psr.flags = PSR_UTF8;
- psr.id.a = mir_strdup(address);
- psr.nick.a = mir_strdup(name);
-
- char email[MAX_PATH];
- mir_snprintf(email, "%s@%s", name, domain);
- psr.email.a = mir_strdup(email);
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
- }
- }*/
ToxHexAddress address = ResolveToxAddressFromToxme(m_hNetlibUser, query);
if (!address.IsEmpty()) {