This commit is contained in:
emdee 2022-11-11 11:40:14 +00:00
parent d40d314f6a
commit b72ca69a8a
9 changed files with 309 additions and 93 deletions

View file

@ -20,6 +20,9 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(tox-weechat C) project(tox-weechat C)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/var/local/src/c-toxcore/toxcore -I/var/local/src/c-toxcore/toxac -I/var/local/src/c-toxcore/toxencryptsave")
set(LD_FLAGS "${LD_FLAGS} -I/var/local/src/c-toxcore/_build")
add_library(tox MODULE add_library(tox MODULE
src/twc.c src/twc.c
src/twc-bootstrap.c src/twc-bootstrap.c
@ -29,7 +32,7 @@ add_library(tox MODULE
src/twc-config.c src/twc-config.c
src/twc-friend-request.c src/twc-friend-request.c
src/twc-gui.c src/twc-gui.c
src/twc-group-invite.c src/twc-conf-invite.c
src/twc-list.c src/twc-list.c
src/twc-message-queue.c src/twc-message-queue.c
src/twc-profile.c src/twc-profile.c

View file

@ -21,14 +21,19 @@
import re import re
import sys import sys
import os
import json import json
import datetime import datetime
import textwrap import textwrap
import urllib.request import urllib.request
if __name__ == '__main__': def iMain(surl):
with urllib.request.urlopen('https://nodes.tox.chat/json') as response: if os.path.exists(surl):
data = json.load(response) with open(surl, 'rt') as response:
data = json.load(response)
else:
with urllib.request.urlopen(surl) as response:
data = json.load(response)
# get online nodes that are defined by IP address # get online nodes that are defined by IP address
nodes = [node for node in data['nodes'] nodes = [node for node in data['nodes']
@ -52,3 +57,32 @@ if __name__ == '__main__':
print(' {{"{}",'.format(key)) print(' {{"{}",'.format(key))
print(' "{}", {}}},'.format(address, port)) print(' "{}", {}}},'.format(address, port))
print('};') print('};')
# get online nodes that are defined by IP address
nodes = [node for node in data['nodes']
if (node['status_tcp'] and node['tcp_ports'])
and re.match(r'^\d+\.\d+\.\d+\.\d+$', node['ipv4'])]
print('static struct t_twc_bootstrap_node const twc_bootstrap_relays[] = {')
for node in nodes:
for port in node['tcp_ports']:
# extract relevant values from node dictionaries
address = node['ipv4']
key = node['public_key']
comment = 'Maintainer: {}, location: {}'.format(
node['maintainer'], node['location'])
print(' /* {} */'.format(comment))
print(' {{"{}",'.format(key))
print(' "{}", {}}},'.format(address, port))
print('};')
return 0
if __name__ == '__main__':
if len(sys.argv) > 1:
surl = sys.argv[1]
else:
surl = 'https://nodes.tox.chat/json'
sys.exit(iMain(surl))

View file

@ -30,81 +30,155 @@ struct t_twc_bootstrap_node
uint16_t const port; uint16_t const port;
}; };
/* bootstrap nodes generated by misc/getnodes.py /* bootstrap nodes generated by /o/var/local/src/tox-weechat/misc/getnodes.py
* last generated 2018-04-12T22:40:44.123211 */ * last generated 2022-11-11T08:54:10.303144 */
static struct t_twc_bootstrap_node const twc_bootstrap_nodes[] = { static struct t_twc_bootstrap_node const twc_bootstrap_nodes[] = {
/* Maintainer: Manolis, location: DE */ /* Maintainer: MAH69K, location: RU */
{"461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F",
"130.133.110.14", 33445},
/* Maintainer: Busindre, location: US */
{"A179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702",
"205.185.116.116", 33445},
/* Maintainer: Busindre, location: US */
{"1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F",
"198.98.51.198", 33445},
/* Maintainer: ray65536, location: RU */
{"8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832",
"85.172.30.117", 33445},
/* Maintainer: fluke571, location: SI */
{"3CEE1F054081E7A011234883BC4FC39F661A55B73637A5AC293DDF1251D9432B",
"194.249.212.109", 33445},
/* Maintainer: MAH69K, location: UA */
{"DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43", {"DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43",
"185.25.116.107", 33445}, "85.143.221.42", 33445},
/* Maintainer: pucetox, location: FR */ /* Maintainer: initramfs, location: TW */
{"7AED21F94D82B05774F697B209628CD5A9AD17E0C073D9329076A4C28ED28147", {"3F0A45A268367C1BEA652F258C85F4A66DA76BCAA667A49E770BCC4917AB6A25",
"217.182.143.254", 2306}, "114.35.245.150", 33445},
/* Maintainer: ru_maniac, location: US */
{"0FB96EEBFB1650DDB52E70CF773DDFCABE25A95CC3BB50FC251082E4B63EF82A",
"104.223.122.15", 33445},
/* Maintainer: a68366, location: FR */
{"AEC204B9A4501412D5F0BB67D9C81B5DB3EE6ADA64122D32A3E9B093D544327D",
"51.254.84.212", 33445},
/* Maintainer: Skey, location: NL */
{"B71E91E2F5029B0A84D3B1136319CDD3D1DB6D3702B6CEFA66A4BEB25A635916",
"213.183.51.211", 33445},
/* Maintainer: t3mp, location: RU */
{"5625A62618CB4FCA70E147A71B29695F38CC65FF0CBD68AD46254585BE564802",
"92.54.84.70", 33445},
/* Maintainer: HooinKyoma, location: SE */
{"672DBE27B4ADB9D5FB105A6BB648B2F8FDB89B3323486A7A21968316E012023C",
"95.215.44.78", 33445},
/* Maintainer: LittleVulpix, location: FR */
{"2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B",
"163.172.136.118", 33445},
/* Maintainer: Yani, location: NL */
{"E59A0E71ADA20D35BD1B0957059D7EF7E7792B3D680AE25C6F4DBBA09114D165",
"37.97.185.116", 33445},
/* Maintainer: linxon, location: RU */
{"B38255EE4B054924F6D79A5E6E5889EC94B6ADF6FE9906F97A3D01E3D083223A",
"80.87.193.193", 33445},
/* Maintainer: Stranger, location: UA */
{"813C8F4187833EF0655B10F7752141A352248462A567529A38B6BBF73E979307",
"46.229.52.198", 33445},
/* Maintainer: velusip, location: CA */ /* Maintainer: velusip, location: CA */
{"7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C", {"7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C",
"149.56.140.5", 33445}, "144.217.167.73", 33445},
/* Maintainer: dvor, location: NL */ /* Maintainer: Cody, location: US */
{"2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B", {"BEF0CFB37AF874BD17B9A8F9FE64C75521DB95A37D33C5BDB00E9CF58659C04F",
"185.14.30.213", 443}, "198.199.98.108", 33445},
/* Maintainer: CeBe, location: DE */ /* Maintainer: GDR!, location: US */
{"6EE1FADE9F55CC7938234CC07C864081FC606D8FE7B751EDA217F268F1078A39", {"3091C6BEB2A993F1C6300C16549FABA67098FF3D62C6D253828B531470B53D68",
"136.243.141.187", 443}, "205.185.115.131", 53},
/* Maintainer: Pokemon, location: NL */ /* Maintainer: kotelnik, location: DE */
{"1B5A8AB25FFFB66620A531C4646B47F0F32B74C547B30AF8BD8266CA50A3AB59",
"37.48.122.22", 33445},
/* Maintainer: warlomak, location: RU */
{"FFAC871E85B1E1487F87AE7C76726AE0E60318A85F6A1669E04C47EB8DC7C72D",
"79.140.30.52", 33445},
/* Maintainer: ru_maniac, location: US */
{"3925752E43BF2F8EB4E12B0E9414311064FF2D76707DC7D5D2CCB43F75081F6B",
"104.223.122.204", 33445},
/* Maintainer: GDR!, location: PL */
{"B9D109CC820C69A5D97A4A1A15708107C6BA85C13BC6188CC809D374AFF18E63",
"77.55.211.53", 53},
/* Maintainer: clearmartin, location: DE */
{"CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707", {"CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707",
"46.101.197.175", 443}, "46.101.197.175", 33445},
/* Maintainer: 2mf, location: DE */
{"B3E5FA80DC8EBD1149AD2AB35ED8B85BD546DEDE261CA593234C619249419506",
"49.12.229.145", 33445},
/* Maintainer: tux1973, location: DE */
{"B84E865125B4EC4C368CD047C72BCE447644A2DC31EF75BD2CDA345BFD310107",
"195.201.7.101", 33445},
/* Maintainer: Tha_14, location: MD */
{"836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409",
"114.35.245.150", 33445},
/* Maintainer: Nikat, location: RU */
{"1911341A83E02503AB1FD6561BD64AF3A9D6C3F12B5FBB656976B2E678644A67",
"188.225.9.167", 33445},
/* Maintainer: miaoski, location: TW */
{"5716530A10D362867C8E87EE1CD5362A233BAFBBA4CF47FA73B7CAD368BD5E6E",
"122.116.39.151", 33445},
/* Maintainer: Cüber, location: LV */
{"534A589BA7427C631773D13083570F529238211893640C99D1507300F055FE73",
"195.123.208.139", 33445},
/* Maintainer: ToxTom, location: CA */
{"F76A11284547163889DDC89A7738CF271797BF5E5E220643E97AD3C7E7903D55",
"139.162.110.188", 33445},
/* Maintainer: Cüber, location: US */
{"28DB44A3CEEE69146469855DFFE5F54DA567F5D65E03EFB1D38BBAEFF2553255",
"198.98.49.206", 33445},
/* Maintainer: Toxdaemon, location: RU */
{"DA98A4C0CD7473A133E115FEA2EBDAEEA2EF4F79FD69325FC070DA4DE4BA3238",
"5.19.249.240", 38296},
};
static struct t_twc_bootstrap_node const twc_bootstrap_relays[] = {
/* Maintainer: MAH69K, location: RU */
{"DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43",
"85.143.221.42", 33445},
/* Maintainer: MAH69K, location: RU */
{"DA4E4ED4B697F2E9B000EEFE3A34B554ACD3F45F5C96EAEA2516DD7FF9AF7B43",
"85.143.221.42", 3389},
/* Maintainer: initramfs, location: TW */
{"3F0A45A268367C1BEA652F258C85F4A66DA76BCAA667A49E770BCC4917AB6A25",
"114.35.245.150", 3389},
/* Maintainer: initramfs, location: TW */
{"3F0A45A268367C1BEA652F258C85F4A66DA76BCAA667A49E770BCC4917AB6A25",
"114.35.245.150", 33445},
/* Maintainer: velusip, location: CA */
{"7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C",
"144.217.167.73", 33445},
/* Maintainer: velusip, location: CA */
{"7E5668E0EE09E19F320AD47902419331FFEE147BB3606769CFBE921A2A2FD34C",
"144.217.167.73", 3389},
/* Maintainer: Cody, location: US */
{"BEF0CFB37AF874BD17B9A8F9FE64C75521DB95A37D33C5BDB00E9CF58659C04F",
"198.199.98.108", 33445},
/* Maintainer: Cody, location: US */
{"BEF0CFB37AF874BD17B9A8F9FE64C75521DB95A37D33C5BDB00E9CF58659C04F",
"198.199.98.108", 3389},
/* Maintainer: GDR!, location: US */
{"3091C6BEB2A993F1C6300C16549FABA67098FF3D62C6D253828B531470B53D68",
"205.185.115.131", 3389},
/* Maintainer: GDR!, location: US */
{"3091C6BEB2A993F1C6300C16549FABA67098FF3D62C6D253828B531470B53D68",
"205.185.115.131", 443},
/* Maintainer: GDR!, location: US */
{"3091C6BEB2A993F1C6300C16549FABA67098FF3D62C6D253828B531470B53D68",
"205.185.115.131", 33445},
/* Maintainer: GDR!, location: US */
{"3091C6BEB2A993F1C6300C16549FABA67098FF3D62C6D253828B531470B53D68",
"205.185.115.131", 53},
/* Maintainer: kotelnik, location: DE */
{"CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707",
"46.101.197.175", 3389},
/* Maintainer: kotelnik, location: DE */
{"CD133B521159541FB1D326DE9850F5E56A6C724B5B8E5EB5CD8D950408E95707",
"46.101.197.175", 33445},
/* Maintainer: 2mf, location: DE */
{"B3E5FA80DC8EBD1149AD2AB35ED8B85BD546DEDE261CA593234C619249419506",
"49.12.229.145", 3389},
/* Maintainer: 2mf, location: DE */
{"B3E5FA80DC8EBD1149AD2AB35ED8B85BD546DEDE261CA593234C619249419506",
"49.12.229.145", 33445},
/* Maintainer: tux1973, location: DE */
{"B84E865125B4EC4C368CD047C72BCE447644A2DC31EF75BD2CDA345BFD310107",
"195.201.7.101", 3389},
/* Maintainer: tux1973, location: DE */
{"B84E865125B4EC4C368CD047C72BCE447644A2DC31EF75BD2CDA345BFD310107",
"195.201.7.101", 33445},
/* Maintainer: Tha_14, location: MD */
{"836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409",
"114.35.245.150", 33445},
/* Maintainer: Tha_14, location: MD */
{"836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409",
"114.35.245.150", 443},
/* Maintainer: Tha_14, location: MD */
{"836D1DA2BE12FE0E669334E437BE3FB02806F1528C2B2782113E0910C7711409",
"114.35.245.150", 3389},
/* Maintainer: Nikat, location: RU */
{"1911341A83E02503AB1FD6561BD64AF3A9D6C3F12B5FBB656976B2E678644A67",
"188.225.9.167", 3389},
/* Maintainer: Nikat, location: RU */
{"1911341A83E02503AB1FD6561BD64AF3A9D6C3F12B5FBB656976B2E678644A67",
"188.225.9.167", 33445},
/* Maintainer: miaoski, location: TW */
{"5716530A10D362867C8E87EE1CD5362A233BAFBBA4CF47FA73B7CAD368BD5E6E",
"122.116.39.151", 3389},
/* Maintainer: miaoski, location: TW */
{"5716530A10D362867C8E87EE1CD5362A233BAFBBA4CF47FA73B7CAD368BD5E6E",
"122.116.39.151", 33445},
/* Maintainer: Cüber, location: LV */
{"534A589BA7427C631773D13083570F529238211893640C99D1507300F055FE73",
"195.123.208.139", 3389},
/* Maintainer: Cüber, location: LV */
{"534A589BA7427C631773D13083570F529238211893640C99D1507300F055FE73",
"195.123.208.139", 33445},
/* Maintainer: ToxTom, location: CA */
{"F76A11284547163889DDC89A7738CF271797BF5E5E220643E97AD3C7E7903D55",
"139.162.110.188", 443},
/* Maintainer: ToxTom, location: CA */
{"F76A11284547163889DDC89A7738CF271797BF5E5E220643E97AD3C7E7903D55",
"139.162.110.188", 33445},
/* Maintainer: ToxTom, location: CA */
{"F76A11284547163889DDC89A7738CF271797BF5E5E220643E97AD3C7E7903D55",
"139.162.110.188", 3389},
/* Maintainer: Cüber, location: US */
{"28DB44A3CEEE69146469855DFFE5F54DA567F5D65E03EFB1D38BBAEFF2553255",
"198.98.49.206", 33445},
/* Maintainer: Toxdaemon, location: RU */
{"DA98A4C0CD7473A133E115FEA2EBDAEEA2EF4F79FD69325FC070DA4DE4BA3238",
"5.19.249.240", 3389},
/* Maintainer: Toxdaemon, location: RU */
{"DA98A4C0CD7473A133E115FEA2EBDAEEA2EF4F79FD69325FC070DA4DE4BA3238",
"5.19.249.240", 38296},
}; };
static int const twc_bootstrap_count = static int const twc_bootstrap_count =
@ -122,7 +196,26 @@ twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port,
twc_hex2bin(public_key, TOX_ADDRESS_SIZE, binary_key); twc_hex2bin(public_key, TOX_ADDRESS_SIZE, binary_key);
TOX_ERR_BOOTSTRAP err; TOX_ERR_BOOTSTRAP err;
int result = tox_bootstrap(tox, address, port, binary_key, &err); int result;
result = tox_bootstrap(tox, address, port, binary_key, &err);
return result;
}
/**
* Bootstrap a Tox object with a relay node. Returns the result of
* tox_bootstrap_from_address.
*/
int
twc_bootstrap_relay(Tox *tox, const char *address, uint16_t port,
const char *public_key)
{
uint8_t binary_key[TOX_ADDRESS_SIZE];
twc_hex2bin(public_key, TOX_ADDRESS_SIZE, binary_key);
TOX_ERR_BOOTSTRAP err;
int result;
result = tox_add_tcp_relay(tox, address, port, binary_key, &err);
return result; return result;
} }
@ -130,10 +223,25 @@ twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port,
/** /**
* Bootstrap a Tox object with a random DHT bootstrap node. * Bootstrap a Tox object with a random DHT bootstrap node.
*/ */
void int
twc_bootstrap_random_node(Tox *tox) twc_bootstrap_random_node(Tox *tox)
{ {
int i = rand() % twc_bootstrap_count; int i = rand() % twc_bootstrap_count;
struct t_twc_bootstrap_node const *const node = &twc_bootstrap_nodes[i]; struct t_twc_bootstrap_node const *const node = &twc_bootstrap_nodes[i];
twc_bootstrap_tox(tox, node->address, node->port, node->key); int result;
result = twc_bootstrap_tox(tox, node->address, node->port, node->key);
return result;
}
/**
* Bootstrap a Tox object with a random DHT bootstrap node.
*/
int
twc_bootstrap_random_relay(Tox *tox)
{
int i = rand() % twc_bootstrap_count;
struct t_twc_bootstrap_node const *const node = &twc_bootstrap_relays[i];
int result;
result = twc_bootstrap_relay(tox, node->address, node->port, node->key);
return result;
} }

View file

@ -26,7 +26,14 @@ int
twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port, twc_bootstrap_tox(Tox *tox, const char *address, uint16_t port,
const char *public_key); const char *public_key);
void int
twc_bootstrap_random_node(Tox *tox); twc_bootstrap_random_node(Tox *tox);
int
twc_bootstrap_relay(Tox *tox, const char *address, uint16_t port,
const char *public_key);
int
twc_bootstrap_random_relay(Tox *tox);
#endif /* TOX_WEECHAT_BOOTSTRAP_H */ #endif /* TOX_WEECHAT_BOOTSTRAP_H */

