1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

Compare commits

...

177 Commits

Author SHA1 Message Date
Sébastien Helleu f07a63755c core: add CVE IDs in ChangeLog 2026-06-09 22:13:57 +02:00
Sébastien Helleu c6f30816dd tests: increase buffer size for injection of fake IRC message 2026-06-07 08:51:20 +02:00
aizu-m c55b5836f0 relay: fix out-of-bounds read in relay_http_print_log_request (#2324) 2026-06-06 14:37:21 +02:00
Sébastien Helleu e93db7f99d relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion
A relay client could send data with no end-of-line (an unterminated method
or header line) and dribble its payload, making WeeChat accumulate it in the
partial message buffer that grew without limit, until all memory was
exhausted. This path is reachable before authentication during websocket
initialization with the "weechat" and "irc" protocols.

The accumulated partial message is now bounded by
RELAY_HTTP_PARTIAL_MESSAGE_MAX_LENGTH: once the limit is reached, the extra
data is ignored.
2026-06-06 14:37:21 +02:00
aizu-m 22ee76cdd6 xfer: fix out-of-bounds read in xfer_chat_recv_cb on empty line (#2323) 2026-06-06 14:33:34 +02:00
aizu-m cf2d0733d3 irc: fix out-of-bounds read in DCC command with quoted filename (#2322) 2026-06-06 14:31:35 +02:00
aizu-m 75b72e7f69 xfer: replace directory separator in remote nick by underscore in download filename (#2321) 2026-06-06 14:21:34 +02:00
Sébastien Helleu 03a6d9306a api: fix infinite loop in function string_replace when the search string is empty 2026-06-06 14:19:37 +02:00
Sébastien Helleu 398cfc473a relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion
A relay client could announce a huge websocket frame (or HTTP body via
"Content-Length") and dribble its payload, making WeeChat accumulate it
in a buffer that grew without limit, until all memory was exhausted. The
websocket frame path is reachable before authentication with the
"weechat" and "irc" protocols.

The announced websocket frame length and HTTP "Content-Length" are now
bounded by WEBSOCKET_FRAME_MAX_LENGTH and RELAY_HTTP_BODY_MAX_LENGTH: an
oversized websocket frame closes the connection, and an oversized body is
rejected.
2026-06-06 14:19:17 +02:00
Sébastien Helleu e5df225d9f irc: limit size of data received from the server to prevent memory exhaustion
A malicious or compromised IRC server could send data with no end-of-line
(or a flood of "005" messages), making WeeChat accumulate it in a buffer
that grew without limit, until all memory was exhausted.

The unterminated received message and the accumulated "005" (ISUPPORT)
data are now bounded by IRC_SERVER_RECV_MSG_MAX_LENGTH and
IRC_SERVER_ISUPPORT_MAX_LENGTH: extra data is ignored once the limit is
reached.
2026-06-06 14:17:41 +02:00
Sébastien Helleu f5fa814fa4 core: fix timing attack on TOTP validation (GHSA-vhv8-g2r9-cwcc)
weecrypto_totp_validate compared the generated and client-supplied OTPs
with strcmp and broke out of the time-window loop on the first match.
Both choices leaked information via response timing: strcmp leaked the
expected OTP digit-by-digit (shrinking the brute-force search from
~10^digits to a handful of guesses within the 30-second window), and
the early break leaked which window offset matched.

Compare in constant time with string_memcmp_constant_time and always
iterate the full window, OR-ing the result into otp_ok without an
early exit.

This affects both relay protocols (which call totp_validate via the
public info hook) and any other caller of the info hook.
2026-06-06 14:10:15 +02:00
Sébastien Helleu 34cbe56a6f relay/irc: fix timing attack on PASS command (GHSA-vhv8-g2r9-cwcc)
The IRC relay protocol's PASS handler compared the server password with
the client-supplied value using strcmp, leaking the password byte-by-byte
via response timing. This is the same class of bug fixed for the api and
weechat protocols, on a separate code path that did not go through
relay_auth_check_password_plain.

Extract the HMAC-then-constant-time-compare logic from
relay_auth_check_password_plain into relay_auth_password_equals, then
use it in both the plain-auth wrapper and the IRC PASS handler.
2026-06-06 14:08:23 +02:00
Sébastien Helleu a17a80f1d0 relay: fix timing attack on password authentication (GHSA-vhv8-g2r9-cwcc)
The relay authentication used non-constant-time comparisons (strcasecmp,
strcmp) to verify password hashes and plaintext passwords, allowing an
attacker to derive the expected hash byte-by-byte from response timing
and then authenticate without knowing the password.

- SHA/PBKDF2 hex hash comparisons: normalize the client-supplied hash to
  uppercase and compare in constant time over the fixed expected length.
- Plaintext password comparison: HMAC-SHA256 both passwords with a fresh
  per-call random key and compare the fixed-size MACs in constant time,
  hiding both per-byte timing and the password length.

Add string_memcmp_constant_time helper in core, exposed via the plugin
API. Bump WEECHAT_PLUGIN_API_VERSION accordingly.
2026-06-06 13:01:52 +02:00
Sébastien Helleu 405707d544 relay: limit size of decompressed websocket frame to prevent memory exhaustion (GHSA-v2v4-45wm-5cr3)
An authenticated relay client using the permessage-deflate websocket
extension could send a small compressed frame that decompresses to an
unbounded amount of data, exhausting all memory and crashing WeeChat.

The output buffer in relay_websocket_inflate is now capped to
WEBSOCKET_INFLATE_MAX_SIZE: frames decompressing beyond this limit are
rejected and the connection is closed.
2026-06-06 12:58:20 +02:00
Sébastien Helleu 2a272a7543 core: set max curl version for symbols
Set max curl version for these symbols:

- CURLPROTO_RTMP: 8.20.0
- CURLPROTO_RTMPT: 8.20.0
- CURLPROTO_RTMPE: 8.20.0
- CURLPROTO_RTMPTE: 8.20.0
- CURLPROTO_RTMPS: 8.20.0
- CURLPROTO_RTMPTS: 8.20.0
- CURLAUTH_DIGEST_IE: 8.21.0
- CURLOPT_KRBLEVEL: 8.17.0
2026-06-06 12:47:07 +02:00
Sébastien Helleu d4b15ea432 ci: force version 3.39.16 of schemathesis
Version 4.0.0 of schemathesis brings major breaking changes, the API tests with
this version will be changed on main branch only.
2025-06-22 09:36:06 +02:00
Sébastien Helleu 3a954405d7 core: set max version for Curl symbol CURLOPT_SSL_FALSESTART 2025-06-21 20:34:13 +02:00
Sébastien Helleu 42ae480f0a tests: add test with a float number using a lot of decimals in calculation of expression
This test validates the fix made in commit
5b4820ab06 and will prevent regression with such
numbers.
2025-06-07 17:01:11 +02:00
Sébastien Helleu f4fe63c312 core: update ChangeLog (issue #2251) 2025-05-25 10:00:24 +02:00
Sébastien Helleu 68b017935a core: fix build on FreeBSD (issue #2251)
Check if the resolv library is found before checking if it has res_init.
2025-05-25 09:58:19 +02:00
Albert Lee 97ceefd183 core: avoid dynamic format strings for Clang -Werror=format-security 2025-05-25 09:58:17 +02:00
Albert Lee 7a757d94c0 gui: use NCURSES_CFLAGS if available 2025-05-25 09:58:08 +02:00
Albert Lee f07d439cec python: use built-in CMake FindPython module from CMake 3.12 or higher 2025-05-25 09:57:59 +02:00
Albert Lee 3f670d31fe core: always define _XPG4_2 and __EXTENSIONS__ on Solaris/illumos 2025-05-25 09:56:21 +02:00
Albert Lee 558087325d core: check if res_init requires linking with libresolv 2025-05-25 09:56:19 +02:00
Albert Lee 3766d52bd3 core: improve support for non-macro htonll and htobe64 2025-05-25 09:56:17 +02:00
Albert Lee 2df0b3e2c3 core: use same msgfmt invocation to perform checks and create weechat.mo
On Illumos, msgfmt aborts when `--output-file=/dev/null` is used.
2025-05-25 09:56:15 +02:00
Albert Lee c1115c04d5 lua: use LUA_CFLAGS from pkg-config 2025-05-25 09:56:12 +02:00
Albert Lee e6d850daa0 core: include pthread.h for pthread types 2025-05-25 09:56:10 +02:00
Sébastien Helleu a0ffb9e5dd core, plugins: replace "%p" by "%lx" in calls to sscanf 2025-05-18 22:29:39 +02:00
Sébastien Helleu 95a940294e Revert "core, plugins: replace "%lx" by "%p" in calls to sscanf"
This reverts commit e64ab3c675.

This was causing incorrect conversion of strings "0x..." to pointers on systems
like Solaris/illumos.

And as a side effect, buffers were sometimes empty in weechat relay clients
like glowing-bear.
2025-05-18 22:29:39 +02:00
Sébastien Helleu d49c6515e4 relay/api: use specifier %@ for times formatted by util_strftimeval 2025-05-18 22:23:14 +02:00
Sébastien Helleu 2f375b652b core: add support of specifier %@ for UTC time in function util_strftimeval 2025-05-18 22:23:04 +02:00
Sébastien Helleu 8a024dddad Version 4.6.4-dev 2025-05-11 11:25:48 +02:00
Sébastien Helleu 951c030082 Version 4.6.3 2025-05-11 11:22:11 +02:00
Sébastien Helleu 5def4f72fe core: add API function util_version_number in upgrade guidelines 2025-05-11 10:00:27 +02:00
Sébastien Helleu 3db2f71112 core: fix buffer overflow in function eval_string_range_chars 2025-05-10 21:38:26 +02:00
Sébastien Helleu 09917a807b core: fix buffer overflow in function eval_string_base_encode 2025-05-10 21:31:22 +02:00
Sébastien Helleu 334f88ae2c core: fix buffer overflow in function eval_syntax_highlight_colorize 2025-05-10 21:30:33 +02:00
Sébastien Helleu 2e14645691 core: fix buffer overflow in function util_parse_time 2025-05-08 19:18:59 +02:00
Sébastien Helleu 2c0bbdf9b9 core: fix integer overflow in function util_version_number 2025-05-08 19:18:59 +02:00
Sébastien Helleu 5839df90e7 core: fix memory leak in function util_parse_delay 2025-05-08 18:39:03 +02:00
Sébastien Helleu 6082453002 core: fix integer overflow in base32 encoding/decoding 2025-05-05 21:39:00 +02:00
Sébastien Helleu d0568dce79 core: fix integer overflow with decimal numbers in calculation of expression 2025-05-05 21:38:28 +02:00
Sébastien Helleu 00a873dda0 ci: replace TCL 8.7 by 8.6 in FreeBSD CI 2025-04-21 08:47:37 +02:00
Sébastien Helleu 18e2badfbd Version 4.6.3-dev 2025-04-18 20:43:53 +02:00
Sébastien Helleu 120b048efb Version 4.6.2 2025-04-18 20:39:02 +02:00
Sébastien Helleu 600e438b90 debian: update changelog 2025-04-18 20:03:35 +02:00
Sébastien Helleu bf3a8628ae debian: bump Standards-Version to 4.7.2 2025-04-18 20:01:08 +02:00
Sébastien Helleu 1478ecd77d core: fix write of weechat.log to stdout with weechat-headless --stdout (issue #2247) 2025-04-15 08:16:06 +02:00
Sébastien Helleu 5c9d9bc8fc core: add refresh of window title on buffer switch, when option weechat.look.window_title is set 2025-04-11 19:32:43 +02:00
Sébastien Helleu ff00323363 Version 4.6.2-dev 2025-04-09 13:37:27 +02:00
Sébastien Helleu 1d2e5ce700 Version 4.6.1 2025-04-09 13:33:19 +02:00
Sébastien Helleu 2eebe241ab core: consider all keys are safe in cursor context (issue #2244) 2025-04-04 18:55:46 +02:00
Sébastien Helleu e93cebf02c core: update ChangeLog (issue #2243) 2025-04-02 23:05:16 +02:00
Alvar Penning c3db4946b2 perl: fix build when multiplicity is not available
Building WeeChat 4.6.0 on OpenBSD failed with the following error.

> /usr/ports/pobj/weechat-4.6.0/weechat-4.6.0/src/plugins/perl/weechat-perl.c:356:13: error: expected ')'
>             function) < 0)
>             ^
> /usr/ports/pobj/weechat-4.6.0/weechat-4.6.0/src/plugins/perl/weechat-perl.c:352:9: note: to match this '('
>     if (weechat_asprintf (
>         ^
> /usr/ports/pobj/weechat-4.6.0/weechat-4.6.0/src/plugins/perl/../weechat-plugin.h:1312:31: note: expanded from macro 'weechat_asprintf'
>     (weechat_plugin->asprintf)(__result, __fmt, ##__argz)

On further inspection, the line in question was recently altered in
099e11d7b8, where a comma was forgotten in the
else branch of the MULTIPLICITY ifdef.

After adding the comma, WeeChat builds as usual.
2025-04-02 23:05:14 +02:00
Sébastien Helleu 86d4da2fd1 irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled (closes #2241) 2025-03-28 12:11:29 +01:00
Sébastien Helleu e39ef93903 Version 4.6.1-dev 2025-03-28 12:10:53 +01:00
Sébastien Helleu 9663f79746 Version 4.6.0 2025-03-23 10:42:41 +01:00
Sébastien Helleu e0b7d2a645 core: update ChangeLog 2025-03-21 07:53:29 +01:00
Nils Görs 99bb1454a4 core: update German translations 2025-03-17 11:03:14 +01:00
Sébastien Helleu caa7af253a tests: add tests on function util_strftimeval with microseconds < 0 or > 999999 2025-03-17 08:12:33 +01:00
Sébastien Helleu 36300c763d core: update ChangeLog (issue #1174) 2025-03-16 15:58:30 +01:00
Sébastien Helleu e3ffef457f core: add contributor (issue #1174) 2025-03-16 15:58:30 +01:00
Sébastien Helleu 6d11468059 spell: rename variable "broker" to "spell_enchant_broker" 2025-03-16 15:58:30 +01:00
Joe Hermaszewski 6b19987e7f spell: allow overriding dictionaries locations
Works for aspell and myspell (hunspell) when using enchant.
2025-03-16 15:58:23 +01:00
Sébastien Helleu d91039ebd0 core: update ChangeLog 2025-03-16 15:11:41 +01:00
Sébastien Helleu 2e6249588f core: update ChangeLog (issue #665) 2025-03-16 15:01:17 +01:00
Sébastien Helleu 847ce17718 xfer: replace "ETA" by "time left" 2025-03-16 15:01:17 +01:00
Andrew Potter 15e2da3aac xfer: compute speed and ETA with microsecond precision 2025-03-16 15:01:17 +01:00
Sébastien Helleu ca22e49041 core, irc: replace "long" by "long long" to store seconds in timeval structure 2025-03-16 14:05:11 +01:00
Sébastien Helleu 764b309e92 core, irc, relay: fix formatting of seconds and microseconds 2025-03-16 14:04:28 +01:00
Sébastien Helleu c0402bce52 core: fix formatting of microseconds in function util_strftimeval 2025-03-16 14:01:04 +01:00
Sébastien Helleu 9fe5fa23a0 core: convert "long long" to "unsigned long long" in functions util_get_microseconds_string and util_parse_delay 2025-03-16 11:13:25 +01:00
Nils Görs e8a335a3e3 core: update German translations 2025-03-16 10:42:23 +01:00
Sébastien Helleu e9983821e7 buflist: fix typo in help on option buflist.look.nick_prefix_empty 2025-03-16 10:36:23 +01:00
Sébastien Helleu b25a9b11a0 buflist: apply option buflist.look.nick_prefix_empty also on private and list buffers 2025-03-15 19:19:19 +01:00
Aaron Jones f5038bccbc Fix function prototypes for list of arguments
At the moment, building WeeChat triggers several thousand -Wstrict-prototypes
diagnostics.  This is due to its source code using an empty argument list for
functions and function pointers that take no arguments, instead of explicitly
declaring that they take no arguments by using a void list.

This commit replaces all empty argument lists with a void list.

Note that Ruby's headers also suffer the same problem, which WeeChat can't
do anything to fix.  Thus, building WeeChat with the Ruby plugin enabled
will still issue approximately 30 such diagnostics.
2025-03-10 08:16:52 +01:00
Nils Görs 20b2bdedc2 core: update German translations 2025-03-09 11:25:46 +01:00
Sébastien Helleu 95366c37b7 doc/api: add reference to function hook_process 2025-03-09 09:40:46 +01:00
Sébastien Helleu 80bb54fed8 doc/api: add difference between hook_url and hook_process_hashtable 2025-03-09 09:31:36 +01:00
Sébastien Helleu 68d452b559 core: improve help on option weechat.completion.nick_ignore_words 2025-03-09 08:26:09 +01:00
Nils Görs 357b7e0d55 core: update German translations 2025-03-08 09:33:15 +01:00
Krzysztof Korościk d8106f863a doc: updated polish translation 2025-03-03 22:43:55 +01:00
Sébastien Helleu 2e570c599b core: add option weechat.completion.nick_ignore_words (closes #1143) 2025-03-03 08:27:22 +01:00
Sébastien Helleu 8280a3b65b api: return input string in function string_iconv_from_internal when current locale is wrong
This fixes a bug when writing configuration files with a wrong locale: now
UTF-8 is kept and written in files instead of string converted using a wrong
charset.
2025-03-01 16:44:22 +01:00
Sébastien Helleu f7cf044f33 core: add version 4.5.2 2025-02-20 23:56:38 +01:00
Sébastien Helleu 98aca3343a debian: update changelog 2025-02-20 23:05:06 +01:00
Sébastien Helleu d9ee4a3c13 core: update ChangeLog 2025-02-20 22:54:37 +01:00
Nils Görs 19d84e975e core: update German translations 2025-02-19 08:28:08 +01:00
Sébastien Helleu c33a28cfca core: add contributor (issue #2234) 2025-02-18 22:11:27 +01:00
Sébastien Helleu 145423c11f core: update ChangeLog (issue #2234) 2025-02-18 22:11:23 +01:00
Sébastien Helleu 4865fe07e2 core: update translations (issue #2234) 2025-02-18 22:11:19 +01:00
Daniel Lublin cc163a0e7e irc: add option -connected in command /server list|listfull 2025-02-18 22:09:24 +01:00
Nils Görs 17e7796669 core: update German translations 2025-02-16 10:35:55 +01:00
Sébastien Helleu 83c4b940a6 tests: fix long lines in Python test script 2025-02-16 00:08:30 +01:00
Sébastien Helleu 8c1379e820 tests: fix indentation in Python test script 2025-02-16 00:08:15 +01:00
Sébastien Helleu e86e558f3f xfer: keep spaces at the end of /me command arguments 2025-02-15 23:42:29 +01:00
Sébastien Helleu 718a317cfb alias: keep spaces at the end of aliases commands arguments 2025-02-15 23:37:06 +01:00
Sébastien Helleu c275f9d994 alias: keep spaces at the end of /alias command arguments 2025-02-15 23:36:53 +01:00
Sébastien Helleu 9285afc3e2 irc: keep spaces at the end of /topic command arguments 2025-02-15 23:32:33 +01:00
Sébastien Helleu c7d21a3ea6 api: add function completion_set 2025-02-15 23:22:44 +01:00
Sébastien Helleu 1b54cd24ed irc: remove extra empty line 2025-02-15 21:14:10 +01:00
Sébastien Helleu d3a9e4e74b core: add extra check of string length on whitespace char options 2025-02-15 20:59:22 +01:00
Sébastien Helleu 8fd4a80af8 irc: keep spaces at the end of some command arguments
The following commands are now preserving trailing spaces in arguments
received: action, allchan, allpv, allserv, away, ctcp, me, msg, notice, query,
quote, saquit, squery, wallchops, wallops.
2025-02-15 20:54:24 +01:00
Sébastien Helleu 091a17b138 core: keep spaces at the end of some command arguments
The following commands are now preserving trailing spaces in arguments
received: allbuf, command, eval, mute, pipe, print, quit, repeat, wait.
2025-02-15 20:54:24 +01:00
Sébastien Helleu e89d6d69ad api: add property keep_spaces_right in function hook_set to keep trailing spaces in command arguments 2025-02-15 20:54:24 +01:00
Sébastien Helleu 3c9eb6dcac core: add option whitespace in command /debug (closes #947)
New options are added to configure the chars displayed for spaces and
tabulations:

- weechat.look.whitespace_char: char for spaces
- weechat.look.tab_whitespace_char: first char for tabulations
2025-02-15 20:54:14 +01:00
Ivan Pešić 8e9692809d core: update Serbian translations 2025-02-12 16:10:38 +01:00
Sébastien Helleu 6388d36858 core: remove unnecessary null check 2025-02-11 21:38:24 +01:00
Nils Görs 8198aade2e core: update German translations 2025-02-10 10:22:43 +01:00
Sébastien Helleu ca6e483cdc relay/api: add a way to toggle between remote and local command execution on remote buffers (issue #2148)
New default key:

- Alt+Ctrl+l (L): toggle execution of commands: remote/local

New options:

- relay.api.remote_input_cmd_local: text displayed for command executed locally
- relay.api.remote_input_cmd_remote: text displayed for command executed on the
  remote WeeChat
2025-02-09 18:31:37 +01:00
Sébastien Helleu 547e2b934e core: update copyright dates 2025-02-01 23:13:18 +01:00
Nils Görs 07deaf97ec core: update German translations 2025-02-01 10:36:31 +01:00
Sébastien Helleu daef5971ae core: add option -color in command /pipe 2025-02-01 09:37:22 +01:00
LuK1337 04aea1bcb5 core: use <stdbool.h> instead of typedef in ncurses-fake.h
Fixes the following error when building in Fedora rawhide:
error: ‘bool’ cannot be defined via ‘typedef’.

Likely GCC 15 related.
2025-01-26 08:54:55 +01:00
Sébastien Helleu 4b7be27028 core: add parameter name in signal handler functions 2025-01-26 08:49:15 +01:00
LuK1337 68c70e5538 core: add int arg for all sigaction.sa_handler functions
src/gui/curses/gui-curses-main.c: In function ‘gui_main_loop’:
src/gui/curses/gui-curses-main.c:399:33: error: passing argument 2 of ‘signal_catch’ from incompatible pointer type [-Wincompatible-pointer-types]
  399 |         signal_catch (SIGWINCH, &gui_main_signal_sigwinch);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 void (*)(void)
In file included from src/gui/curses/gui-curses-main.c:38:
src/gui/curses/../../core/core-signal.h:33:46: note: expected ‘void (*)(int)’ but argument is of type ‘void (*)(void)’
   33 | extern void signal_catch (int signum, void (*handler)(int));
      |                                       ~~~~~~~^~~~~~~~~~~~~
2025-01-26 08:46:04 +01:00
Nils Görs 865dd61d31 core: update German translations 2025-01-25 21:30:47 +01:00
Sébastien Helleu b53f3c2db8 core: add tags of lines in hsignal sent with command /pipe 2025-01-25 17:06:10 +01:00
Ivan Pešić 56698151db core: update Serbian translations 2025-01-21 15:58:16 +01:00
Nils Görs 1285a7d391 core: update German translations 2025-01-08 21:47:01 +01:00
Sébastien Helleu 36b62cfc5e core: add option -v to display upgrades in command /version
The number of upgrades is also displayed on startup after at least one
`/upgrade`.
2025-01-07 20:35:35 +01:00
Nils Görs d97fed80cb core: update German translations 2025-01-07 19:24:18 +01:00
Sébastien Helleu 80ca209e70 Revert "core: check "weechat" binary with command /upgrade"
This reverts commit d665e2d489.

The fix is not working when WeeChat is not executed with an absolute path.
2025-01-07 17:37:07 +01:00
Sébastien Helleu d302294723 relay/api: always return a body with field "error" in error responses 2025-01-07 07:52:09 +01:00
Sébastien Helleu 60422ca6b1 relay: remove extra space in JSON authentication error 2025-01-07 07:28:45 +01:00
Sébastien Helleu 9d3388b09e relay/api: use cjson lib to return errors 2025-01-07 07:23:55 +01:00
Sébastien Helleu d10af1037b relay/api: use cjson lib to build JSON body of handshake request 2025-01-07 07:18:01 +01:00
Sébastien Helleu 10b4fffaca relay/api: fix return code when buffer is not found in completion resource callback 2025-01-07 07:12:37 +01:00
Sébastien Helleu c48dee3211 relay/api: add schema for errors returned in OpenAPI document 2025-01-06 07:45:02 +01:00
Sébastien Helleu cf726265d1 core: fix typo in ChangeLog 2025-01-06 07:40:53 +01:00
Sébastien Helleu 8b2cdf3032 core: update ChangeLog (issue #2207) 2025-01-05 15:05:47 +01:00
Sébastien Helleu 3523b5e4e2 doc/relay/api: add doc on resource /api/completion 2025-01-05 15:03:35 +01:00
Nils c6c420c698 relay: add completion resource 2025-01-05 14:54:07 +01:00
Sébastien Helleu cfe34388fb relay/api: bump version in OpenAPI document 2025-01-05 13:05:58 +01:00
Sébastien Helleu 3eaa1a3a6e relay/api: fix name of body field "buffer_name" in doc of POST /api/input 2025-01-05 10:36:04 +01:00
Sébastien Helleu de88cd3b58 core: fix typo in /help bar 2025-01-05 10:16:51 +01:00
Sébastien Helleu b88582c7ec core: update ChangeLog (issue #2222) 2025-01-05 10:03:26 +01:00
Trygve Aaberge cab9496a70 python: define constants using PyModule_Add...Constant
This follows the recommendation from Pythons documentation for
PyModule_GetDict where it says:

    It is recommended extensions use other PyModule_* and PyObject_*
    functions rather than directly manipulate a module’s __dict__.
2025-01-05 10:03:07 +01:00
Trygve Aaberge c0c837b1be python: set m_size for created modules to 0
This value determines the size of the per-module memory area. Setting
this value to -1 as it was before this change means that the module has
global state and therefore does not support subinterpreters.

However, subinterpreters are used to run the Python scripts, so the
weechat module has to support subinterpreters. Therefore we should set
this value to 0 as no per-module memory is required.

This seems to fix the crash reported in #2046 without the need for the
workaround added in commit 85c7494dc (it does for me when testing with
Python 3.12.0 at least).

This change came up as a suggestion in cpython's issue tracker where it
was pointed out that using modules with m_size set to -1 is not
supported in subinterpreters. See these two comments:

https://github.com/python/cpython/issues/116510#issuecomment-2377915771
https://github.com/python/cpython/issues/116510#issuecomment-2389485369

It's not completely clear to me what is required for a module to support
subinterpreters and re-initialization (which is required for setting
m_size to 0), but https://peps.pythondiscord.com/pep-0489/ says:

    A simple rule of thumb is: Do not define any static data, except
    built-in types with no mutable or user-settable class attributes.

The only static data we define is of type int and str, so I think it
should be fine.
2025-01-05 09:27:38 +01:00
Emir SARI 7c30dbcf05 core: update Turkish translations 2025-01-04 18:22:08 +01:00
Sébastien Helleu d665e2d489 core: check "weechat" binary with command /upgrade
Always check that "weechat" binary exists and is executable with command
`/upgrade`, even when the path to binary is not given.
2025-01-04 18:08:19 +01:00
Nils Görs 16346255f1 core: update German translations 2024-12-23 12:47:01 +01:00
Sébastien Helleu 2a7f557f05 core: add version 4.5.1 2024-12-23 08:56:34 +01:00
Sébastien Helleu 8e8e982af6 core: fix typo in ChangeLog 2024-12-23 08:38:20 +01:00
Sébastien Helleu 883c12dec2 relay: fix description of relay clients after /upgrade 2024-12-22 19:31:06 +01:00
Sébastien Helleu ad5fde5966 relay: fix crash after /upgrade when relay clients are connected 2024-12-22 19:31:04 +01:00
Sébastien Helleu 119664d090 api: allow to add empty buffer with function infolist_new_var_buffer
This fixes the following error with `/upgrade` command when relay clients are
connected:

  relay: failed to save upgrade data
2024-12-22 19:05:52 +01:00
Sébastien Helleu 97ede70307 Revert "ci: fix macOS CI"
Remove workaround for https://github.com/actions/runner-images/issues/10984

This reverts commit 2555c378a2.
2024-12-22 10:51:52 +01:00
Sébastien Helleu c26ff6c51b core: fix detection of dl library (closes #2218)
This fixes the linking to curl and ncurses on macOS.
2024-12-21 18:06:59 +01:00
Sébastien Helleu 9e34a0e917 core: add option POST_BUILD in add_custom_command
This fixes the following CMake warning:

CMake Warning (dev) at src/gui/curses/normal/CMakeLists.txt:73 (add_custom_command):
  Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given.  Assuming
  POST_BUILD to preserve backward compatibility.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.
2024-12-21 18:02:43 +01:00
Sébastien Helleu befcd09d63 logger: fix path displayed when the logs directory can not be created 2024-12-21 17:15:38 +01:00
Sébastien Helleu 8aba934c50 xfer: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu 3b88065266 trigger: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu ce2c4b74a2 spell: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu d3d0948e2e script: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu 68dce2b47a ruby: replace call to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu b45d2105a5 relay: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu 74c63c0541 python: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu 770d87c3d6 plugin/script: replace calls to malloc by weechat_asprintf 2024-12-21 15:31:39 +01:00
Sébastien Helleu 099e11d7b8 perl: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 8af3a4cef8 lua: replace call to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 7226b005e9 logger: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 45509e1cd1 irc: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu cdb4823fad guile: replace call to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 82f0b3b121 fset: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu e6409355b6 fifo: replace call to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu e2675f5afe exec: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu e6388c1d1a charset: replace call to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 9779f56125 alias: replace calls to malloc by weechat_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 818a4c95a9 core: replace calls to malloc by string_asprintf 2024-12-21 15:12:33 +01:00
Sébastien Helleu 8f43dceedf core: update ChangeLog 2024-12-20 07:36:15 +01:00
zeromind 05c60a2292 perl: set locale only on supported Perl versions
restrict setting the locale only if the Perl version supports it (>=5.27.9)

fixes #2219
2024-12-20 07:34:20 +01:00
Sébastien Helleu 798c7a5262 core: fix parsing of command in /pipe command 2024-12-17 23:22:29 +01:00
Sébastien Helleu 732f24b6ba core: add command /pipe 2024-12-16 13:39:14 +01:00
Sébastien Helleu 0fc0071297 Version 4.6.0-dev 2024-12-15 09:07:29 +01:00
707 changed files with 13902 additions and 8282 deletions
+3 -5
View File
@@ -92,7 +92,7 @@ env:
ruby
rubygem-asciidoctor
sudo
tcl87
tcl86
zstd
jobs:
@@ -163,7 +163,7 @@ jobs:
env:
RELAY_PASSWORD: test
run: |
pipx install schemathesis
pipx install schemathesis==3.39.16
weechat-headless \
--dir /tmp/weechat-test-api \
--run-command '/set relay.network.password "${{ env.RELAY_PASSWORD }}"' \
@@ -381,9 +381,7 @@ jobs:
/usr/local/bin/python3.11 \
/usr/local/bin/python3.11-config \
;
# workaround for https://github.com/actions/runner-images/issues/10984
brew uninstall --ignore-dependencies --force pkg-config@0.29.2
brew install asciidoctor aspell cjson guile lua ruby
brew install asciidoctor aspell cjson guile lua pkg-config ruby
- uses: actions/checkout@v4
+2
View File
@@ -28,6 +28,7 @@ Alphabetically:
- Christian Heinz
- Christopher O'Neill (deltafire)
- coypoop
- Daniel Lublin
- Danilo Spinella
- David Flatz
- Dmitry Kobylin
@@ -63,6 +64,7 @@ Alphabetically:
- jesopo
- Jim Ramsay (lack)
- Jiri Golembiovsky (GolemJ)
- Joe Hermaszewski
- Joey Pabalinas (alyptik)
- Johan Rylander
- Johannes Kuhn
+98
View File
@@ -1,5 +1,103 @@
# WeeChat ChangeLog
## Version 4.6.4 (under dev)
### Added
- core: add support of specifier `%@` for UTC time in function util_strftimeval
### Fixed
- api: fix infinite loop in function string_replace when the search string is empty
- irc: limit size of data received from the server to prevent memory exhaustion
- irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322))
- relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion
- relay: fix timing attack on password authentication ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
- api, relay: fix timing attack on TOTP validation ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524))
- relay/weechat: fix empty buffers in client when WeeChat is running on Solaris/illumos
- relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion
- relay: fix out-of-bounds read in dump of data ([#2324](https://github.com/weechat/weechat/issues/2324))
- xfer: replace directory separator in remote nick by underscore in download filename to prevent writing the file outside the download directory ([#2321](https://github.com/weechat/weechat/issues/2321))
- xfer: fix out-of-bounds read when receiving empty line in DCC chat ([#2323](https://github.com/weechat/weechat/issues/2323))
- build: fix build on Solaris/illumos (issue #2251)
## Version 4.6.3 (2025-05-11)
### Fixed
- core: fix integer overflow with decimal numbers in calculation of expression
- core: fix integer overflow in base32 encoding/decoding
- core: fix integer overflow in function util_version_number
- core: fix buffer overflow in function util_parse_time
- core: fix buffer overflow in function eval_syntax_highlight_colorize
- core: fix buffer overflow in function eval_string_base_encode
- core: fix buffer overflow in function eval_string_range_chars
- core: fix memory leak in function util_parse_delay
## Version 4.6.2 (2025-04-18)
### Fixed
- core: fix write of weechat.log to stdout with `weechat-headless --stdout` ([#2247](https://github.com/weechat/weechat/issues/2247))
- core: add refresh of window title on buffer switch, when option weechat.look.window_title is set
## Version 4.6.1 (2025-04-09)
### Fixed
- core: consider all keys are safe in cursor context ([#2244](https://github.com/weechat/weechat/issues/2244))
- irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled ([#2241](https://github.com/weechat/weechat/issues/2241))
- perl: fix build when multiplicity is not available ([#2243](https://github.com/weechat/weechat/issues/2243))
## Version 4.6.0 (2025-03-23)
### Changed
- core: add option `-v` to display upgrades in command `/version`
- api: add property `keep_spaces_right` in function hook_set to keep trailing spaces in command arguments
- core, irc, alias, xfer: keep spaces at the end of some commands, where trailing spaces are important
- irc: add option `-connected` in command `/server list|listfull`
- buflist: apply option buflist.look.nick_prefix_empty also on private and list buffers
- xfer: compute speed and ETA with microsecond precision ([#665](https://github.com/weechat/weechat/issues/665))
### Added
- core: add command `/pipe`
- core: add option `whitespace` in command `/debug`, add options weechat.look.whitespace_char and weechat.look.tab_whitespace_char ([#947](https://github.com/weechat/weechat/issues/947))
- core: add option weechat.completion.nick_ignore_words ([#1143](https://github.com/weechat/weechat/issues/1143))
- spell: add CMake options ASPELL_DICT_DIR and ENCHANT_MYSPELL_DICT_DIR to override dictionaries locations ([#1174](https://github.com/weechat/weechat/issues/1174))
- api: add function completion_set
- relay/api: add resource `POST /api/completion` ([#2207](https://github.com/weechat/weechat/issues/2207))
- relay/api: add default key `Alt`+`Ctrl`+`l` (L) to toggle between remote and local commands on remote buffers, add option `togglecmd` in command `/remote`, add options relay.api.remote_input_cmd_local and relay.api.remote_input_cmd_remote ([#2148](https://github.com/weechat/weechat/issues/2148))
### Fixed
- relay: fix crash after `/upgrade` when relay clients are connected
- core: save configuration files as UTF-8 when the locale is wrong
- api: fix creation of empty buffer in function infolist_new_var_buffer
- core: fix build with gcc 15 ([#2229](https://github.com/weechat/weechat/issues/2229), [#2230](https://github.com/weechat/weechat/issues/2230))
- core: fix detection of dl library ([#2218](https://github.com/weechat/weechat/issues/2218))
- logger: fix path displayed when the logs directory can not be created
- perl: fix build with Perl < 5.7.29 ([#2219](https://github.com/weechat/weechat/issues/2219), [#2220](https://github.com/weechat/weechat/issues/2220))
- python: enable subinterpreters ([#2222](https://github.com/weechat/weechat/issues/2222))
## Version 4.5.2 (2025-02-20)
### Fixed
- core: fix build with gcc 15 ([#2229](https://github.com/weechat/weechat/issues/2229), [#2230](https://github.com/weechat/weechat/issues/2230))
## Version 4.5.1 (2024-12-23)
### Fixed
- relay: fix crash after `/upgrade` when relay clients are connected
- api: fix creation of empty buffer in function infolist_new_var_buffer
- core: fix detection of dl library ([#2218](https://github.com/weechat/weechat/issues/2218))
- logger: fix path displayed when the logs directory can not be created
- perl: fix build with Perl < 5.7.29 ([#2219](https://github.com/weechat/weechat/issues/2219), [#2220](https://github.com/weechat/weechat/issues/2220))
## Version 4.5.0 (2024-12-15)
### Changed
+33 -4
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2007-2008 Julien Louis <ptitlouis@sysif.net>
# Copyright (C) 2008-2009 Emmanuel Bouthenot <kolter@openics.org>
#
@@ -166,6 +166,16 @@ if(ENABLE_TESTS AND NOT ENABLE_HEADLESS)
message(FATAL_ERROR "Headless mode is required for tests.")
endif()
# Set this to override aspell's dictionaries directory
if(ASPELL_DICT_DIR)
add_definitions(-DASPELL_DICT_DIR="${ASPELL_DICT_DIR}")
endif()
# Set this to override the myspell dictionaries directory when using enchant
if(ENCHANT_MYSPELL_DICT_DIR)
add_definitions(-DENCHANT_MYSPELL_DICT_DIR="${ENCHANT_MYSPELL_DICT_DIR}")
endif()
# option WEECHAT_HOME
set(WEECHAT_HOME "${WEECHAT_HOME}" CACHE
STRING "Force a single WeeChat home directory for config, logs, scripts, etc."
@@ -188,6 +198,7 @@ include(FindPkgConfig)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckLibraryExists)
check_include_files("langinfo.h" HAVE_LANGINFO_CODESET)
check_include_files("sys/resource.h" HAVE_SYS_RESOURCE_H)
@@ -198,13 +209,33 @@ check_symbol_exists("malloc_trim" "malloc.h" HAVE_MALLOC_TRIM)
check_function_exists(mallinfo HAVE_MALLINFO)
check_function_exists(mallinfo2 HAVE_MALLINFO2)
check_symbol_exists("htonll" "sys/types.h;netinet/in.h;inttypes.h" HAVE_HTONLL)
check_symbol_exists("eat_newline_glitch" "term.h" HAVE_EAT_NEWLINE_GLITCH)
# Check if res_init requires libresolv
check_function_exists(res_init, LIBC_HAS_RES_INIT)
if(NOT LIBC_HAS_RES_INIT)
find_library(RESOLV_LIBRARY resolv)
if(RESOLV_LIBRARY)
check_library_exists("${RESOLV_LIBRARY}" res_init "" LIBRESOLV_HAS_RES_INIT)
if(LIBRESOLV_HAS_RES_INIT)
list(APPEND EXTRA_LIBS ${RESOLV_LIBRARY})
endif()
endif()
endif()
# Check for Large File Support
if(ENABLE_LARGEFILE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES)
endif()
# _XPG4_2 is needed for macros like CMSG_SPACE
# __EXTENSIONS__ is needed for constants like NI_MAXHOST and for struct timeval
if(CMAKE_HOST_SOLARIS)
add_definitions(-D_XPG4_2 -D__EXTENSIONS__)
endif()
# Check for libgcrypt
pkg_check_modules(LIBGCRYPT REQUIRED libgcrypt)
include_directories(${LIBGCRYPT_INCLUDE_DIRS})
@@ -247,9 +278,7 @@ find_library(DL_LIBRARY
PATHS /lib /usr/lib /usr/libexec /usr/local/lib /usr/local/libexec
)
if(DL_LIBRARY)
string(REGEX REPLACE "/[^/]*$" "" DL_LIBRARY_PATH "${DL_LIBRARY}")
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${DL_LIBRARY_PATH}")
list(APPEND EXTRA_LIBS dl)
list(APPEND EXTRA_LIBS ${DL_LIBRARY})
endif()
add_subdirectory(icons)
+1 -1
View File
@@ -48,7 +48,7 @@ WeeChat is following a "practical" semantic versioning, see file [CONTRIBUTING.m
## Copyright
Copyright © 2003-2024 [Sébastien Helleu](https://github.com/flashcode)
Copyright © 2003-2025 [Sébastien Helleu](https://github.com/flashcode)
This file is part of WeeChat, the extensible chat client.
+21
View File
@@ -7,6 +7,27 @@ When upgrading from version X to Y, please read and apply all instructions from
For a list of all changes in each version, please see [CHANGELOG.md](CHANGELOG.md).
## Version 4.6.3
### API function util_version_number
An integer overflow has been fixed in the function
[util_version_number](https://weechat.org/doc/weechat/plugin/#_util_version_number)
which now returns a version up to "127.255.255.255" (0x7FFFFFFF).
## Version 4.6.0
### Relay remote commands
Commands on remote buffers can now be toggled: execution on remote WeeChat or
locally, with a new default key: `Alt`+`Ctrl`+`l` (L).
You can add this key with this command:
```text
/key missing
```
## Version 4.3.1
### Detection of libgcrypt
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2014-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2014-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2007 Julien Louis <ptitlouis@sysif.net>
# Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org>
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2011-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2011-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,6 +1,6 @@
#
# Copyright (C) 2017 Adam Saponara <as@php.net>
# Copyright (C) 2017-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2017-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
-34
View File
@@ -1,34 +0,0 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2009 Julien Louis <ptitlouis@sysif.net>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
# - Find Python
# This module finds if Python is installed and determines where the include files
# and libraries are. It also determines what the name of the library is. This
# code sets the following variables:
#
# PYTHON_EXECUTABLE = full path to the python binary
# PYTHON_INCLUDE_DIRS = path to where python.h can be found
# PYTHON_LIBRARIES = path to where libpython.so* can be found
# PYTHON_LDFLAGS = python compiler options for linking
pkg_check_modules(PYTHON python3-embed IMPORTED_TARGET GLOBAL)
if(NOT PYTHON_FOUND)
pkg_check_modules(PYTHON python3 IMPORTED_TARGET GLOBAL)
endif()
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2015-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2015-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+1
View File
@@ -43,6 +43,7 @@
#cmakedefine HAVE_MALLINFO2
#cmakedefine HAVE_MALLOC_H
#cmakedefine HAVE_MALLOC_TRIM
#cmakedefine HAVE_HTONLL
#cmakedefine HAVE_EAT_NEWLINE_GLITCH
#cmakedefine HAVE_ASPELL_VERSION_STRING
#cmakedefine HAVE_ENCHANT_GET_VERSION
+1 -1
View File
@@ -24,7 +24,7 @@ Build-Depends:
libzstd-dev,
zlib1g-dev,
libcjson-dev
Standards-Version: 4.7.0
Standards-Version: 4.7.2
Homepage: https://weechat.org/
Vcs-Git: https://salsa.debian.org/kolter/weechat.git
Vcs-Browser: https://salsa.debian.org/kolter/weechat
+13
View File
@@ -1,3 +1,16 @@
weechat (4.6.1-1) unstable; urgency=medium
* New upstream release (Closes: #1102450, #1098090)
-- Emmanuel Bouthenot <kolter@debian.org> Wed, 16 Apr 2025 20:31:07 +0000
weechat (4.5.1-1) unstable; urgency=medium
* New upstream release
* Update copyright file (new year)
-- Emmanuel Bouthenot <kolter@debian.org> Mon, 20 Jan 2025 14:39:42 +0000
weechat (4.4.3-1) unstable; urgency=medium
* New upstream release
+1 -1
View File
@@ -24,7 +24,7 @@ Build-Depends:
libzstd-dev,
zlib1g-dev,
libcjson-dev
Standards-Version: 4.7.0
Standards-Version: 4.7.2
Homepage: https://weechat.org/
Vcs-Git: https://salsa.debian.org/kolter/weechat.git
Vcs-Browser: https://salsa.debian.org/kolter/weechat
+1 -1
View File
@@ -4,7 +4,7 @@ Upstream-Contact: Sébastien Helleu <flashcode@flashtux.org>
Source: https://weechat.org/
Files: *
Copyright: 2003-2024, Sébastien Helleu <flashcode@flashtux.org>
Copyright: 2003-2025, Sébastien Helleu <flashcode@flashtux.org>
License: GPL-3+
Files: src/core/core-command.c
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org>
#
# This file is part of WeeChat, the extensible chat client.
+1 -1
View File
@@ -99,7 +99,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat je napsán Sébastienem Helleu a přispěvovateli (kompletní seznam je v
souboru AUTHORS.md).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -100,7 +100,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat wird programmiert von Sébastien Helleu und weiteren Beteiligten (eine vollständige Auflistung
findet man in der AUTHORS.md Datei).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+6 -5
View File
@@ -1764,11 +1764,12 @@ Sie können mit dem Befehl <<command_weechat_key,/key>> geändert und neue hinzu
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Taste | Beschreibung | Befehl
| kbd:[Alt+m] | schaltet Mausfunktion ein/aus. | `+/mouse toggle+`
| kbd:[Alt+s] | Umschalten der Rechtschreibprüfung. | `+/mute spell toggle+`
| kbd:[Alt+=] | schaltet Filterfunktion an/aus. | `+/filter toggle+`
| kbd:[Alt+-] | schaltet, für den aktuellen Buffer, Filterfunktion an/aus. | `+/filter toggle @+`
| Taste | Beschreibung | Befehl
| kbd:[Alt+m] | schaltet Mausfunktion ein/aus. | `+/mouse toggle+`
| kbd:[Alt+s] | Umschalten der Rechtschreibprüfung. | `+/mute spell toggle+`
| kbd:[Alt+=] | schaltet Filterfunktion an/aus. | `+/filter toggle+`
| kbd:[Alt+-] | schaltet, für den aktuellen Buffer, Filterfunktion an/aus. | `+/filter toggle @+`
| kbd:[Alt+Ctrl+l] (`L`) | Umschalten zwischen Remote- und lokalen Befehlen in einem Remote-Buffer (relay "api"). | `+/remote togglecmd+`
|===
[[key_bindings_search_context]]
+1 -1
View File
@@ -1,6 +1,6 @@
<!--
Custom styles for Asciidoctor
Copyright (C) 2016-2024 Sébastien Helleu <flashcode@flashtux.org>
Copyright (C) 2016-2025 Sébastien Helleu <flashcode@flashtux.org>
-->
<style>
+1 -1
View File
@@ -100,7 +100,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat is written by Sébastien Helleu and contributors (complete list is in
the AUTHORS.md file).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -577,7 +577,7 @@ Example in C:
/*
* weechat.c - core functions for WeeChat
*
* Copyright (C) 2024 Your Name <your@email.com>
* Copyright (C) 2025 Your Name <your@email.com>
*
* This file is part of WeeChat, the extensible chat client.
*
+81 -5
View File
@@ -4762,7 +4762,7 @@ This function is not available in scripting API.
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.6.4._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -4779,6 +4779,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -4795,8 +4797,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
@@ -10981,6 +10983,11 @@ _WeeChat ≥ 4.1.0._
URL transfer.
This function is similar to <<_hook_process,hook_process>> and
<<_hook_process_hashtable,hook_process_hashtable>> with command "url:..."
but it uses a thread instead of new process, making it more lightweight
and thus recommended for this usage.
Prototype:
[source,c]
@@ -14014,6 +14021,10 @@ Properties:
| Name of sub plugin (commonly script name, which is displayed in
`/help command` for a hook of type _command_).
| keep_spaces_right | 4.6.0 | _command_, _command_run_
| "0" or "1"
| Keep trailing spaces in command arguments when it is executed.
| stdin | 0.4.3 | _process_, _process_hashtable_
| any string
| Send data on standard input (_stdin_) of child process.
@@ -15519,8 +15530,8 @@ void weechat_window_set_title (const char *title);
Arguments:
* _title_: new title for terminal (NULL to reset title); string is evaluated,
so variables like `${info:version}` can be used
* _title_: new title for terminal; string is evaluated, so variables like
`${info:version}` can be used
(see <<_string_eval_expression,string_eval_expression>>)
C example:
@@ -17083,6 +17094,71 @@ def my_completion_cb(data: str, completion_item: str, buffer: str, completion: s
return weechat.WEECHAT_RC_OK
----
==== completion_set
_WeeChat ≥ 4.6.0._
Set a completion property.
Prototype:
[source,c]
----
void weechat_completion_get_string (struct t_gui_completion *completion,
const char *property,
const char *value);
----
Arguments:
* _completion_: completion pointer
* _property_: property name (see table below)
* _value_: new value for property
Properties:
[width="100%",cols="^2,^1,4,8",options="header"]
|===
| Name | Min WeeChat | Value | Description
| add_space | 4.6.0 | "0" or "1"
| "0": do not add space after completion +
"1": add space after completion (default).
|===
C example:
[source,c]
----
int
my_completion_cb (const void *pointer, void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* do not add space after completion */
weechat_completion_set (completion, "add_space", "0");
/* ... */
return WEECHAT_RC_OK;
}
----
Script (Python):
[source,python]
----
# prototype
def completion_set(completion: str, property: str, value: str) -> int: ...
# example
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# do not add space after completion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
----
==== completion_list_add
_WeeChat ≥ 2.9._
+54 -2
View File
@@ -1184,7 +1184,7 @@ Body parameters:
* `buffer_id` (integer, optional): buffer unique identifier (not to be confused
with the buffer number, which is different)
* `buffer` (string, optional, default: `core.weechat`): buffer name
* `buffer_name` (string, optional, default: `core.weechat`): buffer name
* `command` (string, **required**): command or text to send to the buffer
Request example: say "hello!" on channel #weechat:
@@ -1192,7 +1192,7 @@ Request example: say "hello!" on channel #weechat:
[source,shell]
----
curl -L -u 'plain:secret_password' -X POST \
-d '{"buffer": "irc.libera.#weechat", "command": "hello!"}' \
-d '{"buffer_name": "irc.libera.#weechat", "command": "hello!"}' \
'https://localhost:9000/api/input'
----
@@ -1220,6 +1220,58 @@ Response:
HTTP/1.1 204 No content
----
[[resource_completion]]
=== Completion
Complete user command or text in a buffer.
Endpoint:
----
POST /api/completion
----
Body parameters:
* `buffer_id` (integer, optional): buffer unique identifier (not to be confused
with the buffer number, which is different)
* `buffer_name` (string, optional, default: `core.weechat`): buffer name
* `command` (string, **required**): command or text to complete
* `position` (integer, optional, default: end of string): position in command
(first position is 0)
Request example: complete command `/qu` on channel #weechat:
[source,shell]
----
curl -L -u 'plain:secret_password' -X POST \
-d '{"buffer_name": "irc.libera.#weechat", "command": "/qu"}' \
'https://localhost:9000/api/completion'
----
Response:
[source,http]
----
HTTP/1.1 200 OK
----
[source,json]
----
{
"context": "command",
"base_word": "qu",
"position_replace": 1,
"add_space": true,
"list": [
"query",
"quiet",
"quit",
"quote"
]
}
----
[[resource_ping]]
=== Ping
+6 -5
View File
@@ -1753,11 +1753,12 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Key | Description | Command
| kbd:[Alt+m] | Toggle mouse. | `+/mouse toggle+`
| kbd:[Alt+s] | Toggle spell checker. | `+/mute spell toggle+`
| kbd:[Alt+=] | Toggle filters. | `+/filter toggle+`
| kbd:[Alt+-] | Toggle filters in current buffer. | `+/filter toggle @+`
| Key | Description | Command
| kbd:[Alt+m] | Toggle mouse. | `+/mouse toggle+`
| kbd:[Alt+s] | Toggle spell checker. | `+/mute spell toggle+`
| kbd:[Alt+=] | Toggle filters. | `+/filter toggle+`
| kbd:[Alt+-] | Toggle filters in current buffer. | `+/filter toggle @+`
| kbd:[Alt+Ctrl+l] (`L`) | Toggle between remote and local commands on a remote buffer (relay "api"). | `+/remote togglecmd+`
|===
[[key_bindings_search_context]]
+1 -1
View File
@@ -102,7 +102,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat est écrit par Sébastien Helleu et des contributeurs (la liste complète
est dans le fichier AUTHORS.md).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier
sous les termes de la GNU General Public License telle que publiée par la
+1 -1
View File
@@ -578,7 +578,7 @@ Exemple en C :
/*
* weechat.c - core functions for WeeChat
*
* Copyright (C) 2024 Your Name <your@email.com>
* Copyright (C) 2025 Your Name <your@email.com>
*
* This file is part of WeeChat, the extensible chat client.
*
+82 -6
View File
@@ -4841,7 +4841,7 @@ Cette fonction n'est pas disponible dans l'API script.
==== util_strftimeval
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0._
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0, 4.6.4._
Formatter la date et l'heure comme la fonction `strftime` de la bibliothèque C,
en utilisant un `struct timeval` en entrée et en supportant des caractères de
@@ -4860,6 +4860,8 @@ Paramètres :
* _max_ : taille de la chaîne
* _format_ : format, le même que celui de la fonction _strftime_, avec des
caractères de conversion supplémentaires :
** `%@`: retourner la date exprimée en Temps Universel Coordonné (UTC)
au lieu de la date relative au fuseau horaire de l'utilisateur _(WeeChat ≥ 4.7.0)_
** `%.N` où `N` est entre 1 and 6: microsecondes remplies avec des zéros sur
N chiffres (par exemple `%.3` pour les millisecondes)
** `%f` : alias de `%.6`
@@ -4876,8 +4878,8 @@ Exemple en C :
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* résultat : 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* résultat : 2023-12-26T18:10:04.460509Z */
----
[NOTE]
@@ -11185,6 +11187,11 @@ _WeeChat ≥ 4.1.0._
Transfert d'URL.
Cette fonction est similaire à <<_hook_process,hook_process>> et
<<_hook_process_hashtable,hook_process_hashtable>> avec la commande "url:..."
mais elle utilise un thread au lieu d'un nouveau processus, la rendant plus
légère et donc recommandée pour cet usage.
Prototype :
[source,c]
@@ -14327,6 +14334,10 @@ Propriétés :
| Nom de la sous-extension (couramment un nom de script, qui est affiché dans
`/help commande` pour un hook de type _command_).
| keep_spaces_right | 4.6.0 | _command_, _command_run_
| "0" ou "1"
| Garder les espaces à la fin des paramètres de la commande quand elle est exécutée.
| stdin | 0.4.3 | _process_, _process_hashtable_ | toute chaîne
| Envoyer les données sur l'entrée standard (_stdin_) du processus fils.
@@ -15860,9 +15871,9 @@ void weechat_window_set_title (const char *title);
Paramètres :
* _title_ : nouveau titre pour le terminal (NULL pour réinitialiser le titre) ;
la chaîne est évaluée, donc les variables comme `${info:version}` peuvent
être utilisées (voir <<_string_eval_expression,string_eval_expression>>)
* _title_ : nouveau titre pour le terminal ; la chaîne est évaluée, donc les variables
comme `${info:version}` peuvent être utilisées
(voir <<_string_eval_expression,string_eval_expression>>)
Exemple en C :
@@ -17447,6 +17458,71 @@ def my_completion_cb(data: str, completion_item: str, buffer: str, completion: s
return weechat.WEECHAT_RC_OK
----
==== completion_set
_WeeChat ≥ 4.6.0._
Affecter une valeur à une propriété d'une complétion.
Prototype:
[source,c]
----
void weechat_completion_get_string (struct t_gui_completion *completion,
const char *property,
const char *value);
----
Paramètres:
* _completion_ : pointeur vers la complétion
* _property_ : nom de la propriété (voir le tableau ci-dessous)
* _value_ : nouvelle valeur pour la propriété
Properties:
[width="100%",cols="^2,^1,4,8",options="header"]
|===
| Name | Min WeeChat | Value | Description
| add_space | 4.6.0 | "0" or "1"
| "0": do not add space after completion +
"1": add space after completion (default).
|===
Exemple en C :
[source,c]
----
int
my_completion_cb (const void *pointer, void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* ne pas ajouter d'espace après la complétion */
weechat_completion_set (completion, "add_space", "0");
/* ... */
return WEECHAT_RC_OK;
}
----
Script (Python):
[source,python]
----
# prototype
def completion_set(completion: str, property: str, value: str) -> int: ...
# exemple
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# ne pas ajouter d'espace après la complétion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
----
==== completion_list_add
_WeeChat ≥ 2.9._
+54 -2
View File
@@ -1196,7 +1196,7 @@ Paramètres du corps :
* `buffer_id` (entier, facultatif) : identifiant unique du tampon (à ne pas
confondre avec le numéro du tampon, qui est différent)
* `buffer_name` (chaîne, facultatif) : nom de tampon
* `buffer_name` (chaîne, facultatif, par défaut: `core.weechat`) : nom de tampon
* `command` (chaîne, **obligatoire**) : commande ou texte à envoyer au tampon
Exemple de requête : dire "hello!" sur le canal #weechat :
@@ -1204,7 +1204,7 @@ Exemple de requête : dire "hello!" sur le canal #weechat :
[source,shell]
----
curl -L -u 'plain:secret_password' -X POST \
-d '{"buffer": "irc.libera.#weechat", "command": "hello!"}' \
-d '{"buffer_name": "irc.libera.#weechat", "command": "hello!"}' \
'https://localhost:9000/api/input'
----
@@ -1232,6 +1232,58 @@ Réponse :
HTTP/1.1 204 No content
----
[[resource_completion]]
=== Complétion
Compléter une commande ou du texte de l'utilisateur sur un tampon.
Point de terminaison :
----
POST /api/completion
----
Paramètres du corps :
* `buffer_id` (entier, facultatif) : identifiant unique du tampon (à ne pas
confondre avec le numéro du tampon, qui est différent)
* `buffer_name` (chaîne, facultatif, par défaut: `core.weechat`) : nom de tampon
* `command` (chaîne, **obligatoire**) : commande ou texte à compléter
* `position` (entier, facultatif, par défaut: fin de la chaîne): position
dans la commande (la première position est 0)
Exemple de requête : compléter la commande `/qu` sur le canal #weechat :
[source,shell]
----
curl -L -u 'plain:secret_password' -X POST \
-d '{"buffer_name": "irc.libera.#weechat", "command": "/qu"}' \
'https://localhost:9000/api/completion'
----
Réponse :
[source,http]
----
HTTP/1.1 200 OK
----
[source,json]
----
{
"context": "command",
"base_word": "qu",
"position_replace": 1,
"add_space": true,
"list": [
"query",
"quiet",
"quit",
"quote"
]
}
----
[[resource_ping]]
=== Ping
+6 -5
View File
@@ -1788,11 +1788,12 @@ Ils peuvent être modifiés et de nouveaux peuvent être ajoutés avec la comman
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Touche | Description | Commande
| kbd:[Alt+m] | Activer/désactiver la souris. | `+/mouse toggle+`
| kbd:[Alt+s] | Activer/désactiver la vérification de l'orthographe. | `+/mute spell toggle+`
| kbd:[Alt+=] | Activer/désactiver les filtres. | `+/filter toggle+`
| kbd:[Alt+-] | Activer/désactiver les filtres dans le tampon courant. | `+/filter toggle @+`
| Touche | Description | Commande
| kbd:[Alt+m] | Activer/désactiver la souris. | `+/mouse toggle+`
| kbd:[Alt+s] | Activer/désactiver la vérification de l'orthographe. | `+/mute spell toggle+`
| kbd:[Alt+=] | Activer/désactiver les filtres. | `+/filter toggle+`
| kbd:[Alt+-] | Activer/désactiver les filtres dans le tampon courant. | `+/filter toggle @+`
| kbd:[Alt+Ctrl+l] (`L`) | Basculer entre les commandes distantes et locales sur un tampon distant (relay "api"). | `+/remote togglecmd+`
|===
[[key_bindings_search_context]]
+1 -1
View File
@@ -103,7 +103,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat is written by Sébastien Helleu and contributors (complete list is in
the AUTHORS.md file).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+89 -5
View File
@@ -4985,7 +4985,7 @@ Questa funzione non è disponibile nelle API per lo scripting.
// TRANSLATION MISSING
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.6.4._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -5002,6 +5002,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -5018,8 +5020,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
@@ -11394,6 +11396,11 @@ _WeeChat ≥ 4.1.0._
URL transfer.
This function is similar to <<_hook_process,hook_process>> and
<<_hook_process_hashtable,hook_process_hashtable>> with command "url:..."
but it uses a thread instead of new process, making it more lightweight
and thus recommended for this usage.
Prototipo:
[source,c]
@@ -14667,11 +14674,17 @@ Properties:
// TRANSLATION MISSING
| subplugin | | any type
| qualsiasi stringa |
// TRANSLATION MISSING
Name of sub plugin (commonly script name, which is displayed in
`/help command` for a hook of type _command_).
// TRANSLATION MISSING
| keep_spaces_right | 4.6.0 | _command_, _command_run_
| "0" or "1"
| Keep trailing spaces in command arguments when it is executed.
| stdin | 0.4.3 | _process_, _process_hashtable_ | qualsiasi stringa |
// TRANSLATION MISSING
Send data on standard input (_stdin_) of child process.
@@ -16291,8 +16304,8 @@ void weechat_window_set_title (const char *title);
Argomenti:
// TRANSLATION MISSING
* _title_: nuovo titolo per il terminale (NULL per resettarlo);
string is evaluated, so variables like `${info:version}` can be used
* _title_: nuovo titolo per il terminale; string is evaluated, so variables
like `${info:version}` can be used
(see <<_string_eval_expression,string_eval_expression>>)
Esempio in C:
@@ -17918,6 +17931,77 @@ def my_completion_cb(data: str, completion_item: str, buffer: str, completion: s
return weechat.WEECHAT_RC_OK
----
==== completion_set
_Novità nella versioe 4.6.0._
// TRANSLATION MISSING
Set a completion property.
Prototipo:
[source,c]
----
void weechat_completion_get_string (struct t_gui_completion *completion,
const char *property,
const char *value);
----
Argomenti:
* _completion_: puntatore al completamento
// TRANSLATION MISSING
* _property_: nome della proprietà (see table below)
// TRANSLATION MISSING
* _value_: new value for property
// TRANSLATION MISSING
Properties:
[width="100%",cols="^2,^1,4,8",options="header"]
|===
// TRANSLATION MISSING
| Name | Min WeeChat | Value | Description
// TRANSLATION MISSING
| add_space | 4.6.0 | "0" or "1"
| "0": do not add space after completion +
"1": add space after completion (default).
|===
Esempio in C:
[source,c]
----
int
my_completion_cb (const void *pointer, void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* do not add space after completion */
weechat_completion_set (completion, "add_space", "0");
/* ... */
return WEECHAT_RC_OK;
}
----
Script (Python):
[source,python]
----
# prototipo
def completion_set(completion: str, property: str, value: str) -> int: ...
# esempio
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# do not add space after completion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
----
==== completion_list_add
_Novità nella versioe 2.9._
+7 -5
View File
@@ -1934,13 +1934,15 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Tasti | Descrizione | Comando
| kbd:[Alt+m] | Abilita/disabilita. | `+/mouse toggle+`
| Tasti | Descrizione | Comando
| kbd:[Alt+m] | Abilita/disabilita. | `+/mouse toggle+`
// TRANSLATION MISSING
| kbd:[Alt+s] | Toggle spell checker. | `+/mute spell toggle+`
| kbd:[Alt+=] | Attiva/disattiva filtri. | `+/filter toggle+`
| kbd:[Alt+s] | Toggle spell checker. | `+/mute spell toggle+`
| kbd:[Alt+=] | Attiva/disattiva filtri. | `+/filter toggle+`
// TRANSLATION MISSING
| kbd:[Alt+-] | Toggle filters in current buffer. | `+/filter toggle @+`
| kbd:[Alt+-] | Toggle filters in current buffer. | `+/filter toggle @+`
// TRANSLATION MISSING
| kbd:[Alt+Ctrl+l] (`L`) | Toggle between remote and local commands on a remote buffer (relay "api"). | `+/remote togglecmd+`
|===
// TRANSLATION MISSING
+1 -1
View File
@@ -100,7 +100,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat は Sébastien Helleu さんと貢献者によって作成されています
(完全なリストは AUTHORS.md ファイルを参照してください)。
著作権 (C) 2003-2024 {author}
著作権 (C) 2003-2025 {author}
WeeChat はフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された
GNU 一般公衆利用許諾契約書 (バージョン 2 か、希望によってはそれ以降のバージョンのうちどれか)
+1 -1
View File
@@ -701,7 +701,7 @@ WeeChat とプラグインの翻訳は gettext で行います、ファイルは
/*
* weechat.c - core functions for WeeChat
*
* Copyright (C) 2024 Your Name <your@email.com>
* Copyright (C) 2025 Your Name <your@email.com>
*
* This file is part of WeeChat, the extensible chat client.
*
+85 -5
View File
@@ -4898,7 +4898,7 @@ weechat_printf (NULL, "date: %s",
// TRANSLATION MISSING
==== util_strftimeval
_WeeChat ≥ 4.2.0, updated in 4.3.0._
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.6.4._
Format date and time like function `strftime` in C library, using `struct timeval`
as input, and supporting extra specifiers.
@@ -4915,6 +4915,8 @@ Arguments:
* _string_: buffer where the formatted string is stored
* _max_: string size
* _format_: format, the same as _strftime_ function, with these extra specifiers:
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
(for example `%.3` for milliseconds)
** `%f`: alias of `%.6`
@@ -4931,8 +4933,8 @@ C example:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* result: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* result: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
@@ -11127,6 +11129,11 @@ _WeeChat ≥ 4.1.0._
URL transfer.
This function is similar to <<_hook_process,hook_process>> and
<<_hook_process_hashtable,hook_process_hashtable>> with command "url:..."
but it uses a thread instead of new process, making it more lightweight
and thus recommended for this usage.
プロトタイプ:
[source,c]
@@ -14238,6 +14245,11 @@ void weechat_hook_set (struct t_hook *hook, const char *property,
| サブプラグインの名前 (通常は `/help command` で _command_
をタイプした時のフックで表示されるスクリプト名)
// TRANSLATION MISSING
| keep_spaces_right | 4.6.0 | _command_, _command_run_
| "0" or "1"
| Keep trailing spaces in command arguments when it is executed.
| stdin | 0.4.3 | _process_、_process_hashtable_ | 任意の文字列
| 子プロセスの標準入力 (_stdin_) にデータを送信
@@ -15787,8 +15799,8 @@ void weechat_window_set_title (const char *title);
引数:
* _title_: 端末の新しいタイトル (タイトルをリセットする場合は NULL);
この文字列は評価されるため、文字列内に `${info:version}` などの変数を含めることが可能です
* _title_: 端末の新しいタイトル; この文字列は評価されるため、文字列内に
`${info:version}` などの変数を含めることが可能です
(<<_string_eval_expression,string_eval_expression>> を参照)
C 言語での使用例:
@@ -17377,6 +17389,74 @@ def my_completion_cb(data: str, completion_item: str, buffer: str, completion: s
return weechat.WEECHAT_RC_OK
----
==== completion_set
_WeeChat バージョン 4.6.0 以上で利用可。_
// TRANSLATION MISSING
Set a completion property.
プロトタイプ:
[source,c]
----
void weechat_completion_get_string (struct t_gui_completion *completion,
const char *property,
const char *value);
----
引数:
* _completion_: 補完へのポインタ
* _property_: プロパティ名 (以下の表を参照)
* _value_: プロパティの新しい値
プロパティ:
[width="100%",cols="^2,^1,4,8",options="header"]
|===
// TRANSLATION MISSING
| Name | Min WeeChat | Value | Description
// TRANSLATION MISSING
| add_space | 4.6.0 | "0" or "1"
| "0": do not add space after completion +
"1": add space after completion (default).
|===
C 言語での使用例:
[source,c]
----
int
my_completion_cb (const void *pointer, void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* do not add space after completion */
weechat_completion_set (completion, "add_space", "0");
/* ... */
return WEECHAT_RC_OK;
}
----
スクリプト (Python) での使用例:
[source,python]
----
# prototype
def completion_set(completion: str, property: str, value: str) -> int: ...
# example
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# do not add space after completion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
----
==== completion_list_add
_WeeChat バージョン 2.9 以上で利用可。_
+7 -5
View File
@@ -1894,11 +1894,13 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| キー | 説明 | コマンド
| kbd:[Alt+m] | マウスの有効無効を切り替え | `+/mouse toggle+`
| kbd:[Alt+s] | スペルチェッカの有効無効を切り替え | `+/mute spell toggle+`
| kbd:[Alt+=] | フィルタの有効無効を切り替え | `+/filter toggle+`
| kbd:[Alt+-] | 現在のバッファのフィルタの有効無効を切り替え | `+/filter toggle @+`
| キー | 説明 | コマンド
| kbd:[Alt+m] | マウスの有効無効を切り替え | `+/mouse toggle+`
| kbd:[Alt+s] | スペルチェッカの有効無効を切り替え | `+/mute spell toggle+`
| kbd:[Alt+=] | フィルタの有効無効を切り替え | `+/filter toggle+`
| kbd:[Alt+-] | 現在のバッファのフィルタの有効無効を切り替え | `+/filter toggle @+`
// TRANSLATION MISSING
| kbd:[Alt+Ctrl+l] (`L`) | Toggle between remote and local commands on a remote buffer (relay "api"). | `+/remote togglecmd+`
|===
// TRANSLATION MISSING
+1 -2
View File
@@ -33,9 +33,8 @@
*-h*, *--help*::
Wyświetla pomoc.
// TRANSLATION MISSING
*-i*, *--build-info*::
Display build information and exit.
Wyświetla informację o kompilacji.
*-l*, *--license*::
Wyświetla licencję.
+1 -1
View File
@@ -101,7 +101,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat jest tworzony przez Sébastien Helleu i społeczność (pełna lista dostępna
jest w pliku AUTHORS.md).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+10 -13
View File
@@ -930,13 +930,11 @@ Pasek _status_ posiada następujące domyślne elementy:
| buffer_nicklist_count | `4` | Ilość nicków wyświetlanych na liście nicków.
| buffer_zoom | ! | `!` oznacza, że połączony bufor jest przybliżony (tylko ten jest wyświetlany), pusta wartość oznacza, że wszystkie połączone bufory są wyświetlane.
| buffer_filter | `+*+` | Wskaźnik filtrowania: `+*+` oznacza, że niektóre linie zostały odfiltrowywane (ukryte), pusta wartość oznacza, że wszystkie linie są wyświetlane.
// TRANSLATION MISSING
| mouse_status | `M` | Mouse status (empty if mouse is disabled), see command <<command_weechat_mouse,/mouse>> and <<key_bindings_toggle_keys,Włącz/wyłącz>>.
| mouse_status | `M` | Status obsługi myszy (pusty jeśli obsługa myszy jest wyłączona), zobacz <<command_weechat_mouse,/mouse>> i <<key_bindings_toggle_keys,Włącz/wyłącz>>.
| scroll | `-Więcej(50)-` | Wskaźnik przewijania, z numerem linii poniżej ostatniej wyświetlanej.
| lag | `Lag: 2.5` | Wskaźnik opóźnienia, w sekundach (ukryty dla niskich opóźnień).
| hotlist | `H: 3:#abc(2,5), 5` | Lista buforów z aktywnością (nieprzeczytane wiadomości) (w przykładzie, 2 podświetlenia i 5 nieprzeczytanych wiadomości w _#abc_, jedna wiadomość w buforze #5).
// TRANSLATION MISSING
| typing | `Typing: bob, (alice)` | Typing notification, see <<typing_notifications,Powiadomienia o pisaniu>>.
| typing | `Typing: bob, (alice)` | Powiadomienia o pisaniu, zobacz <<typing_notifications,Powiadomienia o pisaniu>>.
| completion | `abc(2) def(5)` | Lista słów do dopełnienia, z ilością możliwych dopełnień dla każdego słowa.
|===
@@ -999,8 +997,7 @@ Inne dostępne elementy (nie używane domyślnie w paskach):
| irc_nick_host | `+Flashy!user@host.com+` | Aktualny nick i host IRC.
| irc_nick_modes | `i` | Atrybuty IRC dla własnego nicka.
| irc_nick_prefix | `@` | Prefiks nicku na kanale IRC.
// TRANSLATION MISSING
| spacer | | Special item used to align text in bars, see <<item_spacer,Odstęp>>.
| spacer | | Specjalny element używany do wyrównania tekstu na paskach, zobacz <<item_spacer,Odstęp>>.
| spell_dict | `fr,en` | Słowniki używane w obecnym buforze.
| spell_suggest | `print,prone,prune` | Sugestie dla słowa pod kursorem (jeśli zawiera błąd).
| tls_version | `TLS1.3` | Wersja TLS używana przez obecny serwer IRC.
@@ -1764,11 +1761,12 @@ Można je zmienić oraz dodać nowe za pomocą komendy <<command_weechat_key,/ke
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Skrót | Opis | Komenda
| kbd:[Alt+m] | Włącz/wyłącz obsługę myszy. | `+/mouse toggle+`
| kbd:[Alt+s] | Włącz/wyłącz sprawdzenie pisowni. | `+/mute spell toggle+`
| kbd:[Alt+=] | Włącz/wyłącz filtry. | `+/filter toggle+`
| kbd:[Alt+-] | Włącz/wyłącz filtry w bieżącym buforze. | `+/filter toggle @+`
| Skrót | Opis | Komenda
| kbd:[Alt+m] | Włącz/wyłącz obsługę myszy. | `+/mouse toggle+`
| kbd:[Alt+s] | Włącz/wyłącz sprawdzenie pisowni. | `+/mute spell toggle+`
| kbd:[Alt+=] | Włącz/wyłącz filtry. | `+/filter toggle+`
| kbd:[Alt+-] | Włącz/wyłącz filtry w bieżącym buforze. | `+/filter toggle @+`
| kbd:[Alt+Ctrl+l] (`L`) | Przełącz między lokalnymi komendami a zdalnym buforem (relay "api"). | `+/remote togglecmd+`
|===
[[key_bindings_search_context]]
@@ -3434,8 +3432,7 @@ Na przykład w celu połączenia się do https://libera.chat/[libera.chat ^↗^
----
[NOTE]
// TRANSLATION MISSING
Default port is 6697 and TLS (encrypted traffic) is enabled.
Domyślny port to 6697 i TLS (szyfrowanie ruchu) jest włączone.
Możesz powiedzieć WeeChat, aby automatycznie łączył się z tym serwerem po
uruchomieniu:
+1 -1
View File
@@ -99,7 +99,7 @@ $HOME/.local/share/weechat/weechat.log::
WeeChat написан Sébastien Helleu и другими участниками (полный список находится
в файле AUTHORS.md).
Copyright (C) 2003-2024 {author}
Copyright (C) 2003-2025 {author}
WeeChat is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
+1 -2
View File
@@ -20,9 +20,8 @@
*-h*, *--help*::
Приказује помоћ.
// TRANSLATION MISSING
*-i*, *--build-info*::
Display build information and exit.
Приказује информације о изградњи и прекида извршавање.
*-l*, *--license*::
Приказује лиценцу програма WeeChat.
+1 -1
View File
@@ -97,7 +97,7 @@ $HOME/.config/weechat/weechat.log::
// tag::copyright[]
Програм WeeChat је написао Себастијен Елеу и људи који су дали свој допринос (комплетна листа се налази у фајлу AUTHORS.md).
Ауторска права (C) 2003-2024 {author}
Ауторска права (C) 2003-2025 {author}
WeeChat је слободни софтвер; можете га редистрибуирати и/или изменити под условима ГНУ Опште Јавне Лиценце коју је објавила Free Software Foundation; или верзије 3 Лиценце, или (по вашој жељи) било којој каснијој верзији.
+2 -2
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
Ово упутство описује WeeChat чет клијент и део је програма WeeChat.
@@ -576,7 +576,7 @@ WeeChat „језгро” се налази у следећим директо
/*
* weechat.c - core functions for WeeChat
*
* Copyright (C) 2024 Your Name <your@email.com>
* Copyright (C) 2025 Your Name <your@email.com>
*
* This file is part of WeeChat, the extensible chat client.
*
+1 -1
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
[[general]]
== Опште
+88 -5
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
Ово упутство описује WeeChat чет клијент и део је програма WeeChat.
@@ -4624,7 +4624,7 @@ weechat_printf (NULL, "date: %s",
==== util_strftimeval
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0._
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0, 4.6.4._
Форматира датум и време као функција `strftime` из C библиотеке, користећи `struct timeval`
као улаз уз подршку за додатне спецификаторе.
@@ -4641,6 +4641,9 @@ int weechat_util_strftimeval (char *string, int max, const char *format, struct
* _string_: бафер у који се смешта форматирани стринг
* _max_: величина стринга
* _format_: формат, исто као за _strftime_ функцију, са следећим додатним спецификаторима:
// TRANSLATION MISSING
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
** `%.N` где је `N` између 1 и 6: микросекунде допуњене нулама на N цифара
(на пример `%.3` за милисекунде)
** `%f`: алијас за `%.6`
@@ -4657,8 +4660,8 @@ C пример:
char time[256];
struct timeval tv;
gettimeofday (&tv, NULL);
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
/* резултат: 2023-12-26T18:10:04.460509 */
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
/* резултат: 2023-12-26T18:10:04.460509Z */
----
[NOTE]
@@ -10702,6 +10705,12 @@ _WeeChat ≥ 4.1.0._
URL трансфер.
// TRANSLATION MISSING
This function is similar to <<_hook_process,hook_process>> and
<<_hook_process_hashtable,hook_process_hashtable>> with command "url:..."
but it uses a thread instead of new process, making it more lightweight
and thus recommended for this usage.
Прототип:
[source,c]
@@ -13621,6 +13630,11 @@ void weechat_hook_set (struct t_hook *hook, const char *property,
| Име под додатка (обично је то име скрипте које се приказује у
`/help команда` за куку типа _command_).
// TRANSLATION MISSING
| keep_spaces_right | 4.6.0 | _command_, _command_run_
| "0" or "1"
| Keep trailing spaces in command arguments when it is executed.
| stdin | 0.4.3 | _process_, _process_hashtable_ | било који стринг
| Шаље податке на стандардни улаз (_stdin_) дете процеса.
@@ -15093,7 +15107,9 @@ void weechat_window_set_title (const char *title);
Аргументи:
* _title_: нови наслов за терминал (NULL ако желите да ресетујете наслов); стринг се израчунава, тако да је могуће коришћење променљивих као што је `${info:version}` (погледајте <<_string_eval_expression,string_eval_expression>>)
* _title_: нови наслов за терминал; стринг се израчунава, тако да је могуће
коришћење променљивих као што је `${info:version}`
(погледајте <<_string_eval_expression,string_eval_expression>>)
C пример:
@@ -16624,6 +16640,73 @@ def my_completion_cb(data: str, completion_item: str, buffer: str, completion: s
return weechat.WEECHAT_RC_OK
----
==== completion_set
_WeeChat ≥ 4.6.0._
// TRANSLATION MISSING
Set a completion property.
Прототип:
[source,c]
----
void weechat_completion_get_string (struct t_gui_completion *completion,
const char *property,
const char *value);
----
Аргументи:
* _completion_: показивач на довршавање
* _property_: име особине (погледајте табелу испод)
* _value_: нова вредност за особину
Особине:
[width="100%",cols="^2,^1,4,8",options="header"]
|===
| Име | Мин WeeChat | Вредност | Опис
// TRANSLATION MISSING
| add_space | 4.6.0 | "0" or "1"
| "0": do not add space after completion +
"1": add space after completion (default).
|===
C пример:
[source,c]
----
int
my_completion_cb (const void *pointer, void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
/* do not add space after completion */
weechat_completion_set (completion, "add_space", "0");
/* ... */
return WEECHAT_RC_OK;
}
----
Скрипта (Python):
[source,python]
----
# прототип
def completion_set(completion: str, property: str, value: str) -> int: ...
# пример
def my_completion_cb(data: str, completion_item: str, buffer: str, completion: str) -> int:
# do not add space after completion
weechat.completion_set(completion, "add_space", "0")
# ...
return weechat.WEECHAT_RC_OK
----
==== completion_list_add
_WeeChat ≥ 2.9._
+1 -1
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
[[start]]
== Покретање програма WeeChat
+1 -1
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
[[introduction]]
== Увод
+1 -1
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
Ово упутство описује WeeChat чет клијент и део је програма WeeChat.
+8 -6
View File
@@ -6,7 +6,7 @@ include::includes/attributes-sr.adoc[]
Превод:
* Иван Пешић (<ivan.pesic@gmail.com>), 2021.
* Иван Пешић (<ivan.pesic@gmail.com>), 2025.
Ово упутство описује WeeChat чет клијент и део је програма WeeChat.
@@ -1671,11 +1671,13 @@ WeeChat нуди доста подразумеваних тастерских п
[width="100%", cols="^.^3,.^8,.^5", options="header"]
|===
| Тастер | Опис | Команда
| kbd:[Alt+m] | Пребацивање активности миша. | `+/mouse toggle+`
| kbd:[Alt+s] | Пребацује стање активности модула за проверу правописа. | `+/mute spell toggle+`
| kbd:[Alt+=] | Пребацивање активности филтера. | `+/filter toggle+`
| kbd:[Alt+-] | Пребацивање активности филтера у текућем баферу. | `+/filter toggle @+`
| Тастер | Опис | Команда
| kbd:[Alt+m] | Пребацивање активности миша. | `+/mouse toggle+`
| kbd:[Alt+s] | Пребацује стање активности модула за проверу правописа. | `+/mute spell toggle+`
| kbd:[Alt+=] | Пребацивање активности филтера. | `+/filter toggle+`
| kbd:[Alt+-] | Пребацивање активности филтера у текућем баферу. | `+/filter toggle @+`
// TRANSLATION MISSING
| kbd:[Alt+Ctrl+l] (`L`) | Toggle between remote and local commands on a remote buffer (relay "api"). | `+/remote togglecmd+`
|===
[[key_bindings_search_context]]
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
+2 -3
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
@@ -79,8 +79,7 @@ foreach(pofile ${PO_FILES})
add_custom_command(
OUTPUT "${mofile}"
COMMAND "${MSGMERGE_EXECUTABLE}" ARGS --quiet -o "${CMAKE_CURRENT_BINARY_DIR}/${pofile}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" ${POT_FILE_PATH}
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose --output-file=/dev/null "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
COMMENT "Compiling ${polang}.po"
)
+415 -225
View File
File diff suppressed because it is too large Load Diff
+582 -356
View File
File diff suppressed because it is too large Load Diff
+413 -223
View File
File diff suppressed because it is too large Load Diff
+601 -372
View File
File diff suppressed because it is too large Load Diff
+370 -193
View File
File diff suppressed because it is too large Load Diff
+444 -253
View File
File diff suppressed because it is too large Load Diff
+561 -354
View File
File diff suppressed because it is too large Load Diff
+595 -373
View File
File diff suppressed because it is too large Load Diff
+473 -280
View File
File diff suppressed because it is too large Load Diff
+387 -203
View File
File diff suppressed because it is too large Load Diff
+368 -191
View File
File diff suppressed because it is too large Load Diff
+605 -395
View File
File diff suppressed because it is too large Load Diff
+811 -642
View File
File diff suppressed because it is too large Load Diff
+352 -191
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2007-2008 Julien Louis <ptitlouis@sysif.net>
# Copyright (C) 2008-2009 Emmanuel Bouthenot <kolter@openics.org>
#
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
# Copyright (C) 2008 Julien Louis <ptitlouis@sysif.net>
# Copyright (C) 2009 Emmanuel Bouthenot <kolter@openics.org>
#
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* core-arraylist.c - array lists management
*
* Copyright (C) 2014-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2014-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2014-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* core-backtrace.c - backtrace after a segfault
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -149,7 +149,7 @@ weechat_backtrace_addr2line (int number, void *address, const char *symbol)
*/
void
weechat_backtrace ()
weechat_backtrace (void)
{
#ifdef HAVE_BACKTRACE
void *trace[BACKTRACE_MAX];
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -22,6 +22,6 @@
#define BACKTRACE_MAX 128
extern void weechat_backtrace ();
extern void weechat_backtrace (void);
#endif /* WEECHAT_BACKTRACE_H */
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* core-calc.c - calculate result of an expression
*
* Copyright (C) 2019-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2019-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -336,9 +336,9 @@ calc_expression (const char *expr)
struct t_arraylist *list_values, *list_ops;
const char *ptr_expr, *ptr_expr2;
char str_result[64], *ptr_operator, *operator;
int index_op, decimals;
int index_op;
enum t_calc_symbol last_symbol;
double value, factor, *ptr_value;
double value, factor, decimals, *ptr_value;
list_values = NULL;
list_ops = NULL;
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2019-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+454 -115
View File
@@ -1,7 +1,7 @@
/*
* core-command.c - WeeChat core commands
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -1841,7 +1841,7 @@ COMMAND_CALLBACK(color)
COMMAND_CALLBACK(command)
{
int length, index_args, any_plugin;
int index_args, any_plugin;
char *command, **commands, **ptr_command;
struct t_weechat_plugin *ptr_plugin;
struct t_gui_buffer *ptr_buffer;
@@ -1912,11 +1912,8 @@ COMMAND_CALLBACK(command)
}
else
{
length = strlen (argv_eol[index_args + 1]) + 2;
command = malloc (length);
if (command)
if (string_asprintf (&command, "/%s", argv_eol[index_args + 1]) >= 0)
{
snprintf (command, length, "/%s", argv_eol[index_args + 1]);
(void) input_exec_command (ptr_buffer, any_plugin, ptr_plugin,
command, NULL);
free (command);
@@ -2038,7 +2035,7 @@ COMMAND_CALLBACK(debug)
struct t_weechat_plugin *ptr_plugin;
struct timeval time_start, time_end;
char *result, *str_threshold;
long long threshold;
unsigned long long threshold;
int debug;
/* make C compiler happy */
@@ -2076,7 +2073,8 @@ COMMAND_CALLBACK(debug)
if (string_strcmp (argv[1], "callbacks") == 0)
{
COMMAND_MIN_ARGS(3, argv[1]);
threshold = util_parse_delay (argv[2], 1);
if (!util_parse_delay (argv[2], 1, &threshold))
COMMAND_ERROR;
if (threshold > 0)
{
str_threshold = util_get_microseconds_string (threshold);
@@ -2294,6 +2292,13 @@ COMMAND_CALLBACK(debug)
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "whitespace") == 0)
{
gui_chat_whitespace_mode ^= 1;
gui_window_ask_refresh (1);
return WEECHAT_RC_OK;
}
COMMAND_ERROR;
}
@@ -3053,7 +3058,7 @@ command_help_list_commands (int verbose)
*/
const char *
command_help_option_color_values ()
command_help_option_color_values (void)
{
return _("a WeeChat color name (default, black, "
"(dark)gray, white, (light)red, (light)green, "
@@ -3079,8 +3084,8 @@ COMMAND_CALLBACK(help)
struct t_weechat_plugin *ptr_plugin;
struct t_config_option *ptr_option;
int i, length, command_found, first_line_displayed, verbose;
char *string, *ptr_string, *pos_double_pipe, *pos_end, *args_desc;
char empty_string[1] = { '\0' }, str_format[64];
char *string, *ptr_string, **string_values, *pos_double_pipe, *pos_end;
char *args_desc, empty_string[1] = { '\0' }, str_format[64];
/* make C compiler happy */
(void) pointer;
@@ -3370,63 +3375,53 @@ COMMAND_CALLBACK(help)
}
break;
case CONFIG_OPTION_TYPE_ENUM:
length = 0;
i = 0;
while (ptr_option->string_values[i])
string_values = string_dyn_alloc (256);
if (string_values)
{
length += strlen (ptr_option->string_values[i]) + 5;
i++;
}
if (length > 0)
{
string = malloc (length);
if (string)
i = 0;
while (ptr_option->string_values[i])
{
string[0] = '\0';
i = 0;
while (ptr_option->string_values[i])
{
strcat (string, "\"");
strcat (string, ptr_option->string_values[i]);
strcat (string, "\"");
if (ptr_option->string_values[i + 1])
strcat (string, ", ");
i++;
}
gui_chat_printf (NULL, " %s: %s",
_("type"), _("enum"));
gui_chat_printf (NULL, " %s: %s",
_("values"), string);
if (ptr_option->default_value)
{
gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_ENUM_DEFAULT(ptr_option)]);
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (NULL,
" %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_VALUE),
ptr_option->string_values[CONFIG_ENUM(ptr_option)],
GUI_COLOR(GUI_COLOR_CHAT));
}
else
{
gui_chat_printf (NULL,
" %s: %s",
_("current value"),
_("(undefined)"));
}
free (string);
string_dyn_concat (string_values, "\"", -1);
string_dyn_concat (string_values,
ptr_option->string_values[i], -1);
string_dyn_concat (string_values, "\"", -1);
if (ptr_option->string_values[i + 1])
string_dyn_concat (string_values, ", ", -1);
i++;
}
gui_chat_printf (NULL, " %s: %s", _("type"), _("enum"));
gui_chat_printf (NULL, " %s: %s", _("values"), *string_values);
if (ptr_option->default_value)
{
gui_chat_printf (
NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_ENUM_DEFAULT(ptr_option)]);
}
else
{
gui_chat_printf (NULL, " %s: %s",
_("default value"),
_("(undefined)"));
}
if (ptr_option->value)
{
gui_chat_printf (
NULL,
" %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_VALUE),
ptr_option->string_values[CONFIG_ENUM(ptr_option)],
GUI_COLOR(GUI_COLOR_CHAT));
}
else
{
gui_chat_printf (NULL,
" %s: %s",
_("current value"),
_("(undefined)"));
}
string_dyn_free (string_values, 1);
}
break;
case CONFIG_NUM_OPTION_TYPES:
@@ -4874,7 +4869,7 @@ COMMAND_CALLBACK(mouse)
COMMAND_CALLBACK(mute)
{
int length, mute_mode, gui_chat_mute_old;
int mute_mode, gui_chat_mute_old;
char *command, *ptr_command;
struct t_gui_buffer *mute_buffer, *ptr_buffer, *gui_chat_mute_buffer_old;
@@ -4939,11 +4934,8 @@ COMMAND_CALLBACK(mute)
}
else
{
length = strlen (ptr_command) + 2;
command = malloc (length);
if (command)
if (string_asprintf (&command, "/%s", ptr_command) >= 0)
{
snprintf (command, length, "/%s", ptr_command);
(void) input_exec_command (buffer, 1, NULL, command, NULL);
free (command);
}
@@ -4959,6 +4951,260 @@ COMMAND_CALLBACK(mute)
return WEECHAT_RC_OK;
}
/*
* Opens a file in write mode to redirect messages.
*
* Returns a pointer to the file, NULL if error.
*/
FILE *
command_pipe_open_file (const char *filename)
{
char *filename2;
FILE *file;
filename2 = string_expand_home (filename);
if (!filename2)
return NULL;
file = fopen (filename2, "w");
if (!file)
return NULL;
fchmod (fileno (file), 0600);
free (filename2);
return file;
}
/*
* Callback for command "/pipe": redirect command output to a buffer or a file
*/
COMMAND_CALLBACK(pipe)
{
const char *ptr_command, *ptr_filename, *ptr_hsignal;
const char *ptr_concat_separator, *ptr_strip_chars;
char *command, space[2] = " ", newline[2] = "\n";
int i, index_command, skip_empty_lines, send_to_buffer, no_locale;
int pipe_set, color, color_set;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) pointer;
(void) data;
if (argc < 2)
{
/* silently ignore missing arguments ("/pipe" does nothing) */
return WEECHAT_RC_OK;
}
index_command = 1;
send_to_buffer = 0;
no_locale = 0;
ptr_concat_separator = NULL;
ptr_strip_chars = NULL;
skip_empty_lines = 0;
ptr_buffer = NULL;
ptr_filename = NULL;
ptr_hsignal = NULL;
ptr_command = NULL;
color = GUI_CHAT_PIPE_COLOR_STRIP;
color_set = 0;
for (i = 1; i < argc; i++)
{
if (string_strcmp (argv[i], "-concat") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
ptr_concat_separator = argv[i];
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-strip") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
ptr_strip_chars = argv[i];
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-skipempty") == 0)
{
skip_empty_lines = 1;
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-c") == 0)
{
ptr_concat_separator = space;
ptr_strip_chars = space;
skip_empty_lines = 1;
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-nl") == 0)
{
no_locale = 1;
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-o") == 0)
{
send_to_buffer = 1;
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-buffer") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
ptr_buffer = gui_buffer_search_by_full_name (argv[i]);
if (!ptr_buffer)
{
gui_chat_printf (NULL,
_("%sBuffer \"%s\" not found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[i]);
return WEECHAT_RC_ERROR;
}
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-file") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
ptr_filename = argv[i];
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-hsignal") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
ptr_hsignal = argv[i];
index_command = i + 1;
}
else if (string_strcmp (argv[i], "-color") == 0)
{
COMMAND_MIN_ARGS(i + 2, argv[i]);
i++;
color = gui_chat_pipe_search_color (argv[i]);
if (color < 0)
{
gui_chat_printf (NULL,
_("%sInvalid color: \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[i]);
return WEECHAT_RC_ERROR;
}
color_set = 1;
index_command = i + 1;
}
else
break;
}
if (index_command < argc)
ptr_command = argv_eol[index_command];
if (!ptr_command || !ptr_command[0])
{
/* silently ignore missing command */
return WEECHAT_RC_OK;
}
/* for hsignal, set default concat separator to newline if not set */
if (ptr_hsignal && !ptr_concat_separator)
ptr_concat_separator = newline;
/*
* when chaining /pipe command, only the first one (surrounding) wins;
* if buffer/file is already set, ignore it and just execute the command
* with the existing redirection
*/
pipe_set = 0;
if (!gui_chat_pipe)
{
gui_chat_pipe_command = strdup (ptr_command);
if (ptr_filename)
{
gui_chat_pipe_file = command_pipe_open_file (ptr_filename);
if (!gui_chat_pipe_file)
{
gui_chat_printf (NULL,
_("%sUnable to open file \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_filename);
return WEECHAT_RC_ERROR;
}
}
else if (ptr_hsignal)
{
gui_chat_pipe_hsignal = strdup (ptr_hsignal);
if (!gui_chat_pipe_hsignal)
COMMAND_ERROR;
gui_chat_pipe_concat_tags = string_dyn_alloc (1024);
}
else
{
gui_chat_pipe_buffer = (ptr_buffer) ? ptr_buffer : buffer;
if (!gui_chat_pipe_buffer)
COMMAND_ERROR;
if (!color_set && !send_to_buffer)
color = GUI_CHAT_PIPE_COLOR_KEEP;
if (gui_chat_pipe_buffer->type != GUI_BUFFER_TYPE_FORMATTED)
{
gui_chat_printf (NULL,
_("%sCommand /pipe can only use buffers "
"with formatted content"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
gui_chat_pipe_buffer = NULL;
return WEECHAT_RC_ERROR;
}
}
gui_chat_pipe_send_to_buffer = send_to_buffer;
if (ptr_concat_separator)
{
gui_chat_pipe_concat_lines = string_dyn_alloc (1024);
gui_chat_pipe_concat_sep = string_convert_escaped_chars (
ptr_concat_separator);
}
if (ptr_strip_chars)
{
gui_chat_pipe_strip_chars = string_convert_escaped_chars (
ptr_strip_chars);
}
gui_chat_pipe_skip_empty_lines = skip_empty_lines;
if (no_locale)
setlocale (LC_ALL, "C");
gui_chat_pipe_color = color;
pipe_set = 1;
gui_chat_pipe = 1;
}
if (string_asprintf (
&command,
"%s%s",
(string_is_command_char (ptr_command)) ? "" : "/",
ptr_command) < 0)
COMMAND_ERROR;
(void) input_exec_command (
buffer,
1, /* any_plugin */
NULL, /* plugin */
command,
NULL); /* commands_allowed */
free (command);
if (pipe_set)
{
gui_chat_pipe_end ();
if (no_locale)
setlocale (LC_ALL, "");
}
return WEECHAT_RC_OK;
}
/*
* Displays a list of loaded plugins.
*/
@@ -5495,7 +5741,7 @@ COMMAND_CALLBACK(print)
*/
void
command_proxy_list ()
command_proxy_list (void)
{
struct t_proxy *ptr_proxy;
const char *ipv6_status;
@@ -5929,7 +6175,7 @@ command_repeat_timer_cb (const void *pointer, void *data, int remaining_calls)
COMMAND_CALLBACK(repeat)
{
int arg_count, count, i;
long long interval;
unsigned long long interval;
char *error;
struct t_command_repeat *cmd_repeat;
@@ -5944,9 +6190,8 @@ COMMAND_CALLBACK(repeat)
if ((argc >= 5) && (string_strcmp (argv[1], "-interval") == 0))
{
interval = util_parse_delay (argv[2], 1000000);
if (interval < 0)
interval = 0;
if (!util_parse_delay (argv[2], 1000000, &interval))
COMMAND_ERROR;
interval /= 1000;
arg_count = 3;
}
@@ -6491,7 +6736,7 @@ int
command_set_display_option_list (const char *message, const char *search,
int display_only_changed)
{
int number_found, section_displayed, length;
int number_found, section_displayed;
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -6524,15 +6769,12 @@ command_set_display_option_list (const char *message, const char *search,
!config_file_option_has_changed (ptr_option))
continue;
length = strlen (ptr_config->name) + 1
+ strlen (ptr_section->name) + 1
+ strlen (ptr_option->name) + 1;
option_full_name = malloc (length);
if (option_full_name)
if (string_asprintf (&option_full_name,
"%s.%s.%s",
ptr_config->name,
ptr_section->name,
ptr_option->name) >= 0)
{
snprintf (option_full_name, length, "%s.%s.%s",
ptr_config->name, ptr_section->name,
ptr_option->name);
if ((!search) ||
(search && search[0]
&& (string_match (option_full_name, search, 1))))
@@ -7126,6 +7368,7 @@ COMMAND_CALLBACK(unset)
void
command_upgrade_display (struct t_gui_buffer *buffer,
int send_to_buffer_as_input,
int translated_string)
{
char string[1024], str_first_start[128], str_last_start[128];
@@ -7187,11 +7430,18 @@ command_upgrade_display (struct t_gui_buffer *buffer,
}
}
(void) input_data (buffer,
string,
NULL,
0, /* split_newline */
0); /* user_data */
if (send_to_buffer_as_input)
{
(void) input_data (buffer,
string,
NULL,
0, /* split_newline */
0); /* user_data */
}
else
{
gui_chat_printf (NULL, "%s", string);
}
}
/*
@@ -7218,12 +7468,12 @@ COMMAND_CALLBACK(upgrade)
{
if (string_strcmp (argv[1], "-o") == 0)
{
command_upgrade_display (buffer, 0);
command_upgrade_display (buffer, 1, 0);
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "-ol") == 0)
{
command_upgrade_display (buffer, 1);
command_upgrade_display (buffer, 1, 1);
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "-yes") == 0)
@@ -7534,7 +7784,8 @@ void
command_version_display (struct t_gui_buffer *buffer,
int send_to_buffer_as_input,
int translated_string,
int display_git_version)
int display_git_version,
int display_upgrades)
{
char string[1024];
@@ -7564,6 +7815,9 @@ command_version_display (struct t_gui_buffer *buffer,
version_get_compilation_time (),
GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
}
if (display_upgrades)
command_upgrade_display (buffer, send_to_buffer_as_input, translated_string);
}
/*
@@ -7572,7 +7826,7 @@ command_version_display (struct t_gui_buffer *buffer,
COMMAND_CALLBACK(version)
{
int send_to_buffer_as_input, translated_string;
int i, send_to_buffer_as_input, translated_string, display_upgrades;
/* make C compiler happy */
(void) pointer;
@@ -7581,20 +7835,32 @@ COMMAND_CALLBACK(version)
send_to_buffer_as_input = 0;
translated_string = 0;
display_upgrades = 0;
if (argc >= 2)
for (i = 1; i < argc; i++)
{
if (string_strcmp (argv[1], "-o") == 0)
if (string_strcmp (argv[i], "-o") == 0)
{
send_to_buffer_as_input = 1;
else if (string_strcmp (argv[1], "-ol") == 0)
translated_string = 0;
}
else if (string_strcmp (argv[i], "-ol") == 0)
{
send_to_buffer_as_input = 1;
translated_string = 1;
}
else if (string_strcmp (argv[i], "-v") == 0)
{
display_upgrades = 1;
}
}
command_version_display (buffer, send_to_buffer_as_input,
translated_string, 1);
command_version_display (
buffer,
send_to_buffer_as_input,
translated_string,
1, /* display_git_version */
display_upgrades);
return WEECHAT_RC_OK;
}
@@ -7605,7 +7871,7 @@ COMMAND_CALLBACK(version)
COMMAND_CALLBACK(wait)
{
long long delay;
unsigned long long delay;
/* make C compiler happy */
(void) pointer;
@@ -7613,7 +7879,8 @@ COMMAND_CALLBACK(wait)
COMMAND_MIN_ARGS(3, "");
delay = util_parse_delay (argv[1], 1000000);
if (!util_parse_delay (argv[1], 1000000, &delay))
COMMAND_ERROR;
if (delay < 1)
COMMAND_ERROR;
@@ -8026,9 +8293,11 @@ COMMAND_CALLBACK(window)
*/
void
command_init ()
command_init (void)
{
hook_command (
struct t_hook *ptr_hook;
ptr_hook = hook_command (
NULL, "allbuf",
N_("execute a command on all buffers"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -8041,6 +8310,7 @@ command_init ()
N_(" set read marker on all buffers:"),
AI(" /allbuf /buffer set unread")),
"%(commands:/)", &command_allbuf, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "away",
N_("set or remove away status"),
@@ -8076,7 +8346,7 @@ command_init ()
N_("> raw[root]: outside windows"),
N_("> raw[window]: inside windows, with optional conditions (see below)"),
N_("conditions: the conditions to display the bar (without conditions, "
"the bar is always displayed:"),
"the bar is always displayed):"),
N_("> raw[active]: on active window"),
N_("> raw[inactive]: on inactive windows"),
N_("> raw[nicklist]: on windows with nicklist"),
@@ -8290,7 +8560,7 @@ command_init ()
* give high priority (50000) so that an alias will not take precedence
* over this command
*/
hook_command (
ptr_hook = hook_command (
NULL, "50000|command",
N_("launch explicit WeeChat or plugin command"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -8310,6 +8580,7 @@ command_init ()
" || -s"
" || %(plugins_names)|" PLUGIN_CORE " %(plugins_commands:/)",
&command_command, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "cursor",
N_("free movement of cursor on screen to execute actions on specific "
@@ -8361,7 +8632,8 @@ command_init ()
" || mouse|cursor [verbose]"
" || hdata [free]"
" || time <command>"
" || unicode <string>"),
" || unicode <string>"
" || whitespace"),
CMD_ARGS_DESC(
N_("raw[list]: list plugins with debug levels"),
N_("raw[set]: set debug level for plugin"),
@@ -8403,6 +8675,9 @@ command_init ()
"the current buffer"),
N_("raw[unicode]: display information about string and unicode chars "
"(evaluated, see /help eval)"),
N_("raw[whitespace]: toggle whitespace mode: make spaces and tabulations "
"visible in buffers and bars (see options weechat.look.whitespace_char "
"and weechat.look.tab_whitespace_char)"),
"",
N_("Examples:"),
AI(" /debug set irc 1"),
@@ -8431,9 +8706,10 @@ command_init ()
" || url"
" || windows"
" || time %(commands:/)"
" || unicode",
" || unicode"
" || whitespace",
&command_debug, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "eval",
N_("evaluate expression"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -8621,6 +8897,7 @@ command_init ()
AI(" /eval -n -c abcd =- bc ==> 1")),
"-n|-s|-c|%(eval_variables)|%*",
&command_eval, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "filter",
N_("filter messages in buffers, to hide/show them according to tags or "
@@ -9070,11 +9347,11 @@ command_init ()
AI(" /mouse toggle 5")),
"enable|disable|toggle",
&command_mouse, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "mute",
N_("execute a command silently"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
N_("[-core | -current | -buffer <name>] <command>"),
N_("[-core|-current|-buffer <name>] <command>"),
CMD_ARGS_DESC(
N_("raw[-core]: no output on WeeChat core buffer"),
N_("raw[-current]: no output on current buffer"),
@@ -9095,6 +9372,63 @@ command_init ()
" || -buffer %(buffers_plugins_names) %(commands:/)|%*"
" || %(commands:/)|%*",
&command_mute, NULL, NULL);
COMMAND_KEEP_SPACES;
ptr_hook = hook_command (
NULL, "pipe",
N_("redirect command output to a buffer, a file or a hsignal"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
N_("[-buffer <name>|-file <filename>|-hsignal <name>] "
"[-color strip|keep|ansi] [-concat <separator>] "
"[-strip <chars>] [-skipempty] [-c] [-o] [-g] [-nl] <command>"),
CMD_ARGS_DESC(
N_("raw[-buffer]: display command output on this buffer"),
N_("name: full buffer name (examples: \"core.weechat\", "
"\"irc.server.libera\", \"irc.libera.#weechat\")"),
N_("raw[-file]: write command output in this file"),
N_("raw[-hsignal]: send command output as hsignal; "
"keys: \"command\", \"output\" (lines separated by separator) "
"and \"tags\" (tags of each line separated by newline)"),
N_("raw[-color]: convert colors"),
N_("raw[-o]: send command output to the buffer as input; "
"colors are stripped and commands are NOT executed "
"(used only with -buffer)"),
N_("raw[-concat]: concatenate all lines displayed using a separator; "
"chars can be escaped (example: \\x20 for space)"),
N_("raw[-strip]: strip chars from lines (beginning/end); "
"chars can be escaped (example: \\x20 for space)"),
N_("raw[-skipempty]: skip empty lines when lines are concatenated"),
N_("raw[-c]: alias for \"-concat \\x20 -strip \\x20 -skipempty\""),
N_("raw[-nl]: display messages in English during the command execution "
"(do not use the current locale)"),
N_("command: command to execute (a \"/\" is automatically added "
"if not found at beginning of command)"),
"",
N_("If no target is specified (\"-buffer\", \"-file\" or \"-hsignal\"), "
"then the command output is sent on the current buffer."),
"",
N_("Note: for commands that display messages in an asynchronous way "
"(like /exec and many IRC commands), the output will not be "
"caught by this command."),
N_("For example \"/pipe /whois nick\" will NOT redirect the answer "
"from IRC server to the current buffer."),
"",
N_("Examples:"),
N_(" write info about external libraries in a file:"),
AI(" /pipe -file /tmp/libs.txt /debug libs"),
N_(" send output of \"/debug libs\" as a single line on current channel:"),
AI(" /pipe -o -c /debug libs"),
N_(" display info about all buffers on current buffer:"),
AI(" /pipe /allbuf /eval /print ${buffer.full_name} -> "
"${buffer.number}. ${buffer.short_name} (${buffer})"),
N_(" send list of filters on current channel, in English:"),
AI(" /pipe -o -nl /filter")),
"-buffer %(buffers_plugins_names) %(commands:/)|%*"
" || -file %(filename) %(commands:/)|%*"
" || -hsignal %- %(commands:/)|%*"
" || -o %(commands:/)|%*"
" || %(commands:/)|%*",
&command_pipe, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "plugin",
N_("list/load/unload plugins"),
@@ -9133,7 +9467,7 @@ command_init ()
" || reload %(plugins_names)|* -a|-s"
" || unload %(plugins_names)",
&command_plugin, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "print",
N_("display text on a buffer"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -9201,6 +9535,7 @@ command_init ()
" || -stderr"
" || -beep",
&command_print, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "proxy",
N_("manage proxies"),
@@ -9242,7 +9577,7 @@ command_init ()
" || del %(proxies_names)|%*"
" || set %(proxies_names) %(proxies_options)",
&command_proxy, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "quit",
N_("quit WeeChat"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -9259,6 +9594,7 @@ command_init ()
"\"weechat.look.save_layout_on_exit\").")),
"",
&command_quit, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "reload",
N_("reload configuration files from disk"),
@@ -9270,7 +9606,7 @@ command_init ()
N_("Without argument, all files (WeeChat and plugins) are reloaded.")),
"%(config_files)|%*",
&command_reload, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "repeat",
N_("execute a command several times"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -9307,6 +9643,7 @@ command_init ()
AI(" /repeat -interval 1 6 /print ${if:${repeat_last}?Boom!:${repeat_revindex0}}")),
"%- %(commands:/)",
&command_repeat, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "reset",
N_("reset config options"),
@@ -9594,17 +9931,18 @@ command_init ()
hook_command (
NULL, "version",
N_("show WeeChat version and compilation date"),
"[-o|-ol]",
"[-o|-ol] [-v]",
CMD_ARGS_DESC(
N_("raw[-o]: send version to current buffer as input (English string)"),
N_("raw[-ol]: send version to current buffer as input (translated string)"),
N_("raw[-v]: verbose mode: display information about upgrades of WeeChat with /upgrade"),
"",
N_("The default alias /v can be used to execute this command on "
"all buffers (otherwise the irc command /version is used on irc "
"buffers).")),
"-o|-ol",
"-o|-ol|-v|%*",
&command_version, NULL, NULL);
hook_command (
ptr_hook = hook_command (
NULL, "wait",
N_("schedule a command execution in future"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated */
@@ -9633,6 +9971,7 @@ command_init ()
N_(" /wait 2m hello")),
"%- %(commands:/)",
&command_wait, NULL, NULL);
COMMAND_KEEP_SPACES;
hook_command (
NULL, "window",
N_("manage windows"),
+7 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -85,6 +85,8 @@ struct t_gui_buffer;
#define CMD_ARGS_DESC(args...) \
STR_CONCAT("\n", WEECHAT_HOOK_COMMAND_STR_FORMATTED, ##args)
#define COMMAND_KEEP_SPACES hook_set (ptr_hook, "keep_spaces_right", "1")
struct t_command_repeat
{
char *buffer_name; /* full buffer name */
@@ -94,12 +96,13 @@ struct t_command_repeat
int index; /* current index (starts at 1) */
};
extern const char *command_help_option_color_values ();
extern const char *command_help_option_color_values (void);
extern void command_version_display (struct t_gui_buffer *buffer,
int send_to_buffer_as_input,
int translated_string,
int display_git_version);
extern void command_init ();
int display_git_version,
int display_upgrades);
extern void command_init (void);
extern void command_startup (int plugins_loaded);
#endif /* WEECHAT_COMMAND_H */
+23 -47
View File
@@ -1,7 +1,7 @@
/*
* core-completion.c - completion for WeeChat commands
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -71,17 +71,12 @@ completion_list_add_quoted_word (struct t_gui_completion *completion,
const char *word)
{
char *temp;
int length;
length = 1 + strlen (word) + 1 + 1;
temp = malloc (length);
if (!temp)
return;
snprintf (temp, length, "\"%s\"", word);
gui_completion_list_add (completion, temp, 0, WEECHAT_LIST_POS_END);
free (temp);
if (string_asprintf (&temp, "\"%s\"", word) >= 0)
{
gui_completion_list_add (completion, temp, 0, WEECHAT_LIST_POS_END);
free (temp);
}
}
/*
@@ -1221,7 +1216,6 @@ completion_list_add_config_options_cb (const void *pointer, void *data,
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
int length;
char *option_full_name;
/* make C compiler happy */
@@ -1239,15 +1233,12 @@ completion_list_add_config_options_cb (const void *pointer, void *data,
for (ptr_option = ptr_section->options; ptr_option;
ptr_option = ptr_option->next_option)
{
length = strlen (ptr_config->name) + 1
+ strlen (ptr_section->name) + 1
+ strlen (ptr_option->name) + 1;
option_full_name = malloc (length);
if (option_full_name)
if (string_asprintf (&option_full_name,
"%s.%s.%s",
ptr_config->name,
ptr_section->name,
ptr_option->name) >= 0)
{
snprintf (option_full_name, length, "%s.%s.%s",
ptr_config->name, ptr_section->name,
ptr_option->name);
gui_completion_list_add (completion,
option_full_name,
0, WEECHAT_LIST_POS_SORT);
@@ -1334,7 +1325,6 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data,
struct t_gui_completion *completion)
{
char *plugin_path, *dir_name, *extra_libdir;
int length;
struct t_hashtable *options;
/* make C compiler happy */
@@ -1347,11 +1337,8 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data,
extra_libdir = getenv (WEECHAT_EXTRA_LIBDIR);
if (extra_libdir && extra_libdir[0])
{
length = strlen (extra_libdir) + 16 + 1;
dir_name = malloc (length);
if (dir_name)
if (string_asprintf (&dir_name, "%s/plugins", extra_libdir) >= 0)
{
snprintf (dir_name, length, "%s/plugins", extra_libdir);
dir_exec_on_files (dir_name, 1, 0,
&completion_list_add_plugins_installed_exec_cb,
completion);
@@ -1383,11 +1370,8 @@ completion_list_add_plugins_installed_cb (const void *pointer, void *data,
}
/* plugins in WeeChat global lib dir */
length = strlen (WEECHAT_LIBDIR) + 16 + 1;
dir_name = malloc (length);
if (dir_name)
if (string_asprintf (&dir_name, "%s/plugins", WEECHAT_LIBDIR) >= 0)
{
snprintf (dir_name, length, "%s/plugins", WEECHAT_LIBDIR);
dir_exec_on_files (dir_name, 1, 0,
&completion_list_add_plugins_installed_exec_cb,
completion);
@@ -1500,7 +1484,6 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
char *pos_space, *option_full_name, *pos_section, *pos_option;
char *file, *section, *value_string, **ptr_value;
const char *color_name;
int length;
struct t_config_file *ptr_config;
struct t_config_section *ptr_section, *section_found;
struct t_config_option *option_found;
@@ -1587,12 +1570,11 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
0, WEECHAT_LIST_POS_BEGINNING);
if (option_found->value)
{
length = 64;
value_string = malloc (length);
if (value_string)
if (string_asprintf (
&value_string,
"%d",
CONFIG_INTEGER(option_found)) >= 0)
{
snprintf (value_string, length,
"%d", CONFIG_INTEGER(option_found));
gui_completion_list_add (completion,
value_string,
0, WEECHAT_LIST_POS_BEGINNING);
@@ -1612,13 +1594,11 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
0, WEECHAT_LIST_POS_BEGINNING);
if (option_found->value)
{
length = strlen (CONFIG_STRING(option_found)) + 2 + 1;
value_string = malloc (length);
if (value_string)
if (string_asprintf (
&value_string,
"\"%s\"",
CONFIG_STRING(option_found)) >= 0)
{
snprintf (value_string, length,
"\"%s\"",
CONFIG_STRING(option_found));
gui_completion_list_add (completion,
value_string,
0, WEECHAT_LIST_POS_BEGINNING);
@@ -2126,17 +2106,13 @@ completion_list_map_eval_buffer_local_variable_cb (void *data,
const void *key, const void *value)
{
char *name;
int length;
/* make C compiler happy */
(void) hashtable;
(void) value;
length = strlen (key) + 3 + 1;
name = malloc (length);
if (name)
if (string_asprintf (&name, "${%s}", (const char *)key) >= 0)
{
snprintf (name, length, "${%s}", (const char *)key);
gui_completion_list_add ((struct t_gui_completion *)data,
name, 0, WEECHAT_LIST_POS_SORT);
free (name);
@@ -2251,7 +2227,7 @@ completion_list_add_eval_variables_cb (const void *pointer, void *data,
*/
void
completion_init ()
completion_init (void)
{
hook_completion (NULL, "buffers_names", /* formerly "%b" */
N_("names of buffers"),
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -28,6 +28,6 @@ extern int completion_list_add_filename_cb (const void *pointer,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion);
extern void completion_init ();
extern void completion_init (void);
#endif /* WEECHAT_COMPLETION_H */
+65 -101
View File
@@ -1,7 +1,7 @@
/*
* core-config-file.c - configuration files/sections/options management
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -201,8 +201,7 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
{
struct t_config_file *new_config_file;
const char *ptr_name;
char *filename;
int priority, length;
int priority;
string_get_priority_and_name (name, &priority, &ptr_name,
CONFIG_PRIORITY_DEFAULT);
@@ -225,16 +224,7 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name,
free (new_config_file);
return NULL;
}
new_config_file->filename = NULL;
length = strlen (ptr_name) + 8 + 1;
filename = malloc (length);
if (filename)
{
snprintf (filename, length, "%s.conf", ptr_name);
new_config_file->filename = strdup (filename);
free (filename);
}
if (!new_config_file->filename)
if (string_asprintf (&new_config_file->filename, "%s.conf", ptr_name) < 0)
{
free (new_config_file->name);
free (new_config_file);
@@ -321,7 +311,7 @@ config_file_arraylist_cmp_config_cb (void *data,
*/
struct t_arraylist *
config_file_get_configs_by_priority ()
config_file_get_configs_by_priority (void)
{
struct t_arraylist *list;
struct t_config_file *ptr_config;
@@ -501,23 +491,16 @@ config_file_search_section (struct t_config_file *config_file,
char *
config_file_option_full_name (struct t_config_option *option)
{
int length_option;
char *option_full_name;
if (!option)
return NULL;
length_option = strlen (option->config_file->name) + 1 +
strlen (option->section->name) + 1 + strlen (option->name) + 1;
option_full_name = malloc (length_option);
if (option_full_name)
{
snprintf (option_full_name, length_option,
"%s.%s.%s",
option->config_file->name,
option->section->name,
option->name);
}
string_asprintf (&option_full_name,
"%s.%s.%s",
option->config_file->name,
option->section->name,
option->name);
return option_full_name;
}
@@ -650,7 +633,7 @@ config_file_option_insert_in_section (struct t_config_option *option)
*/
struct t_config_option *
config_file_option_malloc ()
config_file_option_malloc (void)
{
struct t_config_option *new_option;
@@ -2373,7 +2356,7 @@ config_file_option_value_to_string (struct t_config_option *option,
{
char *value;
const char *ptr_value;
int enabled, length;
int enabled;
if (!option)
return NULL;
@@ -2381,14 +2364,11 @@ config_file_option_value_to_string (struct t_config_option *option,
if ((default_value && !option->default_value)
|| (!default_value && !option->value))
{
length = 7 + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE_NULL) : "",
"null");
string_asprintf (
&value,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE_NULL) : "",
"null");
return value;
}
@@ -2397,66 +2377,51 @@ config_file_option_value_to_string (struct t_config_option *option,
case CONFIG_OPTION_TYPE_BOOLEAN:
enabled = (default_value) ?
CONFIG_BOOLEAN_DEFAULT(option) : CONFIG_BOOLEAN(option);
length = 7 + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
(enabled) ? "on" : "off");
string_asprintf (
&value,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
(enabled) ? "on" : "off");
return value;
case CONFIG_OPTION_TYPE_INTEGER:
length = 31 + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%d",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
(default_value) ? CONFIG_INTEGER_DEFAULT(option) : CONFIG_INTEGER(option));
string_asprintf (
&value,
"%s%d",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
(default_value) ? CONFIG_INTEGER_DEFAULT(option) : CONFIG_INTEGER(option));
return value;
case CONFIG_OPTION_TYPE_STRING:
ptr_value = (default_value) ? CONFIG_STRING_DEFAULT(option) : CONFIG_STRING(option);
length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%s%s%s%s%s",
(use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "",
(use_delimiters) ? "\"" : "",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value,
(use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "",
(use_delimiters) ? "\"" : "");
string_asprintf (
&value,
"%s%s%s%s%s%s",
(use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "",
(use_delimiters) ? "\"" : "",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value,
(use_colors && use_delimiters) ? GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS) : "",
(use_delimiters) ? "\"" : "");
return value;
case CONFIG_OPTION_TYPE_COLOR:
ptr_value = gui_color_get_name (
(default_value) ? CONFIG_COLOR_DEFAULT(option) : CONFIG_COLOR(option));
if (!ptr_value)
return NULL;
length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value);
string_asprintf (
&value,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value);
return value;
case CONFIG_OPTION_TYPE_ENUM:
ptr_value = (default_value) ?
option->string_values[CONFIG_ENUM_DEFAULT(option)] :
option->string_values[CONFIG_ENUM(option)];
length = strlen (ptr_value) + ((use_colors) ? 64 : 0) + 1;
value = malloc (length);
if (!value)
return NULL;
snprintf (value, length,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value);
option->string_values[CONFIG_ENUM(option)];
string_asprintf (
&value,
"%s%s",
(use_colors) ? GUI_COLOR(GUI_COLOR_CHAT_VALUE) : "",
ptr_value);
return value;
case CONFIG_NUM_OPTION_TYPES:
/* make C compiler happy */
@@ -3187,7 +3152,7 @@ int
config_file_write_internal (struct t_config_file *config_file,
int default_options)
{
int filename_length, rc;
int rc;
long file_perms;
char *filename, *filename2, resolved_path[PATH_MAX], *error;
struct t_config_section *ptr_section;
@@ -3197,25 +3162,24 @@ config_file_write_internal (struct t_config_file *config_file,
return WEECHAT_CONFIG_WRITE_ERROR;
/* build filename */
filename_length = strlen (weechat_config_dir) + strlen (DIR_SEPARATOR) +
strlen (config_file->filename) + 1;
filename = malloc (filename_length);
if (!filename)
if (string_asprintf (&filename,
"%s%s%s",
weechat_config_dir,
DIR_SEPARATOR,
config_file->filename) < 0)
{
return WEECHAT_CONFIG_WRITE_MEMORY_ERROR;
snprintf (filename, filename_length, "%s%s%s",
weechat_config_dir, DIR_SEPARATOR, config_file->filename);
}
/*
* build temporary filename, this temp file will be renamed to filename
* after write
*/
filename2 = malloc (filename_length + 32);
if (!filename2)
if (string_asprintf (&filename2, "%s.weechattmp", filename) < 0)
{
free (filename);
return WEECHAT_CONFIG_WRITE_MEMORY_ERROR;
}
snprintf (filename2, filename_length + 32, "%s.weechattmp", filename);
/* if filename is a symbolic link, use target as filename */
if (realpath (filename, resolved_path))
@@ -3624,8 +3588,7 @@ config_file_update_data_read (struct t_config_file *config_file,
int
config_file_read_internal (struct t_config_file *config_file, int reload)
{
int filename_length, line_number, rc, length, version;
int warning_update_displayed;
int line_number, rc, length, version, warning_update_displayed;
char *filename, *section, *option, *value;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -3638,13 +3601,14 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
warning_update_displayed = 0;
/* build filename */
filename_length = strlen (weechat_config_dir) + strlen (DIR_SEPARATOR) +
strlen (config_file->filename) + 1;
filename = malloc (filename_length);
if (!filename)
if (string_asprintf (&filename,
"%s%s%s",
weechat_config_dir,
DIR_SEPARATOR,
config_file->filename) < 0)
{
return WEECHAT_CONFIG_READ_MEMORY_ERROR;
snprintf (filename, filename_length, "%s%s%s",
weechat_config_dir, DIR_SEPARATOR, config_file->filename);
}
/* create file with default options if it does not exist */
if (access (filename, F_OK) != 0)
@@ -4186,7 +4150,7 @@ config_file_free (struct t_config_file *config_file)
*/
void
config_file_free_all ()
config_file_free_all (void)
{
while (config_files)
{
@@ -4533,7 +4497,7 @@ config_file_add_to_infolist (struct t_infolist *infolist,
*/
void
config_file_print_log ()
config_file_print_log (void)
{
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
+4 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -205,7 +205,7 @@ extern int config_file_set_version (struct t_config_file *config_file,
struct t_hashtable *data_read),
const void *callback_update_pointer,
void *callback_update_data);
extern struct t_arraylist *config_file_get_configs_by_priority ();
extern struct t_arraylist *config_file_get_configs_by_priority (void);
extern struct t_config_section *config_file_new_section (struct t_config_file *config_file,
const char *name,
int user_can_add_options,
@@ -340,7 +340,7 @@ extern void config_file_option_free (struct t_config_option *option,
extern void config_file_section_free_options (struct t_config_section *section);
extern void config_file_section_free (struct t_config_section *section);
extern void config_file_free (struct t_config_file *config_file);
extern void config_file_free_all ();
extern void config_file_free_all (void);
extern void config_file_free_all_plugin (struct t_weechat_plugin *plugin);
extern struct t_hdata *config_file_hdata_config_file_cb (const void *pointer,
void *data,
@@ -353,6 +353,6 @@ extern struct t_hdata *config_file_hdata_config_option_cb (const void *pointer,
const char *hdata_name);
extern int config_file_add_to_infolist (struct t_infolist *infolist,
const char *option_name);
extern void config_file_print_log ();
extern void config_file_print_log (void);
#endif /* WEECHAT_CONFIG_FILE_H */
+153 -24
View File
@@ -1,7 +1,7 @@
/*
* core-config.c - WeeChat configuration options (file weechat.conf)
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -217,8 +217,10 @@ struct t_config_option *config_look_scroll_page_percent = NULL;
struct t_config_option *config_look_search_text_not_found_alert = NULL;
struct t_config_option *config_look_separator_horizontal = NULL;
struct t_config_option *config_look_separator_vertical = NULL;
struct t_config_option *config_look_tab_whitespace_char = NULL;
struct t_config_option *config_look_tab_width = NULL;
struct t_config_option *config_look_time_format = NULL;
struct t_config_option *config_look_whitespace_char = NULL;
struct t_config_option *config_look_window_auto_zoom = NULL;
struct t_config_option *config_look_window_separator_horizontal = NULL;
struct t_config_option *config_look_window_separator_vertical = NULL;
@@ -307,6 +309,7 @@ struct t_config_option *config_completion_nick_case_sensitive = NULL;
struct t_config_option *config_completion_nick_completer = NULL;
struct t_config_option *config_completion_nick_first_only = NULL;
struct t_config_option *config_completion_nick_ignore_chars = NULL;
struct t_config_option *config_completion_nick_ignore_words = NULL;
struct t_config_option *config_completion_partial_completion_alert = NULL;
struct t_config_option *config_completion_partial_completion_command = NULL;
struct t_config_option *config_completion_partial_completion_command_arg = NULL;
@@ -361,6 +364,7 @@ int config_num_highlight_tags = 0;
char **config_plugin_extensions = NULL;
int config_num_plugin_extensions = 0;
char config_tab_spaces[TAB_MAX_WIDTH + 1];
char config_tab_spaces_whitespace[(TAB_MAX_WIDTH * 4) + 1];
struct t_config_look_word_char_item *config_word_chars_highlight = NULL;
int config_word_chars_highlight_count = 0;
struct t_config_look_word_char_item *config_word_chars_input = NULL;
@@ -372,6 +376,7 @@ char **config_eval_syntax_colors = NULL;
int config_num_eval_syntax_colors = 0;
char *config_item_time_evaluated = NULL;
char *config_buffer_time_same_evaluated = NULL;
struct t_hashtable *config_hashtable_completion_nick_ignore_words = NULL;
struct t_hashtable *config_hashtable_completion_partial_templates = NULL;
char **config_hotlist_sort_fields = NULL;
int config_num_hotlist_sort_fields = 0;
@@ -428,7 +433,7 @@ config_check_config_permissions (const void *pointer, void *data,
*/
void
config_change_save_config_layout_on_exit ()
config_change_save_config_layout_on_exit (void)
{
if (gui_init_ok && !CONFIG_BOOLEAN(config_look_save_config_on_exit)
&& (CONFIG_ENUM(config_look_save_layout_on_exit) != CONFIG_LOOK_SAVE_LAYOUT_ON_EXIT_NONE))
@@ -493,12 +498,8 @@ config_change_window_title (const void *pointer, void *data,
(void) data;
(void) option;
if (gui_init_ok
|| (CONFIG_STRING(config_look_window_title)
&& CONFIG_STRING(config_look_window_title)[0]))
{
if (gui_init_ok)
gui_window_set_title (CONFIG_STRING(config_look_window_title));
}
}
/*
@@ -761,7 +762,7 @@ config_change_buffer_time_same (const void *pointer, void *data,
*/
void
config_compute_prefix_max_length_all_buffers ()
config_compute_prefix_max_length_all_buffers (void)
{
struct t_gui_buffer *ptr_buffer;
@@ -780,7 +781,7 @@ config_compute_prefix_max_length_all_buffers ()
*/
void
config_set_nick_colors ()
config_set_nick_colors (void)
{
if (config_nick_colors)
{
@@ -859,7 +860,7 @@ config_change_look_nick_color_force (const void *pointer, void *data,
*/
void
config_set_eval_syntax_colors ()
config_set_eval_syntax_colors (void)
{
if (config_eval_syntax_colors)
{
@@ -1311,20 +1312,54 @@ config_check_separator (const void *pointer, void *data,
}
/*
* Callback for changes on option "weechat.look.tab_width".
* Checks options "weechat.look.whitespace_char" and
* "weechat.look.tab_whitespace_char".
*/
void
config_change_tab_width (const void *pointer, void *data,
struct t_config_option *option)
int
config_check_whitespace_char (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
memset (config_tab_spaces, ' ', CONFIG_INTEGER(config_look_tab_width));
config_tab_spaces[CONFIG_INTEGER(config_look_tab_width)] = '\0';
return ((strlen (value) <= 4) && (utf8_strlen_screen (value) == 1)) ? 1 : 0;
}
/*
* Callback for changes on options "weechat.look.tab_width" and
* "weechat.look.tab_whitespace_char".
*/
void
config_change_tab (const void *pointer, void *data,
struct t_config_option *option)
{
int tab_width, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
tab_width = CONFIG_INTEGER(config_look_tab_width);
/* build a string with spaces that replace Tab char */
memset (config_tab_spaces, ' ', tab_width);
config_tab_spaces[tab_width] = '\0';
/* replaces spaces in whitespace mode */
config_tab_spaces_whitespace[0] = '\0';
strcat (config_tab_spaces_whitespace,
CONFIG_STRING(config_look_tab_whitespace_char));
for (i = 1; i < tab_width; i++)
{
strcat (config_tab_spaces_whitespace,
CONFIG_STRING(config_look_whitespace_char));
}
gui_window_ask_refresh (1);
}
@@ -1383,6 +1418,56 @@ config_change_eval_syntax_colors (const void *pointer, void *data,
gui_color_buffer_display ();
}
/*
* Callback for changes on option "weechat.completion.nick_ignore_words".
*/
void
config_change_completion_nick_ignore_words (const void *pointer,
void *data,
struct t_config_option *option)
{
char **words;
int num_words, i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
if (!config_hashtable_completion_nick_ignore_words)
{
config_hashtable_completion_nick_ignore_words = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL, NULL);
}
else
{
hashtable_remove_all (config_hashtable_completion_nick_ignore_words);
}
words = string_split (
CONFIG_STRING(config_completion_nick_ignore_words),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
&num_words);
if (words)
{
for (i = 0; i < num_words; i++)
{
hashtable_set (config_hashtable_completion_nick_ignore_words,
words[i], NULL);
}
string_free_split (words);
}
}
/*
* Callback for changes on option
* "weechat.completion.partial_completion_templates".
@@ -1567,7 +1652,7 @@ config_day_change_timer_cb (const void *pointer, void *data,
*/
void
config_weechat_init_after_read ()
config_weechat_init_after_read (void)
{
int context;
@@ -1922,7 +2007,7 @@ config_weechat_debug_get (const char *plugin_name)
*/
void
config_weechat_debug_set_all ()
config_weechat_debug_set_all (void)
{
struct t_config_option *ptr_option;
struct t_weechat_plugin *ptr_plugin;
@@ -3142,7 +3227,7 @@ config_weechat_key_delete_option_cb (const void *pointer, void *data,
*/
int
config_weechat_init_options ()
config_weechat_init_options (void)
{
int context;
char section_name[128];
@@ -4336,13 +4421,24 @@ config_weechat_init_options ()
&config_check_separator, NULL, NULL,
&config_change_buffers, NULL, NULL,
NULL, NULL, NULL);
config_look_tab_whitespace_char = config_file_new_option (
weechat_config_file, weechat_config_section_look,
"tab_whitespace_char", "string",
N_("first char to display for tabulations when whitespace mode is "
"enabled with command `/debug whitespace`; width on screen must "
"be exactly one char; subsequent chars are set by option "
"weechat.look.whitespace_char"),
NULL, 0, 0, "", NULL, 0,
&config_check_whitespace_char, NULL, NULL,
&config_change_tab, NULL, NULL,
NULL, NULL, NULL);
config_look_tab_width = config_file_new_option (
weechat_config_file, weechat_config_section_look,
"tab_width", "integer",
N_("number of spaces used to display tabs in messages"),
NULL, 1, TAB_MAX_WIDTH, "1", NULL, 0,
NULL, NULL, NULL,
&config_change_tab_width, NULL, NULL,
&config_change_tab, NULL, NULL,
NULL, NULL, NULL);
config_look_time_format = config_file_new_option (
weechat_config_file, weechat_config_section_look,
@@ -4351,6 +4447,16 @@ config_weechat_init_options ()
"messages (see man strftime for date/time specifiers)"),
NULL, 0, 0, "%a, %d %b %Y %T", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_whitespace_char = config_file_new_option (
weechat_config_file, weechat_config_section_look,
"whitespace_char", "string",
N_("char to display for spaces when whitespace mode is enabled with "
"command `/debug whitespace`; width on screen must be exactly "
"one char; see also option weechat.look.tab_whitespace_char"),
NULL, 0, 0, "·", NULL, 0,
&config_check_whitespace_char, NULL, NULL,
&config_change_buffers, NULL, NULL,
NULL, NULL, NULL);
config_look_window_auto_zoom = config_file_new_option (
weechat_config_file, weechat_config_section_look,
"window_auto_zoom", "boolean",
@@ -5116,6 +5222,19 @@ config_weechat_init_options ()
N_("chars ignored for nick completion"),
NULL, 0, 0, "[]`_-^", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_completion_nick_ignore_words = config_file_new_option (
weechat_config_file, weechat_config_section_completion,
"nick_ignore_words", "string",
N_("comma-separated list of nicks to ignore (not completed); "
"the whole nick must be set in this option even if chars are "
"ignored in completion with option "
"weechat.completion.nick_ignore_chars; look up for nicks is with "
"exact case then lower case, so it's possible to use only lower "
"case for nicks in this option"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
&config_change_completion_nick_ignore_words, NULL, NULL,
NULL, NULL, NULL);
config_completion_partial_completion_alert = config_file_new_option (
weechat_config_file, weechat_config_section_completion,
"partial_completion_alert", "boolean",
@@ -5469,7 +5588,7 @@ config_weechat_init_options ()
*/
int
config_weechat_init ()
config_weechat_init (void)
{
int rc;
struct timeval tv_time;
@@ -5477,6 +5596,8 @@ config_weechat_init ()
time_t seconds;
snprintf (config_tab_spaces, sizeof (config_tab_spaces), " ");
snprintf (config_tab_spaces_whitespace, sizeof (config_tab_spaces_whitespace),
"\u2192");
rc = config_weechat_init_options ();
@@ -5512,6 +5633,8 @@ config_weechat_init ()
config_change_word_chars_highlight (NULL, NULL, NULL);
if (!config_word_chars_input)
config_change_word_chars_input (NULL, NULL, NULL);
if (!config_hashtable_completion_nick_ignore_words)
config_change_completion_nick_ignore_words (NULL, NULL, NULL);
if (!config_hashtable_completion_partial_templates)
config_change_completion_partial_completion_templates (NULL, NULL, NULL);
@@ -5528,7 +5651,7 @@ config_weechat_init ()
*/
int
config_weechat_read ()
config_weechat_read (void)
{
int rc;
@@ -5551,7 +5674,7 @@ config_weechat_read ()
*/
int
config_weechat_write ()
config_weechat_write (void)
{
return config_file_write (weechat_config_file);
}
@@ -5561,7 +5684,7 @@ config_weechat_write ()
*/
void
config_weechat_free ()
config_weechat_free (void)
{
config_file_free (weechat_config_file);
@@ -5639,6 +5762,12 @@ config_weechat_free ()
config_buffer_time_same_evaluated = NULL;
}
if (config_hashtable_completion_nick_ignore_words)
{
hashtable_free (config_hashtable_completion_nick_ignore_words);
config_hashtable_completion_nick_ignore_words = NULL;
}
if (config_hashtable_completion_partial_templates)
{
hashtable_free (config_hashtable_completion_partial_templates);
+12 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2005-2006 Emmanuel Bouthenot <kolter@openics.org>
*
* This file is part of WeeChat, the extensible chat client.
@@ -273,8 +273,10 @@ extern struct t_config_option *config_look_scroll_page_percent;
extern struct t_config_option *config_look_search_text_not_found_alert;
extern struct t_config_option *config_look_separator_horizontal;
extern struct t_config_option *config_look_separator_vertical;
extern struct t_config_option *config_look_tab_whitespace_char;
extern struct t_config_option *config_look_tab_width;
extern struct t_config_option *config_look_time_format;
extern struct t_config_option *config_look_whitespace_char;
extern struct t_config_option *config_look_window_auto_zoom;
extern struct t_config_option *config_look_window_separator_horizontal;
extern struct t_config_option *config_look_window_separator_vertical;
@@ -356,6 +358,7 @@ extern struct t_config_option *config_completion_nick_case_sensitive;
extern struct t_config_option *config_completion_nick_completer;
extern struct t_config_option *config_completion_nick_first_only;
extern struct t_config_option *config_completion_nick_ignore_chars;
extern struct t_config_option *config_completion_nick_ignore_words;
extern struct t_config_option *config_completion_partial_completion_alert;
extern struct t_config_option *config_completion_partial_completion_command;
extern struct t_config_option *config_completion_partial_completion_command_arg;
@@ -397,6 +400,7 @@ extern int config_num_highlight_tags;
extern char **config_plugin_extensions;
extern int config_num_plugin_extensions;
extern char config_tab_spaces[];
extern char config_tab_spaces_whitespace[];
extern struct t_config_look_word_char_item *config_word_chars_highlight;
extern int config_word_chars_highlight_count;
extern struct t_config_look_word_char_item *config_word_chars_input;
@@ -407,24 +411,25 @@ extern struct t_hashtable *config_hashtable_nick_color_force;
extern char **config_eval_syntax_colors;
extern int config_num_eval_syntax_colors;
extern char *config_buffer_time_same_evaluated;
extern struct t_hashtable *config_hashtable_completion_nick_ignore_words;
extern struct t_hashtable *config_hashtable_completion_partial_templates;
extern char **config_hotlist_sort_fields;
extern int config_num_hotlist_sort_fields;
extern void config_set_nick_colors ();
extern void config_set_nick_colors (void);
extern struct t_config_option *config_weechat_debug_get (const char *plugin_name);
extern int config_weechat_debug_set (const char *plugin_name,
const char *value);
extern void config_weechat_debug_set_all ();
extern void config_weechat_debug_set_all (void);
extern int config_weechat_buffer_set (struct t_gui_buffer *buffer,
const char *property, const char *value);
extern int config_weechat_notify_set (struct t_gui_buffer *buffer,
const char *notify);
extern void config_get_item_time (char *text_time, int max_length);
extern int config_weechat_get_key_context (struct t_config_section *section);
extern int config_weechat_init ();
extern int config_weechat_read ();
extern int config_weechat_write ();
extern void config_weechat_free ();
extern int config_weechat_init (void);
extern int config_weechat_read (void);
extern int config_weechat_write (void);
extern void config_weechat_free (void);
#endif /* WEECHAT_CONFIG_H */
+18 -11
View File
@@ -1,7 +1,7 @@
/*
* core-crypto.c - cryptographic functions
*
* Copyright (C) 2018-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2018-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -34,10 +34,18 @@
/* Bring in htobe64 */
#ifdef __ANDROID__
#define _BSD_SOURCE
#define BE_INT64 htobe64
#include <endian.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define htobe64 OSSwapHostToBigInt64
#define BE_INT64 OSSwapHostToBigInt64
#elif defined(HAVE_HTONLL)
#include <sys/types.h>
#include <netinet/in.h>
#include <inttypes.h>
#define BE_INT64 htonll
#else
#define BE_INT64 htobe64
#endif
#include "weechat.h"
@@ -47,10 +55,6 @@
#include "core-string.h"
#include "../plugins/plugin.h"
#ifdef htonll
#define htobe64 htonll
#endif
char *weecrypto_hash_algo_string[] = {
"crc32",
"md5",
@@ -533,7 +537,7 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
int rc, offset, length;
unsigned long bin_code;
moving_factor_swapped = htobe64 (moving_factor);
moving_factor_swapped = BE_INT64 (moving_factor);
rc = weecrypto_hmac (secret, length_secret,
&moving_factor_swapped, sizeof (moving_factor_swapped),
GCRY_MD_SHA1,
@@ -658,15 +662,18 @@ weecrypto_totp_validate (const char *secret_base32, time_t totp_time,
otp_ok = 0;
/*
* Compare in constant time and never break early: a non-constant
* compare and an early exit on match would let an observer measure
* how many digits of the expected OTP they got right and which
* time-window offset matched.
*/
for (i = moving_factor - window; i <= moving_factor + window; i++)
{
rc = weecrypto_totp_generate_internal (secret, length_secret,
i, digits, str_otp);
if (rc && (strcmp (str_otp, otp) == 0))
{
if (rc && (string_memcmp_constant_time (str_otp, otp, digits) == 0))
otp_ok = 1;
break;
}
}
free (secret);
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2018-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+17 -12
View File
@@ -1,7 +1,7 @@
/*
* core-debug.c - debug functions
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -93,7 +93,7 @@ long long debug_long_callbacks = 0; /* callbacks taking more than */
*/
void
debug_build_info ()
debug_build_info (void)
{
/* display version and compilation date/time */
string_fprintf (
@@ -228,8 +228,11 @@ debug_dump_cb (const void *pointer, void *data,
*/
void
debug_sigsegv_cb ()
debug_sigsegv_cb (int signo)
{
/* make C compiler happy */
(void) signo;
debug_dump (1);
unhook_all ();
gui_main_end (0);
@@ -340,7 +343,7 @@ debug_windows_tree_display (struct t_gui_window_tree *tree, int indent)
*/
void
debug_windows_tree ()
debug_windows_tree (void)
{
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Windows tree:"));
@@ -352,7 +355,7 @@ debug_windows_tree ()
*/
void
debug_memory ()
debug_memory (void)
{
#ifdef HAVE_MALLINFO2
struct mallinfo2 info;
@@ -498,7 +501,7 @@ debug_hdata_map_cb (void *data,
*/
void
debug_hdata ()
debug_hdata (void)
{
int count;
@@ -516,7 +519,7 @@ debug_hdata ()
*/
void
debug_hooks ()
debug_hooks (void)
{
int i;
@@ -650,7 +653,7 @@ debug_hooks_plugin_types (const char *plugin_mask, const char **hook_types)
*/
void
debug_infolists ()
debug_infolists (void)
{
struct t_infolist *ptr_infolist;
struct t_infolist_item *ptr_item;
@@ -814,7 +817,7 @@ debug_libs_cb (const void *pointer, void *data,
*/
void
debug_directories ()
debug_directories (void)
{
char *extra_libdir, str_temp[1024];
@@ -862,7 +865,9 @@ debug_display_time_elapsed (struct timeval *time1, struct timeval *time2,
gettimeofday (&debug_timeval_end, NULL);
diff = util_timeval_diff (time1, time2);
str_diff = util_get_microseconds_string (diff);
if (diff < 0)
diff *= -1;
str_diff = util_get_microseconds_string ((unsigned long long)diff);
if (display)
{
@@ -1023,7 +1028,7 @@ debug_unicode (const char *string)
*/
void
debug_init ()
debug_init (void)
{
/*
* hook signals with high priority, to be sure they will be used before
@@ -1039,6 +1044,6 @@ debug_init ()
*/
void
debug_end ()
debug_end (void)
{
}
+11 -11
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -26,22 +26,22 @@ struct t_gui_window_tree;
extern long long debug_long_callbacks;
extern void debug_build_info ();
extern void debug_sigsegv_cb ();
extern void debug_windows_tree ();
extern void debug_memory ();
extern void debug_hdata ();
extern void debug_hooks ();
extern void debug_build_info (void);
extern void debug_sigsegv_cb (int signo);
extern void debug_windows_tree (void);
extern void debug_memory (void);
extern void debug_hdata (void);
extern void debug_hooks (void);
extern void debug_hooks_plugin_types (const char *plugin_name,
const char **hook_types);
extern void debug_infolists ();
extern void debug_directories ();
extern void debug_infolists (void);
extern void debug_directories (void);
extern void debug_display_time_elapsed (struct timeval *time1,
struct timeval *time2,
const char *message,
int display);
extern void debug_unicode (const char *string);
extern void debug_init ();
extern void debug_end ();
extern void debug_init (void);
extern void debug_end (void);
#endif /* WEECHAT_DEBUG_H */
+18 -22
View File
@@ -1,7 +1,7 @@
/*
* core-dir.c - directory/file functions
*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -64,7 +64,7 @@
*/
char *
dir_get_temp_dir ()
dir_get_temp_dir (void)
{
char *tmpdir;
struct stat buf;
@@ -109,7 +109,7 @@ int
dir_mkdir_home (const char *directory, int mode)
{
char *dir, *dir1, *dir2, *dir3, *dir4, *dir5;
int rc, dir_length;
int rc;
rc = 0;
dir = NULL;
@@ -129,11 +129,8 @@ dir_mkdir_home (const char *directory, int mode)
else
{
/* build directory in data dir by default */
dir_length = strlen (weechat_data_dir) + strlen (directory) + 2;
dir = malloc (dir_length);
if (!dir)
if (string_asprintf (&dir, "%s/%s", weechat_data_dir, directory) < 0)
goto end;
snprintf (dir, dir_length, "%s/%s", weechat_data_dir, directory);
}
dir1 = string_replace (dir, "${weechat_config_dir}", weechat_config_dir);
@@ -383,10 +380,10 @@ end:
*/
int
dir_create_home_temp_dir ()
dir_create_home_temp_dir (void)
{
char *temp_dir, *temp_home_template, *ptr_weechat_home;
int rc, length, add_separator;
int rc, add_separator;
rc = 0;
temp_dir = NULL;
@@ -396,16 +393,15 @@ dir_create_home_temp_dir ()
if (!temp_dir || !temp_dir[0])
goto memory_error;
length = strlen (temp_dir) + 32 + 1;
temp_home_template = malloc (length);
if (!temp_home_template)
goto memory_error;
add_separator = (temp_dir[strlen (temp_dir) - 1] != DIR_SEPARATOR_CHAR);
snprintf (temp_home_template, length,
"%s%sweechat_temp_XXXXXX",
temp_dir,
add_separator ? DIR_SEPARATOR : "");
if (string_asprintf (&temp_home_template,
"%s%sweechat_temp_XXXXXX",
temp_dir,
(add_separator) ? DIR_SEPARATOR : "") < 0)
{
goto memory_error;
}
ptr_weechat_home = mkdtemp (temp_home_template);
if (!ptr_weechat_home)
{
@@ -603,7 +599,7 @@ error:
*/
int
dir_find_home_dirs ()
dir_find_home_dirs (void)
{
char *ptr_home, *ptr_weechat_home, *config_weechat_home;
char *config_dir, *data_dir, *state_dir, *cache_dir, *runtime_dir;
@@ -742,7 +738,7 @@ dir_create_home_dir (char *path)
*/
void
dir_create_home_dirs ()
dir_create_home_dirs (void)
{
int rc;
@@ -776,7 +772,7 @@ error:
*/
void
dir_remove_home_dirs ()
dir_remove_home_dirs (void)
{
dir_rmtree (weechat_config_dir);
if (strcmp (weechat_config_dir, weechat_data_dir) != 0)
@@ -802,7 +798,7 @@ dir_remove_home_dirs ()
*/
char *
dir_get_string_home_dirs ()
dir_get_string_home_dirs (void)
{
char *dirs[6];
+5 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -20,14 +20,14 @@
#ifndef WEECHAT_DIR_H
#define WEECHAT_DIR_H
extern char *dir_get_temp_dir();
extern char *dir_get_temp_dir (void);
extern int dir_mkdir_home (const char *directory, int mode);
extern int dir_mkdir (const char *directory, int mode);
extern int dir_mkdir_parents (const char *directory, int mode);
extern int dir_rmtree (const char *directory);
extern void dir_create_home_dirs ();
extern void dir_remove_home_dirs ();
extern char *dir_get_string_home_dirs ();
extern void dir_create_home_dirs (void);
extern void dir_remove_home_dirs (void);
extern char *dir_get_string_home_dirs (void);
extern void dir_exec_on_files (const char *directory, int recurse_subdirs,
int hidden_files,
void (*callback)(void *data,
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* core-doc.c - documentation generator
*
* Copyright (C) 2023-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2023-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2023-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
+18 -8
View File
@@ -1,7 +1,7 @@
/*
* core-eval.c - evaluate expressions with references to internal vars
*
* Copyright (C) 2012-2024 Sébastien Helleu <flashcode@flashtux.org>
* Copyright (C) 2012-2025 Sébastien Helleu <flashcode@flashtux.org>
*
* This file is part of WeeChat, the extensible chat client.
*
@@ -300,6 +300,9 @@ eval_string_range_chars (const char *range)
string = NULL;
result = NULL;
if (!range || !range[0])
goto end;
for (i = 0; eval_range_chars[i][0]; i++)
{
if (strcmp (range, eval_range_chars[i][0]) == 0)
@@ -309,11 +312,15 @@ eval_string_range_chars (const char *range)
char1 = utf8_char_int (range);
/* next char must be '-' */
if (!range[0])
goto end;
ptr_char = utf8_next_char (range);
if (!ptr_char || !ptr_char[0] || (ptr_char[0] != '-'))
goto end;
/* next char is the char2 */
if (!range[0])
goto end;
ptr_char = utf8_next_char (ptr_char);
if (!ptr_char || !ptr_char[0])
goto end;
@@ -894,7 +901,7 @@ eval_string_base_encode (const char *text)
ptr_string++;
length = strlen (ptr_string);
result = malloc ((length * 4) + 1);
result = malloc ((length * 4) + 8 + 1);
if (!result)
goto end;
@@ -1144,6 +1151,7 @@ char *
eval_hdata_count (const char *text, struct t_eval_context *eval_context)
{
struct t_hdata *hdata;
unsigned long ptr_value;
void *pointer;
char *pos1, *pos2, *value, *hdata_name, *pointer_name, str_count[64];
int rc, count;
@@ -1174,9 +1182,10 @@ eval_hdata_count (const char *text, struct t_eval_context *eval_context)
if (strncmp (pointer_name, "0x", 2) == 0)
{
rc = sscanf (pointer_name, "%p", &pointer);
rc = sscanf (pointer_name, "%lx", &ptr_value);
if ((rc != EOF) && (rc != 0))
{
pointer = (void *)ptr_value;
if (!hdata_check_pointer (hdata, NULL, pointer))
goto end;
}
@@ -1413,6 +1422,7 @@ eval_string_hdata (const char *text, struct t_eval_context *eval_context)
void *pointer;
struct t_hdata *hdata;
int rc;
unsigned long ptr;
value = NULL;
hdata_name = NULL;
@@ -1464,9 +1474,10 @@ eval_string_hdata (const char *text, struct t_eval_context *eval_context)
{
if (strncmp (pointer_name, "0x", 2) == 0)
{
rc = sscanf (pointer_name, "%p", &pointer);
rc = sscanf (pointer_name, "%lx", &ptr);
if ((rc != EOF) && (rc != 0))
{
pointer = (void *)ptr;
if (!hdata_check_pointer (hdata, NULL, pointer))
goto end;
}
@@ -1572,7 +1583,8 @@ eval_syntax_highlight_colorize (const char *value)
else if (ptr_value[0] == '-')
color--;
}
ptr_value++;
if (ptr_value[0])
ptr_value++;
if (config_num_eval_syntax_colors > 0)
{
string_dyn_concat (
@@ -2524,11 +2536,9 @@ eval_replace_regex (const char *string, regex_t *regex, const char *replace,
if (!string || !regex || !replace)
goto end;
length = strlen (string) + 1;
result = malloc (length);
result = strdup (string);
if (!result)
goto end;
snprintf (result, length, "%s", string);
eval_context->regex = &eval_regex;
eval_context->regex_replacement_index = 1;

Some files were not shown because too many files have changed in this diff Show More