Merge remote-tracking branch 'upstream/master'

This commit is contained in:
mannol 2014-02-23 23:24:07 +01:00
commit cf8a090cde
15 changed files with 153 additions and 66 deletions

View File

@ -15,6 +15,14 @@ before_script:
- cd .. - cd ..
#installing yasm, needed for compiling vpx #installing yasm, needed for compiling vpx
- sudo apt-get install yasm > /dev/null - sudo apt-get install yasm > /dev/null
#installing libconfig, needed for DHT_bootstrap_daemon
- wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz > /dev/null
- tar -xvzf libconfig-1.4.9.tar.gz > /dev/null
- cd libconfig-1.4.9
- ./configure > /dev/null
- make -j3 > /dev/null
- sudo make install > /dev/null
- cd ..
#installing libopus, needed for audio encoding/decoding #installing libopus, needed for audio encoding/decoding
- wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null - wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz > /dev/null
- tar xzf opus-1.0.3.tar.gz > /dev/null - tar xzf opus-1.0.3.tar.gz > /dev/null
@ -37,7 +45,7 @@ before_script:
script: script:
- autoreconf -i - autoreconf -i
- CFLAGS=-Ofast ./configure - CFLAGS=-Ofast ./configure --enable-daemon --enable-ntox
- make -j3 - make -j3
- make check - make check
- make dist - make dist

View File

@ -49,8 +49,6 @@ On FreeBSD 10+:
pkg install automake autoconf pkg install automake autoconf
``` ```
Note that `libconfig-dev` should be >= 1.4.
You should get and install [libsodium](https://github.com/jedisct1/libsodium): You should get and install [libsodium](https://github.com/jedisct1/libsodium):
```bash ```bash
git clone git://github.com/jedisct1/libsodium.git git clone git://github.com/jedisct1/libsodium.git
@ -112,7 +110,7 @@ brew install --HEAD libtoxcore
To do it manually: To do it manually:
``` ```
brew install libtool automake autoconf libconfig libsodium check brew install libtool automake autoconf libsodium check
``` ```
Then clone this repo and generate makefile: Then clone this repo and generate makefile:
```bash ```bash
@ -234,7 +232,7 @@ While [Toxic](https://github.com/tox/toxic) is no longer in core, a list of Tox
- --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav) - --disable-av disable A/V support (default: auto) see: [libtoxav](#libtoxav)
- --enable-phone build phone (default: no) see: [Test phone](#phone) - --enable-phone build phone (default: no) see: [Test phone](#phone)
- --enable-ntox build nTox client (default: no) see: [nTox](#ntox) - --enable-ntox build nTox client (default: no) see: [nTox](#ntox)
- --enable-daemon build DHT bootstrap daemon (default: no) see: [Bootstrap daemon](#bootstrapd) - --enable-daemon build DHT bootstrap daemon (default=no) see: [Bootstrap daemon](#bootstrapd)
- --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-shared[=PKGS] build shared libraries [default=yes]
- --enable-static[=PKGS] build static libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes]
@ -335,7 +333,7 @@ Daemon is disabled by default. You can enable it by adding --enable-daemon argum
```bash ```bash
./configure --enable-daemon ./configure --enable-daemon
``` ```
There is one dependency required for bootstrap daemon: libconfig. There is one dependency required for bootstrap daemon: `libconfig-dev` >= 1.4.
Install on fedora: Install on fedora:
```bash ```bash
@ -354,6 +352,7 @@ brew install libconfig
OS X non-homebrew: OS X non-homebrew:
Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install Grab the following [package] (http://www.hyperrealm.com/libconfig/), uncompress and install
See this [readme](other\bootstrap_daemon\README.md) on how to set up the bootstrap daemon.
<a name="ntox" /> <a name="ntox" />

View File

@ -62,6 +62,51 @@ void print_typingchange(Tox *m, int friendnumber, int typing, void *userdata)
typing_changes = 2; typing_changes = 2;
} }
uint8_t filenum;
uint32_t file_accepted;
uint64_t file_size;
void file_request_accept(Tox *m, int friendnumber, uint8_t filenumber, uint64_t filesize, uint8_t *filename,
uint16_t filename_length, void *userdata)
{
if (*((uint32_t *)userdata) != 974536)
return;
if (filename_length == sizeof("Gentoo.exe") && memcmp(filename, "Gentoo.exe", sizeof("Gentoo.exe")) == 0)
++file_accepted;
file_size = filesize;
tox_file_send_control(m, friendnumber, 1, filenumber, TOX_FILECONTROL_ACCEPT, NULL, 0);
}
uint32_t file_sent;
uint32_t sendf_ok;
void file_print_control(Tox *m, int friendnumber, uint8_t send_recieve, uint8_t filenumber, uint8_t control_type,
uint8_t *data, uint16_t length, void *userdata)
{
if (*((uint32_t *)userdata) != 974536)
return;
if (send_recieve == 0 && control_type == TOX_FILECONTROL_FINISHED)
file_sent = 1;
if (send_recieve == 1 && control_type == TOX_FILECONTROL_ACCEPT)
sendf_ok = 1;
}
uint64_t size_recv;
void write_file(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata)
{
if (*((uint32_t *)userdata) != 974536)
return;
uint8_t *f_data = malloc(length);
memset(f_data, 6, length);
if (memcmp(f_data, data, length) == 0)
size_recv += length;
}
START_TEST(test_few_clients) START_TEST(test_few_clients)
{ {
long long unsigned int cur_time = time(NULL); long long unsigned int cur_time = time(NULL);
@ -168,6 +213,44 @@ START_TEST(test_few_clients)
} }
ck_assert_msg(tox_get_is_typing(tox2, 0) == 0, "Typing fail"); ck_assert_msg(tox_get_is_typing(tox2, 0) == 0, "Typing fail");
filenum = file_accepted = file_size = file_sent = sendf_ok = size_recv = 0;
long long unsigned int f_time = time(NULL);
tox_callback_file_data(tox3, write_file, &to_compare);
tox_callback_file_control(tox2, file_print_control, &to_compare);
tox_callback_file_control(tox3, file_print_control, &to_compare);
tox_callback_file_send_request(tox3, file_request_accept, &to_compare);
uint64_t totalf_size = 100 * 1024 * 1024;
int fnum = tox_new_file_sender(tox2, 0, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"));
ck_assert_msg(fnum != -1, "tox_new_file_sender fail");
int fpiece_size = tox_file_data_size(tox2, 0);
uint8_t *f_data = malloc(fpiece_size);
memset(f_data, 6, fpiece_size);
while (1) {
file_sent = 0;
tox_do(tox1);
tox_do(tox2);
tox_do(tox3);
if (sendf_ok)
while (tox_file_send_data(tox2, 0, fnum, f_data, fpiece_size < totalf_size ? fpiece_size : totalf_size) == 0) {
if (totalf_size <= fpiece_size) {
sendf_ok = 0;
tox_file_send_control(tox2, 0, 0, fnum, TOX_FILECONTROL_FINISHED, NULL, 0);
}
totalf_size -= fpiece_size;
}
if (file_sent && size_recv == file_size)
break;
c_sleep(10);
}
printf("100MB file sent in %llu seconds\n", time(NULL) - f_time);
printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time); printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time);
} }
END_TEST END_TEST
@ -244,7 +327,7 @@ Suite *tox_suite(void)
{ {
Suite *s = suite_create("Tox"); Suite *s = suite_create("Tox");
DEFTESTCASE_SLOW(few_clients, 30); DEFTESTCASE_SLOW(few_clients, 50);
DEFTESTCASE_SLOW(many_clients, 240); DEFTESTCASE_SLOW(many_clients, 240);
return s; return s;
} }

