From 3a3d8ab5e46b3cf0a8414fa668475c7a4d1fdbec Mon Sep 17 00:00:00 2001 From: "emdee@spm.plastiras.org" Date: Fri, 8 Mar 2024 04:02:20 +0000 Subject: [PATCH] updates --- README.md | 22 +++++++++++++++------- src/twc-commands.c | 37 +++++++++++++++++++++++++++++++++++-- src/twc-tox-callbacks.c | 7 ++++++- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d6ca028..16378ac 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ Tox-WeeChat is a [Tox][1] protocol plugin for [WeeChat][2]. It is functional, but lacks certain features that might be expected of a full-fledged Tox client. Originally from the abandonned https://github.com/haavard/tox-weechat -Tox-WeeChat is compliant with all "Required" points in the [Tox Client -Standard][3]. - +Tox-WeeChat is compliant with all "Required" points in the +[Tox Client Standard][3]. There is no support for NGC groups. ## Features + - One-to-one chats - Conference chats (text only) - Proxy support @@ -16,7 +16,8 @@ Standard][3]. - File transfer ## Installation -Tox-WeeChat requires [WeeChat][2] (tested with version 2.3) and [TokTok + +Tox-WeeChat requires [WeeChat][2] (tested with version 4.1.2) and [TokTok c-toxcore][4] (tested with version 0.2.18). CMake 2.8.12 or newer is also required to build. @@ -41,12 +42,15 @@ an example. - Create a new profile with `/tox create `. The data file is stored in `~/.cache/weechat/tox/` by default. - Load your profile and connect to the Tox network with - `/tox load `. + `/tox load ` (see also /bootstrap, /conf, /friend, /invite, + /me, /msg, /myid, /name, /names, /nospam, /part, /send, + /status, /statusmsg, /topic, /tox). - Run `/help -listfull tox` to get a list of all available commands, and `/set tox.*` for a list of options, including proxies. ### Common issues #### Long Tox names messing up WeeChat layout + Tox allows names up to 128 bytes long. To prevent long names from taking all your screen space, you can set the following options in WeeChat: - `weechat.bar.nicklist.size_max` @@ -54,8 +58,10 @@ your screen space, you can set the following options in WeeChat: - `buffers.look.name_size_max` (if using buffers.pl) #### Tox won't connect through my proxy + Make sure the proxy type, address and port is correct, and that UDP is -disabled (`/set tox.profile.*.udp`) and probably IPv6. +disabled (`/set tox.profile.*.udp`) and it is required to disable IPv6 +(`/set tox.profile.*.ipv6`). ## License Copyright (c) 2018 HÃ¥vard Pettersson @@ -83,4 +89,6 @@ along with Tox-WeeChat. If not, see . --- This is a hard fork of https://github.com/haavard/tox-weechat/ -now at https://git.macaw.me/emdee/tox-weechat +now at https://git.macaw.me/emdee/tox-weechat You can also run weechat under +toxygen https://git.macaw.me/emdee/toxygen using qweechat +https://git.macaw.me/emdee/qweechat diff --git a/src/twc-commands.c b/src/twc-commands.c index e47b5b6..297c49c 100644 --- a/src/twc-commands.c +++ b/src/twc-commands.c @@ -231,6 +231,16 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer, } else if (argc > 2 && strlen(argv[2]) > 0) { if (weechat_strcasecmp(argv[2], "0") == 0) { TOX_CONNECTION status; + if (!(profile)) { + weechat_printf(profile->buffer, "%sInvalid profile.", + weechat_prefix("error")); + return WEECHAT_RC_OK; + } + if (!(profile->tox)) { + weechat_printf(profile->buffer, "%sInvalid tox in profile.", + weechat_prefix("error")); + return WEECHAT_RC_OK; + } status = tox_self_get_connection_status(profile->tox); if ( status == TOX_CONNECTION_NONE) { weechat_printf(profile->buffer, @@ -285,6 +295,18 @@ twc_cmd_bootstrap(const void *pointer, void *data, struct t_gui_buffer *buffer, } else if (argc > 2 && strlen(argv[2]) > 0) { if (weechat_strcasecmp(argv[2], "0") == 0) { TOX_CONNECTION status; + if (!(profile)) { + weechat_printf(profile->buffer, + "%sNo profile.", + weechat_prefix("network")); + return WEECHAT_RC_OK; + } + if (!(profile->tox)) { + weechat_printf(profile->buffer, + "%sNo tox in profile.", + weechat_prefix("network")); + return WEECHAT_RC_OK; + } status = tox_self_get_connection_status(profile->tox); if ( status == TOX_CONNECTION_NONE) { weechat_printf(profile->buffer, @@ -557,8 +579,19 @@ twc_cmd_friend(const void *pointer, void *data, struct t_gui_buffer *buffer, { char *endptr; unsigned long num = strtoul(argv[2], &endptr, 10); - if (endptr == argv[2] || - (request = twc_friend_request_with_index(profile, num)) == NULL) + if (endptr == argv[2]) + { + weechat_printf(profile->buffer, "%sInvalid friend request ID.", + weechat_prefix("error")); + return WEECHAT_RC_OK; + } + if (!(profile)) + { + weechat_printf(profile->buffer, "%sInvalid profile.", + weechat_prefix("error")); + return WEECHAT_RC_OK; + } + if ((request = twc_friend_request_with_index(profile, num)) == NULL) { weechat_printf(profile->buffer, "%sInvalid friend request ID.", weechat_prefix("error")); diff --git a/src/twc-tox-callbacks.c b/src/twc-tox-callbacks.c index 1a8ba7a..a77dc84 100644 --- a/src/twc-tox-callbacks.c +++ b/src/twc-tox-callbacks.c @@ -796,12 +796,17 @@ twc_tox_log_callback(Tox *tox, TOX_LOG_LEVEL level, const char *file, { case TOX_LOG_LEVEL_TRACE: color = weechat_color("gray"); + if (weechat_strcasecmp(file, "network.c") == 0) + return; + if (weechat_strcasecmp(file, "onion_client.c") == 0 && + weechat_strcasecmp(file, "onion_isconnected") != 0) + return; break; case TOX_LOG_LEVEL_DEBUG: color = weechat_color("white"); break; case TOX_LOG_LEVEL_INFO: - color = weechat_color("lightblue"); + color = weechat_color("lightgreen"); break; case TOX_LOG_LEVEL_WARNING: color = weechat_color("yellow");