View file

@ -303,7 +303,7 @@ void
twc_chat_send_message(struct t_twc_chat *chat, const char *message, twc_chat_send_message(struct t_twc_chat *chat, const char *message,
TOX_MESSAGE_TYPE message_type) TOX_MESSAGE_TYPE message_type)
{ {
TOX_ERR_CONFERENCE_SEND_MESSAGE err = TOX_ERR_CONFERENCE_SEND_MESSAGE_OK; Tox_Err_Conference_Send_Message err = TOX_ERR_CONFERENCE_SEND_MESSAGE_OK;
if (chat->friend_number >= 0) if (chat->friend_number >= 0)
{ {
twc_message_queue_add_friend_message(chat->profile, chat->friend_number, twc_message_queue_add_friend_message(chat->profile, chat->friend_number,

View file

@ -31,7 +31,7 @@
#include "twc-chat.h" #include "twc-chat.h"
#include "twc-config.h" #include "twc-config.h"
#include "twc-friend-request.h" #include "twc-friend-request.h"
#include "twc-group-invite.h" #include "twc-conf-invite.h"
#include "twc-list.h" #include "twc-list.h"
#include "twc-profile.h" #include "twc-profile.h"
#include "twc-tfer.h" #include "twc-tfer.h"
@ -215,8 +215,9 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer,
TWC_CHECK_PROFILE_LOADED(profile); TWC_CHECK_PROFILE_LOADED(profile);
/* /bootstrap connect <address> <port> <key> */ /* /bootstrap connect <address> <port> <key> */
if (argc == 5 && weechat_strcasecmp(argv[1], "connect") == 0) if (argc > 1 && weechat_strcasecmp(argv[1], "connect") == 0)
{ {
if (argc > 4 && strlen(argv[2]) > 0) {
char *address = argv[2]; char *address = argv[2];
uint16_t port = atoi(argv[3]); uint16_t port = atoi(argv[3]);
char *public_key = argv[4]; char *public_key = argv[4];
@ -227,8 +228,68 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer,
"%sBootstrap could not open address \"%s\"", "%sBootstrap could not open address \"%s\"",
weechat_prefix("error"), address); weechat_prefix("error"), address);
} }
} else if (argc > 2 && strlen(argv[2]) > 0) {
if (weechat_strcasecmp(argv[2], "0") == 0) {
TOX_CONNECTION status;
status = tox_self_get_connection_status(profile->tox);
if ( status == TOX_CONNECTION_NONE) {
weechat_printf(profile->buffer,
"%sBootstrap connected.",
weechat_prefix("network"));
} else {
weechat_printf(profile->buffer,
"%sBootstrap not connected.",
weechat_prefix("network"));
}
}
} else {
if (!twc_bootstrap_random_node(profile->tox))
{
weechat_printf(profile->buffer,
"%sBootstrap could not open random DHT",
weechat_prefix("error"));
}
};
return WEECHAT_RC_OK;
}
return WEECHAT_RC_OK; /* /bootstrap relay <address> <port> <key> */
if (argc > 1 && weechat_strcasecmp(argv[1], "relay") == 0)
{
if (argc > 4 && strlen(argv[2]) > 0) {
char *address = argv[2];
uint16_t port = atoi(argv[3]);
char *public_key = argv[4];
if (!twc_bootstrap_relay(profile->tox, address, port, public_key))
{
weechat_printf(profile->buffer,
"%sBootstrap could not open address \"%s\"",
weechat_prefix("error"), address);
}
} else if (argc > 2 && strlen(argv[2]) > 0) {
if (weechat_strcasecmp(argv[2], "0") == 0) {
TOX_CONNECTION status;
status = tox_self_get_connection_status(profile->tox);
if ( status == TOX_CONNECTION_NONE) {
weechat_printf(profile->buffer,
"%sBootstrap connected.",
weechat_prefix("network"));
} else {
weechat_printf(profile->buffer,
"%sBootstrap not connected.",
weechat_prefix("network"));
}
}
} else {
if (!twc_bootstrap_random_relay(profile->tox))
{
weechat_printf(profile->buffer,
"%sBootstrap could not open random relay",
weechat_prefix("error"));
}
};
return WEECHAT_RC_OK;
} }
return WEECHAT_RC_ERROR; return WEECHAT_RC_ERROR;
@ -1337,11 +1398,14 @@ void
twc_commands_init() twc_commands_init()
{ {
weechat_hook_command("bootstrap", "manage bootstrap nodes", weechat_hook_command("bootstrap", "manage bootstrap nodes",
"connect <address> <port> <Tox ID>", "connect <address> <port> <Tox ID>"
" || relay <address> <port> <Tox ID>",
"address: internet address of node to bootstrap with\n" "address: internet address of node to bootstrap with\n"
" port: port of the node\n" " port: port of the node\n"
" Tox ID: Tox ID of the node", " Tox ID: Tox ID of the node",
"connect", twc_cmd_bootstrap, NULL, NULL); "connect"
" || relay",
twc_cmd_bootstrap, NULL, NULL);
weechat_hook_command("friend", "manage friends", weechat_hook_command("friend", "manage friends",
"list" "list"

View file

@ -31,7 +31,7 @@
#include "twc-utils.h" #include "twc-utils.h"
#include "twc.h" #include "twc.h"
#include "twc-group-invite.h" #include "twc-conf-invite.h"
/** /**
* Add a new group invite to a profile. * Add a new group invite to a profile.

View file

@ -29,7 +29,7 @@
#include "twc-chat.h" #include "twc-chat.h"
#include "twc-friend-request.h" #include "twc-friend-request.h"
#include "twc-group-invite.h" #include "twc-conf-invite.h"
#include "twc-message-queue.h" #include "twc-message-queue.h"
#include "twc-profile.h" #include "twc-profile.h"
#include "twc-tfer.h" #include "twc-tfer.h"
@ -593,7 +593,7 @@ twc_group_title_callback(Tox *tox, uint32_t group_number, uint32_t peer_number,
void void
twc_file_recv_control_callback(Tox *tox, uint32_t friend_number, twc_file_recv_control_callback(Tox *tox, uint32_t friend_number,
uint32_t file_number, TOX_FILE_CONTROL control, uint32_t file_number, Tox_File_Control control,
void *user_data) void *user_data)
{ {
struct t_twc_profile *profile = twc_profile_search_tox(tox); struct t_twc_profile *profile = twc_profile_search_tox(tox);
@ -668,7 +668,7 @@ twc_file_chunk_request_callback(Tox *tox, uint32_t friend_number,
weechat_prefix("error"), file->filename); weechat_prefix("error"), file->filename);
return; return;
} }
enum TOX_ERR_FILE_SEND_CHUNK error; enum Tox_Err_File_Send_Chunk error;
tox_file_send_chunk(profile->tox, friend_number, file_number, position, tox_file_send_chunk(profile->tox, friend_number, file_number, position,
data, length, &error); data, length, &error);
if (error) if (error)

View file

@ -239,7 +239,7 @@ twc_set_buffer_logging(struct t_gui_buffer *buffer, bool logging)
*/ */
char * char *
twc_tox_err_file_control(enum TOX_ERR_FILE_CONTROL error) twc_tox_err_file_control(enum Tox_Err_File_Control error)
{ {
char *messages[] = { char *messages[] = {
"success", "success",
@ -256,7 +256,7 @@ twc_tox_err_file_control(enum TOX_ERR_FILE_CONTROL error)
} }
char * char *
twc_tox_err_file_get(enum TOX_ERR_FILE_GET error) twc_tox_err_file_get(enum Tox_Err_File_Get error)
{ {
char *messages[] = { char *messages[] = {
"success", "success",
@ -269,7 +269,7 @@ twc_tox_err_file_get(enum TOX_ERR_FILE_GET error)
} }
char * char *
twc_tox_err_file_seek(enum TOX_ERR_FILE_SEEK error) twc_tox_err_file_seek(enum Tox_Err_File_Seek error)
{ {
char *messages[] = { char *messages[] = {
"success", "success",
@ -284,7 +284,7 @@ twc_tox_err_file_seek(enum TOX_ERR_FILE_SEEK error)
} }
char * char *
twc_tox_err_file_send(enum TOX_ERR_FILE_SEND error) twc_tox_err_file_send(enum Tox_Err_File_Send error)
{ {
char *messages[] = { char *messages[] = {
"success", "success",
@ -298,7 +298,7 @@ twc_tox_err_file_send(enum TOX_ERR_FILE_SEND error)
} }
char * char *
twc_tox_err_file_send_chunk(enum TOX_ERR_FILE_SEND_CHUNK error) twc_tox_err_file_send_chunk(enum Tox_Err_File_Send_Chunk error)
{ {
char *messages[] = { char *messages[] = {
"success", "success",