View File

@ -1,7 +1,7 @@
/* DHT boostrap /* DHT boostrap
* *
* A simple DHT boostrap server for tox. * A simple DHT boostrap node for tox.
* *
* Copyright (C) 2013 Tox project All Rights Reserved. * Copyright (C) 2013 Tox project All Rights Reserved.
* *
@ -33,8 +33,8 @@
#include "../testing/misc_tools.c" #include "../testing/misc_tools.c"
#ifdef DHT_SERVER_EXTRA_PACKETS #ifdef DHT_NODE_EXTRA_PACKETS
#include "./bootstrap_server_packets.c" #include "./bootstrap_node_packets.c"
#define DHT_VERSION_NUMBER 1 #define DHT_VERSION_NUMBER 1
#define DHT_MOTD "This is a test motd" #define DHT_MOTD "This is a test motd"
@ -111,7 +111,7 @@ int main(int argc, char *argv[])
Onion *onion = new_onion(dht); Onion *onion = new_onion(dht);
Onion_Announce *onion_a = new_onion_announce(dht); Onion_Announce *onion_a = new_onion_announce(dht);
#ifdef DHT_SERVER_EXTRA_PACKETS #ifdef DHT_NODE_EXTRA_PACKETS
bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD)); bootstrap_set_callbacks(dht->net, DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD));
#endif #endif
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
perror("Initialization"); perror("Initialization");
manage_keys(dht); manage_keys(dht);
/* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ /* We want our DHT public key to be the same as our internal one since this is a bootstrap node */
memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
printf("Public key: "); printf("Public key: ");
@ -166,7 +166,7 @@ int main(int argc, char *argv[])
while (1) { while (1) {
if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { if (is_waiting_for_dht_connection && DHT_isconnected(dht)) {
printf("Connected to other bootstrap server successfully.\n"); printf("Connected to other bootstrap node successfully.\n");
is_waiting_for_dht_connection = 0; is_waiting_for_dht_connection = 0;
} }

View File

@ -1,3 +1,3 @@
As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out. As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out.
For a current DHT server list please visit http://wiki.tox.im/Servers For a current DHT node list please visit http://wiki.tox.im/nodes

View File

@ -15,5 +15,5 @@ DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \
$(NACL_LIBS) \ $(NACL_LIBS) \
$(WINSOCK2_LIBS) $(WINSOCK2_LIBS)
EXTRA_DIST += $(top_srcdir)/other/DHTservers \ EXTRA_DIST += $(top_srcdir)/other/DHTnodes \
$(top_srcdir)/other/tox.png $(top_srcdir)/other/tox.png

View File

@ -3,10 +3,10 @@ if BUILD_DHT_BOOTSTRAP_DAEMON
noinst_PROGRAMS += tox_bootstrap_daemon noinst_PROGRAMS += tox_bootstrap_daemon
tox_bootstrap_daemon_SOURCES = \ tox_bootstrap_daemon_SOURCES = \
../other/bootstrap_serverdaemon/tox_bootstrap_daemon.c ../other/bootstrap_daemon/tox_bootstrap_daemon.c
tox_bootstrap_daemon_CFLAGS = \ tox_bootstrap_daemon_CFLAGS = \
-I$(top_srcdir)/other/bootstrap_serverdaemon \ -I$(top_srcdir)/other/bootstrap_daemon \
$(LIBSODIUM_CFLAGS) \ $(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS) \ $(NACL_CFLAGS) \
$(LIBCONFIG_CFLAGS) $(LIBCONFIG_CFLAGS)
@ -22,6 +22,6 @@ tox_bootstrap_daemon_LDADD = \
endif endif
EXTRA_DIST += \ EXTRA_DIST += \
$(top_srcdir)/other/bootstrap_serverdaemon/conf \ $(top_srcdir)/other/bootstrap_daemon/conf \
$(top_srcdir)/other/bootstrap_serverdaemon/tox_bootstrap_daemon.sh $(top_srcdir)/other/bootstrap_daemon/tox_bootstrap_daemon.sh

View File

@ -1,4 +1,4 @@
// ProjectTox dht bootstrap server daemon configuration file. // ProjectTox dht bootstrap node daemon configuration file.
// Listening port. // Listening port.
port = 33445 port = 33445
@ -20,20 +20,21 @@ enable_ipv6 = false
// Automatically bootstrap with nodes on local area network. // Automatically bootstrap with nodes on local area network.
enable_lan_discovery = true enable_lan_discovery = true
// Any number of servers the daemon will bootstrap itself from. // Any number of nodes the daemon will bootstrap itself from.
// Remember to replace the provided example with your own server list. // Remember to replace the provided example with your own node list.
// You may leave the list empty or remove "bootstrap_servers" complitely, // There is a maintained list of bootstrap nodes on Tox's wiki, if you need it.
// You may leave the list empty or remove "bootstrap_nodes" complitely,
// in both cases this will be interpreted as if you don't want to bootstrap // in both cases this will be interpreted as if you don't want to bootstrap
// from anyone. // from anyone.
bootstrap_servers = ( bootstrap_nodes = (
{ // Server 1 { // Node 1
// Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also // Any ipv4 or ipv6, depending if `enable_ipv6` is set or not, and also
// any US-ASCII domain name. // any US-ASCII domain name.
address = "198.46.136.167" address = "198.46.136.167"
port = 33445 port = 33445
public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854" public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854"
}, },
{ // Server 2 { // Node 2
address = "example.org" address = "example.org"
port = 33445 port = 33445
public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858" public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858"

View File

@ -1,6 +1,6 @@
/* tox_bootstrap_daemon.c /* tox_bootstrap_daemon.c
* *
* Tox DHT bootstrap server daemon. * Tox DHT bootstrap node daemon.
* *
* Copyright (C) 2014 Tox project All Rights Reserved. * Copyright (C) 2014 Tox project All Rights Reserved.
* *
@ -92,7 +92,7 @@ int manage_keys(DHT *dht, char *keys_file_path)
fclose(keys_file); fclose(keys_file);
// We want our DHT public key to be the same as our internal one since this is a bootstrap server // We want our DHT public key to be the same as our internal one since this is a bootstrap node
memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
@ -184,14 +184,14 @@ int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_fi
return 1; return 1;
} }
// Bootstraps servers listed in the config file // Bootstraps nodes listed in the config file
// //
// returns 1 on success, some or no bootstrap servers were added // returns 1 on success, some or no bootstrap nodes were added
// 0 on failure, a error accured while parsing config file // 0 on failure, a error accured while parsing config file
int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
{ {
const char *NAME_BOOTSTRAP_SERVERS = "bootstrap_servers"; const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes";
const char *NAME_PUBLIC_KEY = "public_key"; const char *NAME_PUBLIC_KEY = "public_key";
const char *NAME_PORT = "port"; const char *NAME_PORT = "port";
@ -207,16 +207,16 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
return 0; return 0;
} }
config_setting_t *server_list = config_lookup(&cfg, NAME_BOOTSTRAP_SERVERS); config_setting_t *node_list = config_lookup(&cfg, NAME_BOOTSTRAP_NODES);
if (server_list == NULL) { if (node_list == NULL) {
syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_SERVERS); syslog(LOG_WARNING, "No '%s' setting in the configuration file. Skipping bootstrapping.\n", NAME_BOOTSTRAP_NODES);
config_destroy(&cfg); config_destroy(&cfg);
return 1; return 1;
} }
if (config_setting_length(server_list) == 0) { if (config_setting_length(node_list) == 0) {
syslog(LOG_WARNING, "No bootstrap servers found. Skipping bootstrapping.\n"); syslog(LOG_WARNING, "No bootstrap nodes found. Skipping bootstrapping.\n");
config_destroy(&cfg); config_destroy(&cfg);
return 1; return 1;
} }
@ -225,45 +225,45 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
const char *bs_address; const char *bs_address;
const char *bs_public_key; const char *bs_public_key;
config_setting_t *server; config_setting_t *node;
int i = 0; int i = 0;
while (config_setting_length(server_list)) { while (config_setting_length(node_list)) {
server = config_setting_get_elem(server_list, 0); node = config_setting_get_elem(node_list, 0);
if (server == NULL) { if (node == NULL) {
config_destroy(&cfg); config_destroy(&cfg);
return 0; return 0;
} }
// Check that all settings are present // Check that all settings are present
if (config_setting_lookup_string(server, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) { if (config_setting_lookup_string(node, NAME_PUBLIC_KEY, &bs_public_key) == CONFIG_FALSE) {
syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PUBLIC_KEY); syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PUBLIC_KEY);
goto next; goto next;
} }
if (config_setting_lookup_int(server, NAME_PORT, &bs_port) == CONFIG_FALSE) { if (config_setting_lookup_int(node, NAME_PORT, &bs_port) == CONFIG_FALSE) {
syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_PORT); syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_PORT);
goto next; goto next;
} }
if (config_setting_lookup_string(server, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) { if (config_setting_lookup_string(node, NAME_ADDRESS, &bs_address) == CONFIG_FALSE) {
syslog(LOG_WARNING, "Bootstrap server #%d: Couldn't find '%s' setting. Skipping the server.\n", i, NAME_ADDRESS); syslog(LOG_WARNING, "Bootstrap node #%d: Couldn't find '%s' setting. Skipping the node.\n", i, NAME_ADDRESS);
goto next; goto next;
} }
// Process settings // Process settings
if (strlen(bs_public_key) != 64) { if (strlen(bs_public_key) != 64) {
syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_PUBLIC_KEY, syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_PUBLIC_KEY,
bs_public_key); bs_public_key);
goto next; goto next;
} }
// not (1 <= port <= 65535) // not (1 <= port <= 65535)
if (bs_port < 1 || bs_port > 65535) { if (bs_port < 1 || bs_port > 65535) {
syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %d. Skipping the server.\n", i, NAME_PORT, bs_port); syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %d. Skipping the node.\n", i, NAME_PORT, bs_port);
goto next; goto next;
} }
@ -273,17 +273,17 @@ int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6)
free(bs_public_key_bin); free(bs_public_key_bin);
if (!address_resolved) { if (!address_resolved) {
syslog(LOG_WARNING, "Bootstrap server #%d: Invalid '%s': %s. Skipping the server.\n", i, NAME_ADDRESS, bs_address); syslog(LOG_WARNING, "Bootstrap node #%d: Invalid '%s': %s. Skipping the node.\n", i, NAME_ADDRESS, bs_address);
goto next; goto next;
} }
syslog(LOG_DEBUG, "Successfully added bootstrap server #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); syslog(LOG_DEBUG, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key);
next: next:
// config_setting_lookup_string() allocates string inside and doesn't allow us to free it // config_setting_lookup_string() allocates string inside and doesn't allow us to free it
// so in order to reuse `bs_public_key` and `bs_address` we have to remove the element // so in order to reuse `bs_public_key` and `bs_address` we have to remove the element
// which will cause libconfig to free allocated strings // which will cause libconfig to free allocated strings
config_setting_remove_elem(server_list, 0); config_setting_remove_elem(node_list, 0);
i++; i++;
} }
@ -378,9 +378,9 @@ int main(int argc, char *argv[])
} }
if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); syslog(LOG_DEBUG, "List of bootstrap nodes read successfully\n");
} else { } else {
syslog(LOG_ERR, "Couldn't read list of bootstrap servers in %s. Exiting.\n", cfg_file_path); syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path);
return 1; return 1;
} }
@ -449,7 +449,7 @@ int main(int argc, char *argv[])
networking_poll(dht->net); networking_poll(dht->net);
if (waiting_for_dht_connection && DHT_isconnected(dht)) { if (waiting_for_dht_connection && DHT_isconnected(dht)) {
syslog(LOG_DEBUG, "Connected to other bootstrap server successfully.\n"); syslog(LOG_DEBUG, "Connected to other bootstrap node successfully.\n");
waiting_for_dht_connection = 0; waiting_for_dht_connection = 0;
} }

View File

@ -1,8 +1,8 @@
/* bootstrap_server_packets.c /* bootstrap_node_packets.c
* *
* Special bootstrap server only packets. * Special bootstrap node only packets.
* *
* Include it in your bootstrap server and use: bootstrap_set_callbacks() to enable. * Include it in your bootstrap node and use: bootstrap_set_callbacks() to enable.
* *
* Copyright (C) 2013 Tox project All Rights Reserved. * Copyright (C) 2013 Tox project All Rights Reserved.
* *

View File

@ -995,7 +995,7 @@ void print_help(char *prog_name)
puts("Options: (order IS relevant)"); puts("Options: (order IS relevant)");
puts(" --ipv4 / --ipv6 [Optional] Support IPv4 only or IPv4 & IPv6."); puts(" --ipv4 / --ipv6 [Optional] Support IPv4 only or IPv4 & IPv6.");
puts(" IP PORT KEY [REQUIRED] A server to connect to (IP/Port) and its key."); puts(" IP PORT KEY [REQUIRED] A node to connect to (IP/Port) and its key.");
puts(" -f keyfile [Optional] Specify a keyfile to read from and write to."); puts(" -f keyfile [Optional] Specify a keyfile to read from and write to.");
} }

View File

@ -149,7 +149,7 @@ typedef int sock_t;
#define NET_PACKET_ONION_RECV_2 141 #define NET_PACKET_ONION_RECV_2 141
#define NET_PACKET_ONION_RECV_1 142 #define NET_PACKET_ONION_RECV_1 142
/* Only used for bootstrap servers */ /* Only used for bootstrap nodes */
#define BOOTSTRAP_INFO_PACKET_ID 240 #define BOOTSTRAP_INFO_PACKET_ID 240

View File

@ -385,23 +385,19 @@ void tox_callback_status_message(Tox *tox, void (*function)(Messenger *tox, int,
/* Set the callback for status type changes. /* Set the callback for status type changes.
* function(int friendnumber, USERSTATUS kind) * function(int friendnumber, USERSTATUS kind)
*/ */
void tox_callback_user_status(Tox *tox, void (*_function)(Tox *tox, int, TOX_USERSTATUS, void *), void *userdata) void tox_callback_user_status(Tox *tox, void (*function)(Messenger *tox, int, TOX_USERSTATUS, void *), void *userdata)
{ {
Messenger *m = tox; Messenger *m = tox;
typedef void (*function_type)(Messenger *, int, USERSTATUS, void *);
function_type function = (function_type)_function;
m_callback_userstatus(m, function, userdata); m_callback_userstatus(m, function, userdata);
} }
/* Set the callback for typing changes. /* Set the callback for typing changes.
* function (int friendnumber, int is_typing) * function (int friendnumber, int is_typing)
*/ */
void tox_callback_typing_change(Tox *tox, void (*function)(Tox *tox, int, int, void *), void *userdata) void tox_callback_typing_change(Tox *tox, void (*function)(Messenger *tox, int, int, void *), void *userdata)
{ {
Messenger *m = tox; Messenger *m = tox;
typedef void (*function_type)(Messenger *, int, int, void *); m_callback_typingchange(m, function, userdata);
function_type function_new = (function_type)function;
m_callback_typingchange(m, function_new, userdata);
} }
/* Set the callback for read receipts. /* Set the callback for read receipts.