Separated bootstrap process to a function.
This commit is contained in:
parent
c4622ab509
commit
2192806a41
2 changed files with 15 additions and 4 deletions
|
@ -210,6 +210,14 @@ tox_weechat_status_message_callback(Tox *tox,
|
|||
tox_weechat_chat_refresh_timer_callback, chat);
|
||||
}
|
||||
|
||||
void
|
||||
tox_weechat_bootstrap(char *address, uint16_t port, char *public_key)
|
||||
{
|
||||
uint8_t *binary_key = tox_weechat_hex2bin(public_key);
|
||||
tox_bootstrap_from_address(tox, address, htons(port), binary_key);
|
||||
free(binary_key);
|
||||
}
|
||||
|
||||
void
|
||||
tox_weechat_tox_init()
|
||||
{
|
||||
|
@ -224,10 +232,8 @@ tox_weechat_tox_init()
|
|||
}
|
||||
free(data_file_path);
|
||||
|
||||
// bootstrap
|
||||
uint8_t *pub_key = tox_weechat_hex2bin(BOOTSTRAP_KEY);
|
||||
tox_bootstrap_from_address(tox, BOOTSTRAP_ADDRESS, htons(BOOTSTRAP_PORT), pub_key);
|
||||
free(pub_key);
|
||||
// bootstrap DHT
|
||||
tox_weechat_bootstrap(BOOTSTRAP_ADDRESS, BOOTSTRAP_PORT, BOOTSTRAP_KEY);
|
||||
|
||||
// start tox_do loop
|
||||
tox_weechat_do_timer_cb(NULL, 0);
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
*/
|
||||
void tox_weechat_tox_init();
|
||||
|
||||
/**
|
||||
* Bootstrap DHT using an inet address, port and a Tox address.
|
||||
*/
|
||||
void tox_weechat_bootstrap(char *address, uint16_t port, char *public_key);
|
||||
|
||||
/**
|
||||
* Dump Tox to file and de-initialize.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue