mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-03 15:16:45 +02:00
Merge with master
This commit is contained in:
29
src/toxic.c
29
src/toxic.c
@ -58,6 +58,7 @@
|
||||
#include "message_queue.h"
|
||||
#include "execute.h"
|
||||
#include "term_mplex.h"
|
||||
#include "name_lookup.h"
|
||||
|
||||
#ifdef X11
|
||||
#include "xtra.h"
|
||||
@ -163,6 +164,7 @@ void exit_toxic_success(Tox *m)
|
||||
free_global_data();
|
||||
tox_kill(m);
|
||||
endwin();
|
||||
name_lookup_cleanup();
|
||||
|
||||
#ifdef X11
|
||||
/* We have to terminate xtra last coz reasons
|
||||
@ -912,7 +914,7 @@ static void print_usage(void)
|
||||
fprintf(stderr, " -o, --noconnect Do not connect to the DHT network\n");
|
||||
fprintf(stderr, " -p, --SOCKS5-proxy Use SOCKS5 proxy: Requires [IP] [port]\n");
|
||||
fprintf(stderr, " -P, --HTTP-proxy Use HTTP proxy: Requires [IP] [port]\n");
|
||||
fprintf(stderr, " -r, --dnslist Use specified DNSservers file\n");
|
||||
fprintf(stderr, " -r, --namelist Use specified name lookup server list\n");
|
||||
fprintf(stderr, " -t, --force-tcp Force toxic to use a TCP connection (use with proxies)\n");
|
||||
fprintf(stderr, " -T, --tcp-server Act as a TCP relay server: Requires [port]\n");
|
||||
fprintf(stderr, " -u, --unencrypt-data Unencrypt an encrypted data file\n");
|
||||
@ -940,7 +942,7 @@ static void parse_args(int argc, char *argv[])
|
||||
{"nodes", required_argument, 0, 'n'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"noconnect", no_argument, 0, 'o'},
|
||||
{"dnslist", required_argument, 0, 'r'},
|
||||
{"namelist", required_argument, 0, 'r'},
|
||||
{"force-tcp", no_argument, 0, 't'},
|
||||
{"tcp-server", required_argument, 0, 'T'},
|
||||
{"SOCKS5-proxy", required_argument, 0, 'p'},
|
||||
@ -1052,10 +1054,10 @@ static void parse_args(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
snprintf(arg_opts.dns_path, sizeof(arg_opts.dns_path), "%s", optarg);
|
||||
snprintf(arg_opts.nameserver_path, sizeof(arg_opts.nameserver_path), "%s", optarg);
|
||||
|
||||
if (!file_exists(arg_opts.dns_path))
|
||||
queue_init_message("DNSservers file not found");
|
||||
if (!file_exists(arg_opts.nameserver_path))
|
||||
queue_init_message("nameserver list not found");
|
||||
|
||||
break;
|
||||
|
||||
@ -1085,7 +1087,6 @@ static void parse_args(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Looks for an old default profile data file and blocklist, and renames them to the new default names.
|
||||
* Saves the old data files under the names "toxic_data.old" and "toxic_data_blocklist.old".
|
||||
*
|
||||
* Returns 0 on success.
|
||||
* Returns -1 on failure.
|
||||
@ -1231,7 +1232,18 @@ int main(int argc, char **argv)
|
||||
exit_toxic_err("failed in main", FATALERR_MEMORY);
|
||||
|
||||
const char *p = arg_opts.config_path[0] ? arg_opts.config_path : NULL;
|
||||
int settings_err = settings_load(user_settings, p);
|
||||
|
||||
if (settings_load(user_settings, p) == -1)
|
||||
queue_init_message("Failed to load user settings");
|
||||
|
||||
int nameserver_ret = name_lookup_init();
|
||||
|
||||
if (nameserver_ret == -1)
|
||||
queue_init_message("curl failed to initialize; name lookup service is disabled.");
|
||||
else if (nameserver_ret == -2)
|
||||
queue_init_message("Name lookup server list could not be found.");
|
||||
else if (nameserver_ret == -3)
|
||||
queue_init_message("Name lookup server list does not contain any valid entries.");
|
||||
|
||||
#ifdef X11
|
||||
if (init_xtra(DnD_callback) == -1)
|
||||
@ -1285,9 +1297,6 @@ int main(int argc, char **argv)
|
||||
|
||||
init_notify(60, 3000);
|
||||
|
||||
if (settings_err == -1)
|
||||
queue_init_message("Failed to load user settings");
|
||||
|
||||
/* screen/tmux auto-away timer */
|
||||
if (init_mplex_away_timer(m) == -1)
|
||||
queue_init_message("Failed to init mplex auto-away.");
|
||||
|
Reference in New Issue
Block a user