summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-02-14 21:37:52 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-02-14 21:37:52 +0000
commite756026c3abd0a81cdf8b082faf7dbaa848489b1 (patch)
treecb2dae6b0953eb43c5f95ba179587c4b7bfc8028 /protocols/Tox/src
parent1bd8a05fc766f007574f32f7fdcc6c468c991315 (diff)
using nodes data from db
git-svn-id: http://svn.miranda-ng.org/main/trunk@12111 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/tox_account.cpp28
-rw-r--r--protocols/Tox/src/version.h2
2 files changed, 22 insertions, 8 deletions
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp
index 6947d4f675..9195cace09 100644
--- a/protocols/Tox/src/tox_account.cpp
+++ b/protocols/Tox/src/tox_account.cpp
@@ -138,13 +138,27 @@ void CToxProto::UninitToxCore()
void CToxProto::DoBootstrap()
{
- static int j = 0;
- int i = 0;
- while (i < 2)
- {
- struct bootstrap_node *d = &bootstrap_nodes[j % SIZEOF(bootstrap_nodes)];
- tox_bootstrap_from_address(tox, d->address, d->port, d->key);
- i++; j++;
+ int NodeCount = db_get_b(NULL, "TOX", "NodeCount", 0);
+ for (int i = 0; i < NodeCount; i++) {
+ char buff[MAX_PATH];
+ mir_snprintf(buff, SIZEOF(buff), "Node_%d_IPv4", i + 1);
+ TCHAR *ptszIPv4 = db_get_tsa(NULL, "TOX", buff);
+ mir_snprintf(buff, SIZEOF(buff), "Node_%d_IPv6", i + 1);
+ TCHAR *ptszIPv6 = db_get_tsa(NULL, "TOX", buff);
+ mir_snprintf(buff, SIZEOF(buff), "Node_%d_ClientID", i + 1);
+ TCHAR *ptszClientID = db_get_tsa(NULL, "TOX", buff);
+ mir_snprintf(buff, SIZEOF(buff), "Node_%d_Port", i + 1);
+ DWORD PortNum = db_get_dw(NULL, "TOX", buff, 0);
+ if (ptszIPv4 && ptszIPv6 && ptszClientID && PortNum) {
+ int len = mir_tstrlen(ptszClientID) / 2;
+ BYTE *p = (BYTE*)mir_alloc(len);
+ for (int j = 0; j < len; j++)
+ _stscanf(ptszClientID + j * 2, _T("%02X"), &p[j]);
+ tox_bootstrap_from_address(tox, _T2A(ptszIPv4), PortNum, p);
+ mir_free(ptszIPv4);
+ mir_free(ptszIPv6);
+ mir_free(ptszClientID);
+ }
}
}
diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h
index e00e04fb2e..77b75e31ee 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 0
-#define __BUILD_NUM 6
+#define __BUILD_NUM 7
#include <stdver.h>