1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-17 08:34:46 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Sébastien Helleu 1dcad3f029 api: allow hook_line to duplicate a message on multiple buffers 2023-08-23 11:41:24 +02:00
225 changed files with 5489 additions and 17666 deletions
-1
View File
@@ -19,7 +19,6 @@ jobs:
- { name: "gcc", cc: "gcc", cxx: "g++", buildargs: "" }
- { name: "gcc_ninja", cc: "gcc", cxx: "g++", buildargs: "-G Ninja" }
- { name: "gcc_no_nls", cc: "gcc", cxx: "g++", buildargs: "-DENABLE_NLS=OFF -DENABLE_DOC=OFF" }
- { name: "gcc_no_zstd", cc: "gcc", cxx: "g++", buildargs: "-DENABLE_ZSTD=OFF -DENABLE_DOC=OFF" }
- { name: "gcc_coverage", cc: "gcc", cxx: "g++", buildargs: "-DENABLE_CODE_COVERAGE=ON" }
- { name: "clang", cc: "clang", cxx: "clang++", buildargs: "" }
-2
View File
@@ -81,12 +81,10 @@ Alphabetically:
* Lázaro A.
* Leonid Evdokimov
* Linus Heckemann
* LuK1337
* Maarten de Vries
* Mantas Mikulėnas (grawity)
* Marco Paolone
* Marco Sirabella
* Mario Campos
* Mateusz Poszwa
* Matt Robinson
* Matthew Horan
+15 -11
View File
@@ -99,7 +99,6 @@ option(ENABLE_NCURSES "Compile the Ncurses interface" ON)
option(ENABLE_HEADLESS "Compile the headless binary" ON)
option(ENABLE_NLS "Enable Native Language Support" ON)
option(ENABLE_LARGEFILE "Enable Large File Support" ON)
option(ENABLE_ZSTD "Enable Zstandard compression" ON)
option(ENABLE_ALIAS "Enable Alias plugin" ON)
option(ENABLE_BUFLIST "Enable Buflist plugin" ON)
option(ENABLE_CHARSET "Enable Charset plugin" ON)
@@ -201,6 +200,20 @@ if(ENABLE_LARGEFILE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES)
endif()
# Check for Gettext
if(ENABLE_NLS)
find_package(Gettext)
if(GETTEXT_FOUND)
add_definitions(-DENABLE_NLS)
find_package(Intl)
if(Intl_FOUND)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
endif()
else()
message(SEND_ERROR "Gettext not found")
endif()
endif()
# Check for libgcrypt
find_package(GCRYPT REQUIRED)
add_definitions(-DHAVE_GCRYPT)
@@ -217,10 +230,7 @@ list(APPEND EXTRA_LIBS gnutls)
find_package(ZLIB REQUIRED)
# Check for zstd
if(ENABLE_ZSTD)
pkg_check_modules(LIBZSTD REQUIRED libzstd)
add_definitions(-DHAVE_ZSTD)
endif()
pkg_check_modules(LIBZSTD REQUIRED libzstd)
# Check for iconv
find_package(Iconv)
@@ -248,13 +258,7 @@ endif()
add_subdirectory(icons)
if(ENABLE_NLS)
find_package(Gettext REQUIRED)
add_definitions(-DENABLE_NLS)
find_package(Intl REQUIRED)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
add_subdirectory(po)
else()
add_custom_target(translations COMMAND true)
endif()
add_subdirectory(src)
+6 -86
View File
@@ -10,45 +10,18 @@ This document lists all the changes for each version. +
For a list of important changes that require manual actions, please look at release notes.
[[v4.1.1]]
== Version 4.1.1 (2023-10-26)
Bug fixes::
* core: fix crash when a custom bar item name is already used by a default bar item (issue #2034)
* core: fix random timeouts when a lot of concurrent processes are launched with hook_process (issue #2033)
* irc: revert compute of nick colors to case sensitive way, deprecate again infos "irc_nick_color" and "irc_nick_color_name" (issue #194, issue #2032)
Build::
* core: make libintl.h required if CMake option ENABLE_NLS is enabled (issue #2031)
[[v4.1.0]]
== Version 4.1.0 (2023-10-15)
== Version 4.1.0 (under dev)
New features::
* core: add completion "eval_variables", used in completion of `/eval`
* core: add command `/sys` to show resource limits/usage and suspend WeeChat process, add key kbd:[Ctrl+z] to suspend WeeChat (issue #985)
* core: ignore key bindings with empty command
* core: add support of quotes in commands `/key bind` and `/key bindctxt`
* core: evaluate command given to `/repeat` with contextual variables (issue #2007)
* core: add option `callbacks` in command `/debug`
* core: add option type "enum" (issue #1973)
* core: add options weechat.buffer.* to save buffer properties set by user, add option `setauto` in command `/buffer` (issue #352)
* core: add parameters and key bindings to move to edges of current area with commands `/cursor go` and `/cursor move` (issue #1282)
* core: add variables "_chat_focused_line_bol" and "_chat_focused_line_eol" in focus data (issue #1955)
* api: add function hook_url, add option `url` in command `/debug` (issue #1723)
* api: add support of path to variable and hashtable comparison in function hdata_compare (issue #1066)
* api: add infos "nick_color_ignore_case" and "nick_color_name_ignore_case" (issue #194)
* api: add info "buffer" (issue #1962)
* buflist: add support of item names in command `/buflist refresh`, add completions "buflist_items" and "buflist_items_used"
* buflist: increase max number of buflist items from 3 to 5 (issue #1703)
* fset: add variable `allowed_values` in options, add options fset.color.allowed_values and fset.color.allowed_values_selected
* fset: allow long type name in type filter
* irc: add count for all nick modes in output of `/names` (issue #97, issue #2020)
* irc: add count and mode filter in command `/names` (issue #98)
* irc: compute color in case insensitive way, reintroduce infos "irc_nick_color" and "irc_nick_color_name", add support of server name (issue #194)
* irc: add buffer for /list reply, add options irc.color.list_buffer_line_selected, irc.color.list_buffer_line_selected_bg, irc.look.list_buffer_sort, irc.look.list_buffer_scroll_horizontal, irc.look.new_list_position, irc.look.list_buffer_topic_strip_colors (issue #1972)
* irc: display commands 716/717 in private buffer (if present) (issue #146)
* irc: create default options irc.ctcp.* when file irc.conf is created (issue #1974)
@@ -56,82 +29,29 @@ New features::
* irc: build dynamically the list of CTCPs supported in reply to "CTCP CLIENTINFO" (issue #1974)
* irc: remove Git revision and compilation date from CTCP VERSION reply (issue #1974)
* irc: remove default CTCP replies FINGER and USERINFO (issue #1974)
* irc, xfer: add support of passive DCC (issue #2004, issue #487)
* script: rename parameters up/down/go to -up/-down/-go in command `/script`
* script: allow jump to the last script with command `/script -go end`
* script: allow jump to the last script with command `/script go end`
* script: allow commands `/script autoload`, `/script noautoload`, `/script toggleautoload` with scripts not present in the repository (issue #1980)
* trigger: add options `-o`, `-ol`, `-i` and `-il` in command `/trigger list` (issue #1953)
Bug fixes::
* core: fix zombie processes after fork (hook process or connect) (issue #1994)
* core: fix generation of TOTP on Big Endian systems (issue #2021)
* core: fix cursor position after `/plugin list -i` or `/plugin list -il`
* core: display focus hashtable for debug even if no key is matching
* fset: add local key bindings during the buffer creation
* fset: remove extra spaces between min and max values when second format is used
* fset: fix mouse actions when second format is used
* fset: apply option fset.color.help_description (issue #1988)
* irc: move value `-all` at the end of completions for command `/ignore del`
* irc: fix memory leak when joining channels with keys
* irc: fix unexpected message sent to server when part of the second line of an IRC command (issue #1992)
* irc: fix display of country code in message 344 received as whois geo info (issue #1736)
* irc: add missing "account-tag" in list of supported capabilities
* irc: add channel in "autojoin" server option only when the channel is actually joined (issue #1990)
* relay: synchronize nick modes with IRC client upon connection (issue #1984)
* script: add local key bindings during the buffer creation
* script: add parameters up/down/go in `/help script` and command completion
* script: fix cursor position after `/script list -i` or `/script list -il`
* script: fix buffer used by command `/script list -i|-il|-o|-ol`
* xfer: display an error message when opening file for read or write fails (issue #2010)
Tests::
* core: add tests on GUI buffer functions
Build::
* core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026)
* core, logger, relay: make zstd dependency optional (issue #2024)
[[v4.0.6]]
== Version 4.0.6 (2023-10-26)
Bug fixes::
* core: fix crash when a custom bar item name is already used by a default bar item (issue #2034)
* core: fix generation of TOTP on Big Endian systems (issue #2021)
* irc: move value `-all` at the end of completions for command `/ignore del`
* irc: fix memory leak when joining channels with keys
Build::
* core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026, issue #2031)
[[v4.0.5]]
== Version 4.0.5 (2023-09-24)
New features::
* core: automatically backup config file read if it has an unsupported version (issue #2013)
* core: display a message when a configuration file is updated to a newer version
* python: make stub (weechat.pyi) compatible with Python 3.8 and 3.9 (issue #2006)
Bug fixes::
* irc: add option irc.look.open_pv_buffer_echo_msg to open private buffer on self message when capability echo-message is enabled (issue #2016)
* irc: fix title of private buffers wrongly set to own address when capability echo-message is enabled (issue #2016)
* irc: fix autojoin of channels when private buffers are opened (issue #2012)
* irc: fix string comparison when CASEMAPPING is set to "ascii"
* script: fix removal of script in system directory while trying to install a script (issue #2019)
* script: fix autoload of multiple scripts at once with `/script autoload` (issue #2018)
* script: fix crash when a `/script` command triggers another `/script` command (issue #923)
* xfer: fix memory leak on plugin unload
Tests::
* irc: add tests on server functions
[[v4.0.4]]
== Version 4.0.4 (2023-08-22)
@@ -177,8 +97,8 @@ Bug fixes::
* core: fix renaming of options with command `/item rename` (issue #1978)
* core: don't send "key_pressed" signal again for the same key press (issue #1976)
* core: don't send "key_combo_*" signals for incomplete keys (issue #1976)
* core: add key kbd:[Ctrl+Backspace] in /help key (issue #1975)
* core: keep keys `ctrl-H` and `ctrl-?` (in lower case) if they were manually bound to custom commands in a previous version
* core: add key ctrl-backspace in /help key (issue #1975)
* core: keep keys ctrl-H and ctrl-? (in lower case) if they were manually bound to custom commands in a previous version
Tests::
@@ -214,7 +134,7 @@ New features::
* core: insert multiple pasted lines in input instead of sending immediately, add keys to move and delete in a single line and whole input, add option weechat.look.input_multiline_lead_linebreak (issue #1502, issue #1503, issue #1504)
* core: render newline characters in chat line messages (issue #1908)
* core: don't split on newline characters in printf_date_tags when input_multiline is set (issue #1909)
* core: add key kbd:[l] (lower `L`) in cursor mode to quote line, add variable "_chat_focused_line" in function hashtable sent to hook_focus callback (issue #1913, issue #1914)
* core: add key @kbd:[l] in cursor mode to quote line, add variable "_chat_focused_line" in function hashtable sent to hook_focus callback (issue #1913, issue #1914)
* core: add option `split_return` in command `/input` (issue #1916)
* core: send all command line parameters not beginning with a dash to all plugins
* core: add command `/reset` to reset options to their default values
@@ -1828,7 +1748,7 @@ New features::
* core: add option weechat.look.hotlist_add_conditions, remove option weechat.look.hotlist_add_buffer_if_away
* core: add option weechat.look.hotlist_remove (issue #99)
* core: add options `-beep` and `-current` in command `/print`
* core: add bare display mode for easy text selection and click on URLs, new key: kbd:[Alt+l] (lower `L`), new option "bare" in command `/window`, new options: weechat.look.bare_display_exit_on_input and weechat.look.bare_display_time_format
* core: add bare display mode for easy text selection and click on URLs, new key: kbd:[Alt+l] (`L`), new option "bare" in command `/window`, new options: weechat.look.bare_display_exit_on_input and weechat.look.bare_display_time_format
* core: add signals "key_combo_{default|search|cursor}"
* core: add terabyte unit for size displayed
* core: display a warning in case of inconsistency between the options weechat.look.save_{config|layout}_on_exit
+1 -75
View File
@@ -11,28 +11,8 @@ It is recommended to read it when upgrading to a new stable version. +
For a complete list of changes, please look at ChangeLog.
[[v4.1.1]]
== Version 4.1.1 (2023-10-26)
[[v4.1.1_custom_bar_items]]
=== Custom bar items
Custom bar items must now have a different name than default bar items
(for example the custom bar item name `time` is now forbidden).
If you have such names in your config, WeeChat will now fail to load them
(this should not happen anyway, since such bar items can not be properly used
or can cause a crash of WeeChat).
[[v4.1.1_nick_color_infos]]
=== Nick color infos
The infos irc_nick_color and irc_nick_color_name are deprecated again, and the
algorithm to compute IRC nick colors has been reverted to case sensitive. +
The server name has been removed from arguments.
[[v4.1.0]]
== Version 4.1.0 (2023-10-15)
== Version 4.1.0 (under dev)
[[v4.1.0_cursor_mode_keys]]
=== New keys to move in cursor mode
@@ -79,42 +59,6 @@ back with the two following commands:
They will then be advertised in reply to "CTCP CLIENTINFO", which is now built
dynamically with these options.
[[v4.1.0_nick_color_infos]]
=== Nick color infos
Two infos to get nick colors have been added: nick_color_ignore_case and
nick_color_name_ignore_case. +
They are similar to nick_color and nick_color_name, except they take as second
argument a range of chars to apply on the nick: the nick is converted to lower
case using this range of chars.
The infos irc_nick_color and irc_nick_color_name, that were deprecated since
version 1.5 are now used again, with a change in parameter: the server is now
optional before the nick: "server,nick". +
The nick is first converted to lower case, following the value of CASEMAPPING
on the server, then hashed to compute the color. +
That means the color for a nick is now case insensitive (in the way IRC servers
are case insensitive, so with a limited range of chars only).
If a script was using this info with a comma in nickname (which should not happen
anyway), this is now interpreted as the server name, and the script must be
modified. +
Anyway, it is recommended to always give the server name to respect the
CASEMAPPING of the server and prevent any issue with a comma in the nickname.
For example nick color of "alice" and "ALICE" is now always guaranteed to be the
same:
----
# with server name (recommended)
weechat.info_get("irc_nick_color", "libera,alice") == weechat.info_get("irc_nick_color", "libera,ALICE")
weechat.info_get("irc_nick_color_name", "libera,alice") == weechat.info_get("irc_nick_color_name", "libera,ALICE")
# without server name (allowed but not recommended, kept for compatibility)
weechat.info_get("irc_nick_color", "alice") == weechat.info_get("irc_nick_color", "ALICE")
weechat.info_get("irc_nick_color_name", "alice") == weechat.info_get("irc_nick_color_name", "ALICE")
----
[[v4.1.0_fset_allowed_values]]
=== Allowed values for options on fset buffer
@@ -140,24 +84,6 @@ You can reset it with this command:
/reset weechat.key_mouse.@chat(fset.fset):button1
----
[[v4.0.6]]
== Version 4.0.6 (2023-10-26)
[[v4.0.6_custom_bar_items]]
=== Custom bar items
Custom bar items must now have a different name than default bar items
(for example the custom bar item name `time` is now forbidden).
If you have such names in your config, WeeChat will now fail to load them
(this should not happen anyway, since such bar items can not be properly used
and can cause a crash of WeeChat).
[[v4.0.5]]
== Version 4.0.5 (2023-09-24)
No release notes.
[[v4.0.4]]
== Version 4.0.4 (2023-08-22)
+20 -22
View File
@@ -45,28 +45,26 @@ set(CMAKE_REQUIRED_INCLUDES ${LIBINTL_INCLUDE})
check_include_files(libintl.h HAVE_LIBINTL_H)
if(NOT HAVE_LIBINTL_H)
message(SEND_ERROR "Header libintl.h not found, required if ENABLE_NLS is enabled")
endif()
check_function_exists(dgettext LIBC_HAS_DGETTEXT)
if(LIBC_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
else()
find_library(LIBINTL_LIBRARY NAMES intl
PATHS
/usr/local/lib
/usr/lib
)
if(LIBINTL_LIBRARY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(CMAKE_REQUIRED_LIBRARIES "iconv")
check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT)
else()
check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
endif()
if(LIBINTL_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
if(HAVE_LIBINTL_H)
check_function_exists(dgettext LIBC_HAS_DGETTEXT)
if(LIBC_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
else()
find_library(LIBINTL_LIBRARY NAMES intl
PATHS
/usr/local/lib
/usr/lib
)
if(LIBINTL_LIBRARY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(CMAKE_REQUIRED_LIBRARIES "iconv")
check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT)
else()
check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
endif()
if(LIBINTL_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
endif()
endif()
endif()
endif()
+1
View File
@@ -1,3 +1,4 @@
#cmakedefine HAVE_LIBINTL_H
#cmakedefine HAVE_SYS_RESOURCE_H
#cmakedefine HAVE_FLOCK
#cmakedefine HAVE_LANGINFO_CODESET
-6
View File
@@ -1,9 +1,3 @@
weechat (4.0.5-1) unstable; urgency=medium
* New upstream release
-- Emmanuel Bouthenot <kolter@debian.org> Sun, 24 Sep 2023 07:49:41 +0000
weechat (4.0.2-1) unstable; urgency=medium
* New upstream release (Closes: #1040248)
+32 -46
View File
@@ -613,14 +613,6 @@ Sollte die macOS Terminal Applikation genutzt werden, empfiehlt es sich,
die Option "Use option as meta key" in den Menü-Einstellungen zu aktivieren.
Dadurch kann man die kbd:[Option] Taste als Meta-Taste verwenden.
[[enter_key]]
=== Einige Tasten, einschließlich Enter, funktionieren nicht. Weshalb?
Wenn eine WeeChat Version < 4.0.0 mit Konfigurationsdateien ausgeführt wird,
die von einer Weechat Version ≥ 4.0.0 erstellt wurde, sind die Tastennamen ungültig und viele Tasten funktionieren überhaupt nicht mehr. +
Um dies zu reparieren, muss WeeChat beendet und alle Einträge aus dem Abschnitt `[key*]` innerhalb der weechat.conf entfernt werden.
Wenn WeeChat erneut gestartet wird, wird die Standardtastenbelegung neu erstellt.
[[customize_key_bindings]]
=== Wie kann ich die Tastaturbelegung anpassen?
@@ -1001,19 +993,35 @@ die Buffer-Eigenschaft genutzt werden, um das maximale Hotlist-Level für einige
oder pro Gruppe von Buffern (wie IRC-Server).
Um nun Highlights (Hervorhebungen) für bestimmte Nicks zu deaktivieren, muss
man die entsprechende Eigenschaft auf 2 setzen.
Für den aktuellen Buffer:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
----
Für alle Kanäle auf dem Server "libera":
man die entsprechende Eigenschaft auf 2 setzen:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
Diese Buffereigenschaft wird aber nicht permanent in der Konfiguration
gespeichert. Um diese Eigenschaften permanent zu verwenden, muss man
das Skript _buffer_autoset.py_ nutzen:
----
/script install buffer_autoset.py
----
Um zum Beispiel Highlights (Hervorhebungen) von Nick "mike" im Kanal
#weechat auf dem IRC Server libera zu deaktivieren:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
Um dies auf den kompletten libera Server anzuwenden:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
Für weitere Beispiele, siehe `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== Wie kann ich bei zusammengefügten Buffern den Zielbuffer ändern (z.B. bei einem Server-Buffer)?
@@ -1146,8 +1154,10 @@ Damit WeeChat weniger Speicher benötigt, solltest Du folgende Tipps umsetzen:
Man sollte sich die Tipps zum <<memory_usage,Speicherverbrauch>> ansehen
und zusätzlich diese Tipps beherzigen:
* "nicklist"-Bar sollte versteckt werden: `/bar hide nicklist` (Taste: kbd:[Alt+Shift+N]).
* deaktiviere "buflist": `/buflist disable` (Taste: kbd:[Alt+Shift+B]).
// TRANSLATION MISSING
* "nicklist"-Bar sollte versteckt werden: `/bar hide nicklist` (key: kbd:[Alt+Shift+N]).
// TRANSLATION MISSING
* Disable "buflist": `/buflist disable` (key: kbd:[Alt+Shift+B]).
* die Sekundenanzeigen in der Statusbar sollte deaktiviert werden:
`+/set weechat.look.item_time_format "%H:%M"+` (dies ist die Standardeinstellung)
* die Echtzeit Rechtschreibkorrektur sollte deaktiviert werden (falls sie aktiviert wurde):
@@ -1175,7 +1185,9 @@ Deaktiviere die automatische Antwort für alle CTCP Anfragen:
/set irc.ctcp.ping ""
----
Mit WeeChat < 4.1.0 wurden andere CTCP-Anfragen standardmäßig beantwortet und müssen ebenfalls deaktiviert werden:
// TRANSLATION MISSING
With WeeChat < 4.1.0, other CTCP queries were replied by default and must be
disabled as well:
----
/set irc.ctcp.finger ""
@@ -1217,32 +1229,6 @@ Kennwörter (sofern sie nicht mit dem Befehl `/secure` in _sec.conf_ gesichert w
Siehe link:weechat_user.de.html#files_and_directories[Benutzerhandbuch / Dateien und Verzeichnisse ^↗^^]
für weitere Informationen über Konfigurationsdateien.
[[move_to_another_device]]
=== Ich möchte mein WeeChat auf ein anderes Gerät verschieben und meine Konfiguration behalten. Was muss ich kopieren?
Überprüfen Sie zunächst die von WeeChat verwendeten Verzeichnisse mit diesem Befehl: `/debug dirs`. +
Die Verzeichnisse home/config und home/data müssen kopiert werden (alle Dateien und Unterverzeichnisse).
Falls beispielsweise XDG-Verzeichnisse verwendet werden (Standard bei WeeChat ≥ 3.2), sollten die
Verzeichnisse `$HOME/.config/weechat` und `$HOME/.local/share/weechat` lauten. +
Sollte ein einzelnes Verzeichnis verwenden werden (Standard bei WeeChat < 3.2), sollte das Verzeichnis
`$HOME/.weechat` lauuten.
[IMPORTANT]
Die WeeChat-Version auf dem Zielgerät muss größer oder gleich der Version sein des Ausganggerätes. +
Ein Downgrade der WeeChat-Konfiguration wird *NICHT UNTERSTÜTZT* und kann zu Schäden führen und ein
unbrauchbares WeeChat verursachen.
Schritte:
. Weechat beenden: `/quit` (oder `/upgrade -quit`, falls eine Sitzung fortgesetzt werden soll,
einschließlich des Inhalts aller Buffer).
. Kopieren Sie alle Verzeichnisse, Unterverzeichnisse und Dateien auf das neue Gerät und behalten Sie die
Namen und Berechtigungen bei.
. Optional: Kopieren Sie alle Dateien außerhalb dieser Verzeichnisse, die auf Ihre Konfiguration verweisen
(es wird nicht empfohlen, Dateien außerhalb von WeeChat-Verzeichnissen zu verwenden).
. WeeChat auf dem neuen Gerät starten: `weechat` (oder `weechat --upgrade`, falls die Sitzung gesichert wurde).
[[development]]
== Entwicklung
+80 -122
View File
@@ -135,6 +135,10 @@ Die folgende Tabelle zeigt eine Auflistung der Pakete, die zum Erstellen von Wee
| Logger-Erweitertung: Kompression von rotierenden Protokolldateien (gzip). +
Relay-Erweiterung: Kompression von Nachrichten (WeeChat -> client) with https://zlib.net/[zlib ^↗^^] (weechat protocol). +
Script-Erweiterung: Lesen der Repository-Indexdatei (gzip).
| libzstd-dev | ≥ 0.8.1
| Logger-Erweiterung: Kompression von rotierenden Protokolldateien. +
Relay-Erweiterung: Kompression von Nachrichten (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
|===
[NOTE]
@@ -148,68 +152,26 @@ WeeChat optional sind:
[width="100%",cols="5,^3,.^15",options="header"]
|===
| Paket ^(1)^ | Version | Funktionen
| {cpp} compiler (pass:[g++ / clang++]) |
| zum Erstellen der Binärdatei und um Test auszuführen, JavaScript Erweiterung.
| gettext |
| Internationalisierung (Übersetzung der Mitteilungen; Hauptsprache ist englisch).
| ca-certificates |
| Zertifikate für TLS Verbindungen.
| libzstd-dev | ≥ 0.8.1
| Logger-Erweiterung: Kompression von rotierenden Protokolldateien (zstandard). +
Relay-Erweiterung: Kompression von Nachrichten (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
| libaspell-dev / libenchant-dev |
| Spell Erweiterung.
| python3-dev | ≥ 3.0
| Python Erweiterung.
| libperl-dev |
| Perl Erweiterung.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Ruby Erweiterung.
| liblua5.4-dev |
| Lua Erweiterung.
| tcl-dev | ≥ 8.5
| Tcl Erweiterung.
| guile-3.0-dev | ≥ 2.0
| Guile (scheme) Erweiterung.
| libv8-dev | ≤ 3.24.3
| JavaScript Erweiterung.
| php-dev | ≥ 7.0
| PHP Erweiterung.
| libphp-embed | ≥ 7.0
| PHP Erweiterung.
| libxml2-dev |
| PHP Erweiterung.
| libargon2-dev |
| PHP Erweiterung (wenn PHP ≥ 7.2).
| libsodium-dev |
| PHP Erweiterung (wenn PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4
| zum Erstellen der man page und der Dokumentation.
| ruby-pygments.rb |
| Build Dokumentation.
| libcpputest-dev | ≥ 3.4
| zum Erstellen und um Test auszuführen.
| Paket ^(1)^ | Version | Funktionen
| {cpp} compiler (pass:[g++ / clang++]) | | zum Erstellen der Binärdatei und um Test auszuführen, JavaScript Erweiterung.
| gettext | | Internationalisierung (Übersetzung der Mitteilungen; Hauptsprache ist englisch).
| ca-certificates | | Zertifikate für TLS Verbindungen.
| libaspell-dev / libenchant-dev | | Spell Erweiterung.
| python3-dev | ≥ 3.0 | Python Erweiterung.
| libperl-dev | | Perl Erweiterung.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Ruby Erweiterung.
| liblua5.4-dev | | Lua Erweiterung.
| tcl-dev | ≥ 8.5 | Tcl Erweiterung.
| guile-3.0-dev | ≥ 2.0 | Guile (scheme) Erweiterung.
| libv8-dev | ≤ 3.24.3 | JavaScript Erweiterung.
| php-dev | ≥ 7.0 | PHP Erweiterung.
| libphp-embed | ≥ 7.0 | PHP Erweiterung.
| libxml2-dev | | PHP Erweiterung.
| libargon2-dev | | PHP Erweiterung (wenn PHP ≥ 7.2).
| libsodium-dev | | PHP Erweiterung (wenn PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | zum Erstellen der man page und der Dokumentation.
| ruby-pygments.rb | | Build Dokumentation.
| libcpputest-dev | ≥ 3.4 | zum Erstellen und um Test auszuführen.
|===
[NOTE]
@@ -250,7 +212,7 @@ $ make install
Optionen für CMake können mit dem Format, `-DOPTION=VALUE`, genutzt werden.
Liste der verfügbaren Optionen:
Liste von häufig verwendeten Optionen:
[width="100%",cols="3m,3,3m,10",options="header"]
|===
@@ -304,9 +266,6 @@ Liste der verfügbaren Optionen:
| ENABLE_GUILE | `ON`, `OFF` | ON
| kompiliert <<scripting_plugins,Guile Erweiterung>> (Scheme).
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Kompilieren der headless Binärdatei.
| ENABLE_IRC | `ON`, `OFF` | ON
| kompiliert <<irc,IRC Erweiterung>>.
@@ -365,9 +324,6 @@ Liste der verfügbaren Optionen:
| ENABLE_XFER | `ON`, `OFF` | ON
| kompiliert <<xfer,Xfer Erweiterung>>.
| ENABLE_ZSTD | `ON`, `OFF` | ON
| aktiviere https://facebook.github.io/zstd/[Zstandard ^↗^^] Kompression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| kompiliert Testumgebung.
@@ -943,10 +899,8 @@ andere Items die zur Verfügung stehen (die aber nicht standardmäßig in einer
| buffer_nicklist_count_all | `4` | Anzahl der sichtbaren Gruppen und Nicks in der Nickliste.
| buffer_nicklist_count_groups | `0` | Anzahl der sichtbaren Gruppen in der Nickliste.
| buffer_short_name | `#test` | Kurzname des aktuellen Buffers.
| buflist2 | `1.weechat` | Liste der Buffer, zweites Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | Liste der Buffer, drittes Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist4 | `1.weechat` | Liste der Buffer, viertes Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist5 | `1.weechat` | Liste der Buffer, fünftes Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist2 | `1.weechat` | List der Buffer, zweites Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | List der Buffer, drittes Bar-Item (siehe Option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Hilfstext zur aktuell ausgewählten Option im Fset-Buffer.
| irc_channel | `#test` | aktueller Name des IRC Kanals.
| irc_host | `+user@host.com+` | aktueller IRC Host.
@@ -1473,8 +1427,7 @@ Externe Erweitertungen und Skripte können andere lokale Variablen definieren un
=== Liste der Buffer
Die Buflist-Erweiterung dient dazu eine Liste der geöffneten Buffer in einer Bar-Item, mit Namen
"buflist", darzustellen (vier weitere Bar-Items sind dabei verfügbar "buflist2", "buflist3", "buflist4"
und "buflist5"). +
"buflist", darzustellen (zwei weiere Bar-Items "buflist2" und "buflist3" sind zusätzlich verfügbar). +
Eine Standardbar, "buflist", wird beim Programmstart automatisch mit folgendem Inhalt erstellt.
[[buflist_commands]]
@@ -1605,15 +1558,6 @@ Sie können mit dem Befehl <<command_weechat_key,/key>> geändert und neue hinzu
| kbd:[Ctrl+↓] | ruft nächsten Befehl/Nachricht aus dem globalen Verlaufsspeicher auf (für alle Buffer). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Taste | Beschreibung | Befehl
| kbd:[Ctrl+z] | Breche den Weechat-Prozess ab | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Buffer
@@ -1872,8 +1816,8 @@ Diese Tasten und Aktionen werden im fset-Buffer verwendet (siehe <<fset,Fset Erw
| kbd:[Ctrl+l] (`L`) | | der Bildschirm wird neu gezeichnet. | `+/fset -refresh+`
| | `$` | Optionen neu einlesen (markierte Optionen werden beibehalten). |
| | `$$` | Optionen neu einlesen (Markierungen von Optionen werden dabei gelöscht). |
| kbd:[Alt+p] | `p` | Umschalten der Beschreibung von Erweiterungen (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Hilfe-Bar Ein-/Ausschalten. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Umschalten der Beschreibung von Erweiterungen (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Hilfe-Bar Ein-/Ausschalten. | `+/bar toggle fset+`
| | `s:x,y` | sortiert Optionen nach Bereichen x,y (siehe Option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | setzt Sortierung wieder auf Standardwerte (siehe Option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | exportiert Optionen in Datei "xxx". | `+/fset -export xxx+`
@@ -1933,16 +1877,11 @@ Diese Tasten und Aktionen werden im fset-Buffer verwendet (siehe <<script_manage
| kbd:[PgDn] | | eine Seite nach unten blättern. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Skript installieren. | `+/script install+`
| kbd:[Alt+r] | `r` | Skript entfernen. | `+/script remove+`
| kbd:[Alt+l] | `l` | Skript laden. | `+/script load+`
| kbd:[Alt+L] | `L` | Skript neu laden. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Skript laden. | `+/script load+`
| kbd:[Alt+u] | `u` | Skript wird beendet. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | das Skript wird in das autoload-Verzeichnis eingebunden. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Skript wird gehalten bzw. freigegeben. | `+/script hold+`
| kbd:[Alt+v] | `v` | Skript Quelltext anzeigen. | `+/script show+`
| | `s:x,y` | Sortiert Skrips nach Feldern x,y (siehe Option <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Sortierung auf den Standardwert zurücksetzen (siehe Option <<option_script.look.sort,script.look.sort>>). |
| | `$` | Liste aktualisieren. |
| | `q` | Buffer schließen. | `+/buffer close+`
|===
[NOTE]
@@ -2307,9 +2246,15 @@ und für jeden einzelen Nick kann ein maximler Hotlist-Level eingestellt wertden
Um zum Beispiel Highlights von "joe" und "mike" im aktuellen Buffer zu deaktivieren:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
Die Buffer-Eigenschaft "hotlist_max_level_nicks" ist keine permanente Einstellung und wird nicht
in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man
das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+`
und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`.
[[highlights]]
=== Hervorhebungen
@@ -2334,9 +2279,15 @@ Dies kann auch mit der Buffereigenschaft „highlight_disable_regex“ eingestel
Gleiches Beispiel, spezifisch für den aktuellen Buffer:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
Die Buffer-Eigenschaft "highlight_disable_regex" ist keine permanente Einstellung und wird nicht
in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man
das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+`
und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`.
[[highlights_words]]
==== Worte als Highlights hinzufügen
@@ -2395,9 +2346,15 @@ die Eigenschaft des Buffers mittels "highlight_regex" anpasst.
Um zum Beispiel jede Nachricht im aktuellen Buffer als Highlight-Nachricht einzustufen:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
Die Buffer-Eigenschaft "highlight_regex" ist keine permanente Einstellung und wird nicht
in der Konfigurationsdatei gesichert. + Um diese Einstellung persistent zu machen benötigt man
das Skript _buffer_autoset.py_: Um das Skript zu installieren `+/script install buffer_autoset.py+`
und um eine Hilfe zu erhalten wie man es nutzt: `+/help buffer_autoset+`.
[[buffer_logging]]
=== Bufferprotokollierung
@@ -3304,31 +3261,30 @@ Sektion in Datei _weechat.conf_:
[width="100%",cols="3m,6m,16",options="header"]
|===
| Sektion | Steuerbefehl | Beschreibung
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, für Core und Erweitertungen (Optionen können in Sektion hinzugefügt/entfernt werden).
| startup | /set weechat.startup.* | Optionen die nach dem Programmstart ausgeführt werden.
| look | /set weechat.look.* | Erscheinungsbild.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Alternativnamen für Farben (Optionen können in Sektion hinzugefügt/entfernt werden).
| color | /set weechat.color.* | Farben.
| completion | /set weechat.completion.* | Optionen für Vervollständigung.
| history | /set weechat.history.* | Optionen für Befehlsverlauf (Befehle und Buffer).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy Optionen.
| network | /set weechat.network.* | Netzwerk/TLS Optionen.
| plugin | /set weechat.plugin.* | Optionen für Erweiterungen.
| signal | /set weechat.signal.* | Optionen für Signale.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Optionen für die Bars.
| layout | <<command_weechat_layout,/layout>> | Layouts.
| buffer | <<command_weechat_buffer,/buffer setauto>> | Eigenschaften, die beim Öffnen des Buffers automatisch angewendet werden.
| notify | <<command_weechat_buffer,/buffer notify>> | Benachrichtigungsstufe für Buffer (Optionen können in Sektion hinzugefügt/entfernt werden).
| filter | <<command_weechat_filter,/filter>> | Filter.
| key | <<command_weechat_key,/key>> | Tastenbefehle in default context.
| key_search | <<command_weechat_key,/key>> | Tastenbefehle in search context.
| key_cursor | <<command_weechat_key,/key>> | Tastenbefehle in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Tastenbefehle in mouse context.
| Sektion | Steuerbefehl | Beschreibung
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, für Core und Erweitertungen (Optionen können in Sektion hinzugefügt/entfernt werden).
| startup | /set weechat.startup.* | Optionen die nach dem Programmstart ausgeführt werden.
| look | /set weechat.look.* | Erscheinungsbild.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Alternativnamen für Farben (Optionen können in Sektion hinzugefügt/entfernt werden).
| color | /set weechat.color.* | Farben.
| completion | /set weechat.completion.* | Optionen für Vervollständigung.
| history | /set weechat.history.* | Optionen für Befehlsverlauf (Befehle und Buffer).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy Optionen.
| network | /set weechat.network.* | Netzwerk/TLS Optionen.
| plugin | /set weechat.plugin.* | Optionen für Erweiterungen.
| signal | /set weechat.signal.* | Optionen für Signale.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Optionen für die Bars.
| layout | <<command_weechat_layout,/layout>> | Layouts.
| notify | <<command_weechat_buffer,/buffer notify>> | Benachrichtigungsstufe für Buffer (Optionen können in Sektion hinzugefügt/entfernt werden).
| filter | <<command_weechat_filter,/filter>> | Filter.
| key | <<command_weechat_key,/key>> | Tastenbefehle in default context.
| key_search | <<command_weechat_key,/key>> | Tastenbefehle in search context.
| key_cursor | <<command_weechat_key,/key>> | Tastenbefehle in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Tastenbefehle in mouse context.
|===
Optionen:
@@ -4212,7 +4168,7 @@ die folgenden zusätzlichen Variablen sind verfügbar:
[width="100%",cols="2,4,8",options="header"]
|===
| Variable | Beschreibung | Wert/Beispiel
| `+${clientinfo}+` | Liste der CTCP Antworten | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | Liste der CTCP Antworten | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | WeeChat Version | `+4.1.0-dev+`
| `+${versiongit}+` | WeeChat Version + Git version ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Git Version ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -4235,9 +4191,11 @@ Die Standard-CTCP-Antworten sind:
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | Antwortformat | Beispiel
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+Name (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
-4
View File
@@ -140,7 +140,6 @@ WeeChat "core" is located in following directories:
|    wee-secure-config.c | Secured data options (file sec.conf).
|    wee-signal.c | Signal functions.
|    wee-string.c | Functions on strings.
|    wee-sys.c | System functions.
|    wee-upgrade-file.c | Internal upgrade system.
|    wee-upgrade.c | Upgrade for WeeChat core (buffers, lines, history, ...).
|    wee-url.c | URL transfer (using libcurl).
@@ -167,7 +166,6 @@ WeeChat "core" is located in following directories:
|       wee-hook-process.c | Hook "process".
|       wee-hook-signal.c | Hook "signal".
|       wee-hook-timer.c | Hook "timer".
|       wee-hook-url.c | Hook "url".
| gui/ | Functions for buffers, windows, ... (used by all interfaces).
|    gui-bar-item.c | Bar items.
|    gui-bar-window.c | Bar windows.
@@ -238,7 +236,6 @@ WeeChat "core" is located in following directories:
|       buflist.c | Main buflist functions.
|       buflist-bar-item.c | Buflist bar items.
|       buflist-command.c | Buflist commands.
|       buflist-completion.c | Buflist completions.
|       buflist-config.c | Buflist config options (file buflist.conf).
|       buflist-info.c | Buflist info/infolists/hdata.
|       buflist-mouse.c | Buflist mouse actions.
@@ -423,7 +420,6 @@ WeeChat "core" is located in following directories:
|          test-core-url.cpp | Tests: URLs.
|          test-core-utf8.cpp | Tests: UTF-8.
|          test-core-util.cpp | Tests: utility functions.
|          test-core-sys.cpp | Tests: system functions.
|       gui/ | Root of unit tests for interfaces.
|          test-gui-bar-window.cpp | Tests: bar window functions.
|          test-gui-buffer.cpp | Tests: buffer functions.
+21 -42
View File
@@ -583,14 +583,6 @@ If you are using the macOS Terminal app, enable the option
"Use option as meta key" in menu Settings/Keyboard after which you can use the
kbd:[Option] key as meta key.
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== How can I customize key bindings?
@@ -933,20 +925,35 @@ link:weechat_user.en.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
buffer property to set the max hotlist level for some nicks, per buffer,
or per group of buffers (like IRC servers).
To only disable highlights, you'd have to set it to 2.
For the current buffer:
To only disable highlights, you'd have to set it to 2:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
For all channels on server "libera":
This buffer property isn't stored in the configuration though.
To automatically reapply these buffer properties, you would need the
_buffer_autoset.py_ script:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
For example, to permanently disable highlights from "mike" on #weechat
on the IRC server libera:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
To apply it to the entire libera server instead:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
For more examples, see `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== How can I change target buffer for commands on merged buffers (like buffer with servers)?
@@ -1144,34 +1151,6 @@ stored in _sec.conf_ with the `/secure` command).
See the link:weechat_user.en.html#files_and_directories[User's guide / Files and directories ^↗^^]
for more information about configuration files.
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== Development
+53 -200
View File
@@ -4028,28 +4028,18 @@ Supported hash algorithms:
[width="100%",cols="2,2,3,6",options="header"]
|===
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha512-224+` | SHA-512/224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha512-256+` | SHA-512/256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+blake2b-160+` | BLAKE2B-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-256+` | BLAKE2B-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-384+` | BLAKE2B-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-512+` | BLAKE2B-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-128+` | BLAKE2S-128 | 16 bytes (128 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-160+` | BLAKE2S-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-224+` | BLAKE2S-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-256+` | BLAKE2S-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
Return value:
@@ -4484,8 +4474,7 @@ Arguments:
* _to_: destination file
* _compressor_: the compressor to use, one of:
** _gzip_: gzip compression
** _zstd_: zstandard compression (available only if zstd was enabled when
WeeChat was compiled)
** _zstd_: zstandard compression
* _compression_level_: compression level, between 1 (fast, low compression) to
100 (slow, best compression)
@@ -6807,7 +6796,7 @@ def config_new_section(config_file: str, name: str,
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
# example
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -6826,7 +6815,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -7068,7 +7057,7 @@ Script (Python):
# prototype
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
string_values: str, min: int, max: int,
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
default_value: str | None, value: str | None, null_value_allowed: int,
callback_check_value: str, callback_check_value_data: str,
callback_change: str, callback_change_data: str,
callback_delete: str, callback_delete_data: str) -> str: ...
@@ -10026,6 +10015,7 @@ struct t_hook *weechat_hook_process (const char *command,
void *callback_data);
----
Arguments:
* _command_: command to launch in child process, URL _(WeeChat ≥ 0.3.7)_ or
@@ -10277,7 +10267,22 @@ available:
_/dev/null_.
|===
For command "url:...", see available options in function <<_hook_url,hook_url>>.
For command "url:...", following options are available (see
`+man curl_easy_setopt+` for a description of each option):
include::{autogendir}/autogen_api_url_options.en.adoc[tag=url_options]
[NOTE]
^(1)^ For options with type "mask", format is: "value1+value2+value3";
for options with type "list", the list items must be separated by a newline
(`\n`). +
^(2)^ When constants are available they must be used as value for option.
For URL, two extra options (strings) are allowed for input/output file:
* _file_in_: file to read and send with URLs (post file)
* _file_out_: write downloaded URL/file in this file (instead of standard
output)
Return value:
@@ -10437,156 +10442,6 @@ hook4 = weechat.hook_process_hashtable("sh",
20000, "my_process_cb", "")
----
==== hook_url
_WeeChat ≥ 4.1.0._
URL transfer.
Prototype:
[source,c]
----
struct t_hook *weechat_hook_url (const char *url,
struct t_hashtable *options,
int timeout,
int (*callback)(const void *pointer,
void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output),
const void *callback_pointer,
void *callback_data);
----
Arguments:
* _url_: URL
* _options_: options for URL transfer (see below); the hashtable is duplicated in
function, so it's safe to free it after this call
* _timeout_: timeout for URL transfer (in milliseconds): after this timeout,
the transfer is stopped (0 means no timeout)
* _callback_: function called when the transfer has ended, arguments and return
value:
** _const void *pointer_: pointer
** _void *data_: pointer
** _const char *url_: URL
** _struct t_hashtable *options_: options
** _struct t_hashtable *output_: result (keys and values are strings), which may
contain the following keys:
*** _response_code_: HTTP response code
*** _headers_: HTTP headers in response
*** _output_: standard output (set only if _file_out_ was not set in options)
*** _error_: error message (set only in case of error)
** return value:
*** _WEECHAT_RC_OK_
*** _WEECHAT_RC_ERROR_
* _callback_pointer_: pointer given to callback when it is called by WeeChat
* _callback_data_: pointer given to callback when it is called by WeeChat;
if not NULL, it must have been allocated with malloc (or similar function)
and it is automatically freed when the hook is deleted
The following Curl options are available (see `+man curl_easy_setopt+` for
a description of each option):
include::{autogendir}/autogen_api_url_options.en.adoc[tag=url_options]
[NOTE]
^(1)^ For options with type "mask", format is: "value1+value2+value3";
for options with type "list", the list items must be separated by a newline
(`\n`). +
^(2)^ When constants are available they must be used as value for option.
These two extra options (strings) are allowed for input/output file:
[width="100%",cols="2,^1,7",options="header"]
|===
| Option | Type | Description
| file_in | string | file to read and send with URLs (post file)
| file_out | string | write downloaded URL/file in this file (instead of standard output)
|===
Return value:
* pointer to new hook, NULL if error occurred
C example:
[source,c]
----
int
my_url_cb (const void *pointer, void *data, const char *url,
struct t_hashtable *options, struct t_hashtable *output)
{
weechat_printf (NULL, "response_code: %s", weechat_hashtable_get (output, "response_code"));
weechat_printf (NULL, "headers: %s", weechat_hashtable_get (output, "headers"));
weechat_printf (NULL, "output: %s", weechat_hashtable_get (output, "output"));
weechat_printf (NULL, "error: %s", weechat_hashtable_get (output, "error"));
return WEECHAT_RC_OK;
}
/* example 1: output to a file */
struct t_hashtable *options_url1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url1)
{
weechat_hashtable_set (options_url1, "file_out", "/tmp/weechat.org.html");
struct t_hook *my_url_hook = weechat_hook_url ("https://weechat.org/",
options_url1,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url1);
}
/* example 2: custom HTTP headers, output sent to callback */
struct t_hashtable *options_url2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url2)
{
weechat_hashtable_set (options_url2, "httpheader",
"Header1: value1\n"
"Header2: value2");
struct t_hook *my_url_hook = weechat_hook_url ("http://localhost:8080/",
options_url2,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url2);
}
----
Script (Python):
[source,python]
----
# prototype
def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: ...
# example
def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
weechat.prnt("", "output: %s" % output)
return weechat.WEECHAT_RC_OK
# example 1: output to a file
hook1 = weechat.hook_url("https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_url_cb", "")
# example 2: custom HTTP headers, output sent to callback
options = {
"httpheader": "\n".join([
"Header1: value1",
"Header2: value2",
]),
}
hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
----
==== hook_connect
_Updated in 1.5, 2.0._
@@ -10773,7 +10628,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
==== hook_line
_WeeChat ≥ 2.3, updated in 3.7._
_WeeChat ≥ 2.3, updated in 3.7, 4.1.0._
Hook a line to be printed in a buffer.
@@ -10844,13 +10699,13 @@ Line data sent to the callback is a hashtable, with following values
| Key | Value (formatted buffer) | Value (free buffer) | Examples
| buffer
| Buffer pointer.
| Buffer pointer.
| Comma-separated list of buffer pointers.
| Comma-separated list of buffer pointers.
| `+0x1234abcd+`
| buffer_name
| Buffer name.
| Buffer name.
| Comma-separated list of buffer names.
| Comma-separated list of buffer names.
| `+core.weechat+` +
`+irc.server.libera+` +
`+irc.libera.#weechat+`
@@ -10938,16 +10793,20 @@ in this hashtable):
| Key | Allowed value (formatted buffer) | Allowed value (free buffer) | Result
| buffer
| Pointer of a buffer with formatted content.
| Pointer of a buffer with free content.
| The line is displayed on this buffer. +
| Comma-separated list buffer pointers (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer pointers (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
If the value is empty, the line is deleted (anything else in the hashtable
is then ignored); the next hooks of type "line" are not called.
| buffer_name
| Name of a buffer with formatted content.
| Name of a buffer with free content.
| The line is displayed on this buffer. +
| Comma-separated list buffer names (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer names (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
If `buffer` is also set, the value of `+buffer_name+` has higher priority and is used. +
If the value is empty, the line is deleted (anything else in the hashtable
is then ignored); the next hooks of type "line" are not called.
@@ -18734,7 +18593,7 @@ for key in hash:
==== hdata_compare
_WeeChat ≥ 1.9, updated in 4.1.0._
_WeeChat ≥ 1.9._
Compare a hdata variable of two objects.
@@ -18750,8 +18609,8 @@ Arguments:
* _hdata_: hdata pointer
* _pointer1_: pointer to first WeeChat/plugin object
* _pointer2_: pointer to second WeeChat/plugin object
* _name_: variable name or path to a variable name; for arrays, the name can be
"N|name" where N is the index in array (starting at 0), for example: "2|name"
* _name_: variable name; for arrays, the name can be "N|name" where N is
the index in array (starting at 0), for example: "2|name"
* _case_sensitive_: 1 for case sensitive comparison of strings, otherwise 0
Return value:
@@ -18767,12 +18626,8 @@ C example:
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
weechat_printf (NULL, "comparison of buffer number = %d",
weechat_printf (NULL, "number comparison = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
weechat_printf (NULL, "comparison of number of lines = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
weechat_printf (NULL, "comparison of local variable = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
----
Script (Python):
@@ -18786,9 +18641,7 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
----
==== hdata_set
+78 -120
View File
@@ -130,6 +130,10 @@ WeeChat:
| Logger plugin: compression of rotated log files (gzip). +
Relay plugin: compression of messages (WeeChat -> client) with https://zlib.net/[zlib ^↗^^] (weechat protocol). +
Script plugin: read of repository index file (gzip).
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files. +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
|===
[NOTE]
@@ -143,68 +147,26 @@ WeeChat:
[width="100%",cols="5,^3,.^15",options="header"]
|===
| Package ^(1)^ | Version | Features
| {cpp} compiler (pass:[g++ / clang++]) |
| Build and run tests, JavaScript plugin.
| gettext |
| Internationalization (translation of messages; base language is English).
| ca-certificates |
| Certificates for TLS connections.
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files (zstandard). +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
| libaspell-dev / libenchant-dev |
| Spell plugin.
| python3-dev | ≥ 3.0
| Python plugin.
| libperl-dev |
| Perl plugin.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Ruby plugin.
| liblua5.4-dev |
| Lua plugin.
| tcl-dev | ≥ 8.5
| Tcl plugin.
| guile-3.0-dev | ≥ 2.0
| Guile (scheme) plugin.
| libv8-dev | ≤ 3.24.3
| JavaScript plugin.
| php-dev | ≥ 7.0
| PHP plugin.
| libphp-embed | ≥ 7.0
| PHP plugin.
| libxml2-dev |
| PHP plugin.
| libargon2-dev |
| PHP plugin (if PHP ≥ 7.2).
| libsodium-dev |
| PHP plugin (if PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4
| Build man page and documentation.
| ruby-pygments.rb |
| Build documentation.
| libcpputest-dev | ≥ 3.4
| Build and run tests.
| Package ^(1)^ | Version | Features
| {cpp} compiler (pass:[g++ / clang++]) | | Build and run tests, JavaScript plugin.
| gettext | | Internationalization (translation of messages; base language is English).
| ca-certificates | | Certificates for TLS connections.
| libaspell-dev / libenchant-dev | | Spell plugin.
| python3-dev | ≥ 3.0 | Python plugin.
| libperl-dev | | Perl plugin.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Ruby plugin.
| liblua5.4-dev | | Lua plugin.
| tcl-dev | ≥ 8.5 | Tcl plugin.
| guile-3.0-dev | ≥ 2.0 | Guile (scheme) plugin.
| libv8-dev | ≤ 3.24.3 | JavaScript plugin.
| php-dev | ≥ 7.0 | PHP plugin.
| libphp-embed | ≥ 7.0 | PHP plugin.
| libxml2-dev | | PHP plugin.
| libargon2-dev | | PHP plugin (if PHP ≥ 7.2).
| libsodium-dev | | PHP plugin (if PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | Build man page and documentation.
| ruby-pygments.rb | | Build documentation.
| libcpputest-dev | ≥ 3.4 | Build and run tests.
|===
[NOTE]
@@ -244,7 +206,7 @@ $ make install
Options can be used for CMake, with format: `-DOPTION=VALUE`.
List of available options:
List of commonly used options:
[width="100%",cols="3m,3,3m,10",options="header"]
|===
@@ -298,9 +260,6 @@ List of available options:
| ENABLE_GUILE | `ON`, `OFF` | ON
| Compile <<scripting_plugins,Guile plugin>> (Scheme).
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compile headless binary.
| ENABLE_IRC | `ON`, `OFF` | ON
| Compile <<irc,IRC plugin>>.
@@ -359,9 +318,6 @@ List of available options:
| ENABLE_XFER | `ON`, `OFF` | ON
| Compile <<xfer,Xfer plugin>>.
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Enable https://facebook.github.io/zstd/[Zstandard ^↗^^] compression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| Compile tests.
@@ -939,8 +895,6 @@ Other items available (not used in bars by default):
| buffer_short_name | `#test` | Current buffer short name.
| buflist2 | `1.weechat` | List of buffers, second bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | List of buffers, third bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist4 | `1.weechat` | List of buffers, fourth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist5 | `1.weechat` | List of buffers, fifth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Help on currently selected option on fset buffer.
| irc_channel | `#test` | Current IRC channel name.
| irc_host | `+user@host.com+` | Current IRC host.
@@ -1459,8 +1413,7 @@ External plugins and scripts can define and use other local variables.
=== List of buffers
Buflist plugin displays a list of buffers in a bar item called "buflist"
(four other bar items "buflist2", "buflist3", "buflist4" and "buflist5" are
available as well). +
(two other bar items "buflist2" and "buflist3" are available as well). +
A default bar "buflist" is created on startup with this item.
[[buflist_commands]]
@@ -1592,15 +1545,6 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Call next command/message in global history (common for all buffers). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Key | Description | Command
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Buffers
@@ -1859,8 +1803,8 @@ These keys and actions are used on the fset buffer (see <<fset,Fset plugin>>).
| kbd:[Ctrl+l] (`L`) | | Refresh options and whole screen. | `+/fset -refresh+`
| | `$` | Refresh options (keep marked options). |
| | `$$` | Refresh options (unmark all options). |
| kbd:[Alt+p] | `p` | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Toggle help bar. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Toggle help bar. | `+/bar toggle fset+`
| | `s:x,y` | Sort options by fields x,y (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Reset sort to its default value (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Export options in file "xxx". | `+/fset -export xxx+`
@@ -1920,16 +1864,11 @@ These keys and actions are used on the script buffer (see <<script_manager,scrip
| kbd:[PgDn] | | Move one page down. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Install script. | `+/script install+`
| kbd:[Alt+r] | `r` | Remove script. | `+/script remove+`
| kbd:[Alt+l] | `l` | Load script. | `+/script load+`
| kbd:[Alt+L] | `L` | Reload script. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Load script. | `+/script load+`
| kbd:[Alt+u] | `u` | Unload script. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Autoload script. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Hold/unhold script. | `+/script hold+`
| kbd:[Alt+v] | `v` | View script. | `+/script show+`
| | `s:x,y` | Sort scripts by fields x,y (see option <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Reset sort to its default value (see option <<option_script.look.sort,script.look.sort>>). |
| | `$` | Refresh list. |
| | `q` | Close buffer. | `+/buffer close+`
|===
[NOTE]
@@ -2282,9 +2221,15 @@ and for each nick the max hotlist level to trigger, possible levels are:
For example to disable highlights from "joe" and "mike" on current buffer:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
The buffer property "hotlist_max_level_nicks" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with
`+/help buffer_autoset+`.
[[highlights]]
=== Highlights
@@ -2309,9 +2254,15 @@ This can also be set with the buffer property "highlight_disable_regex".
Same example, specific to the current buffer:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
The buffer property "highlight_disable_regex" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with
`+/help buffer_autoset+`.
[[highlights_words]]
==== Add words to highlight
@@ -2366,9 +2317,15 @@ You can force highlight using a regular expression with the buffer property
For example to force the highlight on all messages in the current buffer:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
The buffer property "highlight_regex" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with
`+/help buffer_autoset+`.
[[buffer_logging]]
=== Buffer logging
@@ -3247,31 +3204,30 @@ Sections in file _weechat.conf_:
[width="100%",cols="3m,6m,16",options="header"]
|===
| Section | Control command | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, for core and plugins (options can be added/removed in section).
| startup | /set weechat.startup.* | Startup options.
| look | /set weechat.look.* | Look and feel.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Color aliases (options can be added/removed in section).
| color | /set weechat.color.* | Colors.
| completion | /set weechat.completion.* | Completion options.
| history | /set weechat.history.* | History options (commands and buffers).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/TLS options.
| plugin | /set weechat.plugin.* | Options on plugins.
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.
| buffer | <<command_weechat_buffer,/buffer setauto>> | Properties auto-applied on buffers when they are opened.
| notify | <<command_weechat_buffer,/buffer notify>> | Notify levels for buffers (options can be added/removed in section).
| filter | <<command_weechat_filter,/filter>> | Filters.
| key | <<command_weechat_key,/key>> | Keys in default context.
| key_search | <<command_weechat_key,/key>> | Keys in search context.
| key_cursor | <<command_weechat_key,/key>> | Keys in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Keys in mouse context.
| Section | Control command | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, for core and plugins (options can be added/removed in section).
| startup | /set weechat.startup.* | Startup options.
| look | /set weechat.look.* | Look and feel.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Color aliases (options can be added/removed in section).
| color | /set weechat.color.* | Colors.
| completion | /set weechat.completion.* | Completion options.
| history | /set weechat.history.* | History options (commands and buffers).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/TLS options.
| plugin | /set weechat.plugin.* | Options on plugins.
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.
| notify | <<command_weechat_buffer,/buffer notify>> | Notify levels for buffers (options can be added/removed in section).
| filter | <<command_weechat_filter,/filter>> | Filters.
| key | <<command_weechat_key,/key>> | Keys in default context.
| key_search | <<command_weechat_key,/key>> | Keys in search context.
| key_cursor | <<command_weechat_key,/key>> | Keys in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Keys in mouse context.
|===
Options:
@@ -4139,7 +4095,7 @@ the following extra variables are available:
[width="100%",cols="2,4,8",options="header"]
|===
| Variable | Description | Value/example
| `+${clientinfo}+` | List of supported CTCP | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | List of supported CTCP | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | WeeChat version | `+4.1.0-dev+`
| `+${versiongit}+` | WeeChat version + Git version ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Git version ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -4161,9 +4117,11 @@ The default CTCP replies are:
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | Reply format | Example
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+name (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
+21 -46
View File
@@ -598,15 +598,6 @@ Si está utilizando aplicación Terminal de macOS, habilite la opción
"Use option as meta key" en el menú Settings/Keyboard después de la cual puede utilizar la tecla
kbd:[Option] como tecla meta.
// TRANSLATION MISSING
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== ¿Cómo puedo personalizar los atajos de teclado?
@@ -963,22 +954,35 @@ link:weechat_user.en.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
buffer property to set the max hotlist level for some nicks, per buffer,
or per group of buffers (like IRC servers).
Para únicamente inhabilitar las notificaciones, debería establecerlo a 2.
// TRANSLATION MISSING
For the current buffer:
Para únicamente inhabilitar las notificaciones, debería establecerlo a 2:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
// TRANSLATION MISSING
For all channels on server "libera":
Esta propiedad del buffer no es almacenada en la configuración.
Para volver a aplicar automáticamente estas propiedades del buffer, necesitaría el script
_buffer_autoset.py_:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
Por ejemplo, para inhabilitar automáticamente las menciones de "mike" en #weechat
en el servidor IRC de libera:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
Para aplicarlo al servidor completo de libera:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
Para más ejemplos, vea `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== ¿Cómo puedo cambiar el objetivo del buffer para comandos en buffers unidos (como en un buffer con servidores)?
@@ -1182,35 +1186,6 @@ almacenadas en _sec.conf_ con el comando `/secure`).
Vea la link:weechat_user.en.html#files_and_directories[Guía del usuario / Archivos y directorios ^↗^^]
para más información relacionada con los archivos de configuración.
// TRANSLATION MISSING
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== Desarrollo
-4
View File
@@ -142,7 +142,6 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|    wee-secure-config.c | Options des données sécurisées (fichier sec.conf).
|    wee-signal.c | Fonctions sur les signaux.
|    wee-string.c | Fonctions sur les chaînes de caractères.
|    wee-sys.c | Fonctions système.
|    wee-upgrade-file.c | Système de mise à jour interne.
|    wee-upgrade.c | Mise à jour du cœur de WeeChat (tampons, lignes, historique, ...).
|    wee-url.c | Transfert d'URL (en utilisant libcurl).
@@ -169,7 +168,6 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|       wee-hook-process.c | Hook "process".
|       wee-hook-signal.c | Hook "signal".
|       wee-hook-timer.c | Hook "timer".
|       wee-hook-url.c | Hook "url".
| gui/ | Fonctions pour les tampons, fenêtres, ... (utilisées par toutes les interfaces).
|    gui-bar-item.c | Objets de barre.
|    gui-bar-window.c | Fenêtres de barre.
@@ -240,7 +238,6 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|       buflist.c | Fonctions principales de Buflist.
|       buflist-bar-item.c | Objets de barre Buflist.
|       buflist-command.c | Commandes pour Buflist.
|       buflist-completion.c | Complétions pour Buflist.
|       buflist-config.c | Options de configuration pour Buflist (fichier buflist.conf).
|       buflist-info.c | Info/infolists/hdata pour Buflist.
|       buflist-mouse.c | Actions souris pour Buflist.
@@ -425,7 +422,6 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|          test-core-url.cpp | Tests : URLs.
|          test-core-utf8.cpp | Tests : UTF-8.
|          test-core-util.cpp | Tests : fonctions utiles.
|          test-core-sys.cpp | Tests : fonctions système.
|       gui/ | Racine des tests unitaires pour les interfaces.
|          test-gui-bar-window.cpp | Tests : fonctions de fenêtres de barre.
|          test-gui-buffer.cpp | Tests : fonctions de tampons.
+21 -47
View File
@@ -601,16 +601,6 @@ Si vous utilisez l'application Terminal sous macOS, activez l'option
"Use option as meta key" dans le menu Réglages/Clavier. Vous pouvez alors
utiliser la touche kbd:[Option] comme touche meta.
[[enter_key]]
=== Quelques touches comme Entrée ne fonctionnent pas, pourquoi ?
Si vous lancez WeeChat < 4.0.0 avec des fichiers de configuration créés par toute
version ≥ 4.0.0, les noms des touches sont invalides et de nombreuses touches
ne fonctionneront plus. +
Pour les réparer, quittez WeeChat, supprimez toutes les sections `[key*]` de
weechat.conf et démarrez WeeChat à nouveau : toutes les touches par défaut
seront recréées.
[[customize_key_bindings]]
=== Comment puis-je configurer les raccourcis clavier ?
@@ -965,20 +955,35 @@ link:weechat_user.fr.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
pour définir le niveau maximum de hotlist pour certains pseudos, par tampon,
ou groupe de tampons (comme des serveurs IRC).
Pour désactiver seulement les highlights, vous pouvez positionner la valeur à 2.
Pour le tampon courant :
Pour désactiver seulement les highlights, vous pouvez positionner la valeur à 2 :
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
Pour tous les canaux sur le serveur "libera":
Cependant, cette propriété de tampon n'est pas sauvegardée dans la configuration.
Pour automatiquement réappliquer ces propriétés de tampons, vous aurez besoin
du script _buffer_autoset.py_ :
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
Par exemple, pour désactiver de manière permanente les highlights de "mike" sur
#weechat sur le serveur IRC libera :
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
Pour l'appliquer à l'ensemble du serveur libera :
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
Pour plus d'exemples, voir `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== Comment puis-je changer le serveur cible pour les commandes avec des tampons mélangés (comme le tampon avec les serveurs) ?
@@ -1190,37 +1195,6 @@ des mots de passes (s'ils ne sont pas stockés dans _sec.conf_ avec la commande
Voir le link:weechat_user.fr.html#files_and_directories[Guide utilisateur / Fichiers et répertoires ^↗^^]
pour plus d'informations sur les fichiers de configuration.
[[move_to_another_device]]
=== Je souhaite déplacer mon WeeChat vers une autre machine et garder ma configuration, que dois-je copier ?
Premièrement, vérifiez les répertoires utilisés par WeeChat avec cette commande :
`/debug dirs`. +
Les répertoires home/config et home/data doivent être copiés (tous les fichiers
et sous-répertoires).
Par exemple si vous utilisez les répertoires XDG (par défaut avec WeeChat ≥ 3.2),
les répertoires devraient être `$HOME/.config/weechat` et `$HOME/.local/share/weechat`. +
Si vous utilisez un répertoire unique (par défaut avec WeeChat < 3.2), le répertoire
devrait être `$HOME/.weechat`.
[IMPORTANT]
La version de WeeChat sur la nouvelle machine doit être supérieure ou égale
à celle de la machine initiale. +
La rétrogradation de la configuration n'est *PAS SUPPORTÉE* et pourrait la casser,
rendant WeeChat inutilisable.
Étapes :
. Quitter Weechat : `/quit` (ou `/upgrade -quit` si vous souhaitez restaurer
la session, qui inclut le contenu de tous les tampons).
. Copier tous les répertoires, fichiers et sous-répertoires vers la nouvelle machine
au même endroit, en préservant les noms et les permissions.
. Facultatif : copier tout fichier en dehors de ces répertoires que vous référencez
dans votre configuration (il n'est pas recommandé d'utiliser des fichiers en
dehors des répertoires WeeChat).
. Démarrer WeeChat sur la nouvelle machine : `weechat` (ou `weechat --upgrade`
si vous avez sauvé la session).
[[development]]
== Développement
+60 -215
View File
@@ -4100,28 +4100,18 @@ Algorithmes de hachage supportés :
[width="100%",cols="2,2,3,6",options="header"]
|===
| Valeur | Algorithme | Taille du haché | Notes
| `+crc32+` | CRC32 | 4 octets (32 bits) | Pas un algorithme de hachage au sens cryptographique.
| `+md5+` | MD5 | 16 octets (128 bits) | *Faible*, non recommandé pour un usage cryptographique.
| `+sha1+` | SHA-1 | 20 octets (160 bits) | *Faible*, non recommandé pour un usage cryptographique.
| `+sha224+` | SHA-224 | 28 octets (224 bits) |
| `+sha256+` | SHA-256 | 32 octets (256 bits) |
| `+sha384+` | SHA-384 | 48 octets (384 bits) |
| `+sha512+` | SHA-512 | 64 octets (512 bits) |
| `+sha512-224+` | SHA-512/224 | 28 octets (224 bits) | Algorithme disponible avec libgcrypt ≥ 1.9.4.
| `+sha512-256+` | SHA-512/256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.9.4.
| `+sha3-224+` | SHA3-224 | 28 octets (224 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 octets (384 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 octets (512 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+blake2b-160+` | BLAKE2B-160 | 20 octets (160 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2b-256+` | BLAKE2B-256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2b-384+` | BLAKE2B-384 | 48 octets (384 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2b-512+` | BLAKE2B-512 | 64 octets (512 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2s-128+` | BLAKE2S-128 | 16 octets (128 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2s-160+` | BLAKE2S-160 | 20 octets (160 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2s-224+` | BLAKE2S-224 | 28 octets (224 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| `+blake2s-256+` | BLAKE2S-256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.8.0.
| Valeur | Algorithme | Taille du haché | Notes
| `+crc32+` | CRC32 | 4 octets (32 bits) | Pas un algorithme de hachage au sens cryptographique.
| `+md5+` | MD5 | 16 octets (128 bits) | *Faible*, non recommandé pour un usage cryptographique.
| `+sha1+` | SHA-1 | 20 octets (160 bits) | *Faible*, non recommandé pour un usage cryptographique.
| `+sha224+` | SHA-224 | 28 octets (224 bits) |
| `+sha256+` | SHA-256 | 32 octets (256 bits) |
| `+sha384+` | SHA-384 | 48 octets (384 bits) |
| `+sha512+` | SHA-512 | 64 octets (512 bits) |
| `+sha3-224+` | SHA3-224 | 28 octets (224 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 octets (384 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 octets (512 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
|===
Valeur de retour :
@@ -4562,8 +4552,7 @@ Paramètres :
* _to_ : fichier cible
* _compressor_ : le compresseur à utiliser, un parmi :
** _gzip_ : compression gzip
** _zstd_ : compression zstandard (disponible seulement si zstd a été activé
lors de la compilation de WeeChat)
** _zstd_ : compression zstandard
* _compression_level_ : niveau de compression, entre 1 (rapide, peu de
compression) à 100 (lent, meilleure compression)
@@ -6830,10 +6819,9 @@ my_section_read_cb (const void *pointer, void *data,
{
/* ... */
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
return WEECHAT_CONFIG_READ_OK;
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
}
int
@@ -6923,7 +6911,7 @@ def config_new_section(config_file: str, name: str,
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
# exemple
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -6942,7 +6930,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -7189,7 +7177,7 @@ Script (Python) :
# prototype
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
string_values: str, min: int, max: int,
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
default_value: str | None, value: str | None, null_value_allowed: int,
callback_check_value: str, callback_check_value_data: str,
callback_change: str, callback_change_data: str,
callback_delete: str, callback_delete_data: str) -> str: ...
@@ -10208,6 +10196,7 @@ struct t_hook *weechat_hook_process (const char *command,
void *callback_data);
----
Paramètres :
* _command_ : commande à lancer dans le processus fils, URL _(WeeChat ≥ 0.3.7)_
@@ -10441,7 +10430,7 @@ struct t_hook *weechat_hook_process_hashtable (const char *command,
Les paramètres sont les mêmes que ceux de la fonction
<<_hook_process,hook_process>>, avec un paramètre supplémentaire :
* _options_ : options pour la commande exécutée ; la table de hachage est
* _options_ : options pour la commande exécutée; la table de hachage est
dupliquée dans la fonction, donc il est possible de la supprimer après cet
appel
@@ -10471,8 +10460,25 @@ sont disponibles :
_/dev/null_.
|===
Pour la commande "url:...", voir les options disponibles dans la fonction
<<_hook_url,hook_url>>.
Pour la commande "url:...", les options suivantes sont disponibles (voir
`+man curl_easy_setopt+` pour une description de chaque option) :
include::{autogendir}/autogen_api_url_options.fr.adoc[tag=url_options]
[NOTE]
^(1)^ Pour les options avec le type "mask", le format est :
"value1+value2+value3" ;
pour les options avec le type "list", les éléments de la liste doivent être
séparés par un retour à la ligne (`\n`). +
^(2)^ Lorsque des constantes sont disponibles, elles doivent être utilisées
comme valeur pour l'option.
Pour l'URL, deux options supplémentaires (chaînes) sont autorisées, pour le
fichier en entrée/sortie :
* _file_in_ : fichier à lire pour envoyer avec l'URL (envoi de fichier "post")
* _file_out_ : écrire l'URL/fichier dans ce fichier (au lieu de la sortie
standard)
Valeur de retour :
@@ -10632,163 +10638,6 @@ hook4 = weechat.hook_process_hashtable("sh",
20000, "my_process_cb", "")
----
==== hook_url
_WeeChat ≥ 4.1.0._
Transfert d'URL.
Prototype :
[source,c]
----
struct t_hook *weechat_hook_url (const char *url,
struct t_hashtable *options,
int timeout,
int (*callback)(const void *pointer,
void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output),
const void *callback_pointer,
void *callback_data);
----
Paramètres :
* _url_ : URL
* _options_ : options pour le transfert d'URL (voir ci-dessous) ; la table de
hachage est dupliquée dans la fonction, donc il est possible de la supprimer
après cet appel
* _timeout_ : timeout pour le transfert d'URL (en millisecondes) : après de délai,
le transfert est stoppé (0 signifie pas de limite)
* _callback_ : fonction appelée lorsque le transfert est terminé, paramètres et
valeur de retour :
** _const void *pointer_ : pointeur
** _void *data_ : pointeur
** _const char *url_ : URL
** _struct t_hashtable *options_ : options
** _struct t_hashtable *output_ : résultat (les clés et valeurs sont des chaînes),
qui peut contenir les clés suivantes :
*** _response_code_ : code réponse HTTP
*** _headers_ : en-têtes HTTP dans la réponse
*** _output_ : sortie standard (défini seulement si _file_out_ n'était pas défini
dans les options)
*** _error_ : message d'erreur (défini seulement en cas d'erreur)
** valeur de retour :
*** _WEECHAT_RC_OK_
*** _WEECHAT_RC_ERROR_
* _callback_pointer_ : pointeur donné à la fonction de rappel lorsqu'elle est
appelée par WeeChat
* _callback_data_ : pointeur donné à la fonction de rappel lorsqu'elle est
appelée par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une
fonction similaire) et est automatiquement libéré (par free) lorsque le
"hook" est supprimé
Les options Curl suivantes sont disponibles (voir `+man curl_easy_setopt+` pour
une description de chaque option) :
include::{autogendir}/autogen_api_url_options.fr.adoc[tag=url_options]
[NOTE]
^(1)^ Pour les options avec le type "mask", le format est :
"value1+value2+value3" ;
pour les options avec le type "list", les éléments de la liste doivent être
séparés par un retour à la ligne (`\n`). +
^(2)^ Lorsque des constantes sont disponibles, elles doivent être utilisées
comme valeur pour l'option.
Ces deux options supplémentaires (chaînes) sont autorisées, pour le fichier en
entrée/sortie :
[width="100%",cols="2,^1,7",options="header"]
|===
| Option | Type | Description
| file_in | string | fichier à lire pour envoyer avec l'URL (envoi de fichier "post")
| file_out | string | écrire l'URL/fichier dans ce fichier (au lieu de la sortie standard)
|===
Valeur de retour :
* pointeur vers le nouveau "hook", NULL en cas d'erreur
Exemple en C :
[source,c]
----
int
my_url_cb (const void *pointer, void *data, const char *url,
struct t_hashtable *options, struct t_hashtable *output)
{
weechat_printf (NULL, "response_code : %s", weechat_hashtable_get (output, "response_code"));
weechat_printf (NULL, "headers : %s", weechat_hashtable_get (output, "headers"));
weechat_printf (NULL, "output : %s", weechat_hashtable_get (output, "output"));
weechat_printf (NULL, "error : %s", weechat_hashtable_get (output, "error"));
return WEECHAT_RC_OK;
}
/* example 1: sortie dans un fichier */
struct t_hashtable *options_url1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url1)
{
weechat_hashtable_set (options_url1, "file_out", "/tmp/weechat.org.html");
struct t_hook *my_url_hook = weechat_hook_url ("https://weechat.org/",
options_url1,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url1);
}
/* example 2: en-têtes HTTP personnalisés, sortie envoyée à la fonction de rappel */
struct t_hashtable *options_url2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url2)
{
weechat_hashtable_set (options_url2, "httpheader",
"Header1: valeur1\n"
"Header2: valeur2");
struct t_hook *my_url_hook = weechat_hook_url ("http://localhost:8080/",
options_url2,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url2);
}
----
Script (Python) :
[source,python]
----
# prototype
def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: ...
# exemple
def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
weechat.prnt("", "output: %s" % output)
return weechat.WEECHAT_RC_OK
# exemple 1 : sortie dans un fichier
hook1 = weechat.hook_url("https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_url_cb", "")
# exemple 2 : en-têtes HTTP personnalisés, sortie envoyée à la fonction de rappel
options = {
"httpheader": "\n".join([
"Header1: valeur1",
"Header2: valeur2",
]),
}
hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
----
==== hook_connect
_Mis à jour dans la 1.5, 2.0._
@@ -10982,7 +10831,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
==== hook_line
_WeeChat ≥ 2.3, mis à jour dans la 3.7._
_WeeChat ≥ 2.3, mis à jour dans la 3.7, 4.1.0._
Intercepter une ligne sur le point d'être affichée dans un tampon.
@@ -11060,13 +10909,13 @@ de hachage, avec les valeurs suivantes (les clés et valeurs sont des chaînes)
| Clé | Valeur (tampon formaté) | Valeur (tampon libre) | Exemples
| buffer
| Pointeur vers le tampon.
| Pointeur vers le tampon.
| Liste de pointeurs vers les tampons, séparés par des virgules.
| Liste de pointeurs vers les tampons, séparés par des virgules.
| `+0x1234abcd+`
| buffer_name
| Nom du tampon.
| Nom du tampon.
| Liste de noms de tampons, séparés par des virgules.
| Liste de noms de tampons, séparés par des virgules.
| `+core.weechat+` +
`+irc.server.libera+` +
`+irc.libera.#weechat+`
@@ -11155,16 +11004,20 @@ valeurs sont des chaînes dans cette table de hachage) :
| Clé | Valeur autorisée (tampon formaté) | Valeur autorisée (tampon libre) | Résultat
| buffer
| Pointeur vers un tampon avec contenu formaté.
| Pointeur vers un tampon avec contenu libre.
| La ligne est affichée sur ce tampon. +
| Liste de pointeurs vers les tampons, séparés par des virgules (avec contenu formaté)
(plusieurs tampons sont supportés seulement avec WeeChat ≥ 4.1.0).
| Liste de pointeurs vers les tampons, séparés par des virgules (avec contenu libre)
(plusieurs tampons sont supportés seulement avec WeeChat ≥ 4.1.0).
| La ligne est affichée sur ces tampons. +
Si la valeur est vide, la ligne est supprimée (le reste de la table de hachage
est alors ignoré) ; les "hooks" suivants de type "line" ne sont pas appelés.
| buffer_name
| Nom d'un tampon avec contenu formaté.
| Nom d'un tampon avec contenu libre.
| La ligne est affichée sur ce tampon. +
| Liste de noms de tampons, séparés par des virgules (avec contenu formaté)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Liste de noms de tampons, séparés par des virgules (avec contenu libre)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| La ligne est affichée sur ces tampons. +
Si `buffer` est également défini, la valeur de `+buffer_name+` a une priorité
plus haute est est utilisée. +
Si la valeur est vide, la ligne est supprimée (le reste de la table de hachage
@@ -19133,7 +18986,7 @@ for key in hash:
==== hdata_compare
_WeeChat ≥ 1.9, mis à jour dans la 4.1.0._
_WeeChat ≥ 1.9._
Comparer une variable hdata de deux objets.
@@ -19149,9 +19002,8 @@ Paramètres :
* _hdata_ : pointeur vers le hdata
* _pointer1_ : pointeur vers le premier objet WeeChat ou d'une extension
* _pointer2_ : pointeur vers le second objet WeeChat ou d'une extension
* _name_ : nom de la variable ou chemin vers le nom de la variable ; pour les
tableaux, le nom peut être "N|name" où N est un index dans le tableau
(démarrant à 0), par exemple : "2|name"
* _name_ : nom de la variable ; pour les tableaux, le nom peut être "N|name" où N
est un index dans le tableau (démarrant à 0), par exemple : "2|name"
* _case_sensitive_ : 1 pour une comparaison tenant compte de la casse pour les chaînes,
sinon 0
@@ -19168,12 +19020,7 @@ Exemple en C :
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
weechat_printf (NULL, "comparaison de numéro de tampon = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
weechat_printf (NULL, "comparaison du nombre de lignes = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
weechat_printf (NULL, "comparaison de variable locale = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
weechat_printf (NULL, "comparaison de numéro = %d", weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
----
Script (Python) :
@@ -19187,9 +19034,7 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
weechat.prnt("", "comparaison de numéro de tampon = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
weechat.prnt("", "comparaison du nombre de lignes = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
weechat.prnt("", "comparaison de variable locale = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
weechat.prnt("", "comparaison de numéro = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
----
==== hdata_set
+92 -130
View File
@@ -130,6 +130,10 @@ Le tableau suivant liste les paquets *requis* pour construire WeeChat :
| Extension Logger : compression des fichiers de log qui tournent (gzip). +
Extention Relay : compression des messages (WeeChat -> client) avec https://zlib.net/[zlib ^↗^^] (protocole weechat). +
Extension Script : lecture du fichier d'index du dépôt (gzip).
| libzstd-dev | ≥ 0.8.1
| Extension Logger : compression des fichiers de log qui tournent. +
Extension Relay : compression des messages (WeeChat -> client) avec https://facebook.github.io/zstd/[Zstandard ^↗^^] (protocole weechat).
|===
[NOTE]
@@ -142,68 +146,26 @@ Le tableau suivant liste les paquets optionnels pour compiler WeeChat :
[width="100%",cols="5,^3,.^15",options="header"]
|===
| Paquet ^(1)^ | Version | Fonctionnalités
| compilateur {cpp} (pass:[g++ / clang++]) |
| Construction et lancement des tests, extension JavaScript.
| gettext |
| Internationalisation (traduction des messages ; la langue de base est l'anglais).
| ca-certificates |
| Certificats pour les connexions TLS.
| libzstd-dev | ≥ 0.8.1
| Extension Logger : compression des fichiers de log qui tournent (zstandard). +
Extension Relay : compression des messages (WeeChat -> client) avec https://facebook.github.io/zstd/[Zstandard ^↗^^] (protocole weechat).
| libaspell-dev / libenchant-dev |
| Extension spell.
| python3-dev | ≥ 3.0
| Extension python.
| libperl-dev |
| Extension perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Extension ruby.
| liblua5.4-dev |
| Extension lua.
| tcl-dev | ≥ 8.5
| Extension tcl.
| guile-3.0-dev | ≥ 2.0
| Extension guile (scheme).
| libv8-dev | ≤ 3.24.3
| Extension javascript.
| php-dev | ≥ 7.0
| Extension PHP.
| libphp-embed | ≥ 7.0
| Extension PHP.
| libxml2-dev |
| Extension PHP.
| libargon2-dev |
| Extension PHP (si PHP ≥ 7.2).
| libsodium-dev |
| Extension PHP (si PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4
| Construction de la page man et de la documentation.
| ruby-pygments.rb |
| Construction de la documentation.
| libcpputest-dev | ≥ 3.4
| Construction et lancement des tests.
| Paquet ^(1)^ | Version | Fonctionnalités
| compilateur {cpp} (pass:[g++ / clang++]) | | Construction et lancement des tests, extension JavaScript.
| gettext | | Internationalisation (traduction des messages ; la langue de base est l'anglais).
| ca-certificates | | Certificats pour les connexions TLS.
| libaspell-dev / libenchant-dev | | Extension spell.
| python3-dev | ≥ 3.0 | Extension python.
| libperl-dev | | Extension perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Extension ruby.
| liblua5.4-dev | | Extension lua.
| tcl-dev | ≥ 8.5 | Extension tcl.
| guile-3.0-dev | ≥ 2.0 | Extension guile (scheme).
| libv8-dev | ≤ 3.24.3 | Extension javascript.
| php-dev | ≥ 7.0 | Extension PHP.
| libphp-embed | ≥ 7.0 | Extension PHP.
| libxml2-dev | | Extension PHP.
| libargon2-dev | | Extension PHP (si PHP ≥ 7.2).
| libsodium-dev | | Extension PHP (si PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | Construction de la page man et de la documentation.
| ruby-pygments.rb | | Construction de la documentation.
| libcpputest-dev | ≥ 3.4 | Construction et lancement des tests.
|===
[NOTE]
@@ -243,7 +205,7 @@ $ make install
Des options peuvent être utilisées pour CMake, avec le format : `-DOPTION=VALUE`.
Liste des options disponibles :
Liste des options couramment utilisées :
[width="100%",cols="3m,3,3m,10",options="header"]
|===
@@ -297,9 +259,6 @@ Liste des options disponibles :
| ENABLE_GUILE | `ON`, `OFF` | ON
| Compiler <<scripting_plugins,l'extension Guile>> (Scheme).
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compiler le binaire sans interface (« headless »).
| ENABLE_IRC | `ON`, `OFF` | ON
| Compiler <<irc,l'extension IRC>>.
@@ -358,9 +317,6 @@ Liste des options disponibles :
| ENABLE_XFER | `ON`, `OFF` | ON
| Compiler <<xfer,l'extension Xfer>>.
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Activer la compression https://facebook.github.io/zstd/[Zstandard ^↗^^].
| ENABLE_TESTS | `ON`, `OFF` | OFF
| Compiler les tests.
@@ -953,8 +909,6 @@ Autres objets (non utilisés dans des barres par défaut) :
| buffer_short_name | `#test` | Nom court du tampon courant.
| buflist2 | `1.weechat` | Liste des tampons, deuxième objet de barre (voir l'option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | Liste des tampons, troisième objet de barre (voir l'option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist4 | `1.weechat` | Liste des tampons, quatrième objet de barre (voir l'option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist5 | `1.weechat` | Liste des tampons, cinquième objet de barre (voir l'option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Aide sur l'option sélectionnée dans le tampon fset.
| irc_channel | `#test` | Nom de canal IRC courant.
| irc_host | `+user@host.com+` | Hôte sur IRC.
@@ -1490,8 +1444,8 @@ variables locales.
=== Liste des tampons
L'extension Buflist affiche une liste des tampons dans un objet de barre appelé
"buflist" (quatre autres objets de barre "buflist2", "buflist3", "buflist4" et
"buflist5" sont également disponibles). +
"buflist" (deux autres objets de barre "buflist2" et "buflist3" sont également
disponibles). +
Une barre par défaut "buflist" est créée au démarrage avec cet objet de barre.
[[buflist_commands]]
@@ -1627,15 +1581,6 @@ Ils peuvent être modifiés et de nouveaux peuvent être ajoutés avec la comman
| kbd:[Ctrl+↓] | Rappeler la commande suivante dans l'historique global (commun à tous les tampons). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== Système
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Touche | Description | Commande
| kbd:[Ctrl+z] | Suspendre le processus WeeChat. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Tampons
@@ -1895,8 +1840,8 @@ Ces touches et actions sont utilisées sur le tampon fset
| kbd:[Ctrl+l] (`L`) | | Rafraîchir les options et l'écran entier. | `+/fset -refresh+`
| | `$` | Rafraîchir les options (garder les options marquées). |
| | `$$` | Rafraîchir les options (démarquer toutes les options). |
| kbd:[Alt+p] | `p` | Activer/désactiver la description des options d'extensions (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Activer/désactiver la barre d'aide. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Activer/désactiver la description des options d'extensions (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Activer/désactiver la barre d'aide. | `+/bar toggle fset+`
| | `s:x,y` | Trier les options par les champs x,y (voir l'option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Réinitialiser le tri à sa valeur par défaut (voir l'option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Exporter les options dans le fichier "xxx". | `+/fset -export xxx+`
@@ -1952,22 +1897,17 @@ Ces touches et actions sont utilisées sur le tampon script
[width="100%",cols="^.^3,^.^2,.^8,.^5",options="header"]
|===
| Touche | Action ^(1)^ | Description | Commande
| kbd:[↑] | | Monter d'une ligne. | `+/script up+`
| kbd:[↓] | | Descendre d'une ligne. | `+/script down+`
| kbd:[PgUp] | | Monter d'une page. | `+/window page_up+`
| kbd:[PgDn] | | Descendre d'une page. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Installer le script. | `+/script install+`
| kbd:[Alt+r] | `r` | Supprimer le script. | `+/script remove+`
| kbd:[Alt+l] | `l` | Charger le script. | `+/script load+`
| kbd:[Alt+L] | `L` | Recharger le script. | `+/script reload+`
| kbd:[Alt+u] | `u` | Décharger le script. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Charger automatiquement le script. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Figer/défiger le script. | `+/script hold+`
| kbd:[Alt+v] | `v` | Voir le script. | `+/script show+`
| | `s:x,y` | Trier les scripts par les champs x,y (voir l'option <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Reset sort to its default value (voir l'option <<option_script.look.sort,script.look.sort>>). |
| | `$` | Rafraîchir la liste. |
| | `q` | Fermer le tampon. | `+/buffer close+`
| kbd:[↑] | | Move one line up. | `+/script up+`
| kbd:[↓] | | Move one line down. | `+/script down+`
| kbd:[PgUp] | | Move one page up. | `+/window page_up+`
| kbd:[PgDn] | | Move one page down. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Install script. | `+/script install+`
| kbd:[Alt+r] | `r` | Remove script. | `+/script remove+`
| kbd:[Alt+l] (`L`) | `l` | Load script. | `+/script load+`
| kbd:[Alt+u] | `u` | Unload script. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Autoload script. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Hold/unhold script. | `+/script hold+`
| kbd:[Alt+v] | `v` | View script. | `+/script show+`
|===
[NOTE]
@@ -2336,9 +2276,16 @@ Par exemple pour désactiver les « highlights » de "joe" et "mike" sur le ta
courant :
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
La propriété de tampon "hotlist_max_level_nicks" n'est pas sauvegardée dans la
configuration. +
Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous
pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide
avec `+/help buffer_autoset+`.
[[highlights]]
=== Highlights
@@ -2363,9 +2310,16 @@ Ceci peut aussi être défini avec la propriété de tampon "highlight_disable_r
Même exemple, spécifique au tampon courant :
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
La propriété de tampon "highlight_disable_regex" n'est pas sauvegardée dans la
configuration. +
Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous
pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide
avec `+/help buffer_autoset+`.
[[highlights_words]]
==== Ajouter des mots pour le « highlight »
@@ -2423,9 +2377,16 @@ Par exemple pour forcer le highlight sur tous les messages dans le canal
courant :
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
La propriété de tampon "highlight_regex" n'est pas sauvegardée dans la
configuration. +
Vous pouvez facilement la sauvegarder avec le script _buffer_autoset.py_ : vous
pouvez l'installer avec `+/script install buffer_autoset.py+` et obtenir de l'aide
avec `+/help buffer_autoset+`.
[[buffer_logging]]
=== Enregistrement des tampons
@@ -3341,31 +3302,30 @@ Sections dans le fichier _weechat.conf_ :
[width="100%",cols="3m,6m,16",options="header"]
|===
| Section | Commande de contrôle | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Niveau de debug, pour le cœur et les extensions (les options peuvent être ajoutées/supprimées dans la section).
| startup | /set weechat.startup.* | Options de démarrage.
| look | /set weechat.look.* | Aspect/présentation.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Alias de couleurs (les options peuvent être ajoutées/supprimées dans la section).
| color | /set weechat.color.* | Couleurs.
| completion | /set weechat.completion.* | Options de complétion.
| history | /set weechat.history.* | Options d'historique (commandes et tampons).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Options des proxies.
| network | /set weechat.network.* | Options réseau/TLS.
| plugin | /set weechat.plugin.* | Options sur les extensions.
| signal | /set weechat.signal.* | Options sur les signaux.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Options des barres.
| layout | <<command_weechat_layout,/layout>> | Dispositions.
| buffer | <<command_weechat_buffer,/buffer setauto>> | Propriétés appliquées automatiquement sur les tampons lorsqu'ils sont ouverts.
| notify | <<command_weechat_buffer,/buffer notify>> | Niveaux de notification des tampons (les options peuvent être ajoutées/supprimées dans la section).
| filter | <<command_weechat_filter,/filter>> | Filtres.
| key | <<command_weechat_key,/key>> | Touches pour le contexte "default".
| key_search | <<command_weechat_key,/key>> | Touches pour le contexte "search".
| key_cursor | <<command_weechat_key,/key>> | Touches pour le contexte "cursor".
| key_mouse | <<command_weechat_key,/key>> | Touches pour le contexte "mouse".
| Section | Commande de contrôle | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Niveau de debug, pour le cœur et les extensions (les options peuvent être ajoutées/supprimées dans la section).
| startup | /set weechat.startup.* | Options de démarrage.
| look | /set weechat.look.* | Aspect/présentation.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Alias de couleurs (les options peuvent être ajoutées/supprimées dans la section).
| color | /set weechat.color.* | Couleurs.
| completion | /set weechat.completion.* | Options de complétion.
| history | /set weechat.history.* | Options d'historique (commandes et tampons).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Options des proxies.
| network | /set weechat.network.* | Options réseau/TLS.
| plugin | /set weechat.plugin.* | Options sur les extensions.
| signal | /set weechat.signal.* | Options sur les signaux.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Options des barres.
| layout | <<command_weechat_layout,/layout>> | Dispositions.
| notify | <<command_weechat_buffer,/buffer notify>> | Niveaux de notification des tampons (les options peuvent être ajoutées/supprimées dans la section).
| filter | <<command_weechat_filter,/filter>> | Filtres.
| key | <<command_weechat_key,/key>> | Touches pour le contexte "default".
| key_search | <<command_weechat_key,/key>> | Touches pour le contexte "search".
| key_cursor | <<command_weechat_key,/key>> | Touches pour le contexte "cursor".
| key_mouse | <<command_weechat_key,/key>> | Touches pour le contexte "mouse".
|===
Options :
@@ -4259,7 +4219,7 @@ et les variables supplémentaires suivantes sont disponibles :
[width="100%",cols="2,4,8",options="header"]
|===
| Variable | Description | Valeur / exemple
| `+${clientinfo}+` | Liste des CTCP supportés | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | Liste des CTCP supportés | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | Version de WeeChat | `+4.1.0-dev+`
| `+${versiongit}+` | Version de WeeChat + version Git ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Version Git ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -4282,9 +4242,11 @@ Les réponses CTCP par défaut sont :
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | Format de réponse | Exemple
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+nom (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
+22 -44
View File
@@ -644,15 +644,6 @@ If you are using the macOS Terminal app, enable the option
"Use option as meta key" in menu Settings/Keyboard. And then you can use the
kbd:[Option] key as meta key.
// TRANSLATION MISSING
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== Come posso personalizzare le associazioni dei tasti?
@@ -1021,25 +1012,41 @@ Altri script correlati:
[[disable_highlights_for_specific_nicks]]
=== How can I disable highlights for specific nicks?
// TRANSLATION MISSING
You can use the
link:weechat_user.it.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^↗^^]
buffer property to set the max hotlist level for some nicks, per buffer,
or per group of buffers (like IRC servers).
To only disable highlights, you'd have to set it to 2.
For the current buffer:
To only disable highlights, you'd have to set it to 2:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
For all channels on server "libera":
This buffer property isn't stored in the configuration though.
To automatically reapply these buffer properties, you would need the
_buffer_autoset.py_ script:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
For example, to permanently disable highlights from "mike" on #weechat
on the IRC server libera:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
To apply it to the entire libera server instead:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
For more examples, see `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== Come si può modificare il buffer destinazione per i comandi sui buffer uniti (come i buffer con i server)?
@@ -1260,35 +1267,6 @@ stored in _sec.conf_ with the `/secure` command).
See the link:weechat_user.it.html#files_and_directories[User's guide / Files and directories ^↗^^]
for more information about configuration files.
// TRANSLATION MISSING
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== Sviluppo
+58 -207
View File
@@ -4219,28 +4219,18 @@ Supported hash algorithms:
[width="100%",cols="2,2,3,6",options="header"]
|===
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha512-224+` | SHA-512/224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha512-256+` | SHA-512/256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+blake2b-160+` | BLAKE2B-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-256+` | BLAKE2B-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-384+` | BLAKE2B-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-512+` | BLAKE2B-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-128+` | BLAKE2S-128 | 16 bytes (128 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-160+` | BLAKE2S-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-224+` | BLAKE2S-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-256+` | BLAKE2S-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
Valore restituito:
@@ -4685,8 +4675,7 @@ Argomenti:
* _to_: destination file
* _compressor_: the compressor to use, one of:
** _gzip_: gzip compression
** _zstd_: zstandard compression (available only if zstd was enabled when
WeeChat was compiled)
** _zstd_: zstandard compression
* _compression_level_: compression level, between 1 (fast, low compression) to
100 (slow, best compression)
@@ -6991,10 +6980,9 @@ my_section_read_cb (const void *pointer, void *data,
{
/* ... */
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
return WEECHAT_CONFIG_READ_OK;
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
}
int
@@ -7084,7 +7072,7 @@ def config_new_section(config_file: str, name: str,
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
# esempio
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -7103,7 +7091,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -7352,7 +7340,7 @@ Script (Python):
# prototipo
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
string_values: str, min: int, max: int,
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
default_value: str | None, value: str | None, null_value_allowed: int,
callback_check_value: str, callback_check_value_data: str,
callback_change: str, callback_change_data: str,
callback_delete: str, callback_delete_data: str) -> str: ...
@@ -10386,6 +10374,7 @@ struct t_hook *weechat_hook_process (const char *command,
void *callback_data);
----
Argomenti:
// TRANSLATION MISSING
@@ -10655,8 +10644,25 @@ available:
_/dev/null_.
|===
Per il comando "url:..." sono disponibili le seguenti opzioni (consultare
`+man curl_easy_setopt+` per la descrizione di ogni opzione):
include::{autogendir}/autogen_api_url_options.it.adoc[tag=url_options]
// TRANSLATION MISSING
For command "url:...", see available options in function <<_hook_url,hook_url>>.
[NOTE]
^(1)^ Per le opzioni con il tipo "mask" il formato è: "value1+value2+value3";
for options with type "list", the list items must be separated by a newline
(`\n`). +
^(2)^ Quando sono disponibili le costanti, esse vanno usate come valore per
l'opzione.
Per un URL, sono consentite due opzioni aggiuntive (stringhe) per il file in
input/output:
* _file_in_: file da leggere e inviare con gli URL (invio del file "post")
* _file_out_: scrive URL scaricato/file in questo file (invece dello standard
* output)
Valore restituito:
@@ -10816,159 +10822,6 @@ hook4 = weechat.hook_process_hashtable("sh",
20000, "my_process_cb", "")
----
// TRANSLATION MISSING
==== hook_url
_WeeChat ≥ 4.1.0._
URL transfer.
Prototipo:
[source,c]
----
struct t_hook *weechat_hook_url (const char *url,
struct t_hashtable *options,
int timeout,
int (*callback)(const void *pointer,
void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output),
const void *callback_pointer,
void *callback_data);
----
Argomenti:
* _url_: URL
* _options_: options for URL transfer (see below); la tabella hash è duplicata
nella funzione, per cui è possibile liberarla dopo questa chiamata
* _timeout_: timeout for URL transfer (in milliseconds): after this timeout,
the transfer is stopped (0 means no timeout)
* _callback_: function called when the transfer has ended, arguments and return
value:
** _const void *pointer_: pointer
** _void *data_: pointer
** _const char *url_: URL
** _struct t_hashtable *options_: options
** _struct t_hashtable *output_: result (keys and values are strings), which may
contain the following keys:
*** _response_code_: HTTP response code
*** _headers_: HTTP headers in response
*** _output_: standard output (set only if _file_out_ was not set in options)
*** _error_: error message (set only in case of error)
** return value:
*** _WEECHAT_RC_OK_
*** _WEECHAT_RC_ERROR_
* _callback_pointer_: puntatore fornito alla callback quando chiamata da WeeChat
* _callback_data_: puntatore fornito alla callback quando chiamata da WeeChat;
if not NULL, it must have been allocated with malloc (or similar function)
and it is automatically freed when the hook is deleted
The following Curl options are available (see `+man curl_easy_setopt+` for
a description of each option):
include::{autogendir}/autogen_api_url_options.it.adoc[tag=url_options]
// TRANSLATION MISSING
[NOTE]
^(1)^ Per le opzioni con il tipo "mask" il formato è: "value1+value2+value3";
for options with type "list", the list items must be separated by a newline
(`\n`). +
^(2)^ Quando sono disponibili le costanti, esse vanno usate come valore per
l'opzione.
These two extra options (strings) are allowed for input/output file:
[width="100%",cols="2,^1,7",options="header"]
|===
| Option | Type | Description
| file_in | string | file da leggere e inviare con gli URL (invio del file "post")
| file_out | string | scrive URL scaricato/file in questo file (invece dello standard output)
|===
Valore restituito:
* puntatore al nuovo hook, NULL in caso di errore
Esempio in C:
[source,c]
----
int
my_url_cb (const void *pointer, void *data, const char *url,
struct t_hashtable *options, struct t_hashtable *output)
{
weechat_printf (NULL, "response_code: %s", weechat_hashtable_get (output, "response_code"));
weechat_printf (NULL, "headers: %s", weechat_hashtable_get (output, "headers"));
weechat_printf (NULL, "output: %s", weechat_hashtable_get (output, "output"));
weechat_printf (NULL, "error: %s", weechat_hashtable_get (output, "error"));
return WEECHAT_RC_OK;
}
/* example 1: output to a file */
struct t_hashtable *options_url1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url1)
{
weechat_hashtable_set (options_url1, "file_out", "/tmp/weechat.org.html");
struct t_hook *my_url_hook = weechat_hook_url ("https://weechat.org/",
options_url1,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url1);
}
/* example 2: custom HTTP headers, output sent to callback */
struct t_hashtable *options_url2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url2)
{
weechat_hashtable_set (options_url2, "httpheader",
"Header1: value1\n"
"Header2: value2");
struct t_hook *my_url_hook = weechat_hook_url ("http://localhost:8080/",
options_url2,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url2);
}
----
Script (Python):
[source,python]
----
# prototipo
def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: ...
# esempio
def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
weechat.prnt("", "output: %s" % output)
return weechat.WEECHAT_RC_OK
# example 1: output to a file
hook1 = weechat.hook_url("https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_url_cb", "")
# example 2: custom HTTP headers, output sent to callback
options = {
"httpheader": "\n".join([
"Header1: value1",
"Header2: value2",
]),
}
hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
----
==== hook_connect
// TRANSLATION MISSING
@@ -11163,7 +11016,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
// TRANSLATION MISSING
==== hook_line
_WeeChat ≥ 2.3, updated in 3.7._
_WeeChat ≥ 2.3, updated in 3.7, 4.1.0._
Hook a line to be printed in a buffer.
@@ -11234,13 +11087,13 @@ Line data sent to the callback is a hashtable, with following values
| Key | Value (formatted buffer) | Value (free buffer) | Examples
| buffer
| Buffer pointer.
| Buffer pointer.
| Comma-separated list of buffer pointers.
| Comma-separated list of buffer pointers.
| `+0x1234abcd+`
| buffer_name
| Buffer name.
| Buffer name.
| Comma-separated list of buffer names.
| Comma-separated list of buffer names.
| `+core.weechat+` +
`+irc.server.libera+` +
`+irc.libera.#weechat+`
@@ -11328,16 +11181,20 @@ in this hashtable):
| Key | Allowed value (formatted buffer) | Allowed value (free buffer) | Result
| buffer
| Pointer of a buffer with formatted content.
| Pointer of a buffer with free content.
| The line is displayed on this buffer. +
| Comma-separated list buffer pointers (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer pointers (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
If the value is empty, the line is deleted (anything else in the hashtable
is then ignored); the next hooks of type "line" are not called.
| buffer_name
| Name of a buffer with formatted content.
| Name of a buffer with free content.
| The line is displayed on this buffer. +
| Comma-separated list buffer names (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer names (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
If `buffer` is also set, the value of `+buffer_name+` has higher priority and is used. +
If the value is empty, the line is deleted (anything else in the hashtable
is then ignored); the next hooks of type "line" are not called.
@@ -19555,7 +19412,7 @@ for key in hash:
// TRANSLATION MISSING
==== hdata_compare
_WeeChat ≥ 1.9, updated in 4.1.0._
_WeeChat ≥ 1.9._
Compare a hdata variable of two objects.
@@ -19571,8 +19428,8 @@ Argomenti:
* _hdata_: hdata pointer
* _pointer1_: pointer to first WeeChat/plugin object
* _pointer2_: pointer to second WeeChat/plugin object
* _name_: variable name or path to a variable name; for arrays, the name can be
"N|name" where N is the index in array (starting at 0), for example: "2|name"
* _name_: variable name; for arrays, the name can be "N|name" where N is
the index in array (starting at 0), for example: "2|name"
* _case_sensitive_: 1 for case sensitive comparison of strings, otherwise 0
Valore restituito:
@@ -19588,12 +19445,8 @@ Esempio in C:
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
weechat_printf (NULL, "comparison of buffer number = %d",
weechat_printf (NULL, "number comparison = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
weechat_printf (NULL, "comparison of number of lines = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
weechat_printf (NULL, "comparison of local variable = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
----
Script (Python):
@@ -19607,9 +19460,7 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
----
// TRANSLATION MISSING
+79 -126
View File
@@ -159,6 +159,11 @@ WeeChat:
| Logger plugin: compression of rotated log files (gzip). +
Relay plugin: compression of messages (WeeChat -> client) with https://zlib.net/[zlib ^↗^^] (weechat protocol). +
Script plugin: read of repository index file (gzip).
// TRANSLATION MISSING
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files. +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
|===
[NOTE]
@@ -176,75 +181,32 @@ WeeChat:
[width="100%",cols="5,^3,.^15",options="header"]
|===
// TRANSLATION MISSING
| Pacchetto ^(1)^ | Versione | Features
| Pacchetto ^(1)^ | Versione | Features
// TRANSLATION MISSING
| {cpp} compiler (pass:[g++ / clang++]) |
| Build and run tests, plugin JavaScript.
| gettext |
| Internazionalizzazione (traduzione dei messaggi; la lingua base è l'inglese).
| ca-certificates |
| Certificati per le connessioni TLS.
| {cpp} compiler (pass:[g++ / clang++]) | | Build and run tests, plugin JavaScript.
| gettext | | Internazionalizzazione (traduzione dei messaggi; la lingua base è l'inglese).
| ca-certificates | | Certificati per le connessioni TLS.
| libaspell-dev / libenchant-dev | | Plugin spell.
| python3-dev | ≥ 3.0 | Plugin python.
| libperl-dev | | Plugin perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Plugin ruby.
| liblua5.4-dev | | Plugin lua.
| tcl-dev | ≥ 8.5 | Plugin tcl.
| guile-3.0-dev | ≥ 2.0 | Plugin guile (scheme).
| libv8-dev | ≤ 3.24.3 | Plugin javascript.
| php-dev | ≥ 7.0 | Plugin php.
| libphp-embed | ≥ 7.0 | Plugin php.
| libxml2-dev | | Plugin php.
// TRANSLATION MISSING
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files (zstandard). +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
| libaspell-dev / libenchant-dev |
| Plugin spell.
| python3-dev | ≥ 3.0
| Plugin python.
| libperl-dev |
| Plugin perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Plugin ruby.
| liblua5.4-dev |
| Plugin lua.
| tcl-dev | ≥ 8.5
| Plugin tcl.
| guile-3.0-dev | ≥ 2.0
| Plugin guile (scheme).
| libv8-dev | ≤ 3.24.3
| Plugin javascript.
| php-dev | ≥ 7.0
| Plugin php.
| libphp-embed | ≥ 7.0
| Plugin php.
| libxml2-dev |
| Plugin php.
| libargon2-dev | | Plugin php (if PHP ≥ 7.2).
// TRANSLATION MISSING
| libargon2-dev |
| Plugin php (if PHP ≥ 7.2).
| libsodium-dev | | Plugin php (if PHP ≥ 7.2).
// TRANSLATION MISSING
| libsodium-dev |
| Plugin php (if PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | Build man page and documentation.
// TRANSLATION MISSING
| asciidoctor | ≥ 1.5.4
| Build man page and documentation.
| ruby-pygments.rb | | Build documentation.
// TRANSLATION MISSING
| ruby-pygments.rb |
| Build documentation.
// TRANSLATION MISSING
| libcpputest-dev | ≥ 3.4
| Build and run tests.
| libcpputest-dev | ≥ 3.4 | Build and run tests.
|===
[NOTE]
@@ -290,7 +252,7 @@ $ make install
Options can be used for CMake, with format: `-DOPTION=VALUE`.
// TRANSLATION MISSING
List of available options:
List of commonly used options:
// TRANSLATION MISSING
[width="100%",cols="3m,3,3m,10",options="header"]
@@ -304,6 +266,7 @@ List of available options:
| CMAKE_INSTALL_PREFIX | directory | /usr/local
| The directory where WeeChat will be installed.
// TRANSLATION MISSING
| WEECHAT_HOME | directory | (empty string)
| The default home directory when running WeeChat. +
With an empty value (recommended), XDG directories are used by default.
@@ -326,6 +289,7 @@ List of available options:
| ENABLE_DOC | `ON`, `OFF` | OFF
| Build HTML documentation.
// TRANSLATION MISSING
| ENABLE_DOC_INCOMPLETE | `ON`, `OFF` | OFF
| Force build of documentation even if some plugins are not compiled
(not recommended: docs will be incomplete).
@@ -345,9 +309,6 @@ List of available options:
| ENABLE_GUILE | `ON`, `OFF` | ON
| Compile <<scripting_plugins,Guile plugin>> (Scheme).
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compile headless binary.
| ENABLE_IRC | `ON`, `OFF` | ON
| Compile <<irc,IRC plugin>>.
@@ -406,10 +367,6 @@ List of available options:
| ENABLE_XFER | `ON`, `OFF` | ON
| Compile <<xfer,Xfer plugin>>.
// TRANSLATION MISSING
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Enable https://facebook.github.io/zstd/[Zstandard ^↗^^] compression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| Compile tests.
@@ -1031,10 +988,6 @@ Other items available (not used in bars by default):
| buffer_short_name | `#test` | Current buffer short name.
| buflist2 | `1.weechat` | List of buffers, second bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | List of buffers, third bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist4 | `1.weechat` | List of buffers, fourth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist5 | `1.weechat` | List of buffers, fifth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Help on currently selected option on fset buffer.
| irc_channel | `#test` | Current IRC channel name.
| irc_host | `+user@host.com+` | Current IRC host.
@@ -1579,8 +1532,7 @@ External plugins and scripts can define and use other local variables.
// TRANSLATION MISSING
Buflist plugin displays a list of buffers in a bar item called "buflist"
(four other bar items "buflist2", "buflist3", "buflist4" and "buflist5" are
available as well). +
(two other bar items "buflist2" and "buflist3" are available as well). +
A default bar "buflist" is created on startup with this item.
[[buflist_commands]]
@@ -1739,16 +1691,6 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Chiama il comando/messaggio successivo nella cronologia globale (identico per tutti i buffer). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Tasti | Descrizione | Comando
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
// TRANSLATION MISSING
[[key_bindings_buffers]]
=== Buffers
@@ -2069,8 +2011,8 @@ These keys and actions are used on the fset buffer (see <<fset,Fset plugin>>).
| kbd:[Ctrl+l] (`L`) | | Refresh options and whole screen. | `+/fset -refresh+`
| | `$` | Refresh options (keep marked options). |
| | `$$` | Refresh options (unmark all options). |
| kbd:[Alt+p] | `p` | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Toggle help bar. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Toggle help bar. | `+/bar toggle fset+`
| | `s:x,y` | Sort options by fields x,y (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Reset sort to its default value (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Export options in file "xxx". | `+/fset -export xxx+`
@@ -2135,16 +2077,11 @@ These keys and actions are used on the script buffer (see <<script_manager,scrip
| kbd:[PgDn] | | Move one page down. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Install script. | `+/script install+`
| kbd:[Alt+r] | `r` | Remove script. | `+/script remove+`
| kbd:[Alt+l] | `l` | Load script. | `+/script load+`
| kbd:[Alt+L] | `L` | Reload script. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Load script. | `+/script load+`
| kbd:[Alt+u] | `u` | Unload script. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Autoload script. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Hold/unhold script. | `+/script hold+`
| kbd:[Alt+v] | `v` | View script. | `+/script show+`
| | `s:x,y` | Sort scripts by fields x,y (see option <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Reset sort to its default value (see option <<option_script.look.sort,script.look.sort>>). |
| | `$` | Refresh list. |
| | `q` | Close buffer. | `+/buffer close+`
|===
// TRANSLATION MISSING
@@ -2523,9 +2460,14 @@ and for each nick the max hotlist level to trigger, possible levels are:
For example to disable highlights from "joe" and "mike" on current buffer:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
The buffer property "hotlist_max_level_nicks" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with `+/help buffer_autoset+`.
// TRANSLATION MISSING
[[highlights]]
=== Highlights
@@ -2552,9 +2494,15 @@ This can also be set with the buffer property "highlight_disable_regex".
Same example, specific to the current buffer:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
The buffer property "highlight_disable_regex" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with
`+/help buffer_autoset+`.
[[highlights_words]]
==== Add words to highlight
@@ -2609,9 +2557,14 @@ You can force highlight using a regular expression with the buffer property
For example to force the highlight on all messages in the current buffer:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
The buffer property "highlight_regex" is not saved in configuration. +
You can easily save it with the script _buffer_autoset.py_: you can install it
with `+/script install buffer_autoset.py+` and get help with `+/help buffer_autoset+`.
// TRANSLATION MISSING
[[buffer_logging]]
=== Buffer logging
@@ -3536,34 +3489,32 @@ Sections in file _weechat.conf_:
// TRANSLATION MISSING
[width="100%",cols="3m,6m,16",options="header"]
|===
| Section | Control command | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, for core and plugins (options can be added/removed in section).
| startup | /set weechat.startup.* | Startup options.
| look | /set weechat.look.* | Look and feel.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Color aliases (options can be added/removed in section).
| color | /set weechat.color.* | Colors.
| completion | /set weechat.completion.* | Completion options.
| history | /set weechat.history.* | History options (commands and buffers).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/TLS options.
| Section | Control command | Description
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Debug level, for core and plugins (options can be added/removed in section).
| startup | /set weechat.startup.* | Startup options.
| look | /set weechat.look.* | Look and feel.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Color aliases (options can be added/removed in section).
| color | /set weechat.color.* | Colors.
| completion | /set weechat.completion.* | Completion options.
| history | /set weechat.history.* | History options (commands and buffers).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/TLS options.
// TRANSLATION MISSING
| plugin | /set weechat.plugin.* | Options on plugins.
| plugin | /set weechat.plugin.* | Options on plugins.
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.
// TRANSLATION MISSING
| buffer | <<command_weechat_buffer,/buffer setauto>> | Properties auto-applied on buffers when they are opened.
| notify | <<command_weechat_buffer,/buffer notify>> | Notify levels for buffers (options can be added/removed in section).
| filter | <<command_weechat_filter,/filter>> | Filters.
| key | <<command_weechat_key,/key>> | Keys in default context.
| key_search | <<command_weechat_key,/key>> | Keys in search context.
| key_cursor | <<command_weechat_key,/key>> | Keys in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Keys in mouse context.
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.
| notify | <<command_weechat_buffer,/buffer notify>> | Notify levels for buffers (options can be added/removed in section).
| filter | <<command_weechat_filter,/filter>> | Filters.
| key | <<command_weechat_key,/key>> | Keys in default context.
| key_search | <<command_weechat_key,/key>> | Keys in search context.
| key_cursor | <<command_weechat_key,/key>> | Keys in cursor context.
| key_mouse | <<command_weechat_key,/key>> | Keys in mouse context.
|===
// TRANSLATION MISSING
@@ -4469,7 +4420,7 @@ the following extra variables are available:
|===
// TRANSLATION MISSING
| Variable | Descrizione | Valore/esempio
| `+${clientinfo}+` | Elenco di CTCP supportate | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | Elenco di CTCP supportate | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | Versione di WeeChat | `+4.1.0-dev+`
// TRANSLATION MISSING
| `+${versiongit}+` | Versione di WeeChat + Git version ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
@@ -4495,9 +4446,11 @@ The default CTCP replies are:
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | Formato risposta | Esempio
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+name (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
-7
View File
@@ -152,8 +152,6 @@ WeeChat "core" は以下のディレクトリに配置されています:
// TRANSLATION MISSING
|    wee-signal.c | Signal functions.
|    wee-string.c | 文字列関数
// TRANSLATION MISSING
|    wee-sys.c | System functions.
|    wee-upgrade-file.c | 内部アップグレードシステム
|    wee-upgrade.c | WeeChat コアのアップグレード (バッファ、行、履歴、...)
|    wee-url.c | URL 転送 (libcurl を使う)
@@ -180,7 +178,6 @@ WeeChat "core" は以下のディレクトリに配置されています:
|       wee-hook-process.c | "process" フック
|       wee-hook-signal.c | "signal" フック
|       wee-hook-timer.c | "timer" フック
|       wee-hook-url.c | "url" フック
| gui/ | バッファ、ウィンドウなどの関数 (全てのインターフェースで利用)
|    gui-bar-item.c | バー要素
|    gui-bar-window.c | バーウィンドウ
@@ -251,8 +248,6 @@ WeeChat "core" は以下のディレクトリに配置されています:
|       buflist.c | buflist の主要関数
|       buflist-bar-item.c | buflist バー要素
|       buflist-command.c | buflist コマンド
// TRANSLATION MISSING
|       buflist-completion.c | Buflist completions.
|       buflist-config.c | buflist 設定オプション (buflist.conf ファイル)
|       buflist-info.c | buflist の情報/インフォリスト/hdata
|       buflist-mouse.c | buflist マウス動作
@@ -457,8 +452,6 @@ WeeChat "core" は以下のディレクトリに配置されています:
|          test-core-url.cpp | テスト: URL
|          test-core-utf8.cpp | テスト: UTF-8
|          test-core-util.cpp | テスト: ユーティリティ関数
// TRANSLATION MISSING
|          test-core-sys.cpp | Tests: system functions.
|       gui/ | インターフェースの単体テストを収める最上位ディレクトリ
// TRANSLATION MISSING
|          test-gui-bar-window.cpp | Tests: bar window functions.
+20 -46
View File
@@ -598,15 +598,6 @@ macOS のターミナル.app を使っている場合、設定メニューのキ
キーを使用」を有効化してください。こうすることで、kbd:[Option]
キーをメタキーとして使うことが可能です。
// TRANSLATION MISSING
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== どうすればキー割り当てをカスタマイズできますか。
@@ -962,22 +953,34 @@ link:weechat_user.ja.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
buffer property to set the max hotlist level for some nicks, per buffer,
or per group of buffers (like IRC servers).
ハイライトを無効化するだけなら、このプロパティを 2 に設定してください.
// TRANSLATION MISSING
For the current buffer:
ハイライトを無効化するだけなら、このプロパティを 2 に設定してください:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
// TRANSLATION MISSING
For all channels on server "libera":
このバッファプロパティは設定に保存されません。このバッファプロパティを自動的に適用するには、_buffer_autoset.py_
スクリプトが必要です:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
例えば、IRC サーバ libera のチャンネル #weechat に参加している "mike"
の発言に対してハイライトを永久的に無効化するには以下のように設定します:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
この設定をすべての libera サーバのバッファに対して適用するには以下のように設定します:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
これ以外の例は `+/help buffer_autoset+` を参照してください。
[[irc_target_buffer]]
=== どうすればマージされたバッファ内であるコマンドを発行するターゲットバッファを変更できますか。
@@ -1183,35 +1186,6 @@ stored in _sec.conf_ with the `/secure` command).
設定ファイルに関する詳しい情報はlink:weechat_user.ja.html#files_and_directories[ユーザーズガイド / ファイルとディレクトリ ^↗^^]を参照してください。
// TRANSLATION MISSING
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== 開発
+63 -208
View File
@@ -2430,6 +2430,7 @@ _WeeChat バージョン 2.4 以上で利用可。_
base 16、32、64 で文字列をエンコード。
プロトタイプ:
[source,c]
@@ -4140,28 +4141,18 @@ Supported hash algorithms:
[width="100%",cols="2,2,3,6",options="header"]
|===
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha512-224+` | SHA-512/224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha512-256+` | SHA-512/256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.9.4.
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+blake2b-160+` | BLAKE2B-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-256+` | BLAKE2B-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-384+` | BLAKE2B-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2b-512+` | BLAKE2B-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-128+` | BLAKE2S-128 | 16 bytes (128 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-160+` | BLAKE2S-160 | 20 bytes (160 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-224+` | BLAKE2S-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| `+blake2s-256+` | BLAKE2S-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.8.0.
| Value | Algorithm | Hash size | Notes
| `+crc32+` | CRC32 | 4 bytes (32 bits) | Not a hash algorithm in the cryptographic sense.
| `+md5+` | MD5 | 16 bytes (128 bits) | *Weak*, not recommended for cryptography usage.
| `+sha1+` | SHA-1 | 20 bytes (160 bits) | *Weak*, not recommended for cryptography usage.
| `+sha224+` | SHA-224 | 28 bytes (224 bits) |
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
戻り値:
@@ -4601,8 +4592,7 @@ int weechat_file_compress (const char *from, const char *to,
* _to_: destination file
* _compressor_: the compressor to use, one of:
** _gzip_: gzip compression
** _zstd_: zstandard compression (available only if zstd was enabled when
WeeChat was compiled)
** _zstd_: zstandard compression
* _compression_level_: compression level, between 1 (fast, low compression) to
100 (slow, best compression)
@@ -6794,10 +6784,9 @@ my_section_read_cb (const void *pointer, void *data,
{
/* ... */
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
return WEECHAT_CONFIG_READ_OK;
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
}
int
@@ -6887,7 +6876,7 @@ def config_new_section(config_file: str, name: str,
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
# 例
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -6906,7 +6895,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -7151,7 +7140,7 @@ struct t_config_option *option_enum =
# プロトタイプ
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
string_values: str, min: int, max: int,
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
default_value: str | None, value: str | None, null_value_allowed: int,
callback_check_value: str, callback_check_value_data: str,
callback_change: str, callback_change_data: str,
callback_delete: str, callback_delete_data: str) -> str: ...
@@ -7211,6 +7200,7 @@ Ruby では、3 組のコールバックとデータ (6 つの文字列変数)
link:++weechat_scripting.ja.html#_ruby++[WeeChat スクリプト作成ガイド ^↗^^]を参照してください
_(WeeChat バージョン 0.4.1 で修正済み)_。
==== config_search_option
設定ファイルのセクションからオプションを検索。
@@ -10133,6 +10123,7 @@ struct t_hook *weechat_hook_process (const char *command,
void *callback_data);
----
引数:
* _command_: 子プロセスで実行するコマンド、URL _(WeeChat バージョン 0.3.7 以上で利用可)_
@@ -10388,8 +10379,22 @@ struct t_hook *weechat_hook_process_hashtable (const char *command,
_/dev/null_ にリダイレクトする
|===
// TRANSLATION MISSING
For command "url:...", see available options in function <<_hook_url,hook_url>>.
"url:..." 型のコマンドでは、以下のコマンドを使うことができます
(それぞれのオプションについては `+man curl_easy_setopt+` を参照):
include::{autogendir}/autogen_api_url_options.ja.adoc[tag=url_options]
[NOTE]
^(1)^ "mask" タイプのオプションでは、フォーマットは "value1+value2+value3" です。
"list" タイプのオプションでは、リスト要素を改行で区切ってください。
(`\n`). +
^(2)^ 定数が利用可能な場合、定数は必ずオプションの値に含めてください。
URL では、入力/出力ファイル用に 2 つのオプション (文字列) を使うことができます:
* _file_in_: 読み込んで URL に送信するファイル (ファイルを送信)
* _file_out_: ダウンロードした URL/ファイルをこのファイルに書き込む
(標準出力を使わない)
戻り値:
@@ -10549,157 +10554,6 @@ hook4 = weechat.hook_process_hashtable("sh",
20000, "my_process_cb", "")
----
// TRANSLATION MISSING
==== hook_url
_WeeChat ≥ 4.1.0._
URL transfer.
プロトタイプ:
[source,c]
----
struct t_hook *weechat_hook_url (const char *url,
struct t_hashtable *options,
int timeout,
int (*callback)(const void *pointer,
void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output),
const void *callback_pointer,
void *callback_data);
----
引数:
* _url_: URL
* _options_: options for URL transfer (see below);
ハッシュテーブルは関数の中で複製されるため、この関数を呼び出した後にハッシュテーブルを安全に開放できます。
* _timeout_: timeout for URL transfer (in milliseconds): after this timeout,
the transfer is stopped (0 means no timeout)
* _callback_: function called when the transfer has ended, arguments and return
value:
** _const void *pointer_: pointer
** _void *data_: pointer
** _const char *url_: URL
** _struct t_hashtable *options_: options
** _struct t_hashtable *output_: result (keys and values are strings), which may
contain the following keys:
*** _response_code_: HTTP response code
*** _headers_: HTTP headers in response
*** _output_: standard output (set only if _file_out_ was not set in options)
*** _error_: error message (set only in case of error)
** return value:
*** _WEECHAT_RC_OK_
*** _WEECHAT_RC_ERROR_
* _callback_pointer_: WeeChat が _callback_ コールバックを呼び出す際にコールバックに渡すポインタ
* _callback_data_: WeeChat が _callback_ コールバックを呼び出す際にコールバックに渡すポインタ;
このポインタが NULL でない場合、このポインタは malloc (または類似の関数)
によって割り当てられたものでなければいけません。さらに、このポインタはここで作成したフックが削除された時点で自動的に開放されます
The following Curl options are available (see `+man curl_easy_setopt+` for
a description of each option):
include::{autogendir}/autogen_api_url_options.ja.adoc[tag=url_options]
[NOTE]
^(1)^ "mask" タイプのオプションでは、フォーマットは "value1+value2+value3" です。
"list" タイプのオプションでは、リスト要素を改行で区切ってください。
(`\n`). +
^(2)^ 定数が利用可能な場合、定数は必ずオプションの値に含めてください。
These two extra options (strings) are allowed for input/output file:
[width="100%",cols="2,^1,7",options="header"]
|===
| Option | Type | Description
| file_in | string | 読み込んで URL に送信するファイル (ファイルを送信)
| file_out | string | ダウンロードした URL/ファイルをこのファイルに書き込む (標準出力を使わない)
|===
戻り値:
* 新しいフックへのポインタ、エラーが起きた場合は NULL
C 言語での使用例:
[source,c]
----
int
my_url_cb (const void *pointer, void *data, const char *url,
struct t_hashtable *options, struct t_hashtable *output)
{
weechat_printf (NULL, "response_code: %s", weechat_hashtable_get (output, "response_code"));
weechat_printf (NULL, "headers: %s", weechat_hashtable_get (output, "headers"));
weechat_printf (NULL, "output: %s", weechat_hashtable_get (output, "output"));
weechat_printf (NULL, "error: %s", weechat_hashtable_get (output, "error"));
return WEECHAT_RC_OK;
}
/* example 1: output to a file */
struct t_hashtable *options_url1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url1)
{
weechat_hashtable_set (options_url1, "file_out", "/tmp/weechat.org.html");
struct t_hook *my_url_hook = weechat_hook_url ("https://weechat.org/",
options_url1,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url1);
}
/* example 2: custom HTTP headers, output sent to callback */
struct t_hashtable *options_url2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url2)
{
weechat_hashtable_set (options_url2, "httpheader",
"Header1: value1\n"
"Header2: value2");
struct t_hook *my_url_hook = weechat_hook_url ("http://localhost:8080/",
options_url2,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url2);
}
----
スクリプト (Python) での使用例:
[source,python]
----
# プロトタイプ
def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: ...
# 例
def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
weechat.prnt("", "output: %s" % output)
return weechat.WEECHAT_RC_OK
# example 1: output to a file
hook1 = weechat.hook_url("https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_url_cb", "")
# example 2: custom HTTP headers, output sent to callback
options = {
"httpheader": "\n".join([
"Header1: value1",
"Header2: value2",
]),
}
hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
----
==== hook_connect
_WeeChat バージョン 1.5 と 2.0 で更新。_
@@ -10887,7 +10741,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
==== hook_line
// TRANSLATION MISSING
_WeeChat ≥ 2.3, updated in 3.7._
_WeeChat ≥ 2.3, updated in 3.7, 4.1.0._
バッファに対する行表示をフックする。
@@ -10957,14 +10811,16 @@ struct t_hook *weechat_hook_line (const char *buffer_type,
|===
| キー | 値 (フォーマット済みバッファ) | 値 (自由内容バッファ) | 例
// TRANSLATION MISSING
| buffer
| バッファポインタ
| バッファポインタ
| Comma-separated list of buffer pointers.
| Comma-separated list of buffer pointers.
| `+0x1234abcd+`
// TRANSLATION MISSING
| buffer_name
| バッファ名
| バッファ名
| Comma-separated list of buffer names.
| Comma-separated list of buffer names.
| `+core.weechat+` +
`+irc.server.libera+` +
`+irc.libera.#weechat+`
@@ -11052,17 +10908,23 @@ WeeChat はそれらを無視します。
|===
| キー | 設定可能な値 (フォーマット済みバッファ) | 設定可能な値 (自由内容バッファ) | 結果
// TRANSLATION MISSING
| buffer
| フォーマット済みバッファへのポインタ
| 自由内容バッファへのポインタ
| 行を表示するバッファ。 +
| Comma-separated list buffer pointers (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer pointers (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
この値が空の場合、行は削除されます (ハッシュテーブルに含まれるその他の情報も無視されます);
"line" 型の次のフックも呼び出されません。
// TRANSLATION MISSING
| buffer_name
| フォーマット済み内容バッファの名前.
| 自由内容バッファの名前
| 行を表示するバッファ。 +
| Comma-separated list buffer names (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer names (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
`buffer` と `+buffer_name+` の両方が設定された場合、`+buffer_name+` の値が優先されます +
この値が空の場合、行は削除されます (ハッシュテーブルに含まれるその他の情報も無視されます);
"line" 型の次のフックも呼び出されません。
@@ -16876,6 +16738,7 @@ if (hashtable_in)
"irc_message_parse" の出力に関するより詳しい情報は
link:weechat_scripting.ja.html#irc_message_parse[WeeChat スクリプト作成ガイド / メッセージの構文解析 ^↗^^]を参照してください。
スクリプト (Python) での使用例:
[source,python]
@@ -18923,8 +18786,7 @@ for key in hash:
==== hdata_compare
// TRANSLATION MISSING
_WeeChat ≥ 1.9, updated in 4.1.0._
_WeeChat バージョン 1.9 以上で利用可。_
2 つのオブジェクトの hdata 変数を比較。
@@ -18940,9 +18802,8 @@ int weechat_hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2
* _hdata_: hdata へのポインタ
* _pointer1_: 1 番目の WeeChat およびプラグインオブジェクトへのポインタ
* _pointer2_: 2 番目の WeeChat およびプラグインオブジェクトへのポインタ
// TRANSLATION MISSING
* _name_: variable name or path to a variable name; 配列の場合、変数名を "N|name"
のように指定できます。ここで N は配列のインデックス番号です (番号は 0 から始まります)。例: "2|name"
* _name_: 変数名; 配列の場合、変数名を "N|name" のように指定できます。ここで
N は配列のインデックス番号です (番号は 0 から始まります)。例: "2|name"
* _case_sensitive_: 大文字小文字を区別する場合 1、それ以外の場合 0
戻り値:
@@ -18958,12 +18819,8 @@ C 言語での使用例:
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
weechat_printf (NULL, "comparison of buffer number = %d",
weechat_printf (NULL, "number comparison = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
weechat_printf (NULL, "comparison of number of lines = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
weechat_printf (NULL, "comparison of local variable = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
----
スクリプト (Python) での使用例:
@@ -18977,9 +18834,7 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
----
==== hdata_set
+76 -129
View File
@@ -146,6 +146,11 @@ WeeChat:
| Logger plugin: compression of rotated log files (gzip). +
Relay plugin: compression of messages (WeeChat -> client) with https://zlib.net/[zlib ^↗^^] (weechat protocol). +
Script plugin: read of repository index file (gzip).
// TRANSLATION MISSING
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files. +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
|===
[NOTE]
@@ -162,70 +167,27 @@ WeeChat:
[width="100%",cols="5,^3,.^15",options="header"]
|===
// TRANSLATION MISSING
| パッケージ ^(1)^ | バージョン | Features
| {cpp} コンパイラ (pass:[g++ / clang++]) |
| ビルドとテストの実行、JavaScript プラグイン
| gettext |
| 国際化 (メッセージの翻訳; ベース言語は英語です)
| ca-certificates |
| TLS 接続に必要な証明書、relay プラグインで TLS サポート
| パッケージ ^(1)^ | バージョン | Features
| {cpp} コンパイラ (pass:[g++ / clang++]) | | ビルドとテストの実行、JavaScript プラグイン
| gettext | | 国際化 (メッセージの翻訳; ベース言語は英語です)
| ca-certificates | | TLS 接続に必要な証明書、relay プラグインで TLS サポート
| libaspell-dev / libenchant-dev | | spell プラグイン
| python3-dev | 3.0 以上 | python プラグイン
| libperl-dev | | perl プラグイン
| ruby3.1, ruby3.1-dev | 1.9.1 以上 | ruby プラグイン
| liblua5.4-dev | | lua プラグイン
| tcl-dev | 8.5 以上 | tcl プラグイン
| guile-3.0-dev | 2.0 以上 | guile (scheme) プラグイン
| libv8-dev | 3.24.3 以下 | javascript プラグイン
| php-dev | 7.0 以上 | PHP プラグイン
| libphp-embed | 7.0 以上 | PHP プラグイン
| libxml2-dev | | PHP プラグイン
| libargon2-dev | | PHP プラグイン (PHP 7.2 以上の場合)
| libsodium-dev | | PHP プラグイン (PHP 7.2 以上の場合)
| asciidoctor | 1.5.4 以上 | man ページと文書のビルド
// TRANSLATION MISSING
| libzstd-dev | ≥ 0.8.1
| Logger plugin: compression of rotated log files (zstandard). +
Relay plugin: compression of messages (WeeChat -> client) with https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat protocol).
| libaspell-dev / libenchant-dev |
| spell プラグイン
| python3-dev | 3.0 以上
| python プラグイン
| libperl-dev |
| perl プラグイン
| ruby3.1, ruby3.1-dev | 1.9.1 以上
| ruby プラグイン
| liblua5.4-dev |
| lua プラグイン
| tcl-dev | 8.5 以上
| tcl プラグイン
| guile-3.0-dev | 2.0 以上
| guile (scheme) プラグイン
| libv8-dev | 3.24.3 以下
| javascript プラグイン
| php-dev | 7.0 以上
| PHP プラグイン
| libphp-embed | 7.0 以上
| PHP プラグイン
| libxml2-dev |
| PHP プラグイン
| libargon2-dev |
| PHP プラグイン (PHP 7.2 以上の場合)
| libsodium-dev |
| PHP プラグイン (PHP 7.2 以上の場合)
| asciidoctor | 1.5.4 以上
| man ページと文書のビルド
// TRANSLATION MISSING
| ruby-pygments.rb |
| Build documentation.
| libcpputest-dev | 3.4 以上
| ビルドとテストの実行
| ruby-pygments.rb | | Build documentation.
| libcpputest-dev | 3.4 以上 | ビルドとテストの実行
|===
[NOTE]
@@ -267,8 +229,7 @@ $ make install
CMake に対するオプションを指定するには、以下の書式を使ってください: `-DOPTION=VALUE`。
// TRANSLATION MISSING
List of available options:
よく利用されるオプションのリスト:
[width="100%",cols="3m,3,3m,10",options="header"]
|===
@@ -324,10 +285,6 @@ List of available options:
| ENABLE_GUILE | `ON`, `OFF` | ON
| <<scripting_plugins,Guile プラグイン>> (Scheme) のコンパイル。
// TRANSLATION MISSING
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compile headless binary.
| ENABLE_IRC | `ON`, `OFF` | ON
| <<irc,IRC プラグイン>>のコンパイル
@@ -386,10 +343,6 @@ List of available options:
| ENABLE_XFER | `ON`, `OFF` | ON
| <<xfer,Xfer プラグイン>>のコンパイル。
// TRANSLATION MISSING
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Enable https://facebook.github.io/zstd/[Zstandard ^↗^^] compression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| コンパイルテスト。
@@ -1001,10 +954,6 @@ By default, the screen is divided up into the following areas:
// TRANSLATION MISSING
| buflist3 | `1.weechat` | List of buffers, third bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist4 | `1.weechat` | List of buffers, fourth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist5 | `1.weechat` | List of buffers, fifth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| fset | `+buflist.look.sort: …+` | Help on currently selected option on fset buffer.
| irc_channel | `#test` | 現在の IRC チャンネル名
// TRANSLATION MISSING
@@ -1544,10 +1493,8 @@ External plugins and scripts can define and use other local variables.
[[buflist]]
=== List of buffers
// TRANSLATION MISSING
Buflist プラグインを使うことで、"buflist" と呼ばれるバー要素の中にバッファリストを表示させることが可能になります
(four other bar items "buflist2", "buflist3", "buflist4" and "buflist5" are
available as well)。 +
(それ以外に "buflist2" と "buflist3" と呼ばれるバー要素も利用可能です)。 +
プラグインは開始時にバー要素 "buflist" を持つデフォルトバー "buflist" を作成します。
[[buflist_commands]]
@@ -1700,16 +1647,6 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | グローバル履歴から次のコマンド/メッセージを呼び出す (すべてのバッファに対して共通の履歴) | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| キー | 説明 | コマンド
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
// TRANSLATION MISSING
[[key_bindings_buffers]]
=== Buffers
@@ -2008,8 +1945,8 @@ These keys and actions are used on the fset buffer (see <<fset,Fset plugin>>).
| kbd:[Ctrl+l] (`L`) | | Refresh options and whole screen. | `+/fset -refresh+`
| | `$` | Refresh options (keep marked options). |
| | `$$` | Refresh options (unmark all options). |
| kbd:[Alt+p] | `p` | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Toggle help bar. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Toggle plugin description options (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Toggle help bar. | `+/bar toggle fset+`
| | `s:x,y` | Sort options by fields x,y (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Reset sort to its default value (see option <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Export options in file "xxx". | `+/fset -export xxx+`
@@ -2074,16 +2011,11 @@ These keys and actions are used on the script buffer (see <<script_manager,scrip
| kbd:[PgDn] | | Move one page down. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Install script. | `+/script install+`
| kbd:[Alt+r] | `r` | Remove script. | `+/script remove+`
| kbd:[Alt+l] | `l` | Load script. | `+/script load+`
| kbd:[Alt+L] | `L` | Reload script. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Load script. | `+/script load+`
| kbd:[Alt+u] | `u` | Unload script. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Autoload script. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Hold/unhold script. | `+/script hold+`
| kbd:[Alt+v] | `v` | View script. | `+/script show+`
| | `s:x,y` | Sort scripts by fields x,y (see option <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Reset sort to its default value (see option <<option_script.look.sort,script.look.sort>>). |
| | `$` | Refresh list. |
| | `q` | Close buffer. | `+/buffer close+`
|===
// TRANSLATION MISSING
@@ -2441,9 +2373,14 @@ irc サーバ "libera" に含まれる全てのバッファに対して設定す
例えば現在のバッファで "joe" と "mike" からのメッセージに対するハイライトを無効化するには以下のように設定します:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
バッファプロパティ "hotlist_max_level_nicks" は設定ファイルに保存されません。 +
これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには
`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。
[[highlights]]
=== ハイライト
@@ -2469,9 +2406,14 @@ This can also be set with the buffer property "highlight_disable_regex".
Same example, specific to the current buffer:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
バッファプロパティ "highlight_disable_regex" は設定ファイルに保存されません。 +
これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには
`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。
[[highlights_words]]
==== ハイライトする単語の追加
@@ -2526,9 +2468,14 @@ Same example, specific to the current buffer:
例えば現在のバッファ宛のすべてのメッセージをハイライトするには以下のように設定します:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
バッファプロパティ "highlight_regex" は設定ファイルに保存されません。 +
これを保存するには _buffer_autoset.py_ スクリプトを使ってください: このスクリプトをインストールするには
`+/script install buffer_autoset.py+` コマンドを使い、ヘルプを見るには `+/help buffer_autoset+` コマンドを使ってください。
// TRANSLATION MISSING
[[buffer_logging]]
=== Buffer logging
@@ -3418,34 +3365,32 @@ _weechat.conf_ ファイル内のセクション:
[width="100%",cols="3m,6m,16",options="header"]
|===
| セクション | 操作コマンド | 説明
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | core とプラグインのデバッグレベル (オプションをセクションに追加/削除出来ます)
| startup | /set weechat.startup.* | 起動オプション
| look | /set weechat.look.* | 外観
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | 色の別名 (オプションをセクションに追加/削除出来ます)
| color | /set weechat.color.* | 色
| completion | /set weechat.completion.* | 補完オプション
| history | /set weechat.history.* | 履歴オプション (コマンドとバッファ)
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | プロキシオプション
| network | /set weechat.network.* | ネットワーク/TLS オプション
| セクション | 操作コマンド | 説明
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | core とプラグインのデバッグレベル (オプションをセクションに追加/削除出来ます)
| startup | /set weechat.startup.* | 起動オプション
| look | /set weechat.look.* | 外観
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | 色の別名 (オプションをセクションに追加/削除出来ます)
| color | /set weechat.color.* | 色
| completion | /set weechat.completion.* | 補完オプション
| history | /set weechat.history.* | 履歴オプション (コマンドとバッファ)
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | プロキシオプション
| network | /set weechat.network.* | ネットワーク/TLS オプション
// TRANSLATION MISSING
| plugin | /set weechat.plugin.* | Options on plugins.
| plugin | /set weechat.plugin.* | Options on plugins.
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | バーオプション
| layout | <<command_weechat_layout,/layout>> | レイアウト
// TRANSLATION MISSING
| buffer | <<command_weechat_buffer,/buffer setauto>> | Properties auto-applied on buffers when they are opened.
| notify | <<command_weechat_buffer,/buffer notify>> | バッファに対する通知レベル (オプションをセクションに追加/削除出来ます)
| filter | <<command_weechat_filter,/filter>> | フィルタ
| key | <<command_weechat_key,/key>> | デフォルトコンテキストのキー
| key_search | <<command_weechat_key,/key>> | 検索コンテキストのキー
| key_cursor | <<command_weechat_key,/key>> | カーソルコンテキストのキー
| key_mouse | <<command_weechat_key,/key>> | マウスコンテキストのキー
| signal | /set weechat.signal.* | Options on signals.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | バーオプション
| layout | <<command_weechat_layout,/layout>> | レイアウト
| notify | <<command_weechat_buffer,/buffer notify>> | バッファに対する通知レベル (オプションをセクションに追加/削除出来ます)
| filter | <<command_weechat_filter,/filter>> | フィルタ
| key | <<command_weechat_key,/key>> | デフォルトコンテキストのキー
| key_search | <<command_weechat_key,/key>> | 検索コンテキストのキー
| key_cursor | <<command_weechat_key,/key>> | カーソルコンテキストのキー
| key_mouse | <<command_weechat_key,/key>> | マウスコンテキストのキー
|===
オプション:
@@ -4336,7 +4281,7 @@ the following extra variables are available:
|===
// TRANSLATION MISSING
| Variable | 説明 | 値/例
| `+${clientinfo}+` | サポートしている CTCP オプションのリスト | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | サポートしている CTCP オプションのリスト | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | WeeChat バージョン | `+4.1.0-dev+`
| `+${versiongit}+` | WeeChat バージョン + Git バージョン ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Git バージョン ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -4359,9 +4304,11 @@ The default CTCP replies are:
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | 応答書式 | 例
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+name (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
+20 -46
View File
@@ -582,15 +582,6 @@ Jeśli używasz aplikacji Terminal na macOS włącz opcję
"Use option as meta key" w menu Settings/Keyboard. Następnie możesz używać klawisza
kbd:[Option] jako klawisza meta.
// TRANSLATION MISSING
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== Jak mogę zmienić przypisania klawiszy?
@@ -936,22 +927,34 @@ link:weechat_user.pl.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
do ustawienia maksymalnego poziomu hotlisty dla niektórych nicków, dla buforów
lub grup buforów (jak serwery IRC).
W celu wyłączenia tylko podświetleń wystarczy ustawić ja na 2.
// TRANSLATION MISSING
For the current buffer:
W celu wyłączenia tylko podświetleń wystarczy ustawić ja na 2:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
// TRANSLATION MISSING
For all channels on server "libera":
To utawienie nie jest zapisywane jednak w konfiguracji.
W celu automatycznego ustawiania tej właściwości należy użyć skryptu _buffer_autoset.py_:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add joe:2,mike:2
/script install buffer_autoset.py
----
Na przykład w celu wyłączenia powiadomień od "mike" na #weechat w sieci libera:
on the IRC server libera:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
Dla całego serwera libera:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
Więcej przykładów można znaleźć wykonując komende `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== Jak mogę zmienić docelowy bufor dla komendy w połączonym buforze (jak bufor z serwerami)?
@@ -1154,35 +1157,6 @@ w _sec.conf_ za pomocą komendy `/secure`).
Przejrzyj link:weechat_user.pl.html#files_and_directories[Poradnik użytkownika / Pliki i foldery ^↗^^],
gdzie znajdziesz więcej informacji o plikach konfiguracyjnych.
// TRANSLATION MISSING
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== Rozwój
+75 -133
View File
@@ -134,6 +134,10 @@ WeeChat:
| Wtyczka logger: kompresja rotowanych plików z logami (gzip). +
Wtyczka relay: kompresja wiadomości (WeeChat -> klient) za pomocą https://zlib.net/[zlib ^↗^^] (protokół weechat). +
Wtyczka script: odczyt repozytorium ze skryptami (gzip).
| libzstd-dev | ≥ 0.8.1
| Wtyczka logger: kompresja rotowanych plików z logami. +
Wtyczka Relay: kompresja wiadomości (WeeChat -> klient) za pomocą https://facebook.github.io/zstd/[Zstandard ^↗^^] (protokół weechat).
|===
[NOTE]
@@ -147,68 +151,26 @@ WeeChat:
[width="100%",cols="5,^3,.^15",options="header"]
|===
| Pakiet ^(1)^ | Wersja | Funkcje
| kompilator {cpp} (pass:[g++ / clang++]) |
| Kompilacja i uruchamianie testów, wtyczka JavaScript.
| gettext |
| Internacjonalizacja (tłumaczenie wiadomości; język bazowy to Angielski).
| ca-certificates |
| Certyfikaty dla połączeń TLS.
| libzstd-dev | ≥ 0.8.1
| Wtyczka logger: kompresja rotowanych plików z logami (zstandard). +
Wtyczka Relay: kompresja wiadomości (WeeChat -> klient) za pomocą https://facebook.github.io/zstd/[Zstandard ^↗^^] (protokół weechat).
| libaspell-dev / libenchant-dev |
| Wtyczka spell.
| python3-dev | ≥ 3.0
| Wtyczka python.
| libperl-dev |
| Wtyczka perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Wtyczka ruby.
| liblua5.4-dev |
| Wtyczka lua.
| tcl-dev | ≥ 8.5
| Wtyczka tcl.
| guile-3.0-dev | ≥ 2.0
| Wtyczka guile (scheme).
| libv8-dev | ≤ 3.24.3
| Wtyczka javascript.
| php-dev | ≥ 7.0
| Wtyczka PHP.
| libphp-embed | ≥ 7.0
| Wtyczka PHP.
| libxml2-dev |
| Wtyczka PHP.
| libargon2-dev |
| Wtyczka PHP (jeśli PHP ≥ 7.2).
| libsodium-dev |
| Wtyczka PHP (jeśli PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4
| Tworzenie strony man i dokumentacji.
| ruby-pygments.rb |
| Dokumentacja budowania.
| libcpputest-dev | ≥ 3.4
| Kompilacja i uruchamianie testów.
| Pakiet ^(1)^ | Wersja | Funkcje
| kompilator {cpp} (pass:[g++ / clang++]) | | Kompilacja i uruchamianie testów, wtyczka JavaScript.
| gettext | | Internacjonalizacja (tłumaczenie wiadomości; język bazowy to Angielski).
| ca-certificates | | Certyfikaty dla połączeń TLS.
| libaspell-dev / libenchant-dev | | Wtyczka spell.
| python3-dev | ≥ 3.0 | Wtyczka python.
| libperl-dev | | Wtyczka perl.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Wtyczka ruby.
| liblua5.4-dev | | Wtyczka lua.
| tcl-dev | ≥ 8.5 | Wtyczka tcl.
| guile-3.0-dev | ≥ 2.0 | Wtyczka guile (scheme).
| libv8-dev | ≤ 3.24.3 | Wtyczka javascript.
| php-dev | ≥ 7.0 | Wtyczka PHP.
| libphp-embed | ≥ 7.0 | Wtyczka PHP.
| libxml2-dev | | Wtyczka PHP.
| libargon2-dev | | Wtyczka PHP (jeśli PHP ≥ 7.2).
| libsodium-dev | | Wtyczka PHP (jeśli PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | Tworzenie strony man i dokumentacji.
| ruby-pygments.rb | | Dokumentacja budowania.
| libcpputest-dev | ≥ 3.4 | Kompilacja i uruchamianie testów.
|===
[NOTE]
@@ -248,8 +210,7 @@ $ make install
Opcje mogą zostać przekazane do CMake, format `-DOPCJA=WARTOŚĆ`.
// TRANSLATION MISSING
List of available options:
Lista popularnych opcji:
[width="100%",cols="3m,3,3m,10",options="header"]
|===
@@ -303,10 +264,6 @@ List of available options:
| ENABLE_GUILE | `ON`, `OFF` | ON
| Kompilacja <<scripting_plugins,wtyczki guile>> (Scheme).
// TRANSLATION MISSING
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compile headless binary.
| ENABLE_IRC | `ON`, `OFF` | ON
| Kompilacja <<irc,wtyczki IRC>>.
@@ -365,10 +322,6 @@ List of available options:
| ENABLE_XFER | `ON`, `OFF` | ON
| Kompilacja <<xfer,wtyczki xfer>>.
// TRANSLATION MISSING
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Enable https://facebook.github.io/zstd/[Zstandard ^↗^^] compression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| Kompiluje testy.
@@ -946,10 +899,6 @@ Inne dostępne elementy (nie używane domyślnie w paskach):
| buffer_short_name | `#test` | Skrócona nazwa obecnego buforu.
| buflist2 | `1.weechat` | Lista buforów, drugi element paska (zobacz opcję <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | Lista buforów, trzeci element paska (zobac opcję <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist4 | `1.weechat` | List of buffers, fourth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist5 | `1.weechat` | List of buffers, fifth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Pomoc dla obecnie wybranej opcji w buforze fset.
| irc_channel | `#test` | Nazwa bieżącego kanału IRC.
| irc_host | `+user@host.com+` | Aktualny host IRC.
@@ -1472,10 +1421,8 @@ External plugins and scripts can define and use other local variables.
[[buflist]]
=== Lista buforów
// TRANSLATION MISSING
Wtyczka buflist wyświetla listę buforów w elemencie paska nazwanym "buflist"
(four other bar items "buflist2", "buflist3", "buflist4" and "buflist5" are
available as well). +
(dostępne są również dwa dodatkowe elementy "buflist2" oraz "buflist3"). +
Domyślny pasek "buflist" jest tworzony podczas uruchomieina z włączoną wtyczką.
[[buflist_commands]]
@@ -1608,16 +1555,6 @@ Można je zmienić oraz dodać nowe za pomocą komendy <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Pokaż następną komendę/wiadomość w historii globalnej (wspólnej dla wszystkich buforów). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Skrót | Opis | Komenda
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Bufory
@@ -1892,8 +1829,8 @@ Poniższe skróty i akcje mogą zostać użyte w buforze fset (zobacz <<fset,wty
| kbd:[Ctrl+l] (`L`) | | Odświerz opcje i cały ekran. | `+/fset -refresh+`
| | `$` | Odświerz opcje (zachowuje zaznaczone opcje). |
| | `$$` | Odświerz opcje (odznacza zaznaczone kompilację). |
| kbd:[Alt+p] | `p` | Przełącz opcje opisu wtyczki (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Przełącz pasek pomocy. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Przełącz opcje opisu wtyczki (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Przełącz pasek pomocy. | `+/bar toggle fset+`
| | `s:x,y` | Sortuj opcje po polach x,y (zobacz opcję <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Zresetuj soerowanie do domyślnej wartości (zobacz opcję <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Wyeksportuj opcje do pliku "xxx". | `+/fset -export xxx+`
@@ -1954,21 +1891,11 @@ Te skróty klawiszowe i akcje mogą zostać użyte w buforze skryptów (zobacz <
| kbd:[PgDn] | | Przewiń stronę w dół. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Zainstaluj skrypt. | `+/script install+`
| kbd:[Alt+r] | `r` | Usuń skrypt. | `+/script remove+`
| kbd:[Alt+l] | `l` | Załaduj skrypt. | `+/script load+`
// TRANSLATION MISSING
| kbd:[Alt+L] | `L` | Reload script. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Załaduj skrypt. | `+/script load+`
| kbd:[Alt+u] | `u` | Wyładuj skrypt. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Automatycznie ładuj skrypt. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Zablokuj/odblokuj skrypt. | `+/script hold+`
| kbd:[Alt+v] | `v` | Pokarz skrypt. | `+/script show+`
// TRANSLATION MISSING
| | `s:x,y` | Sort scripts by fields x,y (see option <<option_script.look.sort,script.look.sort>>). |
// TRANSLATION MISSING
| | `s:` | Reset sort to its default value (see option <<option_script.look.sort,script.look.sort>>). |
// TRANSLATION MISSING
| | `$` | Refresh list. |
// TRANSLATION MISSING
| | `q` | Close buffer. | `+/buffer close+`
|===
[NOTE]
@@ -2326,9 +2253,14 @@ z ustawonym dla każdego z nich maksymalnym poziomem hotlisty, możliwe poziomy
Na przykład, żeby wyłączyć podświetlenia od "joe" oraz "mike" w obecnym buforze:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
Właściwość bufora "hotlist_max_level_nicks" nie jest zapisywana w konfiguracji. +
Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą
`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`.
[[highlights]]
=== Podświetlenia
@@ -2353,9 +2285,14 @@ Można to także osiągnąć za pomocą właściwości bufora "highlight_disable
Ten sam przykład, tylko dla konkretnego bufora:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
Właściwość bufora "highlight_disable_regex" nie jest zapisywana w konfiguracji. +
Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą
`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`.
[[highlights_words]]
==== Dodawanie słów do podświetleń
@@ -2409,9 +2346,14 @@ Możesz wymusić podświetlenia używając wyrażenia regularnego z właściwoś
Na przykład żeby wymusić podświetlenie dla wszytkich wiadomości w obecnym buforze:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
Właściwość bufora "highlight_regex" nie jest zapisywana w konfiguracji. +
Można ją zapisać za pomocą skryptu _buffer_autoset.py_: można go zaintalować za pomocą
`+/script install buffer_autoset.py+`, informacje o używaniu `+/help buffer_autoset+`.
[[buffer_logging]]
=== Bufor logera
@@ -3299,32 +3241,30 @@ Sekcje w pliku _weechat.conf_:
[width="100%",cols="3m,6m,16",options="header"]
|===
| Sekcja | Komenda | Opis
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Poziom debugowania dla rdzenia i wtyczek (opcje mogą być dodawane/usuwane w sekcji).
| startup | /set weechat.startup.* | Opcje dla startu aplikacji.
| look | /set weechat.look.* | Wygląd.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Aliasy kolorów (opcje mogą być dodawane/usuwane w sekcji).
| color | /set weechat.color.* | Kolory.
| completion | /set weechat.completion.* | Opcje dopełnień.
| history | /set weechat.history.* | Opcje historii (komend i buforów).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Opcje proxy.
| network | /set weechat.network.* | Opcje sieci/TLS.
| plugin | /set weechat.plugin.* | Opcje wtyczek.
| signal | /set weechat.signal.* | Opcje sygnałów.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Opcje pasków.
| layout | <<command_weechat_layout,/layout>> | Układy.
// TRANSLATION MISSING
| buffer | <<command_weechat_buffer,/buffer setauto>> | Properties auto-applied on buffers when they are opened.
| notify | <<command_weechat_buffer,/buffer notify>> | Poziomy powiadomień dla buforów (opcje mogą być dodawane/usuwane w sekcji).
| filter | <<command_weechat_filter,/filter>> | Filtry.
| key | <<command_weechat_key,/key>> | Skróty klawiszowe dla domyślnego kontekstu.
| key_search | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu wyszukiwania.
| key_cursor | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu kursora.
| key_mouse | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu myszy.
| Sekcja | Komenda | Opis
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Poziom debugowania dla rdzenia i wtyczek (opcje mogą być dodawane/usuwane w sekcji).
| startup | /set weechat.startup.* | Opcje dla startu aplikacji.
| look | /set weechat.look.* | Wygląd.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Aliasy kolorów (opcje mogą być dodawane/usuwane w sekcji).
| color | /set weechat.color.* | Kolory.
| completion | /set weechat.completion.* | Opcje dopełnień.
| history | /set weechat.history.* | Opcje historii (komend i buforów).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Opcje proxy.
| network | /set weechat.network.* | Opcje sieci/TLS.
| plugin | /set weechat.plugin.* | Opcje wtyczek.
| signal | /set weechat.signal.* | Opcje sygnałów.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Opcje pasków.
| layout | <<command_weechat_layout,/layout>> | Układy.
| notify | <<command_weechat_buffer,/buffer notify>> | Poziomy powiadomień dla buforów (opcje mogą być dodawane/usuwane w sekcji).
| filter | <<command_weechat_filter,/filter>> | Filtry.
| key | <<command_weechat_key,/key>> | Skróty klawiszowe dla domyślnego kontekstu.
| key_search | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu wyszukiwania.
| key_cursor | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu kursora.
| key_mouse | <<command_weechat_key,/key>> | Skróty klawiszowe dla kontekstu myszy.
|===
Opcje:
@@ -4204,7 +4144,7 @@ the following extra variables are available:
|===
// TRANSLATION MISSING
| Variable | Opis | Wartość/Przykład
| `+${clientinfo}+` | Lista wspieranych CTCP | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | Lista wspieranych CTCP | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | Wersja WeeChat | `+4.1.0-dev+`
| `+${versiongit}+` | Wersja WeeChat + wersja Git ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Wersja git ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -4227,9 +4167,11 @@ The default CTCP replies are:
[width="100%",cols="2,4,8",options="header"]
|===
| CTCP | Format odpowiedzi | Przykład
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Sat, 08 Jul 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+name (John Doe)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
+1 -1
View File
@@ -37,7 +37,7 @@ STUB_HEADER = """\
# DO NOT EDIT BY HAND!
#
from typing import Dict, Union
from typing import Dict
"""
CONSTANT_RE = (
+1 -6
View File
@@ -142,11 +142,10 @@ WeeChat „језгро” се налази у следећим директо
|    wee-secure-buffer.c | Бафер обезбеђених података.
|    wee-secure-config.c | Опције обезбеђених података (фајл sec.conf).
|    wee-string.c | Функције над стринговима.
|    wee-sys.c | Системске функције.
|    wee-upgrade-file.c | Интерни систем ажурирања.
|    wee-upgrade.c | Ажурирање за WeeChat језгро (бафери, линије, историја, ...).
|    wee-url.c | URL трансфер (помоћу libcurl).
|    wee-utf8.c | UTF-8 функције.
|    wee-utf8.c | UTF-8 фунцкије.
|    wee-util.c | Неке друге функције.
|    wee-version.c | Функције за WeeChat верзију.
|    weechat.c | Основне функције: опције командне линије, покретање.
@@ -169,7 +168,6 @@ WeeChat „језгро” се налази у следећим директо
|       wee-hook-process.c | Кука "process".
|       wee-hook-signal.c | Кука "signal".
|       wee-hook-timer.c | Кука "timer".
|       wee-hook-url.c | Кука "url".
| gui/ | Функције за бафере, прозоре, ... (користе их сви интерфејси).
|    gui-bar-item.c | Ставке трака.
|    gui-bar-window.c | Прозори трака.
@@ -240,8 +238,6 @@ WeeChat „језгро” се налази у следећим директо
|       buflist.c | Главне buflist функције.
|       buflist-bar-item.c | Buflist ставке траке.
|       buflist-command.c | Buflist команде.
// TRANSLATION MISSING
|       buflist-completion.c | Buflist completions.
|       buflist-config.c | Buflist опције кофиг (фајл buflist.conf).
|       buflist-info.c | Buflist info/infolists/hdata.
|       buflist-mouse.c | Buflist акције мишем.
@@ -426,7 +422,6 @@ WeeChat „језгро” се налази у следећим директо
|          test-core-url.cpp | Тестови: URL адресе.
|          test-core-utf8.cpp | Тестови: UTF-8.
|          test-core-util.cpp | Тестови: помоћне функције.
|          test-core-sys.cpp | Тестови: системске функције.
|       gui/ | Корен unit тестова интерфејса.
|          test-gui-bar-window.cpp | Тестови: функције прозора траке.
|          test-gui-buffer.cpp | Тестови: бафер функције.
+25 -48
View File
@@ -517,15 +517,6 @@ UXTerm*metaSendsEscape: true
Ако користите macOS Terminal апликацију, укључите опцију „Use option as meta key” у менију Settings/Keyboard након чега можете користити тастер kbd:[Option] као meta тастер.
// TRANSLATION MISSING
[[enter_key]]
=== Some keys including Enter are not working, why?
If you run a WeeChat < 4.0.0 with configuration files created by any
version ≥ 4.0.0, the keys names become invalid and many keys won't work at all. +
To repair them, exit WeeChat, remove all sections `[key*]` from weechat.conf
and start WeeChat again: all default keys will be created.
[[customize_key_bindings]]
=== Како могу да прилагодим тастерске пречице?
@@ -830,20 +821,32 @@ link:weechat_user.sr.html#max_hotlist_level_nicks[hotlist_max_level_nicks_add ^
можете користити да за неке надимке подесите максимални ниво вруће листе, по баферу, или по
групи бафера (као на пример IRC сервери).
Ако само желите да искључите истицања, треба да је поставите на 2.
За текући бафер:
Ако само желите да искључите истицања, треба да је поставите на 2:
----
/buffer setauto hotlist_max_level_nicks_add пера:2,мика:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
За све канале на серверу „libera”:
Међутим, ова особина бафера се не чува у конфигурацији. Ако желите да се ове особине бафера аутоматски поново примене, биће вам потребна скрипта _buffer_autoset.py_:
----
/set weechat.buffer.irc.libera.*.hotlist_max_level_nicks_add пера:2,мика:2
/script install buffer_autoset.py
----
На пример, ако за стално желите да искључите истицања од надимка „mike” са #weechat на IRC серверу libera:
----
/buffer_autoset add irc.libera.#weechat hotlist_max_level_nicks_add mike:2
----
Ако уместо овога желите да се примени на комплетан libera сервер:
----
/buffer_autoset add irc.libera hotlist_max_level_nicks_add mike:2
----
За још примера, погледајте `+/help buffer_autoset+`.
[[irc_target_buffer]]
=== Како могу да променим циљни бафер за команде над спојеним баферима (као што је бафер са серверима)?
@@ -960,8 +963,10 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Можете да следите исте савете као за <<memory_usage,меморију>>, као и следеће:
* Сакријте „nicklist” траку: `/bar hide nicklist` (тастер: kbd:[Alt+Shift+N]).
* Искључите „buflist”: `/buflist disable` (тастер: kbd:[Alt+Shift+B]).
// TRANSLATION MISSING
* Сакријте „nicklist” траку: `/bar hide nicklist` (key: kbd:[Alt+Shift+N]).
// TRANSLATION MISSING
* Disable "buflist": `/buflist disable` (key: kbd:[Alt+Shift+B]).
* Уклоните приказ секунди из времена у статусној траци: `+/set weechat.look.item_time_format "%H:%M"+` (ово је и подразумевана вредност).
* Искључите проверу неисправно написаних речи у командној линији у реалном времену (ако сте је укључили): `+/set spell.check.real_time off+`.
* Поставите променљиву _TZ_ (на пример: `export TZ="Europe/Paris"`), тиме спречавате чест приступ фајлу _/etc/localtime_.
@@ -986,8 +991,9 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
/set irc.ctcp.ping ""
----
Са WeeChat < 4.1.0, на остале CTCP упите се подразумевано одговарало и такође морају
да се искључе:
// TRANSLATION MISSING
With WeeChat < 4.1.0, other CTCP queries were replied by default and must be
disabled as well:
----
/set irc.ctcp.finger ""
@@ -1022,35 +1028,6 @@ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Погледајте link:weechat_user.sr.html#files_and_directories[Корисничко упутство / Фајлови и директоријуми ^↗^^] за више информација о конфигурационим фајловима.
// TRANSLATION MISSING
[[move_to_another_device]]
=== I want to move my WeeChat to another device and keep my config, what should I copy?
First check directories used by WeeChat with this command: `/debug dirs`. +
Directories home/config and home/data must be copied (all files and sub-directories).
For example if you're using XDG directories (default with WeeChat ≥ 3.2),
the directories should be `$HOME/.config/weechat` and `$HOME/.local/share/weechat`. +
If you're using a single directory (default with WeeChat < 3.2), the directory
should be `$HOME/.weechat`.
[IMPORTANT]
The WeeChat version on the new device must be greater than or equal to the version
on the initial device. +
Downgrading WeeChat configuration is *NOT SUPPORTED* and can break it,
leading to unusable WeeChat.
Steps:
. Quit Weechat: `/quit` (or `/upgrade -quit` if you want to resume the session,
which includes content of all buffers).
. Copy all directories, sub-directories and files to the new device, keeping
same names and permissions.
. Optional: copy any file outside these directories that you refer to in your
configuration (it's not recommended to use files outside WeeChat directories).
. Start WeeChat on the new device: `weechat` (or `weechat --upgrade` if you
saved the session).
[[development]]
== Развој
+60 -207
View File
@@ -3901,28 +3901,18 @@ int weechat_crypto_hash (const void *data, int data_size, const char *hash_algo,
[width="100%", cols="2,2,3,6", options="header"]
|===
| Вредност | Алгоритам | Величина хеша | Напомене
| `+crc32+` | CRC32 | 4 бајта (32 бита) | Није хеш алгоритам у криптографском смислу.
| `+md5+` | MD5 | 16 бајтова (128 бита) | *Слаб*, не препоручује се за криптографску употребу.
| `+sha1+` | SHA-1 | 20 бајтова (160 бита) | *Слаб*, не препоручује се за криптографску употребу.
| `+sha224+` | SHA-224 | 28 бајтова (224 бита) |
| `+sha256+` | SHA-256 | 32 бајта (256 бита) |
| `+sha384+` | SHA-384 | 48 бајтова (384 бита) |
| `+sha512+` | SHA-512 | 64 бајта (512 бита) |
| `+sha512-224+` | SHA-512/224 | 28 бајтова (224 бита) | Алгоритам је доступан у libgcrypt ≥ 1.9.4.
| `+sha512-256+` | SHA-512/256 | 32 бајта (256 бита) | Алгоритам је доступан у libgcrypt ≥ 1.9.4.
| `+sha3-224+` | SHA3-224 | 28 бајтова (224 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 бајта (256 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 бајтова (384 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 бајта (512 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+blake2b-160+` | BLAKE2B-160 | 20 бајтова (160 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2b-256+` | BLAKE2B-256 | 32 бајта (256 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2b-384+` | BLAKE2B-384 | 48 бајтова (384 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2b-512+` | BLAKE2B-512 | 64 бајта (512 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2s-128+` | BLAKE2S-128 | 16 бајтова (128 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2s-160+` | BLAKE2S-160 | 20 бајтова (160 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2s-224+` | BLAKE2S-224 | 28 бајтова (224 бита) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| `+blake2s-256+` | BLAKE2S-256 | 32 бајта (256 бита) ) | Алгоритам је доступан у libgcrypt ≥ 1.8.0.
| Вредност | Алгоритам | Величина хеша | Напомене
| `+crc32+` | CRC32 | 4 бајта (32 бита) | Није хеш алгоритам у криптографском смислу.
| `+md5+` | MD5 | 16 бајтова (128 бита) | *Слаб*, не препоручује се за криптографску употребу.
| `+sha1+` | SHA-1 | 20 бајтова (160 бита) | *Слаб*, не препоручује се за криптографску употребу.
| `+sha224+` | SHA-224 | 28 бајтова (224 бита) |
| `+sha256+` | SHA-256 | 32 бајта (256 бита) |
| `+sha384+` | SHA-384 | 48 бајтова (384 бита) |
| `+sha512+` | SHA-512 | 64 бајта (512 бита) |
| `+sha3-224+` | SHA3-224 | 28 бајтова (224 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-256+` | SHA3-256 | 32 бајта (256 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-384+` | SHA3-384 | 48 бајтова (384 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
| `+sha3-512+` | SHA3-512 | 64 бајта (512 бита) | Алгоритам је доступан у libgcrypt ≥ 1.7.0.
|===
Повратна вредност:
@@ -4326,6 +4316,11 @@ if (weechat_file_copy ("/tmp/test.txt", "/path/to/test2.txt"))
[NOTE]
Ова функција није доступна у API скриптовања.
[[util]]
=== Алати
Неке корисне функције.
==== file_compress
_WeeChat ≥ 3.7._
@@ -4346,9 +4341,7 @@ int weechat_file_compress (const char *from, const char *to,
* _to_: одредишни фајл
* _compressor_: компресор који треба да се користи, једно од:
** _gzip_: gzip компресија
// TRANSLATION MISSING
** _zstd_: zstandard компресија (available only if zstd was enabled when
WeeChat was compiled)
** _zstd_: zstandard компресија
* _compression_level_: ниво компресије, између 1 (брзо, ниска компресија) и
100 (споро, најбоља компресија)
@@ -4369,11 +4362,6 @@ if (weechat_file_compress ("/tmp/test.txt", "/tmp/test.txt.zst", "zstd", 50))
[NOTE]
Ова функција није доступна у API скриптовања.
[[util]]
=== Алати
Неке корисне функције.
==== util_timeval_cmp
Пореди две „timeval” структуре.
@@ -6521,10 +6509,9 @@ my_section_read_cb (const void *pointer, void *data,
{
/* ... */
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
return WEECHAT_CONFIG_READ_OK;
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
}
int
@@ -6614,7 +6601,7 @@ def config_new_section(config_file: str, name: str,
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
# пример
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -6633,7 +6620,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
# ...
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
@@ -6859,7 +6846,7 @@ struct t_config_option *option_enum =
# прототип
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
string_values: str, min: int, max: int,
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
default_value: str | None, value: str | None, null_value_allowed: int,
callback_check_value: str, callback_check_value_data: str,
callback_change: str, callback_change_data: str,
callback_delete: str, callback_delete_data: str) -> str: ...
@@ -9727,6 +9714,7 @@ struct t_hook *weechat_hook_process (const char *command,
void *callback_data);
----
Аргументи:
* _command_: команда која се покреће у дете процесу, URL _(WeeChat ≥ 0.3.7)_ или функција _(WeeChat ≥ 1.5)_ (погледајте испод)
@@ -9957,8 +9945,18 @@ struct t_hook *weechat_hook_process_hashtable (const char *command,
_/dev/null_.
|===
// TRANSLATION MISSING
For command "url:...", see available options in function <<_hook_url,hook_url>>.
За команду „url:...” су доступне следеће опције (за опис сваке опције погледајте `+man curl_easy_setopt+`):
include::{autogendir}/autogen_api_url_options.sr.adoc[tag=url_options]
[NOTE]
^(1)^ За опције типа „mask”, формат је: „вредност1+вредност2+вредност3”; за опције типа „list”, ставке листе морају да се раздвоје преломом линије (`\n`). +
^(2)^ Ако су доступне константе, оне морају да се користе као вредност опције.
За URL су дозвољене две додатне опције (стрингови) за улазни/излазни фајл:
* _file_in_: фајл који се чита и шаље URL адресама (post фајл)
* _file_out_: преузети URL/фајл се уписује у овај фајл (уместо на стандардни излаз)
Повратна вредност:
@@ -10118,152 +10116,6 @@ hook4 = weechat.hook_process_hashtable("sh",
20000, "my_process_cb", "")
----
// TRANSLATION MISSING
==== hook_url
_WeeChat ≥ 4.1.0._
URL transfer.
Прототип:
[source,c]
----
struct t_hook *weechat_hook_url (const char *url,
struct t_hashtable *options,
int timeout,
int (*callback)(const void *pointer,
void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output),
const void *callback_pointer,
void *callback_data);
----
Аргументи:
* _url_: URL
* _options_: options for URL transfer (see below); хеш табела се дуплира у функцији, тако да након овог позива безбедно можете да ослободите меморију коју заузима
* _timeout_: timeout for URL transfer (in milliseconds): after this timeout,
the transfer is stopped (0 means no timeout)
* _callback_: function called when the transfer has ended, arguments and return
value:
** _const void *pointer_: pointer
** _void *data_: pointer
** _const char *url_: URL
** _struct t_hashtable *options_: options
** _struct t_hashtable *output_: result (keys and values are strings), which may
contain the following keys:
*** _response_code_: HTTP response code
*** _headers_: HTTP headers in response
*** _output_: standard output (set only if _file_out_ was not set in options)
*** _error_: error message (set only in case of error)
** return value:
*** _WEECHAT_RC_OK_
*** _WEECHAT_RC_ERROR_
* _callback_pointer_: показивач који се прослеђује функцији повратног позива када је позове програм WeeChat
* _callback_data_: показивач који се прослеђује функцији повратног позива када је позове програм WeeChat; ако није NULL, алоцирала га је malloc (или нека слична функција) и аутоматски се ослобађа када се кука обрише
The following Curl options are available (see `+man curl_easy_setopt+` for
a description of each option):
include::{autogendir}/autogen_api_url_options.sr.adoc[tag=url_options]
[NOTE]
^(1)^ За опције типа „mask”, формат је: „вредност1+вредност2+вредност3”; за опције типа „list”, ставке листе морају да се раздвоје преломом линије (`\n`). +
^(2)^ Ако су доступне константе, оне морају да се користе као вредност опције.
These two extra options (strings) are allowed for input/output file:
[width="100%",cols="2,^1,7",options="header"]
|===
| Option | Type | Description
| file_in | string | фајл који се чита и шаље URL адресама (post фајл)
| file_out | string | преузети URL/фајл се уписује у овај фајл (уместо на стандардни излаз)
|===
Повратна вредност:
* показивач на нову куку, NULL у случају грешке
C пример:
[source,c]
----
int
my_url_cb (const void *pointer, void *data, const char *url,
struct t_hashtable *options, struct t_hashtable *output)
{
weechat_printf (NULL, "response_code: %s", weechat_hashtable_get (output, "response_code"));
weechat_printf (NULL, "headers: %s", weechat_hashtable_get (output, "headers"));
weechat_printf (NULL, "output: %s", weechat_hashtable_get (output, "output"));
weechat_printf (NULL, "error: %s", weechat_hashtable_get (output, "error"));
return WEECHAT_RC_OK;
}
/* example 1: output to a file */
struct t_hashtable *options_url1 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url1)
{
weechat_hashtable_set (options_url1, "file_out", "/tmp/weechat.org.html");
struct t_hook *my_url_hook = weechat_hook_url ("https://weechat.org/",
options_url1,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url1);
}
/* example 2: custom HTTP headers, output sent to callback */
struct t_hashtable *options_url2 = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (options_url2)
{
weechat_hashtable_set (options_url2, "httpheader",
"Header1: value1\n"
"Header2: value2");
struct t_hook *my_url_hook = weechat_hook_url ("http://localhost:8080/",
options_url2,
20000,
&my_url_cb, NULL, NULL);
weechat_hashtable_free (options_url2);
}
----
Скрипта (Python):
[source,python]
----
# прототип
def hook_url(url: str, options: Dict[str, str], timeout: int, callback: str, callback_data: str) -> str: ...
# пример
def my_url_cb(data: str, url: str, options: Dict[str, str], output: Dict[str, str]) -> int:
weechat.prnt("", "output: %s" % output)
return weechat.WEECHAT_RC_OK
# example 1: output to a file
hook1 = weechat.hook_url("https://weechat.org/",
{"file_out": "/tmp/weechat.org.html"},
20000, "my_url_cb", "")
# example 2: custom HTTP headers, output sent to callback
options = {
"httpheader": "\n".join([
"Header1: value1",
"Header2: value2",
]),
}
hook2 = weechat.hook_url("http://localhost:8080/", options, 20000, "my_url_cb", "")
----
==== hook_connect
_Ажурирано у верзијама 1.5, 2.0._
@@ -10441,7 +10293,7 @@ hook = weechat.hook_connect("", "my.server.org", 1234, 1, 0, "",
==== hook_line
_WeeChat ≥ 2.3, ажурирано у 3.7._
_WeeChat ≥ 2.3, ажурирано у 3.7, 4.1.0._
Качи се на линију која треба да се испише у бафер.
@@ -10497,14 +10349,16 @@ struct t_hook *weechat_hook_line (const char *buffer_type,
|===
| Кључ | Вредност (форматирани бафер) | Вредност (слободни бафер) | Примери
// TRANSLATION MISSING
| buffer
| Показивач на бафер.
| Показивач на бафер.
| Comma-separated list of buffer pointers.
| Comma-separated list of buffer pointers.
| `+0x1234abcd+`
// TRANSLATION MISSING
| buffer_name
| Име бафера.
| Име бафера.
| Comma-separated list of buffer names.
| Comma-separated list of buffer names.
| `+core.weechat+` +
`+irc.server.libera+` +
`+irc.libera.#weechat+`
@@ -10589,17 +10443,23 @@ struct t_hook *weechat_hook_line (const char *buffer_type,
|===
| Кључ | Дозвољена вредност (форматирани бафер) | Дозвољена вредност (слободни бафер) | Резултат
// TRANSLATION MISSING
| buffer
| Показивач на бафер са форматираним садржајем.
| Показивач на бафер са слободним садржајем.
| Линија се приказује у овом баферу. +
| Comma-separated list buffer pointers (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer pointers (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
Ако је вредност празна, линија се брише (тада се све остало у хеш табели
игнорише); наредне куке типа „line” се не позивају.
// TRANSLATION MISSING
| buffer_name
| Име бафера са форматираним садржајем.
| Име бафера са слободним садржајем.
| Линија се приказује у овом баферу. +
| Comma-separated list buffer names (with formatted content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| Comma-separated list buffer names (with free content)
(multiple buffers are supported only with WeeChat ≥ 4.1.0).
| The line is displayed on these buffers. +
Ако је и `buffer` постављено, вредност `+buffer_name+` има виши приоритет и она се користи. +
Ако је вредност празна, линија се брише (тада се све остало у хеш табели
игнорише); наредне куке типа „line” се не позивају.
@@ -18159,7 +18019,7 @@ for key in hash:
==== hdata_compare
_WeeChat ≥ 1.9, ажурирано у верзији 4.1.0._
_WeeChat ≥ 1.9._
Пореди hdata променљиву два објекта.
@@ -18175,8 +18035,7 @@ int weechat_hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2
* _hdata_: показивач на hdata
* _pointer1_: показивач на први објекат програма WeeChat/додатка
* _pointer2_: показивач на други објекат програма WeeChat/додатка
* _name_: назив променљиве или путања до назива променљиве; у случају низова, име може
бити „N|име” где је N индекс низа (који почиње од 0), на пример: „2|име”
* _name_: име променљиве; у случају низова, име може бити „N|име” где је N индекс низа (који почиње од 0), на пример: „2|име”
* _case_sensitive_: 1 за поређење стрингова које разликује величину слова, у супротном 0
Повратна вредност:
@@ -18192,12 +18051,8 @@ C пример:
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
weechat_printf (NULL, "comparison of buffer number = %d",
weechat_printf (NULL, "number comparison = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
weechat_printf (NULL, "comparison of number of lines = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
weechat_printf (NULL, "comparison of local variable = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
----
Скрипта (Python):
@@ -18211,9 +18066,7 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
weechat.prnt("", "бројно поређење = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
----
==== hdata_set
+1
View File
@@ -92,6 +92,7 @@ _клијенти_ су повезани са _релејем_ као што ј
[[command_handshake]]
=== handshake
// TRANSLATION MISSING
_WeeChat ≥ 2.9, ажурирано у верзијама 3.5, 4.0.0._
Извршава руковање између клијента и програма WeeChat: ово је у већини случајева неопходно како би се сазнале поставке сесије и припремила аутентификација командом _init_.
+72 -129
View File
@@ -129,6 +129,10 @@ WeeChat мора да се изгради са CMake.
| Logger додатак: компресија ротирајућих лог фајлова (gzip). +
Relay додатак: компресија порука (WeeChat -> клијент) са https://zlib.net/[zlib ^↗^^] (weechat протокол). +
Script додатак: читање индекс фајла репозиторијума (gzip).
| libzstd-dev | ≥ 0.8.1
| Logger додатак: компресија ротирајућих лог фајлова. +
Relay додатак: компресија порука (WeeChat -> клијент) са https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat протокол).
|===
[NOTE]
@@ -140,68 +144,26 @@ WeeChat мора да се изгради са CMake.
[width="100%", cols="5,^3,.^15", options="header"]
|===
| Пакет ^(1)^ | Верзија | Могућности
| {cpp} компајлер (pass:[g++ / clang++]) |
| Изградња и покретање тестова, JavaScript додатак.
| gettext |
| Интернационализација (превод порука; основни језик је енглески).
| ca-certificates |
| Сертификати за TLS везе.
| libzstd-dev | ≥ 0.8.1
| Logger додатак: компресија ротирајућих лог фајлова (zstandard). +
Relay додатак: компресија порука (WeeChat -> клијент) са https://facebook.github.io/zstd/[Zstandard ^↗^^] (weechat протокол).
| libaspell-dev / libenchant-dev |
| Spell додатак.
| python3-dev | ≥ 3.0
| Python додатак.
| libperl-dev |
| Perl додатак.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1
| Ruby додатак.
| liblua5.4-dev |
| Lua додатак.
| tcl-dev | ≥ 8.5
| Tcl додатак.
| guile-3.0-dev | ≥ 2.0
| Guile (scheme) додатак.
| libv8-dev | ≤ 3.24.3
| JavaScript додатак.
| php-dev | ≥ 7.0
| PHP додатак.
| libphp-embed | ≥ 7.0
| PHP додатак.
| libxml2-dev |
| PHP додатак.
| libargon2-dev |
| PHP додатак (ако је PHP ≥ 7.2).
| libsodium-dev |
| PHP додатак (ако је PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4
| Изградња man странице и документације.
| ruby-pygments.rb |
| Документација изградње.
| libcpputest-dev | ≥ 3.4
| Изградња и покретање тестова.
| Пакет ^(1)^ | Верзија | Могућности
| {cpp} компајлер (pass:[g++ / clang++]) | | Изградња и покретање тестова, JavaScript додатак.
| gettext | | Интернационализација (превод порука; основни језик је енглески).
| ca-certificates | | Сертификати за TLS везе.
| libaspell-dev / libenchant-dev | | Spell додатак.
| python3-dev | ≥ 3.0 | Python додатак.
| libperl-dev | | Perl додатак.
| ruby3.1, ruby3.1-dev | ≥ 1.9.1 | Ruby додатак.
| liblua5.4-dev | | Lua додатак.
| tcl-dev | ≥ 8.5 | Tcl додатак.
| guile-3.0-dev | ≥ 2.0 | Guile (scheme) додатак.
| libv8-dev | ≤ 3.24.3 | JavaScript додатак.
| php-dev | ≥ 7.0 | PHP додатак.
| libphp-embed | ≥ 7.0 | PHP додатак.
| libxml2-dev | | PHP додатак.
| libargon2-dev | | PHP додатак (ако је PHP ≥ 7.2).
| libsodium-dev | | PHP додатак (ако је PHP ≥ 7.2).
| asciidoctor | ≥ 1.5.4 | Изградња man странице и документације.
| ruby-pygments.rb | | Документација изградње.
| libcpputest-dev | ≥ 3.4 | Изградња и покретање тестова.
|===
[NOTE]
@@ -239,8 +201,7 @@ $ make install
Можете да користите опције за CMake, у формату: `-DОПЦИЈА=ВРЕДНОСТ`.
// TRANSLATION MISSING
List of available options:
Листа често коришћених опција:
[width="100%", cols="3m,3,3m,10", options="header"]
|===
@@ -294,10 +255,6 @@ List of available options:
| ENABLE_GUILE | `ON`, `OFF` | ON
| Компајлира <<scripting_plugins,Guile додатак>> (Scheme).
// TRANSLATION MISSING
| ENABLE_HEADLESS | `ON`, `OFF` | ON
| Compile headless binary.
| ENABLE_IRC | `ON`, `OFF` | ON
| Компајлира <<irc,IRC додатак>>.
@@ -356,10 +313,6 @@ List of available options:
| ENABLE_XFER | `ON`, `OFF` | ON
| Компајлира <<xfer,Xfer додатак>>.
// TRANSLATION MISSING
| ENABLE_ZSTD | `ON`, `OFF` | ON
| Enable https://facebook.github.io/zstd/[Zstandard ^↗^^] compression.
| ENABLE_TESTS | `ON`, `OFF` | OFF
| Компајлира тестове.
@@ -890,10 +843,6 @@ _nicklist_ трака садржи следеће подразумеване с
| buffer_short_name | `#test` | Кратко име текућег бафера.
| buflist2 | `1.weechat` | Листа бафера, друга ставка траке (погледајте опцију <<option_buflist.look.use_items,buflist.look.use_items>>).
| buflist3 | `1.weechat` | Листа бафера, трећа ставка траке (погледајте опцију <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist4 | `1.weechat` | List of buffers, fourth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
// TRANSLATION MISSING
| buflist5 | `1.weechat` | List of buffers, fifth bar item (see option <<option_buflist.look.use_items,buflist.look.use_items>>).
| fset | `+buflist.look.sort: …+` | Помоћ у вези тренутно изабране опције у fset баферу.
| irc_channel | `#test` | Име тренутног IRC канала.
| irc_host | `+user@host.com+` | Име тренутног IRC хоста.
@@ -1379,10 +1328,7 @@ _прозор_ је површина екрана која приказује б
[[buflist]]
=== Листа бафера
// TRANSLATION MISSING
Buflist додатак приказује листу бафера у ставки траке која се зове „buflist”
(four other bar items "buflist2", "buflist3", "buflist4" and "buflist5" are
available as well). +
Buflist додатак приказује листу бафера у ставки траке која се зове „buflist” (такође су доступне још две ставке траке „buflist2” и „buflist3”). +
Подразумевана трака „buflist” са овом ставком се креира током покретања програма.
[[buflist_commands]]
@@ -1513,15 +1459,6 @@ WeeChat нуди доста подразумеваних тастерских п
| kbd:[Ctrl+↓] | Позив наредне команде/поруке у глобалној историји (заједничкој за све бафере). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== Систем
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Тастер | Опис | Команда
| kbd:[Ctrl+z] | Суспендује WeeChat процес. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Бафери
@@ -1779,8 +1716,8 @@ kbd:[▼]: точкић доле
| kbd:[Ctrl+l] (`L`) | | Освежава опције и цео екран. | `+/fset -refresh+`
| | `$` | Освежава опције (маркиране опције остају маркиране). |
| | `$$` | Освежава опције (уклања се маркирање са свих опција). |
| kbd:[Alt+p] | `p` | Пребацује стање опција описа додатка (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | `v` | Пребацује стање видљивости траке помоћи. | `+/bar toggle fset+`
| kbd:[Alt+p] | | Пребацује стање опција описа додатка (`pass:[plugins.desc.*]`). | `+/mute /set fset.look.show_plugins_desc toggle+`
| kbd:[Alt+v] | | Пребацује стање видљивости траке помоћи. | `+/bar toggle fset+`
| | `s:x,y` | Сортира опције по пољима x,y (погледајте опцију <<option_fset.look.sort,fset.look.sort>>). | `+/mute /set fset.look.sort x,y+`
| | `s:` | Ресетује сортирање на подразумевану вредност (погледајте опцију <<option_fset.look.sort,fset.look.sort>>). | `+/mute /unset fset.look.sort+`
| | `w:xxx` | Извози опције у фајл „xxx”. | `+/fset -export xxx+`
@@ -1840,18 +1777,11 @@ kbd:[▼]: точкић доле
| kbd:[PgDn] | | Помера једну страну наниже. | `+/window page_down+`
| kbd:[Alt+i] | `i` | Инсталира скрипту. | `+/script install+`
| kbd:[Alt+r] | `r` | Брише скрипту. | `+/script remove+`
| kbd:[Alt+l] | `l` | Учитава скрипту. | `+/script load+`
// TRANSLATION MISSING
| kbd:[Alt+L] | `L` | Reload script. | `+/script reload+`
| kbd:[Alt+l] (`L`) | `l` | Учитава скрипту. | `+/script load+`
| kbd:[Alt+u] | `u` | Уклања скрипту из меморије. | `+/script unload+`
| kbd:[Alt+Shift+A] | `A` | Аутоучитавање скрипте. | `+/script toggleautoload+`
| kbd:[Alt+h] | `h` | Задржава/отпушта скрипту. | `+/script hold+`
| kbd:[Alt+v] | `v` | Преглед скрипте. | `+/script show+`
// TRANSLATION MISSING
| | `s:x,y` | Sort scripts by fields x,y (погледајте опцију <<option_script.look.sort,script.look.sort>>). |
| | `s:` | Ресетује сортирање на подразумевану вредност (погледајте опцију <<option_script.look.sort,script.look.sort>>). |
| | `$` | Освежава листу. |
| | `q` | Затвара бафер. | `+/buffer close+`
|===
[NOTE]
@@ -2181,9 +2111,13 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options]
На пример, ако желите да искључите истицања од „joe” и „mike” у текућем баферу:
----
/buffer setauto hotlist_max_level_nicks_add joe:2,mike:2
/buffer set hotlist_max_level_nicks_add joe:2,mike:2
----
[NOTE]
Особина бафера „hotlist_max_level_nicks” се не чува у конфигурацији. +
Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`.
[[highlights]]
=== Истицања
@@ -2207,9 +2141,13 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options]
Исти пример, који функционише само на текућем баферу:
----
/buffer setauto highlight_disable_regex <flash.*>
/buffer set highlight_disable_regex <flash.*>
----
[NOTE]
Особина бафера „highlight_disable_regex” се не чува у конфигурацији. +
Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`.
[[highlights_words]]
==== Додавање речи које се истичу
@@ -2251,9 +2189,13 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=charset_options]
На пример, да форсирате истицање свих порука у текућем баферу:
----
/buffer setauto highlight_regex .*
/buffer set highlight_regex .*
----
[NOTE]
Особина бафера „highlight_regex” се не чува у конфигурацији. +
Лако можете да је сачувате скриптом _buffer_autoset.py_: инсталирате је командом `+/script install buffer_autoset.py+`, а помоћ добијате са `+/help buffer_autoset+`.
[[buffer_logging]]
=== Логовање бафера
@@ -3065,31 +3007,30 @@ include::{autogendir}/autogen_user_options.sr.adoc[tag=sec_options]
[width="100%", cols="3m,6m,16", options="header"]
|===
| Одељак | Команда за контролу | Опис
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Дибаг ниво, за језгро и додатке (у одељку је могуће додавање/уклањање опција).
| startup | /set weechat.startup.* | Опције покретања програма.
| look | /set weechat.look.* | Изглед и осећај.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Алијаси боја (у одељку је могуће додавање/уклањање опција).
| color | /set weechat.color.* | Боје.
| completion | /set weechat.completion.* | Опције довршавања.
| history | /set weechat.history.* | Опције историје (команди и бафера).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Прокси опције.
| network | /set weechat.network.* | Мрежне/TLS опције.
| plugin | /set weechat.plugin.* | Опције додатака.
| signal | /set weechat.signal.* | Опције сигнала.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Опције трака.
| layout | <<command_weechat_layout,/layout>> | Распореди.
| buffer | <<command_weechat_buffer,/buffer setauto>> | Особине које се аутоматски примењују на бафере када се отварају.
| notify | <<command_weechat_buffer,/buffer notify>> | Нивои обавештавања за бафере (у одељку је могуће додавање/уклањање опција).
| filter | <<command_weechat_filter,/filter>> | Филтери.
| key | <<command_weechat_key,/key>> | Тастери у подразумеваном контексту.
| key_search | <<command_weechat_key,/key>> | Тастери у search контексту.
| key_cursor | <<command_weechat_key,/key>> | Тастери у cursor контексту.
| key_mouse | <<command_weechat_key,/key>> | Тастери у mouse конексту.
| Одељак | Команда за контролу | Опис
| debug | <<command_weechat_debug,/debug set>> +
/set weechat.debug.* | Дибаг ниво, за језгро и додатке (у одељку је могуће додавање/уклањање опција).
| startup | /set weechat.startup.* | Опције покретања програма.
| look | /set weechat.look.* | Изглед и осећај.
| palette | <<command_weechat_color,/color alias>> +
/set weechat.palette.* | Алијаси боја (у одељку је могуће додавање/уклањање опција).
| color | /set weechat.color.* | Боје.
| completion | /set weechat.completion.* | Опције довршавања.
| history | /set weechat.history.* | Опције историје (команди и бафера).
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Прокси опције.
| network | /set weechat.network.* | Мрежне/TLS опције.
| plugin | /set weechat.plugin.* | Опције додатака.
| signal | /set weechat.signal.* | Опције сигнала.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Опције трака.
| layout | <<command_weechat_layout,/layout>> | Распореди.
| notify | <<command_weechat_buffer,/buffer notify>> | Нивои обавештавања за бафере (у одељку је могуће додавање/уклањање опција).
| filter | <<command_weechat_filter,/filter>> | Филтери.
| key | <<command_weechat_key,/key>> | Тастери у подразумеваном контексту.
| key_search | <<command_weechat_key,/key>> | Тастери у search контексту.
| key_cursor | <<command_weechat_key,/key>> | Тастери у cursor контексту.
| key_mouse | <<command_weechat_key,/key>> | Тастери у mouse конексту.
|===
Опције:
@@ -3931,7 +3872,7 @@ CTCP одговори се израчунавају (погледајте ком
[width="100%", cols="2,4,8", options="header"]
|===
| Променљива | Опис | Вредност/пример
| `+${clientinfo}+` | Листа подржаних CTCP | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| `+${clientinfo}+` | Листа подржаних CTCP | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| `+${version}+` | Верзија програма WeeChat | `+4.1.0-dev+`
| `+${versiongit}+` | WeeChat верзија + Git верзија ^(1)^ | `+4.1.0-dev (git: v4.0.0-51-g8f98b922a)+`
| `+${git}+` | Git верзија ^(1)^ | `+v4.0.0-51-g8f98b922a+`
@@ -3952,9 +3893,11 @@ CTCP одговори се израчунавају (погледајте ком
[width="100%", cols="2,4,8", options="header"]
|===
| CTCP | Формат одговора | Пример
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO PING SOURCE TIME VERSION+`
| CLIENTINFO | `+${clientinfo}+` | `+ACTION DCC CLIENTINFO FINGER PING SOURCE TIME USERINFO VERSION+`
| FINGER | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
| SOURCE | `+${download}+` | `+https://weechat.org/download/+`
| TIME | `+${time}+` | `+Суб, 08 Јул 2023 21:11:19 +0200+`
| USERINFO | `+${username} (${realname})+` | `+име (Пера Перић)+`
| VERSION | `+WeeChat ${version}+` | `+WeeChat 4.1.0-dev+`
|===
+56 -52
View File
@@ -17,11 +17,6 @@
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
# Check for programs xgettext, msgmerge and msgfmt
find_program(XGETTEXT_EXECUTABLE xgettext REQUIRED)
find_program(MSGMERGE_EXECUTABLE msgmerge REQUIRED)
find_program(MSGFMT_EXECUTABLE msgfmt REQUIRED)
set(PO_FILES
cs.po
de.po
@@ -44,61 +39,70 @@ set(POT_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${POT_FILE}")
include(srcfiles.cmake)
# Create PO template file weechat.pot
set(SRC_FILES)
set(POT_DEPENDS)
# Looking for xgettext, msgmerge and msgfmt
find_program(XGETTEXT_EXECUTABLE xgettext)
find_program(MSGMERGE_EXECUTABLE msgmerge)
find_program(MSGFMT_EXECUTABLE msgfmt)
foreach(srcfile ${WEECHAT_SOURCES})
set(SRC_FILES ${SRC_FILES} ${srcfile})
set(POT_DEPENDS ${POT_DEPENDS} "${CMAKE_SOURCE_DIR}/${srcfile}")
endforeach()
if(XGETTEXT_EXECUTABLE AND MSGMERGE_EXECUTABLE AND MSGFMT_EXECUTABLE)
add_custom_command(
OUTPUT "${POT_FILE_PATH}"
COMMAND "${XGETTEXT_EXECUTABLE}"
ARGS -o "${POT_FILE_PATH}" --add-comments='TRANSLATORS:' --keyword='_' --keyword='weechat_gettext' --keyword='N_' --keyword='NG_:1,2' --keyword='weechat_ngettext:1,2' --no-location --from-code=UTF-8 --directory="${CMAKE_SOURCE_DIR}" --package-name='WeeChat' --package-version=${VERSION} --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder='NAME' ${SRC_FILES}
DEPENDS ${POT_DEPENDS}
COMMENT "Generating ${POT_FILE}"
)
# Create PO template file weechat.pot
set(SRC_FILES)
set(POT_DEPENDS)
set(MO_FILES)
set(UPDATE_PO_TARGETS)
foreach(pofile ${PO_FILES})
get_filename_component(polang ${pofile} NAME_WE)
foreach(srcfile ${WEECHAT_SOURCES})
set(SRC_FILES ${SRC_FILES} ${srcfile})
set(POT_DEPENDS ${POT_DEPENDS} "${CMAKE_SOURCE_DIR}/${srcfile}")
endforeach()
# Compile .po files in build directory (to binary .mo files)
set(modir "${CMAKE_CURRENT_BINARY_DIR}/${polang}/LC_MESSAGES")
file(MAKE_DIRECTORY "${modir}")
set(mofile "${modir}/${PROJECT_NAME}.mo")
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}"
DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
COMMENT "Compiling ${polang}.po"
OUTPUT "${POT_FILE_PATH}"
COMMAND "${XGETTEXT_EXECUTABLE}"
ARGS -o "${POT_FILE_PATH}" --add-comments='TRANSLATORS:' --keyword='_' --keyword='weechat_gettext' --keyword='N_' --keyword='NG_:1,2' --keyword='weechat_ngettext:1,2' --no-location --from-code=UTF-8 --directory="${CMAKE_SOURCE_DIR}" --package-name='WeeChat' --package-version=${VERSION} --msgid-bugs-address=${BUGS_ADDRESS} --copyright-holder='NAME' ${SRC_FILES}
DEPENDS ${POT_DEPENDS}
COMMENT "Generating ${POT_FILE}"
)
# Update .po files in source directory (if needed)
set(MO_FILES)
set(UPDATE_PO_TARGETS)
foreach(pofile ${PO_FILES})
get_filename_component(polang ${pofile} NAME_WE)
# Compile .po files in build directory (to binary .mo files)
set(modir "${CMAKE_CURRENT_BINARY_DIR}/${polang}/LC_MESSAGES")
file(MAKE_DIRECTORY "${modir}")
set(mofile "${modir}/${PROJECT_NAME}.mo")
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}"
DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
COMMENT "Compiling ${polang}.po"
)
# Update .po files in source directory (if needed)
add_custom_target(
update-${pofile}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --previous --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" "${POT_FILE_PATH}"
COMMENT "Updating ${polang}.po"
)
set(UPDATE_PO_TARGETS ${UPDATE_PO_TARGETS} update-${pofile})
install(FILES "${mofile}" DESTINATION "${LOCALEDIR}/${polang}/LC_MESSAGES")
set(MO_FILES ${MO_FILES} ${mofile})
endforeach()
add_custom_target(translations ALL DEPENDS ${MO_FILES})
# Update weechat.pot in source directory (if needed)
add_custom_target(
update-${pofile}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --previous --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" "${POT_FILE_PATH}"
COMMENT "Updating ${polang}.po"
update-${POT_FILE}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${POT_FILE}" "${POT_FILE_PATH}"
COMMENT "Updating ${POT_FILE}"
)
set(UPDATE_PO_TARGETS ${UPDATE_PO_TARGETS} update-${pofile})
install(FILES "${mofile}" DESTINATION "${LOCALEDIR}/${polang}/LC_MESSAGES")
set(MO_FILES ${MO_FILES} ${mofile})
endforeach()
# Update all .po and weechat.pot in source directory (if needed)
add_custom_target(update-po DEPENDS update-${POT_FILE} ${UPDATE_PO_TARGETS})
add_custom_target(translations ALL DEPENDS ${MO_FILES})
# Update weechat.pot in source directory (if needed)
add_custom_target(
update-${POT_FILE}
COMMAND "${MSGMERGE_EXECUTABLE}" --quiet --update --backup=none "${CMAKE_CURRENT_SOURCE_DIR}/${POT_FILE}" "${POT_FILE_PATH}"
COMMENT "Updating ${POT_FILE}"
)
# Update all .po and weechat.pot in source directory (if needed)
add_custom_target(update-po DEPENDS update-${POT_FILE} ${UPDATE_PO_TARGETS})
endif()
+129 -497
View File
File diff suppressed because it is too large Load Diff
+373 -614
View File
File diff suppressed because it is too large Load Diff
+133 -497
View File
File diff suppressed because it is too large Load Diff
+156 -576
View File
File diff suppressed because it is too large Load Diff
+95 -444
View File
File diff suppressed because it is too large Load Diff
+140 -500
View File
File diff suppressed because it is too large Load Diff
+138 -548
View File
File diff suppressed because it is too large Load Diff
+141 -659
View File
File diff suppressed because it is too large Load Diff
+141 -504
View File
File diff suppressed because it is too large Load Diff
+98 -486
View File
File diff suppressed because it is too large Load Diff
+96 -451
View File
File diff suppressed because it is too large Load Diff
+148 -727
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -35,8 +35,6 @@ SET(WEECHAT_SOURCES
./src/core/hook/wee-hook-signal.h
./src/core/hook/wee-hook-timer.c
./src/core/hook/wee-hook-timer.h
./src/core/hook/wee-hook-url.c
./src/core/hook/wee-hook-url.h
./src/core/wee-arraylist.c
./src/core/wee-arraylist.h
./src/core/wee-backtrace.c
@@ -91,8 +89,6 @@ SET(WEECHAT_SOURCES
./src/core/wee-signal.h
./src/core/wee-string.c
./src/core/wee-string.h
./src/core/wee-sys.c
./src/core/wee-sys.h
./src/core/wee-upgrade.c
./src/core/wee-upgrade-file.c
./src/core/wee-upgrade-file.h
@@ -183,8 +179,6 @@ SET(WEECHAT_SOURCES
./src/plugins/buflist/buflist.c
./src/plugins/buflist/buflist-command.c
./src/plugins/buflist/buflist-command.h
./src/plugins/buflist/buflist-completion.c
./src/plugins/buflist/buflist-completion.h
./src/plugins/buflist/buflist-config.c
./src/plugins/buflist/buflist-config.h
./src/plugins/buflist/buflist.h
+136 -577
View File
File diff suppressed because it is too large Load Diff
+80 -428
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -47,7 +47,6 @@ set(LIB_CORE_SRC
wee-secure-config.c wee-secure-config.h
wee-signal.c wee-signal.h
wee-string.c wee-string.h
wee-sys.c wee-sys.h
wee-upgrade.c wee-upgrade.h
wee-upgrade-file.c wee-upgrade-file.h
wee-url.c wee-url.h
@@ -72,7 +71,6 @@ set(LIB_CORE_SRC
hook/wee-hook-process.c hook/wee-hook-process.h
hook/wee-hook-signal.c hook/wee-hook-signal.h
hook/wee-hook-timer.c hook/wee-hook-timer.h
hook/wee-hook-url.c hook/wee-hook-url.h
)
# Check for flock support
@@ -91,9 +89,7 @@ include_directories(${GNUTLS_INCLUDE_PATH})
include_directories(${CURL_INCLUDE_DIRS})
if(ENABLE_ZSTD)
include_directories(${ZSTD_INCLUDE_DIRS})
endif()
include_directories(${ZSTD_INCLUDE_DIRS})
include_directories("${CMAKE_BINARY_DIR}")
add_library(weechat_core STATIC ${LIB_CORE_SRC})
+2 -3
View File
@@ -101,7 +101,6 @@ int
hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
int rc, hook_matching, length;
char *command2;
const char *ptr_string, *ptr_command;
@@ -150,13 +149,13 @@ hook_command_run_exec (struct t_gui_buffer *buffer, const char *command)
if (hook_matching)
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
rc = (HOOK_COMMAND_RUN(ptr_hook, callback)) (
ptr_hook->callback_pointer,
ptr_hook->callback_data,
buffer,
ptr_command);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (rc == WEECHAT_RC_OK_EAT)
{
if (command2)
+2 -3
View File
@@ -364,7 +364,6 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
struct t_hook *ptr_hook, *next_hook;
struct t_hook *hook_plugin, *hook_other_plugin, *hook_other_plugin2;
struct t_hook *hook_incomplete_command;
struct t_hook_exec_cb hook_exec_cb;
char **argv, **argv_eol;
const char *ptr_command_name;
int argc, rc, length_command_name, allow_incomplete_commands;
@@ -501,7 +500,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
else
{
/* execute the command! */
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running++;
rc = (int) (HOOK_COMMAND(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
@@ -509,7 +508,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
argc,
argv,
argv_eol);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running--;
if (rc == WEECHAT_RC_ERROR)
rc = HOOK_COMMAND_EXEC_ERROR;
else
+2 -3
View File
@@ -107,7 +107,6 @@ hook_completion_exec (struct t_weechat_plugin *plugin,
struct t_gui_completion *completion)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
const char *pos;
char *item;
@@ -135,14 +134,14 @@ hook_completion_exec (struct t_weechat_plugin *plugin,
&& !ptr_hook->running
&& (strcmp (HOOK_COMPLETION(ptr_hook, completion_item), item) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
(void) (HOOK_COMPLETION(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
completion_item,
buffer,
completion);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
}
ptr_hook = next_hook;
+2 -3
View File
@@ -98,7 +98,6 @@ void
hook_config_exec (const char *option, const char *value)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
hook_exec_start ();
@@ -112,13 +111,13 @@ hook_config_exec (const char *option, const char *value)
&& (!HOOK_CONFIG(ptr_hook, option)
|| (string_match (option, HOOK_CONFIG(ptr_hook, option), 0))))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
(void) (HOOK_CONFIG(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
option,
value);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
}
ptr_hook = next_hook;
+1 -1
View File
@@ -270,7 +270,7 @@ hook_connect_free_data (struct t_hook *hook)
if (HOOK_CONNECT(hook, child_pid) > 0)
{
kill (HOOK_CONNECT(hook, child_pid), SIGKILL);
hook_schedule_clean_process (HOOK_CONNECT(hook, child_pid));
waitpid (HOOK_CONNECT(hook, child_pid), NULL, 0);
HOOK_CONNECT(hook, child_pid) = 0;
}
if (HOOK_CONNECT(hook, child_read) != -1)
+3 -4
View File
@@ -203,9 +203,8 @@ hook_fd (struct t_weechat_plugin *plugin, int fd, int flag_read,
void
hook_fd_exec ()
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
int i, num_fd, timeout, ready, found;
struct t_hook *ptr_hook, *next_hook;
if (!weechat_hooks[HOOK_TYPE_FD])
return;
@@ -280,12 +279,12 @@ hook_fd_exec ()
}
if (found)
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
(void) (HOOK_FD(ptr_hook, callback)) (
ptr_hook->callback_pointer,
ptr_hook->callback_data,
HOOK_FD(ptr_hook, fd));
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
}
}
+4 -5
View File
@@ -153,7 +153,6 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
struct t_hashtable *hashtable_focus2)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct t_hashtable *hashtable1, *hashtable2, *hashtable_ret;
const char *focus1_chat, *focus1_bar_item_name, *keys;
char **list_keys, *new_key;
@@ -186,12 +185,12 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
&& (strcmp (HOOK_FOCUS(ptr_hook, area), focus1_bar_item_name) == 0))))
{
/* run callback for focus #1 */
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
hashtable_ret = (HOOK_FOCUS(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
hashtable1);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (hashtable_ret)
{
if (hashtable_ret != hashtable1)
@@ -210,12 +209,12 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
/* run callback for focus #2 */
if (hashtable2)
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
hashtable_ret = (HOOK_FOCUS(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
hashtable2);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (hashtable_ret)
{
if (hashtable_ret != hashtable2)
+2 -3
View File
@@ -102,7 +102,6 @@ struct t_hdata *
hook_hdata_get (struct t_weechat_plugin *plugin, const char *hdata_name)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct t_hdata *value;
/* make C compiler happy */
@@ -129,12 +128,12 @@ hook_hdata_get (struct t_weechat_plugin *plugin, const char *hdata_name)
&& !ptr_hook->running
&& (strcmp (HOOK_HDATA(ptr_hook, hdata_name), hdata_name) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
value = (HOOK_HDATA(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
HOOK_HDATA(ptr_hook, hdata_name));
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
hook_exec_end ();
return value;
+2 -3
View File
@@ -129,7 +129,6 @@ int
hook_hsignal_send (const char *signal, struct t_hashtable *hashtable)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
int rc;
rc = WEECHAT_RC_OK;
@@ -145,13 +144,13 @@ hook_hsignal_send (const char *signal, struct t_hashtable *hashtable)
&& !ptr_hook->running
&& (hook_hsignal_match (signal, ptr_hook)))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
rc = (HOOK_HSIGNAL(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
signal,
hashtable);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (rc == WEECHAT_RC_OK_EAT)
break;
+2 -3
View File
@@ -106,7 +106,6 @@ hook_info_get_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
struct t_hashtable *hashtable)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct t_hashtable *value;
/* make C compiler happy */
@@ -126,13 +125,13 @@ hook_info_get_hashtable (struct t_weechat_plugin *plugin, const char *info_name,
&& !ptr_hook->running
&& (strcmp (HOOK_INFO_HASHTABLE(ptr_hook, info_name), info_name) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
value = (HOOK_INFO_HASHTABLE(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
info_name,
hashtable);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
hook_exec_end ();
return value;
+2 -3
View File
@@ -105,7 +105,6 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
char *value;
/* make C compiler happy */
@@ -125,13 +124,13 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name,
&& !ptr_hook->running
&& (strcmp (HOOK_INFO(ptr_hook, info_name), info_name) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
value = (HOOK_INFO(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
info_name,
arguments);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
hook_exec_end ();
return value;
+2 -3
View File
@@ -106,7 +106,6 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
void *pointer, const char *arguments)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct t_infolist *value;
/* make C compiler happy */
@@ -126,14 +125,14 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name,
&& !ptr_hook->running
&& (strcmp (HOOK_INFOLIST(ptr_hook, infolist_name), infolist_name) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
value = (HOOK_INFOLIST(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
infolist_name,
pointer,
arguments);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
hook_exec_end ();
return value;
+54 -11
View File
@@ -27,6 +27,7 @@
#include <string.h>
#include "../weechat.h"
#include "../wee-arraylist.h"
#include "../wee-hashtable.h"
#include "../wee-hook.h"
#include "../wee-infolist.h"
@@ -121,18 +122,31 @@ hook_line (struct t_weechat_plugin *plugin, const char *buffer_type,
* Executes a line hook and updates the line data.
*/
void
struct t_arraylist *
hook_line_exec (struct t_gui_line *line)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct t_hashtable *hashtable, *hashtable2;
char str_value[128], *str_tags;
if (!weechat_hooks[HOOK_TYPE_LINE])
return;
struct t_arraylist *buffers;
struct t_gui_buffer *ptr_buffer;
char str_value[128], *str_tags, **str_buffers;
int i, size;
hashtable = NULL;
buffers = NULL;
str_buffers = NULL;
buffers = arraylist_new (16, 0, 0, NULL, NULL, NULL, NULL);
if (!buffers)
goto end;
arraylist_add (buffers, line->data->buffer);
if (!weechat_hooks[HOOK_TYPE_LINE])
goto end;
str_buffers = string_dyn_alloc (256);
if (!str_buffers)
goto end;
hook_exec_start ();
@@ -162,8 +176,28 @@ hook_line_exec (struct t_gui_line *line)
if (!hashtable)
break;
}
HASHTABLE_SET_POINTER("buffer", line->data->buffer);
HASHTABLE_SET_STR("buffer_name", line->data->buffer->full_name);
size = arraylist_size (buffers);
/* build list of buffer pointers */
string_dyn_copy (str_buffers, NULL);
for (i = 0; i < size; i++)
{
if (i > 0)
string_dyn_concat (str_buffers, ",", -1);
snprintf (str_value, sizeof (str_value),
"0x%lx", (unsigned long)(arraylist_get (buffers, i)));
string_dyn_concat (str_buffers, str_value, -1);
}
HASHTABLE_SET_STR("buffer", *str_buffers);
/* build list of buffer names */
string_dyn_copy (str_buffers, NULL);
for (i = 0; i < size; i++)
{
if (i > 0)
string_dyn_concat (str_buffers, ",", -1);
ptr_buffer = (struct t_gui_buffer *)arraylist_get (buffers, i);
string_dyn_concat (str_buffers, ptr_buffer->full_name, -1);
}
HASHTABLE_SET_STR("buffer_name", *str_buffers);
HASHTABLE_SET_STR("buffer_type",
gui_buffer_type_string[line->data->buffer->type]);
HASHTABLE_SET_INT("y", line->data->y);
@@ -183,16 +217,16 @@ hook_line_exec (struct t_gui_line *line)
HASHTABLE_SET_STR_NOT_NULL("message", line->data->message);
/* run callback */
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
hashtable2 = (HOOK_LINE(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
hashtable);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (hashtable2)
{
gui_line_hook_update (line, hashtable, hashtable2);
gui_line_hook_update (line, buffers, hashtable, hashtable2);
hashtable_free (hashtable2);
if (!line->data->buffer)
break;
@@ -204,8 +238,17 @@ hook_line_exec (struct t_gui_line *line)
hook_exec_end ();
end:
if (hashtable)
hashtable_free (hashtable);
if (str_buffers)
string_dyn_free (str_buffers, 1);
if (line->data->buffer && buffers && (arraylist_size (buffers) == 0))
arraylist_add (buffers, line->data->buffer);
return buffers;
}
/*
+1 -1
View File
@@ -51,7 +51,7 @@ extern struct t_hook *hook_line (struct t_weechat_plugin *plugin,
t_hook_callback_line *callback,
const void *callback_pointer,
void *callback_data);
extern void hook_line_exec (struct t_gui_line *line);
extern struct t_arraylist *hook_line_exec (struct t_gui_line *line);
extern void hook_line_free_data (struct t_hook *hook);
extern int hook_line_add_to_infolist (struct t_infolist_item *item,
struct t_hook *hook);
+2 -3
View File
@@ -100,7 +100,6 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
const char *modifier_data, const char *string)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
char *new_msg, *message_modified;
/* make C compiler happy */
@@ -126,14 +125,14 @@ hook_modifier_exec (struct t_weechat_plugin *plugin, const char *modifier,
&& (string_strcasecmp (HOOK_MODIFIER(ptr_hook, modifier),
modifier) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
new_msg = (HOOK_MODIFIER(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
modifier,
modifier_data,
message_modified);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
/* empty string returned => message dropped */
if (new_msg && !new_msg[0])
+2 -3
View File
@@ -121,7 +121,6 @@ void
hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
char *prefix_no_color, *message_no_color;
if (!weechat_hooks[HOOK_TYPE_PRINT])
@@ -162,7 +161,7 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
HOOK_PRINT(ptr_hook, tags_array))))
{
/* run callback */
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
(void) (HOOK_PRINT(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
@@ -173,7 +172,7 @@ hook_print_exec (struct t_gui_buffer *buffer, struct t_gui_line *line)
(int)line->data->displayed, (int)line->data->highlight,
(HOOK_PRINT(ptr_hook, strip_colors)) ? prefix_no_color : line->data->prefix,
(HOOK_PRINT(ptr_hook, strip_colors)) ? message_no_color : line->data->message);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
}
ptr_hook = next_hook;
+6 -8
View File
@@ -278,9 +278,7 @@ hook_process_child (struct t_hook *hook_process)
{
ptr_url++;
}
rc = weeurl_download (ptr_url,
HOOK_PROCESS(hook_process, options),
NULL); /* output */
rc = weeurl_download (ptr_url, HOOK_PROCESS(hook_process, options));
}
else if (strncmp (HOOK_PROCESS(hook_process, command), "func:", 5) == 0)
{
@@ -598,11 +596,12 @@ hook_process_timer_cb (const void *pointer, void *data, int remaining_calls)
if (weechat_debug_core >= 1)
{
gui_chat_printf (NULL,
_("End of command '%s', timeout reached (%.3fs)"),
_("End of command '%s', timeout reached (%.1fs)"),
HOOK_PROCESS(hook_process, command),
((float)HOOK_PROCESS(hook_process, timeout)) / 1000);
}
kill (HOOK_PROCESS(hook_process, child_pid), SIGKILL);
usleep (1000);
unhook (hook_process);
}
else
@@ -793,7 +792,6 @@ void
hook_process_exec ()
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
hook_exec_start ();
@@ -806,9 +804,9 @@ hook_process_exec ()
&& !ptr_hook->running
&& (HOOK_PROCESS(ptr_hook, child_pid) == 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
hook_process_run (ptr_hook);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
}
ptr_hook = next_hook;
@@ -862,7 +860,7 @@ hook_process_free_data (struct t_hook *hook)
if (HOOK_PROCESS(hook, child_pid) > 0)
{
kill (HOOK_PROCESS(hook, child_pid), SIGKILL);
hook_schedule_clean_process (HOOK_PROCESS(hook, child_pid));
waitpid (HOOK_PROCESS(hook, child_pid), NULL, 0);
HOOK_PROCESS(hook, child_pid) = 0;
}
if (HOOK_PROCESS(hook, child_read[HOOK_PROCESS_STDIN]) != -1)
+2 -3
View File
@@ -129,7 +129,6 @@ int
hook_signal_send (const char *signal, const char *type_data, void *signal_data)
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
int rc;
rc = WEECHAT_RC_OK;
@@ -145,14 +144,14 @@ hook_signal_send (const char *signal, const char *type_data, void *signal_data)
&& !ptr_hook->running
&& hook_signal_match (signal, ptr_hook))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
rc = (HOOK_SIGNAL(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
signal,
type_data,
signal_data);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (rc == WEECHAT_RC_OK_EAT)
break;
+3 -4
View File
@@ -302,9 +302,8 @@ end:
void
hook_timer_exec ()
{
struct t_hook *ptr_hook, *next_hook;
struct t_hook_exec_cb hook_exec_cb;
struct timeval tv_time;
struct t_hook *ptr_hook, *next_hook;
if (!weechat_hooks[HOOK_TYPE_TIMER])
return;
@@ -325,13 +324,13 @@ hook_timer_exec ()
&& (util_timeval_cmp (&HOOK_TIMER(ptr_hook, next_exec),
&tv_time) <= 0))
{
hook_callback_start (ptr_hook, &hook_exec_cb);
ptr_hook->running = 1;
(void) (HOOK_TIMER(ptr_hook, callback))
(ptr_hook->callback_pointer,
ptr_hook->callback_data,
(HOOK_TIMER(ptr_hook, remaining_calls) > 0) ?
HOOK_TIMER(ptr_hook, remaining_calls) - 1 : -1);
hook_callback_end (ptr_hook, &hook_exec_cb);
ptr_hook->running = 0;
if (!ptr_hook->deleted)
{
HOOK_TIMER(ptr_hook, last_exec).tv_sec = tv_time.tv_sec;
-461
View File
@@ -1,461 +0,0 @@
/*
* wee-hook-url.c - WeeChat URL hook
*
* Copyright (C) 2023 Sébastien Helleu <flashcode@flashtux.org>
*
* 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/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
#include <poll.h>
#include <fcntl.h>
#include <errno.h>
#include <pthread.h>
#include "../weechat.h"
#include "../wee-hashtable.h"
#include "../wee-hook.h"
#include "../wee-infolist.h"
#include "../wee-log.h"
#include "../wee-string.h"
#include "../wee-url.h"
#include "../../gui/gui-chat.h"
#include "../../plugins/plugin.h"
/*
* Returns description of hook.
*
* Note: result must be freed after use.
*/
char *
hook_url_get_description (struct t_hook *hook)
{
char str_desc[1024];
snprintf (str_desc, sizeof (str_desc),
"URL: \"%s\", thread id: %d",
HOOK_URL(hook, url),
0);
return strdup (str_desc);
}
/*
* Displays keys and values of a hashtable.
*/
void
hook_url_hashtable_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
/* make C compiler happy */
(void) data;
(void) hashtable;
gui_chat_printf (NULL, " %s: \"%s\"",
(const char *)key,
(const char *)value);
}
/*
* Runs callback of url hook.
*/
void
hook_url_run_callback (struct t_hook *hook)
{
if (url_debug)
{
gui_chat_printf (NULL, "Running hook_url callback for URL \"%s\":",
HOOK_URL(hook, url));
gui_chat_printf (NULL, " options:");
hashtable_map (HOOK_URL(hook, options), &hook_url_hashtable_map_cb, NULL);
gui_chat_printf (NULL, " output:");
hashtable_map (HOOK_URL(hook, output), &hook_url_hashtable_map_cb, NULL);
}
(void) (HOOK_URL(hook, callback))
(hook->callback_pointer,
hook->callback_data,
HOOK_URL(hook, url),
HOOK_URL(hook, options),
HOOK_URL(hook, output));
}
/*
* Thread cleanup function: mark thread as not running any more.
*/
void
hook_url_thread_cleanup (void *hook_pointer)
{
struct t_hook *hook;
hook = (struct t_hook *)hook_pointer;
HOOK_URL(hook, thread_running) = 0;
}
/*
* URL transfer (in a separate thread).
*/
void *
hook_url_transfer_thread (void *hook_pointer)
{
struct t_hook *hook;
int url_rc;
char str_error_code[12];
hook = (struct t_hook *)hook_pointer;
pthread_cleanup_push (&hook_url_thread_cleanup, hook);
url_rc = weeurl_download (HOOK_URL(hook, url),
HOOK_URL(hook, options),
HOOK_URL(hook, output));
if (url_rc != 0)
{
snprintf (str_error_code, sizeof (str_error_code), "%d", url_rc);
hashtable_set (HOOK_URL(hook, output), "error_code", str_error_code);
}
pthread_cleanup_pop (1);
pthread_exit (NULL);
}
/*
* Checks if thread is still alive.
*/
int
hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_hook *hook;
const char *ptr_error;
char str_error[1024], str_error_code[12];
/* make C compiler happy */
(void) data;
(void) remaining_calls;
hook = (struct t_hook *)pointer;
if (hook->deleted)
return WEECHAT_RC_OK;
if (!HOOK_URL(hook, thread_running))
{
hook_url_run_callback (hook);
ptr_error = hashtable_get (HOOK_URL(hook, output), "error");
if ((weechat_debug_core >= 1) && ptr_error && ptr_error[0])
{
gui_chat_printf (
NULL,
_("%sURL transfer error: %s (URL: \"%s\")"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
ptr_error,
HOOK_URL(hook, url));
}
unhook (hook);
return WEECHAT_RC_OK;
}
if (remaining_calls == 0)
{
if (!hashtable_has_key (HOOK_URL(hook, output), "error_code"))
{
snprintf (str_error, sizeof (str_error),
"transfer timeout reached (%.3fs)",
((float)HOOK_URL(hook, timeout)) / 1000);
snprintf (str_error_code, sizeof (str_error_code), "6");
hashtable_set (HOOK_URL(hook, output), "error", str_error);
hashtable_set (HOOK_URL(hook, output), "error_code", str_error_code);
}
hook_url_run_callback (hook);
if (weechat_debug_core >= 1)
{
gui_chat_printf (
NULL,
_("End of URL transfer '%s', timeout reached (%.3fs)"),
HOOK_URL(hook, url),
((float)HOOK_URL(hook, timeout)) / 1000);
}
pthread_cancel (HOOK_URL(hook, thread_id));
usleep (1000);
unhook (hook);
}
return WEECHAT_RC_OK;
}
/*
* Starts transfer for an URL hook.
*/
void
hook_url_transfer (struct t_hook *hook)
{
int rc, timeout, max_calls;
long interval;
char str_error[1024], str_error_code[12], str_error_code_pthread[12];
HOOK_URL(hook, thread_running) = 1;
/* create thread */
rc = pthread_create (&(HOOK_URL(hook, thread_id)), NULL,
&hook_url_transfer_thread, hook);
if (rc != 0)
{
snprintf (str_error, sizeof (str_error),
"error calling pthread_create (%d)", rc);
snprintf (str_error_code, sizeof (str_error_code), "5");
snprintf (str_error_code_pthread, sizeof (str_error_code_pthread),
"%d", rc);
hashtable_set (HOOK_URL(hook, output), "error", str_error);
hashtable_set (HOOK_URL(hook, output), "error_code", str_error_code);
hashtable_set (HOOK_URL(hook, output), "error_code_pthread",
str_error_code_pthread);
hook_url_run_callback (hook);
if (weechat_debug_core >= 1)
{
gui_chat_printf (NULL,
_("%sError running thread in hook_url: %s (URL: \"%s\")"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
strerror (rc),
HOOK_URL(hook, url));
}
unhook (hook);
return;
}
/* main thread */
HOOK_URL(hook, thread_created) = 1;
timeout = HOOK_URL(hook, timeout);
interval = 100;
max_calls = 0;
if (timeout > 0)
{
if (timeout <= 100)
{
interval = timeout;
max_calls = 1;
}
else
{
interval = 100;
max_calls = timeout / 100;
if (timeout % 100 == 0)
max_calls++;
}
}
HOOK_URL(hook, hook_timer) = hook_timer (hook->plugin,
interval, 0, max_calls,
&hook_url_timer_cb,
hook,
NULL);
}
/*
* Hooks a URL.
*
* Returns pointer to new hook, NULL if error.
*/
struct t_hook *
hook_url (struct t_weechat_plugin *plugin,
const char *url,
struct t_hashtable *options,
int timeout,
t_hook_callback_url *callback,
const void *callback_pointer,
void *callback_data)
{
struct t_hook *new_hook;
struct t_hook_url *new_hook_url;
new_hook = NULL;
new_hook_url = NULL;
if (!url || !url[0] || !callback)
goto error;
new_hook = malloc (sizeof (*new_hook));
if (!new_hook)
goto error;
new_hook_url = malloc (sizeof (*new_hook_url));
if (!new_hook_url)
goto error;
hook_init_data (new_hook, plugin, HOOK_TYPE_URL, HOOK_PRIORITY_DEFAULT,
callback_pointer, callback_data);
new_hook->hook_data = new_hook_url;
new_hook_url->callback = callback;
new_hook_url->url = strdup (url);
new_hook_url->options = (options) ? hashtable_dup (options) : NULL;
new_hook_url->timeout = timeout;
new_hook_url->thread_id = 0;
new_hook_url->thread_created = 0;
new_hook_url->thread_running = 0;
new_hook_url->hook_timer = NULL;
new_hook_url->output = hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
hook_add_to_list (new_hook);
if (weechat_debug_core >= 1)
{
gui_chat_printf (NULL,
"debug: hook_url: url=\"%s\", "
"options=\"%s\", timeout=%d",
new_hook_url->url,
hashtable_get_string (new_hook_url->options,
"keys_values"),
new_hook_url->timeout);
}
hook_url_transfer (new_hook);
return new_hook;
error:
if (new_hook)
free (new_hook);
if (new_hook_url)
free (new_hook_url);
return NULL;
}
/*
* Frees data in a url hook.
*/
void
hook_url_free_data (struct t_hook *hook)
{
void *retval;
if (!hook || !hook->hook_data)
return;
if (HOOK_URL(hook, url))
{
free (HOOK_URL(hook, url));
HOOK_URL(hook, url) = NULL;
}
if (HOOK_URL(hook, options))
{
hashtable_free (HOOK_URL(hook, options));
HOOK_URL(hook, options) = NULL;
}
if (HOOK_URL(hook, hook_timer))
{
unhook (HOOK_URL(hook, hook_timer));
HOOK_URL(hook, hook_timer) = NULL;
}
if (HOOK_URL(hook, thread_running))
{
pthread_cancel (HOOK_URL(hook, thread_id));
HOOK_URL(hook, thread_running) = 0;
}
if (HOOK_URL(hook, thread_created))
pthread_join (HOOK_URL(hook, thread_id), &retval);
if (HOOK_URL(hook, output))
{
hashtable_free (HOOK_URL(hook, output));
HOOK_URL(hook, output) = NULL;
}
free (hook->hook_data);
hook->hook_data = NULL;
}
/*
* Adds url hook data in the infolist item.
*
* Returns:
* 1: OK
* 0: error
*/
int
hook_url_add_to_infolist (struct t_infolist_item *item,
struct t_hook *hook)
{
if (!item || !hook || !hook->hook_data)
return 0;
if (!infolist_new_var_pointer (item, "callback", HOOK_URL(hook, callback)))
return 0;
if (!infolist_new_var_string (item, "url", HOOK_URL(hook, url)))
return 0;
if (!infolist_new_var_string (item, "options", hashtable_get_string (HOOK_URL(hook, options), "keys_values")))
return 0;
if (!infolist_new_var_integer (item, "timeout", (int)(HOOK_URL(hook, timeout))))
return 0;
if (!infolist_new_var_integer (item, "thread_created", (int)(HOOK_URL(hook, thread_created))))
return 0;
if (!infolist_new_var_integer (item, "thread_running", (int)(HOOK_URL(hook, thread_running))))
return 0;
if (!infolist_new_var_pointer (item, "hook_timer", HOOK_URL(hook, hook_timer)))
return 0;
if (!infolist_new_var_string (item, "output", hashtable_get_string (HOOK_URL(hook, output), "keys_values")))
return 0;
return 1;
}
/*
* Prints url hook data in WeeChat log file (usually for crash dump).
*/
void
hook_url_print_log (struct t_hook *hook)
{
if (!hook || !hook->hook_data)
return;
log_printf (" url data:");
log_printf (" callback. . . . . . . : 0x%lx", HOOK_URL(hook, callback));
log_printf (" url . . . . . . . . . : '%s'", HOOK_URL(hook, url));
log_printf (" options . . . . . . . : 0x%lx (hashtable: '%s')",
HOOK_URL(hook, options),
hashtable_get_string (HOOK_URL(hook, options),
"keys_values"));
log_printf (" timeout . . . . . . . : %ld", HOOK_URL(hook, timeout));
log_printf (" thread_created. . . . : %d", (int)HOOK_URL(hook, thread_created));
log_printf (" thread_running. . . . : %d", (int)HOOK_URL(hook, thread_running));
log_printf (" hook_timer. . . . . . : 0x%lx", HOOK_URL(hook, hook_timer));
log_printf (" output. . . . . . . . : 0x%lx (hashtable: '%s')",
HOOK_URL(hook, output),
hashtable_get_string (HOOK_URL(hook, output),
"keys_values"));
}
-60
View File
@@ -1,60 +0,0 @@
/*
* Copyright (C) 2023 Sébastien Helleu <flashcode@flashtux.org>
*
* 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/>.
*/
#ifndef WEECHAT_HOOK_URL_H
#define WEECHAT_HOOK_URL_H
struct t_weechat_plugin;
struct t_infolist_item;
struct t_hashtable;
#define HOOK_URL(hook, var) (((struct t_hook_url *)hook->hook_data)->var)
typedef int (t_hook_callback_url)(const void *pointer, void *data,
const char *url,
struct t_hashtable *options,
struct t_hashtable *output);
struct t_hook_url
{
t_hook_callback_url *callback; /* URL callback */
char *url; /* URL */
struct t_hashtable *options; /* URL options (see doc) */
long timeout; /* timeout (ms) (0 = no timeout) */
pthread_t thread_id; /* thread id */
int thread_created; /* thread created */
int thread_running; /* 1 if thread is running */
struct t_hook *hook_timer; /* timer to check if thread has ended*/
struct t_hashtable *output; /* URL transfer output data */
};
extern char *hook_url_get_description (struct t_hook *hook);
extern struct t_hook *hook_url (struct t_weechat_plugin *plugin,
const char *url,
struct t_hashtable *options,
int timeout,
t_hook_callback_url *callback,
const void *callback_pointer,
void *callback_data);
extern void hook_url_free_data (struct t_hook *hook);
extern int hook_url_add_to_infolist (struct t_infolist_item *item,
struct t_hook *hook);
extern void hook_url_print_log (struct t_hook *hook);
#endif /* WEECHAT_HOOK_URL_H */
+75 -380
View File
@@ -59,11 +59,8 @@
#include "wee-secure.h"
#include "wee-secure-buffer.h"
#include "wee-secure-config.h"
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-sys.h"
#include "wee-upgrade.h"
#include "wee-url.h"
#include "wee-utf8.h"
#include "wee-util.h"
#include "wee-version.h"
@@ -645,7 +642,7 @@ COMMAND_CALLBACK(buffer)
long number, number1, number2, numbers[3];
char *error, *value, *pos, *str_number1, *pos_number2;
int i, count, prev_number, clear_number, list_size;
int buffer_found, arg_name, type_free, switch_to_buffer, rc;
int buffer_found, arg_name, type_free, switch_to_buffer;
/* make C compiler happy */
(void) pointer;
@@ -1331,41 +1328,6 @@ COMMAND_CALLBACK(buffer)
return WEECHAT_RC_OK;
}
/*
* set a property on buffer, saved in config, auto-applied when the buffer
* is opened
*/
if (string_strcmp (argv[1], "setauto") == 0)
{
COMMAND_MIN_ARGS(3, "setauto");
if (argc == 3)
{
/*
* default to empty value for valueless buffer "properties",
* e.g. localvar_del_xxx
*/
rc = config_weechat_buffer_set (buffer, argv[2], "");
}
else
{
value = string_remove_quotes (argv_eol[3], "'\"");
rc = config_weechat_buffer_set (buffer,
argv[2],
(value) ? value : argv_eol[3]);
if (value)
free (value);
}
if (!rc)
{
gui_chat_printf (
NULL,
_("%sUnable to create option for buffer property \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[2]);
}
return WEECHAT_RC_OK;
}
/* get a buffer property */
if (string_strcmp (argv[1], "get") == 0)
{
@@ -1991,8 +1953,7 @@ COMMAND_CALLBACK(debug)
struct t_config_option *ptr_option;
struct t_weechat_plugin *ptr_plugin;
struct timeval time_start, time_end;
char *result, *str_threshold;
long long threshold;
char *result;
int debug;
/* make C compiler happy */
@@ -2027,28 +1988,6 @@ COMMAND_CALLBACK(debug)
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "callbacks") == 0)
{
COMMAND_MIN_ARGS(3, "callbacks");
threshold = util_parse_delay (argv[2], 1);
if (threshold > 0)
{
str_threshold = util_get_microseconds_string (threshold);
debug_long_callbacks = threshold;
gui_chat_printf (NULL,
_("Debug enabled for callbacks (threshold: %s)"),
(str_threshold) ? str_threshold : "?");
if (str_threshold)
free (str_threshold);
}
else
{
debug_long_callbacks = 0;
gui_chat_printf (NULL, _("Debug disabled for callbacks"));
}
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "certs") == 0)
{
gui_chat_printf (NULL,
@@ -2224,15 +2163,6 @@ COMMAND_CALLBACK(debug)
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "url") == 0)
{
url_debug ^= 1;
gui_chat_printf (NULL,
_("Debug hook_url: %s"),
(url_debug) ? _("enabled") : _("disabled"));
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "windows") == 0)
{
debug_windows_tree ();
@@ -4118,7 +4048,7 @@ COMMAND_CALLBACK(key)
{
struct t_gui_key *ptr_new_key;
int i, old_keys_count, keys_added, context, rc;
char *key_name, *value;
char *key_name;
/* make C compiler happy */
(void) pointer;
@@ -4209,14 +4139,8 @@ COMMAND_CALLBACK(key)
}
gui_key_verbose = 1;
value = string_remove_quotes (argv_eol[3], "'\"");
(void) gui_key_bind (NULL, /* buffer */
GUI_KEY_CONTEXT_DEFAULT,
argv[2],
(value) ? value : argv_eol[3],
1); /* check_key */
if (value)
free (value);
(void) gui_key_bind (NULL, GUI_KEY_CONTEXT_DEFAULT,
argv[2], argv_eol[3], 1);
gui_key_verbose = 0;
return WEECHAT_RC_OK;
@@ -4257,14 +4181,7 @@ COMMAND_CALLBACK(key)
}
gui_key_verbose = 1;
value = string_remove_quotes (argv_eol[4], "'\"");
gui_key_bind (NULL, /* buffer */
context,
argv[3],
(value) ? value : argv_eol[4],
1); /* check_key */
if (value)
free (value);
gui_key_bind (NULL, context, argv[3], argv_eol[4], 1);
gui_key_verbose = 0;
return WEECHAT_RC_OK;
@@ -5744,91 +5661,6 @@ COMMAND_CALLBACK(reload)
return WEECHAT_RC_OK;
}
/*
* Executes a repeated command.
*/
void
command_repeat_exec (struct t_command_repeat *command_repeat)
{
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *pointers, *extra_vars;
char str_number[32], *cmd_eval;
if (!command_repeat || !command_repeat->buffer_name
|| !command_repeat->command)
{
return;
}
ptr_buffer = gui_buffer_search_by_full_name (command_repeat->buffer_name);
if (!ptr_buffer)
return;
pointers = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL, NULL);
if (!pointers)
return;
extra_vars = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (!extra_vars)
{
hashtable_free (pointers);
return;
}
hashtable_set (pointers, "buffer", ptr_buffer);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count);
hashtable_set (extra_vars, "repeat_count", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->index);
hashtable_set (extra_vars, "repeat_index", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->index - 1);
hashtable_set (extra_vars, "repeat_index0", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count - command_repeat->index + 1);
hashtable_set (extra_vars, "repeat_revindex", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count - command_repeat->index);
hashtable_set (extra_vars, "repeat_revindex0", str_number);
hashtable_set (extra_vars, "repeat_first",
(command_repeat->index == 1) ? "1" : "0");
hashtable_set (extra_vars, "repeat_last",
(command_repeat->index >= command_repeat->count) ? "1" : "0");
cmd_eval = eval_expression (command_repeat->command,
pointers, extra_vars, NULL);
if (cmd_eval)
{
(void) input_data (ptr_buffer,
cmd_eval,
command_repeat->commands_allowed,
0); /* split_newline */
free (cmd_eval);
}
hashtable_free (pointers);
hashtable_free (extra_vars);
if (command_repeat->index < command_repeat->count)
{
/* increment index for next execution */
command_repeat->index++;
}
else
{
/* it was the last execution, free up memory */
free (command_repeat->buffer_name);
free (command_repeat->command);
if (command_repeat->commands_allowed)
free (command_repeat->commands_allowed);
free (command_repeat);
}
}
/*
* Callback for repeat timer.
*/
@@ -5836,11 +5668,35 @@ command_repeat_exec (struct t_command_repeat *command_repeat)
int
command_repeat_timer_cb (const void *pointer, void *data, int remaining_calls)
{
char **repeat_args;
int i;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) data;
(void) remaining_calls;
command_repeat_exec ((struct t_command_repeat *)pointer);
repeat_args = (char **)pointer;
if (!repeat_args)
return WEECHAT_RC_ERROR;
if (repeat_args[0] && repeat_args[1])
{
/* search buffer, fallback to core buffer if not found */
ptr_buffer = gui_buffer_search_by_full_name (repeat_args[0]);
if (ptr_buffer)
(void) input_data (ptr_buffer, repeat_args[1], repeat_args[2], 0);
}
if (remaining_calls == 0)
{
for (i = 0; i < 3; i++)
{
if (repeat_args[i])
free (repeat_args[i]);
}
free (repeat_args);
}
return WEECHAT_RC_OK;
}
@@ -5852,9 +5708,8 @@ command_repeat_timer_cb (const void *pointer, void *data, int remaining_calls)
COMMAND_CALLBACK(repeat)
{
int arg_count, count, i;
long long interval;
char *error;
struct t_command_repeat *cmd_repeat;
long interval;
char *error, **repeat_args;
/* make C compiler happy */
(void) pointer;
@@ -5867,10 +5722,9 @@ COMMAND_CALLBACK(repeat)
if ((argc >= 5) && (string_strcmp (argv[1], "-interval") == 0))
{
interval = util_parse_delay (argv[2], 1000000);
if (interval < 0)
interval = util_parse_delay (argv[2], 1000);
if (interval < 1)
interval = 0;
interval /= 1000;
arg_count = 3;
}
@@ -5886,25 +5740,8 @@ COMMAND_CALLBACK(repeat)
return WEECHAT_RC_OK;
}
cmd_repeat = malloc (sizeof (*cmd_repeat));
if (!cmd_repeat)
{
gui_chat_printf (NULL,
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/repeat");
return WEECHAT_RC_OK;
}
cmd_repeat->buffer_name = strdup (buffer->full_name);
cmd_repeat->command = strdup (argv_eol[arg_count + 1]);
cmd_repeat->commands_allowed = (input_commands_allowed) ?
string_rebuild_split_string (
(const char **)input_commands_allowed, ",", 0, -1) : NULL;
cmd_repeat->count = count;
cmd_repeat->index = 1;
/* first execute command now */
command_repeat_exec (cmd_repeat);
(void) input_data (buffer, argv_eol[arg_count + 1], NULL, 0);
/* repeat execution of command */
if (count > 1)
@@ -5914,14 +5751,28 @@ COMMAND_CALLBACK(repeat)
/* execute command multiple times now */
for (i = 0; i < count - 1; i++)
{
command_repeat_exec (cmd_repeat);
(void) input_data (buffer, argv_eol[arg_count + 1], NULL, 0);
}
}
else
{
/* schedule execution of command in future */
repeat_args = malloc (3 * sizeof (*repeat_args));
if (!repeat_args)
{
gui_chat_printf (NULL,
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/repeat");
return WEECHAT_RC_OK;
}
repeat_args[0] = strdup (buffer->full_name);
repeat_args[1] = strdup (argv_eol[arg_count + 1]);
repeat_args[2] = (input_commands_allowed) ?
string_rebuild_split_string (
(const char **)input_commands_allowed, ",", 0, -1) : NULL;
hook_timer (NULL, interval, 0, count - 1,
&command_repeat_timer_cb, cmd_repeat, NULL);
&command_repeat_timer_cb, repeat_args, NULL);
}
}
@@ -6119,7 +5970,7 @@ COMMAND_CALLBACK(save)
COMMAND_CALLBACK(secure)
{
int passphrase_was_set, count_encrypted, rc;
int passphrase_was_set, count_encrypted;
/* make C compiler happy */
(void) pointer;
@@ -6150,33 +6001,7 @@ COMMAND_CALLBACK(secure)
gui_chat_printf (NULL, _("All encrypted data has been deleted"));
return WEECHAT_RC_OK;
}
rc = secure_decrypt_data_not_decrypted (argv_eol[2]);
if (rc == -2)
{
gui_chat_printf (
NULL,
_("%sFailed to decrypt data: hash algorithm \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
config_file_option_string (secure_config_crypt_hash_algo));
}
else if (rc == -3)
{
gui_chat_printf (
NULL,
_("%sFailed to decrypt data: cipher \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
config_file_option_string (secure_config_crypt_cipher));
}
else if ((rc == -1) || (rc == 0))
{
gui_chat_printf (NULL,
_("%sFailed to decrypt data: wrong passphrase?"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
}
else
if (secure_decrypt_data_not_decrypted (argv_eol[2]) > 0)
{
gui_chat_printf (NULL,
_("Encrypted data has been successfully decrypted"));
@@ -6184,6 +6009,12 @@ COMMAND_CALLBACK(secure)
free (secure_passphrase);
secure_passphrase = strdup (argv_eol[2]);
}
else
{
gui_chat_printf (NULL,
_("%sFailed to decrypt data (wrong passphrase?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
}
return WEECHAT_RC_OK;
}
@@ -6763,47 +6594,6 @@ COMMAND_CALLBACK(set)
return WEECHAT_RC_OK;
}
/*
* Callback for command "/sys": system actions.
*/
COMMAND_CALLBACK(sys)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) buffer;
COMMAND_MIN_ARGS(2, "");
if (string_strcmp (argv[1], "get") == 0)
{
COMMAND_MIN_ARGS(2, "get");
if (string_strcmp (argv[2], "rlimit") == 0)
sys_display_rlimit ();
else if (string_strcmp (argv[2], "rusage") == 0)
sys_display_rusage ();
else
COMMAND_ERROR;
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "suspend") == 0)
{
signal_suspend ();
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "waitpid") == 0)
{
sys_waitpid ();
return WEECHAT_RC_OK;
}
COMMAND_ERROR;
}
/*
* Callback for command "/toggle": toggles value of configuration option.
*/
@@ -7072,17 +6862,14 @@ COMMAND_CALLBACK(upgrade)
}
/*
* it is forbidden to upgrade while there are some background process or
* thread (hook types: process, connect, url)
* it is forbidden to upgrade while there are some background process
* (hook type "process" or "connect")
*/
if (weechat_hooks[HOOK_TYPE_PROCESS]
|| weechat_hooks[HOOK_TYPE_CONNECT]
|| weechat_hooks[HOOK_TYPE_URL])
if (weechat_hooks[HOOK_TYPE_PROCESS] || weechat_hooks[HOOK_TYPE_CONNECT])
{
gui_chat_printf (NULL,
_("%sCan't upgrade: there is one or more background "
"process/thread running (hook type: process, "
"connect or url)"),
"process (hook type 'process' or 'connect')"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_OK;
}
@@ -7434,7 +7221,7 @@ COMMAND_CALLBACK(version)
COMMAND_CALLBACK(wait)
{
long long delay;
long delay;
/* make C compiler happy */
(void) pointer;
@@ -7442,12 +7229,10 @@ COMMAND_CALLBACK(wait)
COMMAND_MIN_ARGS(3, "");
delay = util_parse_delay (argv[1], 1000000);
delay = util_parse_delay (argv[1], 1000);
if (delay < 1)
COMMAND_ERROR;
delay /= 1000;
if (input_data_delayed (buffer, argv_eol[2], NULL, 0, delay) != WEECHAT_RC_OK)
COMMAND_ERROR;
@@ -7860,7 +7645,6 @@ command_init ()
hook_command (
NULL, "allbuf",
N_("execute a command on all buffers"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<command>"),
N_("command: command to execute (or text to send to buffer if "
"command does not start with '/')\n"
@@ -7872,7 +7656,6 @@ command_init ()
hook_command (
NULL, "away",
N_("set or remove away status"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-all] [<message>]"),
N_(" -all: set or remove away status on all connected servers\n"
"message: message for away (if no message is given, away status is "
@@ -7881,7 +7664,6 @@ command_init ()
hook_command (
NULL, "bar",
N_("manage bars"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list|listfull|listitems"
" || add <name> <type>[,<conditions>] <position> <size> <separator> "
"<item1>[,<item2>...]"
@@ -7957,7 +7739,6 @@ command_init ()
hook_command (
NULL, "buffer",
N_("manage buffers"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list"
" || add [-free] [-switch] <name>"
" || clear [<number>|<name>|-merged|-all [<number>|<name>...]]"
@@ -7977,7 +7758,6 @@ command_init ()
" || setvar <name> [<value>]"
" || delvar <name>"
" || set <property> [<value>]"
" || setauto <property> [<value>]"
" || get <property>"
" || jump smart|last_displayed|prev_visited|next_visited"
" || <number>|-|+|<name>"),
@@ -8015,9 +7795,6 @@ command_init ()
" setvar: set a local variable in the current buffer\n"
" delvar: delete a local variable from the current buffer\n"
" set: set a property in the current buffer\n"
" setauto: like \"set\" and also define option "
"\"weechat.buffer.<name>.<property>\" so that the property is saved "
"in configuration and applied each time this buffer is opened\n"
" get: display a property of current buffer\n"
" jump: jump to another buffer:\n"
" smart: next buffer with activity\n"
@@ -8084,7 +7861,6 @@ command_init ()
" || setvar %(buffer_local_variables) %(buffer_local_variable_value)"
" || delvar %(buffer_local_variables)"
" || set %(buffer_properties_set)"
" || setauto %(buffer_properties_setauto)"
" || get %(buffer_properties_get)"
" || jump smart|last_displayed|prev_visited|next_visited"
" || %(buffers_plugins_names)|%(buffers_names)|%(irc_channels)|"
@@ -8093,7 +7869,6 @@ command_init ()
hook_command (
NULL, "color",
N_("define color aliases and display palette of colors"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("alias <color> <name>"
" || unalias <color>"
" || reset"
@@ -8135,7 +7910,6 @@ command_init ()
hook_command (
NULL, "50000|command",
N_("launch explicit WeeChat or plugin command"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-buffer <name>] <plugin> <command>"),
N_("-buffer: execute the command on this buffer\n"
" plugin: execute the command from this plugin; 'core' for a "
@@ -8151,7 +7925,6 @@ command_init ()
NULL, "cursor",
N_("free movement of cursor on screen to execute actions on specific "
"areas of screen"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("go chat|<bar> [top_left|top_right|bottom_left|bottom_right]"
" || go <x>,<y>"
" || move up|down|left|right|"
@@ -8203,13 +7976,11 @@ command_init ()
hook_command (
NULL, "debug",
N_("debug functions"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list"
" || set <plugin> <level>"
" || dump|hooks [<plugin>]"
" || buffer|certs|color|dirs|infolists|libs|memory|tags|"
"term|url|windows"
" || callbacks <duration>[<unit>]"
"term|windows"
" || mouse|cursor [verbose]"
" || hdata [free]"
" || time <command>"
@@ -8222,16 +7993,7 @@ command_init ()
"written when WeeChat crashes)\n"
" hooks: display infos about hooks (with a plugin: display "
"detailed info about hooks created by the plugin)\n"
" buffer: dump buffer content with hexadecimal values in WeeChat "
"log file\n"
"callbacks: write hook and bar item callbacks that took more than "
"\"duration\" in the WeeChat log file (0 = disable), where optional "
"unit is one of:\n"
" us: microseconds (default)\n"
" ms: milliseconds\n"
" s: seconds\n"
" m: minutes\n"
" h: hours\n"
" buffer: dump buffer content with hexadecimal values in log file\n"
" certs: display number of loaded trusted certificate authorities\n"
" color: display infos about current color pairs\n"
" cursor: toggle debug for cursor mode\n"
@@ -8246,7 +8008,6 @@ command_init ()
" mouse: toggle debug for mouse\n"
" tags: display tags for lines\n"
" term: display infos about terminal\n"
" url: toggle debug for calls to hook_url (display output hashtable)\n"
" windows: display windows tree\n"
" time: measure time to execute a command or to send text to "
"the current buffer\n"
@@ -8262,7 +8023,6 @@ command_init ()
" || set %(plugins_names)|" PLUGIN_CORE
" || dump %(plugins_names)|" PLUGIN_CORE
" || buffer"
" || callbacks"
" || certs"
" || color"
" || cursor verbose"
@@ -8276,7 +8036,6 @@ command_init ()
" || mouse verbose"
" || tags"
" || term"
" || url"
" || windows"
" || time %(commands:/)"
" || unicode",
@@ -8284,7 +8043,6 @@ command_init ()
hook_command (
NULL, "eval",
N_("evaluate expression"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-n|-s] [-d] <expression>"
" || [-n] [-d [-d]] -c <expression1> <operator> <expression2>"),
N_(" -n: display result without sending it to buffer "
@@ -8455,13 +8213,12 @@ command_init ()
" /eval -n -c abcd !~ abc ==> 0\n"
" /eval -n -c abcd =* a*d ==> 1\n"
" /eval -n -c abcd =- bc ==> 1"),
"-n|-s|-c|%(eval_variables)|%*",
"-n|-s|-c -n|-s|-c",
&command_eval, NULL, NULL);
hook_command (
NULL, "filter",
N_("filter messages in buffers, to hide/show them according to tags or "
"regex"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list"
" || enable|disable|toggle [<name>|@]"
" || add|addreplace <name> <buffer>[,<buffer>...] <tags> <regex>"
@@ -8551,7 +8308,6 @@ command_init ()
hook_command (
NULL, "help",
N_("display help about commands and options"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("-list|-listfull [<plugin> [<plugin>...]] || <command> || <option>"),
N_(" -list: list commands, by plugin (without argument, this list is "
"displayed)\n"
@@ -8566,7 +8322,6 @@ command_init ()
hook_command (
NULL, "history",
N_("show buffer command history"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("clear || <value>"),
N_("clear: clear history\n"
"value: number of history entries to show"),
@@ -8575,7 +8330,6 @@ command_init ()
hook_command (
NULL, "hotlist",
N_("manage hotlist"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("add [low|message|private|highlight]"
" || clear [<level>]"
" || remove"
@@ -8603,7 +8357,6 @@ command_init ()
hook_command (
NULL, "50000|input",
N_("functions for command line"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<action> [<arguments>]"),
N_("list of actions:\n"
" return: simulate key \"enter\"\n"
@@ -8690,7 +8443,6 @@ command_init ()
hook_command (
NULL, "item",
N_("manage custom bar items"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list"
" || add|addreplace <name> \"<conditions>\" \"<content>\""
" || rename <name> <new_name>"
@@ -8754,7 +8506,6 @@ command_init ()
hook_command (
NULL, "key",
N_("bind/unbind keys"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[list|listdefault|listdiff] [<context>]"
" || bind <key> [<command> [<args>]]"
" || bindctxt <context> <key> [<command> [<args>]]"
@@ -8774,9 +8525,7 @@ command_init ()
"key (for context \"default\")\n"
" bindctxt: bind a command to a key or display command bound to "
"key, for given context\n"
" command: command (many commands can be separated by semicolons); "
"quotes can be used to preserve spaces at the beginning/end of "
"command\n"
" command: command (many commands can be separated by semicolons)\n"
" unbind: remove a key binding (for context \"default\")\n"
" unbindctxt: remove a key binding for given context\n"
" reset: reset a key to default binding (for context "
@@ -8853,7 +8602,6 @@ command_init ()
hook_command (
NULL, "layout",
N_("manage buffers/windows layouts"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("store [<name>] [buffers|windows]"
" || apply [<name>] [buffers|windows]"
" || leave"
@@ -8889,7 +8637,6 @@ command_init ()
hook_command (
NULL, "mouse",
N_("mouse control"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("enable|disable|toggle [<delay>]"),
N_(" enable: enable mouse\n"
"disable: disable mouse\n"
@@ -8909,7 +8656,6 @@ command_init ()
hook_command (
NULL, "mute",
N_("execute a command silently"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-core | -current | -buffer <name>] <command>"),
N_(" -core: no output on WeeChat core buffer\n"
"-current: no output on current buffer\n"
@@ -8936,7 +8682,6 @@ command_init ()
hook_command (
NULL, "plugin",
N_("list/load/unload plugins"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list [-o|-ol|-i|-il|<name>]"
" || listfull [<name>]"
" || load <filename> [<arguments>]"
@@ -8973,7 +8718,6 @@ command_init ()
hook_command (
NULL, "print",
N_("display text on a buffer"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-buffer <number>|<name>] [-newbuffer <name>] [-free] [-switch] "
"[-core|-current] [-y <line>] [-escape] [-date <date>] "
"[-tags <tags>] [-action|-error|-join|-network|-quit] [<text>]"
@@ -9040,7 +8784,6 @@ command_init ()
hook_command (
NULL, "proxy",
N_("manage proxies"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("list"
" || add <name> <type> <address> <port> [<username> [<password>]]"
" || del <name>|-all"
@@ -9077,7 +8820,6 @@ command_init ()
hook_command (
NULL, "quit",
N_("quit WeeChat"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-yes] [<arguments>]"),
N_(" -yes: required if option \"weechat.look.confirm_quit\" "
"is enabled\n"
@@ -9094,7 +8836,6 @@ command_init ()
hook_command (
NULL, "reload",
N_("reload configuration files from disk"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[<file> [<file>...]]"),
N_("file: configuration file to reload (without extension \".conf\")\n"
"\n"
@@ -9104,31 +8845,16 @@ command_init ()
hook_command (
NULL, "repeat",
N_("execute a command several times"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-interval <delay>[<unit>]] <count> <command>"),
N_(" delay: delay between execution of commands (minimum: 1 millisecond)\n"
N_(" delay: delay between execution of commands\n"
" unit: optional, values are:\n"
" us: microseconds\n"
" ms: milliseconds\n"
" s: seconds (default)\n"
" m: minutes\n"
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command "
"does not start with '/'), evaluated and the following variables "
"are set each time the command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end "
"(from \"count\" to 1)\n"
" ${repeat_revindex0}: current index from the end "
"(from \"count\" - 1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, "
"\"0\" for the others\n"
" ${repeat_last}: \"1\" for the last execution, "
"\"0\" for the others\n"
"does not start with '/')\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed "
"(if the buffer does not exist any more, the command is not "
@@ -9136,16 +8862,12 @@ command_init ()
"\n"
"Example:\n"
" scroll 2 pages up:\n"
" /repeat 2 /window page_up\n"
" print a countdown, starting at 5:\n"
" /repeat -interval 1 6 "
"/print ${if:${repeat_last}?Boom!:${repeat_revindex0}}"),
" /repeat 2 /window page_up"),
"%- %(commands:/)",
&command_repeat, NULL, NULL);
hook_command (
NULL, "reset",
N_("reset config options"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<option>"
" || -mask <option>"),
N_("option: name of an option\n"
@@ -9163,7 +8885,6 @@ command_init ()
hook_command (
NULL, "save",
N_("save configuration files to disk"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[<file> [<file>...]]"),
N_("file: configuration file to save (without extension \".conf\")\n"
"\n"
@@ -9177,7 +8898,6 @@ command_init ()
NULL, "secure",
N_("manage secured data (passwords or private data encrypted in file "
"sec.conf)"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("passphrase <passphrase>|-delete"
" || decrypt <passphrase>|-discard"
" || set <name> <value>"
@@ -9237,7 +8957,6 @@ command_init ()
hook_command (
NULL, "set",
N_("set config options and environment variables"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[<option> [<value>]]"
" || diff [<option> [<option>...]]"
" || env [<variable> [<value>]]"),
@@ -9275,28 +8994,9 @@ command_init ()
" || diff %(config_options)|%*"
" || env %(env_vars) %(env_value)",
&command_set, NULL, NULL);
hook_command (
NULL, "sys",
N_("system actions"),
"get rlimit|rusage"
" || suspend"
" || waitpid",
N_(" get: display system info\n"
" rlimit: display resource limits "
"(see /help weechat.startup.sys_rlimit and \"man getrlimit\")\n"
" rusage: display resource usage (see \"man getrusage\")\n"
"suspend: suspend WeeChat and go back to the shell, by sending "
"signal SIGTSTP to the WeeChat process\n"
"waitpid: acknowledge the end of children processes (to prevent "
"\"zombie\" processes)"),
"get rlimit|rusage"
" || suspend"
" || waitpid",
&command_sys, NULL, NULL);
hook_command (
NULL, "toggle",
N_("toggle value of a config option"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<option> [<value> [<value>...]]"),
N_("option: name of an option\n"
" value: possible values for the option (values are split like the "
@@ -9333,7 +9033,6 @@ command_init ()
hook_command (
NULL, "unset",
N_("unset/reset config options"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<option>"
" || -mask <option>"),
N_("option: name of an option\n"
@@ -9355,7 +9054,6 @@ command_init ()
NULL, "upgrade",
N_("save WeeChat session and reload the WeeChat binary without "
"disconnecting from servers"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("[-yes] [<path_to_binary>|-save|-quit]"),
N_(" -yes: required if option \"weechat.look.confirm_upgrade\" "
"is enabled\n"
@@ -9433,11 +9131,9 @@ command_init ()
hook_command (
NULL, "wait",
N_("schedule a command execution in future"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
N_("<number>[<unit>] <command>"),
N_(" number: amount of time to wait (minimum: 1 millisecond)\n"
N_(" number: amount of time to wait (integer number)\n"
" unit: optional, values are:\n"
" us: microseconds\n"
" ms: milliseconds\n"
" s: seconds (default)\n"
" m: minutes\n"
@@ -9461,7 +9157,6 @@ command_init ()
hook_command (
NULL, "window",
N_("manage windows"),
/* TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated */
/* xgettext:no-c-format */
N_("list"
" || -1|+1|b#|up|down|left|right [-window <number>]"
+1 -10
View File
@@ -21,8 +21,6 @@
#ifndef WEECHAT_COMMAND_H
#define WEECHAT_COMMAND_H
struct t_gui_buffer;
#define COMMAND_CALLBACK(__command) \
int \
command_##__command (const void *pointer, void *data, \
@@ -82,14 +80,7 @@ struct t_gui_buffer;
return WEECHAT_RC_ERROR; \
}
struct t_command_repeat
{
char *buffer_name; /* full buffer name */
char *command; /* cmd to exec (or text for buffer) */
char *commands_allowed; /* commands currently allowed */
int count; /* number of times the cmd is exec. */
int index; /* current index (starts at 1) */
};
struct t_gui_buffer;
extern const char *command_help_option_color_values ();
extern void command_version_display (struct t_gui_buffer *buffer,
-189
View File
@@ -489,76 +489,6 @@ completion_list_add_buffer_properties_set_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
/*
* Adds a buffer local variable to completions list (for `/buffer setauto`).
*/
void
completion_list_map_buffer_local_variable_setauto_cb (void *data,
struct t_hashtable *hashtable,
const void *key,
const void *value)
{
char str_localvar[4096];
/* make C compiler happy */
(void) hashtable;
(void) value;
snprintf (str_localvar, sizeof (str_localvar),
"localvar_set_%s", (const char *)key);
gui_completion_list_add ((struct t_gui_completion *)data,
str_localvar,
0, WEECHAT_LIST_POS_SORT);
}
/*
* Adds buffer properties (that can be set), local variables and key bindings
* to completion list.
*/
int
completion_list_add_buffer_properties_setauto_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_gui_key *ptr_key;
char str_key[1024];
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
/* add buffer properties */
for (i = 0; gui_buffer_properties_set[i]; i++)
{
gui_completion_list_add (completion,
gui_buffer_properties_set[i],
0, WEECHAT_LIST_POS_SORT);
}
/* add buffer local variables */
hashtable_map (completion->buffer->local_variables,
&completion_list_map_buffer_local_variable_setauto_cb,
completion);
/* add buffer keys */
for (ptr_key = completion->buffer->keys; ptr_key;
ptr_key = ptr_key->next_key)
{
snprintf (str_key, sizeof (str_key), "key_bind_%s", ptr_key->key);
gui_completion_list_add (completion, str_key, 0, WEECHAT_LIST_POS_SORT);
snprintf (str_key, sizeof (str_key), "key_unbind_%s", ptr_key->key);
gui_completion_list_add (completion, str_key, 0, WEECHAT_LIST_POS_SORT);
}
return WEECHAT_RC_OK;
}
/*
* Adds buffer properties (that can be read) to completion list.
*/
@@ -2071,119 +2001,6 @@ completion_list_add_env_value_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
/*
* Adds a buffer local variable for /eval to completions list.
*/
void
completion_list_map_eval_buffer_local_variable_cb (void *data,
struct t_hashtable *hashtable,
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)
{
snprintf (name, length, "${%s}", (const char *)key);
gui_completion_list_add ((struct t_gui_completion *)data,
name, 0, WEECHAT_LIST_POS_SORT);
free (name);
}
}
/*
* Adds /eval variables to completion list.
*/
int
completion_list_add_eval_variables_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
char *eval_variables[] = {
"${\\xxx}",
"${base_decode:base,xxx}",
"${base_encode:base,xxx}",
"${calc:xxx}",
"${chars:range}",
"${color:xxx}",
"${cut:+max,suffix,string}",
"${cut:max,suffix,string}",
"${cutscr:+max,suffix,string}",
"${cutscr:max,suffix,string}",
"${date:format}",
"${date}",
"${define:name,value}",
"${env:XXX}",
"${esc:xxx}",
"${eval:xxx}",
"${eval_cond:xxx}",
"${file.section.option}",
"${hdata.var1.var2}",
"${hdata[list].var1.var2}",
"${hdata[ptr].var1.var2}",
"${hdata[ptr_name].var1.var2}",
"${hide:char,string}",
"${if:condition?value_if_true:value_if_false}",
"${info:name,arguments}",
"${length:xxx}",
"${lengthscr:xxx}",
"${lower:xxx}",
"${modifier:name,data,xxx}",
"${random:min,max}",
"${raw:xxx}",
"${re:+}",
"${re:N}",
"${repeat:count,string}",
"${rev:xxx}",
"${revscr:xxx}",
"${sec.data.xxx}",
"${split:count,separators,flags,xxx}",
"${split:number,separators,flags,xxx}",
"${split:random,separators,flags,xxx}",
"${split_shell:count,xxx}",
"${split_shell:number,xxx}",
"${split_shell:random,xxx}",
"${translate:xxx}",
"${upper:xxx}",
"${weechat_cache_dir}",
"${weechat_config_dir}",
"${weechat_data_dir}",
"${weechat_runtime_dir}",
"${window}",
"${window.buffer}",
"${window.buffer.xxx}",
NULL,
};
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
for (i = 0; eval_variables[i]; i++)
{
gui_completion_list_add (completion, eval_variables[i],
0, WEECHAT_LIST_POS_SORT);
}
hashtable_map (completion->buffer->local_variables,
&completion_list_map_eval_buffer_local_variable_cb,
completion);
return WEECHAT_RC_OK;
}
/*
* Adds hooks for completions done by WeeChat core.
*/
@@ -2209,9 +2026,6 @@ completion_init ()
hook_completion (NULL, "buffer_properties_set",
N_("properties that can be set on a buffer"),
&completion_list_add_buffer_properties_set_cb, NULL, NULL);
hook_completion (NULL, "buffer_properties_setauto",
N_("properties that can be automatically set on a buffer"),
&completion_list_add_buffer_properties_setauto_cb, NULL, NULL);
hook_completion (NULL, "buffer_properties_get",
N_("properties that can be read on a buffer"),
&completion_list_add_buffer_properties_get_cb, NULL, NULL);
@@ -2328,7 +2142,4 @@ completion_init ()
hook_completion (NULL, "env_value",
N_("value of an environment variable"),
&completion_list_add_env_value_cb, NULL, NULL);
hook_completion (NULL, "eval_variables",
N_("variables that can be used in /eval command"),
&completion_list_add_eval_variables_cb, NULL, NULL);
}
+5 -93
View File
@@ -37,7 +37,6 @@
#include "wee-config-file.h"
#include "wee-arraylist.h"
#include "wee-config.h"
#include "wee-dir.h"
#include "wee-hashtable.h"
#include "wee-hdata.h"
#include "wee-hook.h"
@@ -3262,66 +3261,6 @@ config_file_parse_version (const char *version)
return (number < 1) ? -1 : (int)number;
}
/*
* Backups a configuration file if its version is unsupported and cannot be
* loaded.
*/
void
config_file_backup (const char *filename)
{
char *filename_backup, str_time[32], str_index[32];
int length, index;
struct tm *local_time;
time_t date;
if (!filename)
return;
length = strlen (filename) + 128;
filename_backup = malloc (length);
if (!filename_backup)
return;
date = time (NULL);
local_time = localtime (&date);
if (strftime (str_time, sizeof (str_time), ".%Y%m%d.%H%M%S", local_time) == 0)
str_time[0] = '\0';
index = 1;
while (1)
{
if (index == 1)
str_index[0] = '\0';
else
snprintf (str_index, sizeof (str_index), ".%d", index);
snprintf (filename_backup, length,
"%s.backup%s%s",
filename, str_time, str_index);
if (access (filename_backup, F_OK) != 0)
break;
index++;
}
if (dir_file_copy (filename, filename_backup))
{
gui_chat_printf (NULL,
_("%sFile %s has been backed up as %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
filename, filename_backup);
}
else
{
gui_chat_printf (NULL,
_("%sError: unable to backup file %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
filename);
}
free (filename_backup);
}
/*
* Updates data read from config file: either section or option + value.
* The update callback (if defined in config) is called if the config version
@@ -3334,22 +3273,16 @@ config_file_backup (const char *filename)
*
* Section can be updated only if option and value are NULL (ie if we are
* reading a section line like "[section]").
*
* Integer warning_update_displayed is set to 1 if a warning is displayed,
* when the file is updated to a newer version (then it's not compatible any
* more with previous versions).
*/
void
config_file_update_data_read (struct t_config_file *config_file,
const char *filename,
const char *section,
const char *option,
const char *value,
char **ret_section,
char **ret_option,
char **ret_value,
int *warning_update_displayed)
char **ret_value)
{
struct t_hashtable *data_read, *hashtable;
const char *ptr_section, *ptr_option, *ptr_value;
@@ -3359,21 +3292,6 @@ config_file_update_data_read (struct t_config_file *config_file,
if (config_file->version_read >= config_file->version)
return;
if (!*warning_update_displayed
&& (config_file->version_read < config_file->version))
{
gui_chat_printf (
NULL,
_("%sImportant: file %s has been updated from version %d to %d, "
"it is not compatible and can not be loaded any more with any "
"older version"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
filename,
config_file->version_read,
config_file->version);
*warning_update_displayed = 1;
}
/* do nothing if there's no update callback */
if (!config_file->callback_update)
return;
@@ -3471,7 +3389,6 @@ 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;
char *filename, *section, *option, *value;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
@@ -3481,7 +3398,6 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
config_file->version_read = 1;
warning_update_displayed = 0;
/* build filename */
filename_length = strlen (weechat_config_dir) + strlen (DIR_SEPARATOR) +
@@ -3580,10 +3496,9 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
section = string_strndup (ptr_line + 1, pos - ptr_line - 1);
if (section)
{
config_file_update_data_read (config_file, filename,
config_file_update_data_read (config_file,
section, NULL, NULL,
&section, NULL, NULL,
&warning_update_displayed);
&section, NULL, NULL);
ptr_section = config_file_search_section (config_file,
section);
if (!ptr_section)
@@ -3666,7 +3581,6 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
filename, line_number,
line);
config_file_backup (filename);
goto end_file;
}
else
@@ -3683,7 +3597,6 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
filename,
config_file->version_read,
config_file->version);
config_file_backup (filename);
goto end_file;
}
}
@@ -3701,10 +3614,9 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
goto end_line;
}
config_file_update_data_read (config_file, filename,
config_file_update_data_read (config_file,
ptr_section->name, option, value,
NULL, &option, &value,
&warning_update_displayed);
NULL, &option, &value);
/* option has been ignored by the update callback? */
if (!option || !option[0])
+13 -200
View File
@@ -36,7 +36,6 @@
#include <regex.h>
#include "weechat.h"
#include "wee-arraylist.h"
#include "wee-config.h"
#include "wee-eval.h"
#include "wee-hashtable.h"
@@ -44,10 +43,10 @@
#include "wee-log.h"
#include "wee-network.h"
#include "wee-utf8.h"
#include "wee-util.h"
#include "wee-list.h"
#include "wee-proxy.h"
#include "wee-string.h"
#include "wee-sys.h"
#include "wee-version.h"
#include "../gui/gui-bar.h"
#include "../gui/gui-bar-item.h"
@@ -85,7 +84,6 @@ struct t_config_section *weechat_config_section_signal = NULL;
struct t_config_section *weechat_config_section_bar = NULL;
struct t_config_section *weechat_config_section_custom_bar_item = NULL;
struct t_config_section *weechat_config_section_layout = NULL;
struct t_config_section *weechat_config_section_buffer = NULL;
struct t_config_section *weechat_config_section_notify = NULL;
struct t_config_section *weechat_config_section_filter = NULL;
struct t_config_section *weechat_config_section_key[GUI_KEY_NUM_CONTEXTS] = {
@@ -382,7 +380,7 @@ config_change_sys_rlimit (const void *pointer, void *data,
(void) option;
if (gui_init_ok)
sys_setrlimit ();
util_setrlimit ();
}
/*
@@ -1482,7 +1480,7 @@ config_weechat_init_after_read ()
{
int context;
sys_setrlimit ();
util_setrlimit ();
gui_buffer_notify_set_all ();
@@ -2197,20 +2195,17 @@ config_weechat_custom_bar_item_read_cb (const void *pointer, void *data,
if (!ptr_temp_item)
{
/* create new temporary custom bar item */
if (gui_bar_item_search_default (item_name) < 0)
ptr_temp_item = gui_bar_item_custom_alloc (item_name);
if (ptr_temp_item)
{
ptr_temp_item = gui_bar_item_custom_alloc (item_name);
if (ptr_temp_item)
{
/* add new custom bar item at the end */
ptr_temp_item->prev_item = last_gui_temp_custom_bar_item;
ptr_temp_item->next_item = NULL;
if (last_gui_temp_custom_bar_item)
last_gui_temp_custom_bar_item->next_item = ptr_temp_item;
else
gui_temp_custom_bar_items = ptr_temp_item;
last_gui_temp_custom_bar_item = ptr_temp_item;
}
/* add new custom bar item at the end */
ptr_temp_item->prev_item = last_gui_temp_custom_bar_item;
ptr_temp_item->next_item = NULL;
if (last_gui_temp_custom_bar_item)
last_gui_temp_custom_bar_item->next_item = ptr_temp_item;
else
gui_temp_custom_bar_items = ptr_temp_item;
last_gui_temp_custom_bar_item = ptr_temp_item;
}
}
@@ -2231,13 +2226,6 @@ config_weechat_custom_bar_item_read_cb (const void *pointer, void *data,
section->name, option_name, value);
}
}
else
{
gui_chat_printf (NULL,
_("%sUnable to add custom bar item \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
item_name);
}
free (item_name);
@@ -2478,171 +2466,6 @@ config_weechat_layout_write_cb (const void *pointer, void *data,
return WEECHAT_CONFIG_WRITE_OK;
}
/*
* Applies a buffer option to all matching buffers.
*/
void
config_weechat_buffer_apply_option (struct t_config_option *option)
{
struct t_arraylist *all_buffers;
struct t_gui_buffer *ptr_buffer;
int i, list_size;
if (!option)
return;
all_buffers = arraylist_new (gui_buffers_count, 0, 0,
NULL, NULL, NULL, NULL);
if (!all_buffers)
return;
for (ptr_buffer = gui_buffers; ptr_buffer;
ptr_buffer = ptr_buffer->next_buffer)
{
arraylist_add (all_buffers, ptr_buffer);
}
list_size = arraylist_size (all_buffers);
for (i = 0; i < list_size; i++)
{
ptr_buffer = (struct t_gui_buffer *)arraylist_get (all_buffers, i);
if (gui_buffer_valid (ptr_buffer))
gui_buffer_apply_config_option_property (ptr_buffer, option);
}
arraylist_free (all_buffers);
}
/*
* Callback for changes on a buffer option.
*/
void
config_weechat_buffer_change_cb (const void *pointer, void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
config_weechat_buffer_apply_option (option);
}
/*
* Callback called when an option is created in section "buffer".
*/
int
config_weechat_buffer_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
struct t_config_option *ptr_option;
const char *pos;
char *buffer_mask, description[4096];
int rc;
/* make C compiler happy */
(void) pointer;
(void) data;
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
if (!option_name)
return rc;
ptr_option = config_file_search_option (config_file, section,
option_name);
if (ptr_option)
{
rc = config_file_option_set (ptr_option, value, 1);
}
else
{
pos = strrchr (option_name, '.');
if (pos)
{
buffer_mask = strndup (option_name, pos - option_name);
if (buffer_mask)
{
snprintf (description, sizeof (description),
_("set property \"%s\" on any buffer matching "
"mask \"%s\"; "
"content is evaluated (see /help eval) for all "
"properties except \"key_bind_xxx\" and "
"\"key_unbind_xxx\"; when evaluation is done, "
"${buffer} is a pointer to the buffer being opened, "
"${property} is the name of the property being set"),
pos + 1,
buffer_mask);
ptr_option = config_file_new_option (
config_file, section,
option_name, "string",
description,
"",
0, 0, "", value, 0,
NULL, NULL, NULL,
&config_weechat_buffer_change_cb, NULL, NULL,
NULL, NULL, NULL);
rc = (ptr_option) ?
WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR;
free (buffer_mask);
}
}
}
if (ptr_option)
config_weechat_buffer_apply_option (ptr_option);
return rc;
}
/*
* Sets a buffer property.
*
* Returns:
* 1: OK
* 0: error
*/
int
config_weechat_buffer_set (struct t_gui_buffer *buffer,
const char *property, const char *value)
{
char option_name[4096];
int rc;
if (!buffer || !property || !property[0])
return 0;
snprintf (option_name, sizeof (option_name),
"%s.%s",
buffer->full_name,
property);
/* create/update option */
rc = config_weechat_buffer_create_option_cb (
NULL, NULL,
weechat_config_file,
weechat_config_section_buffer,
option_name,
(value) ? value : "");
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
{
gui_chat_printf (
NULL,
_("Option \"weechat.buffer.%s\" has been set to \"%s\""),
option_name,
(value) ? value : "");
}
return (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) ? 1 : 0;
}
/*
* Callback for changes on a notify option.
*/
@@ -5159,16 +4982,6 @@ config_weechat_init_options ()
NULL, NULL, NULL,
NULL, NULL, NULL);
/* buffer */
weechat_config_section_buffer = config_file_new_section (
weechat_config_file, "buffer",
1, 1,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
&config_weechat_buffer_create_option_cb, NULL, NULL,
NULL, NULL, NULL);
/* notify */
weechat_config_section_notify = config_file_new_section (
weechat_config_file, "notify",
-3
View File
@@ -142,7 +142,6 @@ extern struct t_config_section *weechat_config_section_signal;
extern struct t_config_section *weechat_config_section_bar;
extern struct t_config_section *weechat_config_section_custom_bar_item;
extern struct t_config_section *weechat_config_section_layout;
extern struct t_config_section *weechat_config_section_buffer;
extern struct t_config_section *weechat_config_section_notify;
extern struct t_config_section *weechat_config_section_filter;
extern struct t_config_section *weechat_config_section_key[];
@@ -401,8 +400,6 @@ 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 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);
+37 -145
View File
@@ -42,29 +42,9 @@ char *weecrypto_hash_algo_string[] = {
"crc32",
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512",
"sha224", "sha256", "sha384", "sha512",
#if GCRYPT_VERSION_NUMBER >= 0x010700
"sha3-224",
"sha3-256",
"sha3-384",
"sha3-512",
#endif
#if GCRYPT_VERSION_NUMBER >= 0x010800
"blake2b-160",
"blake2b-256",
"blake2b-384",
"blake2b-512",
"blake2s-128",
"blake2s-160",
"blake2s-224",
"blake2s-256",
#endif
#if GCRYPT_VERSION_NUMBER >= 0x010904
"sha512-224",
"sha512-256",
"sha3-224", "sha3-256", "sha3-384", "sha3-512",
#endif
NULL,
};
@@ -72,42 +52,10 @@ int weecrypto_hash_algo[] = {
GCRY_MD_CRC32,
GCRY_MD_MD5,
GCRY_MD_SHA1,
GCRY_MD_SHA224,
GCRY_MD_SHA256,
GCRY_MD_SHA384,
GCRY_MD_SHA512,
GCRY_MD_SHA224, GCRY_MD_SHA256, GCRY_MD_SHA384, GCRY_MD_SHA512,
#if GCRYPT_VERSION_NUMBER >= 0x010700
GCRY_MD_SHA3_224,
GCRY_MD_SHA3_256,
GCRY_MD_SHA3_384,
GCRY_MD_SHA3_512,
GCRY_MD_SHA3_224, GCRY_MD_SHA3_256, GCRY_MD_SHA3_384, GCRY_MD_SHA3_512,
#endif
#if GCRYPT_VERSION_NUMBER >= 0x010800
GCRY_MD_BLAKE2B_160,
GCRY_MD_BLAKE2B_256,
GCRY_MD_BLAKE2B_384,
GCRY_MD_BLAKE2B_512,
GCRY_MD_BLAKE2S_128,
GCRY_MD_BLAKE2S_160,
GCRY_MD_BLAKE2S_224,
GCRY_MD_BLAKE2S_256,
#endif
#if GCRYPT_VERSION_NUMBER >= 0x010904
GCRY_MD_SHA512_224,
GCRY_MD_SHA512_256,
#endif
};
char *weecrypto_cipher_string[] = {
"aes128",
"aes192",
"aes256",
NULL,
};
int weecrypto_cipher[] = {
GCRY_CIPHER_AES128,
GCRY_CIPHER_AES192,
GCRY_CIPHER_AES256,
};
@@ -132,53 +80,22 @@ weecrypto_get_hash_algo (const char *hash_algo)
return GCRY_MD_NONE;
}
/*
* Returns the cipher with the name, or GCRY_CIPHER_NONE if not found.
*/
int
weecrypto_get_cipher (const char *cipher)
{
int i;
if (!cipher)
return GCRY_CIPHER_NONE;
for (i = 0; weecrypto_cipher_string[i]; i++)
{
if (strcmp (weecrypto_cipher_string[i], cipher) == 0)
return weecrypto_cipher[i];
}
return GCRY_CIPHER_NONE;
}
/*
* Computes hash of data using the given hash algorithm.
*
* The hash size depends on the algorithm, common ones are:
*
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA512_256 256 bits == 32 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA512_224 224 bits == 28 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
* GCRY_MD_BLAKE2B_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_384 384 bits == 48 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_512 512 bits == 64 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_128 128 bits == 16 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_224 224 bits == 28 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
*
* The result hash is stored in "hash" (the buffer must be large enough).
*
@@ -248,27 +165,17 @@ hash_end:
*
* The hash size depends on the algorithm, common ones are:
*
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA512_224 224 bits == 28 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA512_256 256 bits == 32 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
* GCRY_MD_BLAKE2B_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_384 384 bits == 48 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_512 512 bits == 64 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_128 128 bits == 16 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_224 224 bits == 28 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
*
* The result hash is stored in "hash" (the buffer must be large enough).
*
@@ -415,27 +322,17 @@ hash_pbkdf2_end:
*
* The hash size depends on the algorithm, common ones are:
*
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA512_224 224 bits == 28 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA512_256 256 bits == 32 bytes (libgcrypt 1.9.4)
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
* GCRY_MD_BLAKE2B_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_384 384 bits == 48 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2B_512 512 bits == 64 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_128 128 bits == 16 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_160 160 bits == 20 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_224 224 bits == 28 bytes (libgcrypt 1.8.0)
* GCRY_MD_BLAKE2S_256 256 bits == 32 bytes (libgcrypt 1.8.0)
* GCRY_MD_CRC32 32 bits == 4 bytes
* GCRY_MD_MD5 128 bits == 16 bytes
* GCRY_MD_SHA1 160 bits == 20 bytes
* GCRY_MD_SHA224 224 bits == 28 bytes
* GCRY_MD_SHA256 256 bits == 32 bytes
* GCRY_MD_SHA384 384 bits == 48 bytes
* GCRY_MD_SHA512 512 bits == 64 bytes
* GCRY_MD_SHA3_224 224 bits == 28 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_256 256 bits == 32 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_384 384 bits == 48 bytes (libgcrypt 1.7.0)
* GCRY_MD_SHA3_512 512 bits == 64 bytes (libgcrypt 1.7.0)
*
* The result hash is stored in "hash" (the buffer must be large enough).
*
@@ -524,10 +421,6 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
int rc, offset, length;
unsigned long bin_code;
#if __BYTE_ORDER == __BIG_ENDIAN
/* Big endian does not need to swap bytes here! */
moving_factor_swapped = moving_factor;
#else
moving_factor_swapped = (moving_factor >> 56)
| ((moving_factor << 40) & 0x00FF000000000000)
| ((moving_factor << 24) & 0x0000FF0000000000)
@@ -536,7 +429,6 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
| ((moving_factor >> 24) & 0x0000000000FF0000)
| ((moving_factor >> 40) & 0x000000000000FF00)
| (moving_factor << 56);
#endif
rc = weecrypto_hmac (secret, length_secret,
&moving_factor_swapped, sizeof (moving_factor_swapped),
-1
View File
@@ -24,7 +24,6 @@
#define WEECRYPTO_TOTP_MAX_DIGITS 10
extern int weecrypto_get_hash_algo (const char *hash_algo);
extern int weecrypto_get_cipher (const char *cipher);
extern int weecrypto_hash (const void *data, int data_size, int hash_algo,
void *hash, int *hash_size);
extern int weecrypto_hash_file (const char *filename, int hash_algo,
+10 -17
View File
@@ -33,9 +33,7 @@
#include <gcrypt.h>
#include <curl/curl.h>
#include <zlib.h>
#ifdef HAVE_ZSTD
#include <zstd.h>
#endif
#include <gnutls/gnutls.h>
@@ -69,9 +67,6 @@
int debug_dump_active = 0;
long long debug_long_callbacks = 0; /* callbacks taking more than */
/* N microseconds will be traced */
/*
* Writes dump of data to WeeChat log file.
@@ -685,13 +680,11 @@ debug_libs_cb (const void *pointer, void *data,
gui_chat_printf (NULL, " zlib: (?)");
#endif /* ZLIB_VERSION */
#ifdef HAVE_ZSTD
/* display zstd version */
gui_chat_printf (NULL, " zstd: %d.%d.%d",
ZSTD_VERSION_MAJOR,
ZSTD_VERSION_MINOR,
ZSTD_VERSION_RELEASE);
#endif /* HAVE_ZSTD */
return WEECHAT_RC_OK;
}
@@ -743,29 +736,29 @@ debug_display_time_elapsed (struct timeval *time1, struct timeval *time2,
const char *message, int display)
{
struct timeval debug_timeval_end;
char *str_diff;
long long diff;
long long diff, diff_hour, diff_min, diff_sec, diff_usec;
gettimeofday (&debug_timeval_end, NULL);
diff = util_timeval_diff (time1, time2);
str_diff = util_get_microseconds_string (diff);
diff_usec = diff % 1000000;
diff_sec = (diff / 1000000) % 60;
diff_min = ((diff / 1000000) / 60) % 60;
diff_hour = (diff / 1000000) / 3600;
if (display)
{
gui_chat_printf (NULL,
"debug: time[%s] -> %s",
"debug: time[%s] -> %lld:%02lld:%02lld.%06lld",
(message) ? message : "?",
(str_diff) ? str_diff : "?");
diff_hour, diff_min, diff_sec, diff_usec);
}
else
{
log_printf ("debug: time[%s] -> %s",
log_printf ("debug: time[%s] -> %lld:%02lld:%02lld.%06lld",
(message) ? message : "?",
(str_diff) ? str_diff : "?");
diff_hour, diff_min, diff_sec, diff_usec);
}
if (str_diff)
free (str_diff);
}
/*
-2
View File
@@ -24,8 +24,6 @@
struct t_gui_window_tree;
extern long long debug_long_callbacks;
extern void debug_sigsegv_cb ();
extern void debug_windows_tree ();
extern void debug_memory ();
+1 -12
View File
@@ -45,9 +45,7 @@
#include <dirent.h>
#include <ftw.h>
#include <zlib.h>
#ifdef HAVE_ZSTD
#include <zstd.h>
#endif
#include "weechat.h"
#include "wee-config.h"
@@ -1137,7 +1135,6 @@ int
dir_file_compress_zstd (const char *from, const char *to,
int compression_level)
{
#ifdef HAVE_ZSTD
FILE *source, *dest;
void *buffer_in, *buffer_out;
size_t buffer_in_size, buffer_out_size, num_read, remaining;
@@ -1300,14 +1297,6 @@ end:
fclose (dest);
return rc;
#else
/* make C compiler happy */
(void) from;
(void) to;
(void) compression_level;
return 0;
#endif /* HAVE_ZSTD */
}
/*
@@ -1317,7 +1306,7 @@ end:
*
* Supported values for parameter "compressor":
* - "gzip": gzip compression (via zlib)
* - "zstd": zstandard compression (it must be enabled at build time)
* - "zstd": zstandard compression
*
* Parameter "compression_level" is the compression level as percentage:
* from 1 (fast, low compression) to 100 (slow, best compression).
+1 -3
View File
@@ -317,7 +317,7 @@ doc_gen_user_commands (const char *path, const char *lang)
HOOK_COMMAND(ptr_hook, command),
TRANS(HOOK_COMMAND(ptr_hook, description)));
length = 1 + utf8_strlen_screen (HOOK_COMMAND(ptr_hook, command)) + 2;
length = 1 + utf8_strlen (HOOK_COMMAND(ptr_hook, command)) + 2;
snprintf (format, sizeof (format), "%%-%ds%%s\n", length);
ptr_args = TRANS(HOOK_COMMAND(ptr_hook, args));
first_line = 1;
@@ -1658,11 +1658,9 @@ doc_generate (const char *path)
* (this is used to generate documentation without installing WeeChat,
* that means no need to run `make install`)
*/
#ifdef ENABLE_NLS
localedir = getenv ("WEECHAT_DOCGEN_LOCALEDIR");
if (localedir && localedir[0])
bindtextdomain (PACKAGE, localedir);
#endif /* ENABLE_NLS */
for (i = 0; locales[i]; i++)
{
+10 -10
View File
@@ -1167,7 +1167,7 @@ char *
eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path,
struct t_eval_context *eval_context)
{
char *value, *var_name, str_value[128], *pos, *property;
char *value, *old_value, *var_name, str_value[128], *pos, *property;
const char *ptr_value, *hdata_name, *ptr_var_name, *pos_open_paren;
int type, debug_id;
struct t_hashtable *hashtable;
@@ -1272,8 +1272,7 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path,
property = string_strndup (pos + 1,
pos_open_paren - pos - 1);
ptr_value = hashtable_get_string (hashtable, property);
if (property)
free (property);
free (property);
value = (ptr_value) ? strdup (ptr_value) : NULL;
break;
}
@@ -1327,12 +1326,13 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path,
goto end;
hdata = hook_hdata_get (NULL, hdata_name);
if (value)
free (value);
old_value = value;
value = eval_hdata_get_value (hdata,
pointer,
pos + 1,
(pos) ? pos + 1 : NULL,
eval_context);
if (old_value)
free (old_value);
}
end:
@@ -1463,7 +1463,7 @@ end:
* - a string to evaluate (format: eval:xxx)
* - a condition to evaluate (format: eval_cond:xxx)
* - a string with escaped chars (format: esc:xxx or \xxx)
* - a string with a range of chars (format: chars:range)
* - a string with a range of chars (format: chars:xxx)
* - a string converted to lower case (format: lower:xxx)
* - a string converted to upper case (format: upper:xxx)
* - a string with chars to hide (format: hide:char,string)
@@ -1478,15 +1478,15 @@ end:
* - split string (format: split:number,separators,flags,xxx
* or split:count,separators,flags,xxx
* or split:random,separators,flags,xxx)
* - split shell arguments (format: split_shell:number,xxx or
* split_shell:count,xxx or split_shell:random,xxx)
* - split shell arguments (format: split:number,xxx or split:count,xxx
* or split:random,xxx)
* - a regex group captured (format: re:N (0.99) or re:+)
* - a color (format: color:xxx)
* - a modifier (format: modifier:name,data,xxx)
* - an info (format: info:name,arguments)
* - a base 16/32/64 encoded/decoded string (format: base_encode:base,xxx
* or base_decode:base,xxx)
* - current date/time (format: date or date:format)
* - current date/time (format: date or date:xxx)
* - an environment variable (format: env:XXX)
* - a ternary operator (format: if:condition?value_if_true:value_if_false)
* - calculate result of an expression (format: calc:xxx)
+19 -139
View File
@@ -28,7 +28,6 @@
#include "weechat.h"
#include "wee-hdata.h"
#include "wee-hook.h"
#include "wee-eval.h"
#include "wee-hashtable.h"
#include "wee-log.h"
@@ -956,14 +955,12 @@ int
hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2,
const char *name, int case_sensitive)
{
int rc, type, type1, type2, int_value1, int_value2;
int rc, int_value1, int_value2;
long long_value1, long_value2;
char *var_name, *property, char_value1, char_value2;
const char *ptr_var_name, *pos, *pos_open_paren, *hdata_name;
const char *str_value1, *str_value2;
char char_value1, char_value2;
const char *ptr_name, *str_value1, *str_value2;
void *ptr_value1, *ptr_value2;
time_t time_value1, time_value2;
struct t_hashtable *hashtable1, *hashtable2;
if (!hdata || !name)
return 0;
@@ -976,47 +973,32 @@ hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2,
return 0;
rc = 0;
ptr_value1 = NULL;
ptr_value2 = NULL;
pos = strchr (name, '.');
if (pos > name)
var_name = string_strndup (name, pos - name);
else
var_name = strdup (name);
if (!var_name)
goto end;
hdata_get_index_and_name (var_name, NULL, &ptr_var_name);
type = hdata_get_var_type (hdata, ptr_var_name);
if (type < 0)
goto end;
switch (type)
hdata_get_index_and_name (name, NULL, &ptr_name);
switch (hdata_get_var_type (hdata, ptr_name))
{
case WEECHAT_HDATA_CHAR:
char_value1 = hdata_char (hdata, pointer1, var_name);
char_value2 = hdata_char (hdata, pointer2, var_name);
char_value1 = hdata_char (hdata, pointer1, name);
char_value2 = hdata_char (hdata, pointer2, name);
rc = (char_value1 < char_value2) ?
-1 : ((char_value1 > char_value2) ? 1 : 0);
break;
case WEECHAT_HDATA_INTEGER:
int_value1 = hdata_integer (hdata, pointer1, var_name);
int_value2 = hdata_integer (hdata, pointer2, var_name);
int_value1 = hdata_integer (hdata, pointer1, name);
int_value2 = hdata_integer (hdata, pointer2, name);
rc = (int_value1 < int_value2) ?
-1 : ((int_value1 > int_value2) ? 1 : 0);
break;
case WEECHAT_HDATA_LONG:
long_value1 = hdata_long (hdata, pointer1, var_name);
long_value2 = hdata_long (hdata, pointer2, var_name);
long_value1 = hdata_long (hdata, pointer1, name);
long_value2 = hdata_long (hdata, pointer2, name);
rc = (long_value1 < long_value2) ?
-1 : ((long_value1 > long_value2) ? 1 : 0);
break;
case WEECHAT_HDATA_STRING:
case WEECHAT_HDATA_SHARED_STRING:
str_value1 = hdata_string (hdata, pointer1, var_name);
str_value2 = hdata_string (hdata, pointer2, var_name);
str_value1 = hdata_string (hdata, pointer1, name);
str_value2 = hdata_string (hdata, pointer2, name);
if (!str_value1 && !str_value2)
rc = 0;
else if (str_value1 && !str_value2)
@@ -1036,105 +1018,20 @@ hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2,
}
break;
case WEECHAT_HDATA_POINTER:
ptr_value1 = hdata_pointer (hdata, pointer1, var_name);
ptr_value2 = hdata_pointer (hdata, pointer2, var_name);
ptr_value1 = hdata_pointer (hdata, pointer1, name);
ptr_value2 = hdata_pointer (hdata, pointer2, name);
rc = (ptr_value1 < ptr_value2) ?
-1 : ((ptr_value1 > ptr_value2) ? 1 : 0);
break;
case WEECHAT_HDATA_TIME:
time_value1 = hdata_time (hdata, pointer1, var_name);
time_value2 = hdata_time (hdata, pointer2, var_name);
time_value1 = hdata_time (hdata, pointer1, name);
time_value2 = hdata_time (hdata, pointer2, name);
rc = (time_value1 < time_value2) ?
-1 : ((time_value1 > time_value2) ? 1 : 0);
break;
case WEECHAT_HDATA_HASHTABLE:
ptr_value1 = hdata_hashtable (hdata, pointer1, var_name);
ptr_value2 = hdata_hashtable (hdata, pointer2, var_name);
if (pos)
{
/*
* for a hashtable, if there is a "." after name of hdata:
* 1) If "()" is at the end, it is a function call to
* hashtable_get_string().
* 2) Otherwise, get the value for this key in hashtable.
*/
hashtable1 = ptr_value1;
hashtable2 = ptr_value2;
pos_open_paren = strchr (pos, '(');
if (pos_open_paren
&& (pos_open_paren > pos + 1)
&& (pos_open_paren[1] == ')'))
{
property = string_strndup (pos + 1,
pos_open_paren - pos - 1);
ptr_value1 = (void *)hashtable_get_string (hashtable1, property);
ptr_value2 = (void *)hashtable_get_string (hashtable2, property);
if (property)
free (property);
type1 = HASHTABLE_STRING;
type2 = HASHTABLE_STRING;
}
else
{
ptr_value1 = hashtable_get (hashtable1, pos + 1);
ptr_value2 = hashtable_get (hashtable2, pos + 1);
type1 = hashtable1->type_values;
type2 = hashtable2->type_values;
}
if (!ptr_value1 && ptr_value2)
rc = -1;
else if (ptr_value1 && !ptr_value2)
rc = 1;
else if (!ptr_value1 && !ptr_value2)
rc = 0;
else if (type1 != type2)
rc = 0;
else
{
switch (type1)
{
case HASHTABLE_INTEGER:
int_value1 = *((int *)ptr_value1);
int_value2 = *((int *)ptr_value2);
rc = (int_value1 < int_value2) ?
-1 : ((int_value1 > int_value2) ? 1 : 0);
break;
case HASHTABLE_STRING:
if (case_sensitive)
rc = strcmp ((const char *)ptr_value1,
(const char *)ptr_value2);
else
rc = string_strcasecmp ((const char *)ptr_value1,
(const char *)ptr_value2);
if (rc < 0)
rc = -1;
else if (rc > 0)
rc = 1;
break;
case HASHTABLE_POINTER:
case HASHTABLE_BUFFER:
rc = (ptr_value1 < ptr_value2) ?
-1 : ((ptr_value1 > ptr_value2) ? 1 : 0);
break;
case HASHTABLE_TIME:
time_value1 = (long long)(*((time_t *)ptr_value1));
time_value2 = (long long)(*((time_t *)ptr_value2));
rc = (time_value1 < time_value2) ?
-1 : ((time_value1 > time_value2) ? 1 : 0);
break;
case HASHTABLE_NUM_TYPES:
break;
}
}
}
else
{
/* compare hashtables by pointer */
rc = (ptr_value1 < ptr_value2) ?
-1 : ((ptr_value1 > ptr_value2) ? 1 : 0);
}
/* no comparison for hashtables */
rc = 0;
break;
case WEECHAT_HDATA_OTHER:
/* no comparison for other types */
@@ -1142,23 +1039,6 @@ hdata_compare (struct t_hdata *hdata, void *pointer1, void *pointer2,
break;
}
/*
* if we are on a pointer and that something else is in path (after "."),
* go on with this pointer and remaining path
*/
if ((type == WEECHAT_HDATA_POINTER) && pos)
{
hdata_name = hdata_get_var_hdata (hdata, var_name);
if (!hdata_name)
goto end;
hdata = hook_hdata_get (NULL, hdata_name);
rc = hdata_compare (hdata, ptr_value1, ptr_value2, pos + 1,
case_sensitive);
}
end:
if (var_name)
free (var_name);
return rc;
}
+39 -188
View File
@@ -28,18 +28,15 @@
#include <string.h>
#include <time.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <errno.h>
#include "weechat.h"
#include "wee-debug.h"
#include "wee-hook.h"
#include "wee-hashtable.h"
#include "wee-infolist.h"
#include "wee-log.h"
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-util.h"
#include "../gui/gui-chat.h"
#include "../plugins/plugin.h"
@@ -47,7 +44,7 @@
char *hook_type_string[HOOK_NUM_TYPES] =
{ "command", "command_run", "timer", "fd", "process", "connect", "line",
"print", "signal", "hsignal", "config", "completion", "modifier",
"info", "info_hashtable", "infolist", "hdata", "focus", "url" };
"info", "info_hashtable", "infolist", "hdata", "focus" };
struct t_hook *weechat_hooks[HOOK_NUM_TYPES]; /* list of hooks */
struct t_hook *last_weechat_hook[HOOK_NUM_TYPES]; /* last hook */
int hooks_count[HOOK_NUM_TYPES]; /* number of hooks */
@@ -60,98 +57,50 @@ int hook_socketpair_ok = 0; /* 1 if socketpair() is OK */
/* hook callbacks */
t_callback_hook *hook_callback_add[HOOK_NUM_TYPES] =
{ NULL, NULL, NULL, &hook_fd_add_cb, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
t_callback_hook *hook_callback_remove[HOOK_NUM_TYPES] =
{ NULL, NULL, NULL, &hook_fd_remove_cb, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
t_callback_hook *hook_callback_free_data[HOOK_NUM_TYPES] =
{
&hook_command_free_data,
&hook_command_run_free_data,
&hook_timer_free_data,
&hook_fd_free_data,
&hook_process_free_data,
&hook_connect_free_data,
&hook_line_free_data,
&hook_print_free_data,
&hook_signal_free_data,
&hook_hsignal_free_data,
&hook_config_free_data,
&hook_completion_free_data,
&hook_modifier_free_data,
&hook_info_free_data,
&hook_info_hashtable_free_data,
&hook_infolist_free_data,
&hook_hdata_free_data,
&hook_focus_free_data,
&hook_url_free_data,
};
{ &hook_command_free_data, &hook_command_run_free_data,
&hook_timer_free_data, &hook_fd_free_data,
&hook_process_free_data, &hook_connect_free_data,
&hook_line_free_data, &hook_print_free_data,
&hook_signal_free_data, &hook_hsignal_free_data,
&hook_config_free_data, &hook_completion_free_data,
&hook_modifier_free_data, &hook_info_free_data,
&hook_info_hashtable_free_data, &hook_infolist_free_data,
&hook_hdata_free_data, &hook_focus_free_data };
t_callback_hook_get_desc *hook_callback_get_desc[HOOK_NUM_TYPES] =
{
&hook_command_get_description,
&hook_command_run_get_description,
&hook_timer_get_description,
&hook_fd_get_description,
&hook_process_get_description,
&hook_connect_get_description,
&hook_line_get_description,
&hook_print_get_description,
&hook_signal_get_description,
&hook_hsignal_get_description,
&hook_config_get_description,
&hook_completion_get_description,
&hook_modifier_get_description,
&hook_info_get_description,
&hook_info_hashtable_get_description,
&hook_infolist_get_description,
&hook_hdata_get_description,
&hook_focus_get_description,
&hook_url_get_description,
};
{ &hook_command_get_description, &hook_command_run_get_description,
&hook_timer_get_description, &hook_fd_get_description,
&hook_process_get_description, &hook_connect_get_description,
&hook_line_get_description, &hook_print_get_description,
&hook_signal_get_description, &hook_hsignal_get_description,
&hook_config_get_description, &hook_completion_get_description,
&hook_modifier_get_description, &hook_info_get_description,
&hook_info_hashtable_get_description, &hook_infolist_get_description,
&hook_hdata_get_description, &hook_focus_get_description };
t_callback_hook_infolist *hook_callback_add_to_infolist[HOOK_NUM_TYPES] =
{
&hook_command_add_to_infolist,
&hook_command_run_add_to_infolist,
&hook_timer_add_to_infolist,
&hook_fd_add_to_infolist,
&hook_process_add_to_infolist,
&hook_connect_add_to_infolist,
&hook_line_add_to_infolist,
&hook_print_add_to_infolist,
&hook_signal_add_to_infolist,
&hook_hsignal_add_to_infolist,
&hook_config_add_to_infolist,
&hook_completion_add_to_infolist,
&hook_modifier_add_to_infolist,
&hook_info_add_to_infolist,
&hook_info_hashtable_add_to_infolist,
&hook_infolist_add_to_infolist,
&hook_hdata_add_to_infolist,
&hook_focus_add_to_infolist,
&hook_url_add_to_infolist,
};
{ &hook_command_add_to_infolist, &hook_command_run_add_to_infolist,
&hook_timer_add_to_infolist, &hook_fd_add_to_infolist,
&hook_process_add_to_infolist, &hook_connect_add_to_infolist,
&hook_line_add_to_infolist, &hook_print_add_to_infolist,
&hook_signal_add_to_infolist, &hook_hsignal_add_to_infolist,
&hook_config_add_to_infolist, &hook_completion_add_to_infolist,
&hook_modifier_add_to_infolist, &hook_info_add_to_infolist,
&hook_info_hashtable_add_to_infolist, &hook_infolist_add_to_infolist,
&hook_hdata_add_to_infolist, &hook_focus_add_to_infolist };
t_callback_hook *hook_callback_print_log[HOOK_NUM_TYPES] =
{
&hook_command_print_log,
&hook_command_run_print_log,
&hook_timer_print_log,
&hook_fd_print_log,
&hook_process_print_log,
&hook_connect_print_log,
&hook_line_print_log,
&hook_print_print_log,
&hook_signal_print_log,
&hook_hsignal_print_log,
&hook_config_print_log,
&hook_completion_print_log,
&hook_modifier_print_log,
&hook_info_print_log,
&hook_info_hashtable_print_log,
&hook_infolist_print_log,
&hook_hdata_print_log,
&hook_focus_print_log,
&hook_url_print_log,
};
{ &hook_command_print_log, &hook_command_run_print_log,
&hook_timer_print_log, &hook_fd_print_log,
&hook_process_print_log, &hook_connect_print_log,
&hook_line_print_log, &hook_print_print_log,
&hook_signal_print_log, &hook_hsignal_print_log,
&hook_config_print_log, &hook_completion_print_log,
&hook_modifier_print_log, &hook_info_print_log,
&hook_info_hashtable_print_log, &hook_infolist_print_log,
&hook_hdata_print_log, &hook_focus_print_log };
/*
@@ -477,67 +426,6 @@ hook_exec_end ()
hook_remove_deleted ();
}
/*
* Starts execution of a hook callback.
*/
void
hook_callback_start (struct t_hook *hook, struct t_hook_exec_cb *hook_exec_cb)
{
if (hook->type == HOOK_TYPE_COMMAND)
hook->running++;
else
hook->running = 1;
if (debug_long_callbacks > 0)
{
gettimeofday (&hook_exec_cb->start_time, NULL);
}
else
{
hook_exec_cb->start_time.tv_sec = 0;
hook_exec_cb->start_time.tv_usec = 0;
}
}
/*
* Ends execution of a hook callback.
*/
void
hook_callback_end (struct t_hook *hook, struct t_hook_exec_cb *hook_exec_cb)
{
struct timeval end_time;
long long time_diff;
char *str_diff;
if (hook->type == HOOK_TYPE_COMMAND)
hook->running--;
else
hook->running = 0;
if ((debug_long_callbacks > 0)
&& (hook_exec_cb->start_time.tv_sec > 0))
{
gettimeofday (&end_time, NULL);
time_diff = util_timeval_diff (&hook_exec_cb->start_time, &end_time);
if (time_diff >= debug_long_callbacks)
{
str_diff = util_get_microseconds_string (time_diff);
log_printf (
_("debug: long callback: hook %s (%s), plugin: %s, "
"subplugin: %s, time elapsed: %s"),
hook_type_string[hook->type],
hook_get_description (hook),
plugin_get_name (hook->plugin),
(hook->subplugin) ? hook->subplugin : "-",
str_diff);
if (str_diff)
free (str_diff);
}
}
}
/*
* Returns description of hook.
*
@@ -628,43 +516,6 @@ hook_set (struct t_hook *hook, const char *property, const char *value)
}
}
/*
* Callback used to clean a process (forked processes) by acknowledging its end.
*/
int
hook_timer_clean_process_cb (const void *pointer, void *data,
int remaining_calls)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) remaining_calls;
waitpid (*((pid_t *)data), NULL, WNOHANG);
return WEECHAT_RC_OK;
}
/*
* Schedule a cleanup timer to clean children (forked processes).
*/
void
hook_schedule_clean_process (pid_t pid)
{
pid_t *temp_pid;
/* temp_pid will be freed when the timer is removed */
temp_pid = malloc (sizeof (*temp_pid));
if (temp_pid)
{
*temp_pid = pid;
hook_timer (NULL, 100, 0, 1,
&hook_timer_clean_process_cb, NULL, temp_pid);
}
}
/*
* Unhooks something.
*/
-14
View File
@@ -40,7 +40,6 @@ struct t_hook;
#include "hook/wee-hook-process.h"
#include "hook/wee-hook-signal.h"
#include "hook/wee-hook-timer.h"
#include "hook/wee-hook-url.h"
struct t_gui_bar;
struct t_gui_buffer;
@@ -74,7 +73,6 @@ enum t_hook_type
HOOK_TYPE_INFOLIST, /* get some info as infolist */
HOOK_TYPE_HDATA, /* get hdata pointer */
HOOK_TYPE_FOCUS, /* focus event (mouse/key) */
HOOK_TYPE_URL, /* URL transfer */
/* number of hook types */
HOOK_NUM_TYPES,
};
@@ -112,12 +110,6 @@ struct t_hook
struct t_hook *next_hook; /* link to next hook */
};
struct t_hook_exec_cb
{
struct timeval start_time; /* callback exec star time (to trace */
/* long running callbacks) */
};
/* hook variables */
extern char *hook_type_string[];
@@ -126,7 +118,6 @@ extern struct t_hook *last_weechat_hook[];
extern int hooks_count[];
extern int hooks_count_total;
extern int hook_socketpair_ok;
extern long long hook_debug_long_callbacks;
/* hook functions */
@@ -139,14 +130,9 @@ extern void hook_init_data (struct t_hook *hook,
extern int hook_valid (struct t_hook *hook);
extern void hook_exec_start ();
extern void hook_exec_end ();
extern void hook_callback_start (struct t_hook *hook,
struct t_hook_exec_cb *hook_exec_cb);
extern void hook_callback_end (struct t_hook *hook,
struct t_hook_exec_cb *hook_exec_cb);
extern char *hook_get_description (struct t_hook *hook);
extern void hook_set (struct t_hook *hook, const char *property,
const char *value);
extern void hook_schedule_clean_process (pid_t pid);
extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin,
const char *subplugin);
+3 -5
View File
@@ -337,11 +337,11 @@ network_is_ip_address (const char *address)
return 0;
/* valid IPv4? */
if (inet_pton (AF_INET, address, &server_addr.sin_addr) == 1)
if (inet_pton (AF_INET, address, &server_addr.sin_addr))
return 1;
/* valid IPv6? */
if (inet_pton (AF_INET6, address, &server_addr6.sin6_addr) == 1)
if (inet_pton (AF_INET6, address, &server_addr6.sin6_addr))
return 1;
/* not a valid IP address */
@@ -554,13 +554,11 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
socks4.method = 1;
socks4.port = htons (port);
network_resolve (address, ip_addr, NULL);
socks4.address = inet_addr (ip_addr);
strncpy (socks4.user, username, sizeof (socks4.user) - 1);
free (username);
if (inet_pton (AF_INET, ip_addr, &socks4.address) != 1)
return 0;
length = 8 + strlen (socks4.user) + 1;
if (network_send_with_retry (sock, (char *) &socks4, length, 0) != length)
return 0;
+4 -19
View File
@@ -26,11 +26,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gcrypt.h>
#include "weechat.h"
#include "wee-config-file.h"
#include "wee-crypto.h"
#include "wee-hashtable.h"
#include "wee-secure.h"
#include "wee-secure-buffer.h"
@@ -87,8 +85,7 @@ secure_buffer_display_data (void *data,
void
secure_buffer_display ()
{
int line, count, count_encrypted, hash_algo;
char str_supported[1024];
int line, count, count_encrypted;
if (!secure_buffer)
return;
@@ -102,22 +99,10 @@ secure_buffer_display ()
line = 0;
str_supported[0] = '\0';
hash_algo = weecrypto_get_hash_algo (
config_file_option_string (secure_config_crypt_hash_algo));
if (hash_algo == GCRY_MD_NONE)
{
snprintf (str_supported, sizeof (str_supported),
" (%s)",
/* TRANSLATORS: "hash algorithm not supported" */
_("not supported"));
}
gui_chat_printf_y (secure_buffer, line++,
"Hash algo: %s%s Cipher: %s Salt: %s",
config_file_option_string (secure_config_crypt_hash_algo),
str_supported,
config_file_option_string (secure_config_crypt_cipher),
"Hash algo: %s Cipher: %s Salt: %s",
secure_hash_algo_string[CONFIG_ENUM(secure_config_crypt_hash_algo)],
secure_cipher_string[CONFIG_ENUM(secure_config_crypt_cipher)],
(CONFIG_BOOLEAN(secure_config_crypt_salt)) ? _("on") : _("off"));
/* display passphrase */
+12 -126
View File
@@ -26,11 +26,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gcrypt.h>
#include "weechat.h"
#include "wee-config-file.h"
#include "wee-crypto.h"
#include "wee-hashtable.h"
#include "wee-secure.h"
#include "wee-secure-config.h"
@@ -50,8 +48,6 @@ struct t_config_option *secure_config_crypt_hash_algo = NULL;
struct t_config_option *secure_config_crypt_passphrase_command = NULL;
struct t_config_option *secure_config_crypt_salt = NULL;
int secure_config_loading = 0;
/*
* Gets passphrase from user and puts it in variable "secure_passphrase".
@@ -176,39 +172,6 @@ secure_config_reload_cb (const void *pointer, void *data,
return config_file_reload (config_file);
}
/*
* Callback for changes on some options "weechat.crypt.*" (that can not be
* changed if there are encrypted data.
*/
int
secure_config_check_crypt_option_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) value;
/* any value allowed while reading config */
if (secure_config_loading)
return 1;
/* no encrypted data => changes allowed */
if (secure_hashtable_data_encrypted->items_count == 0)
return 1;
gui_chat_printf (NULL,
_("%sOption %s.%s.%s can not be changed because there "
"are still encrypted data"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
option->config_file->name,
option->section->name,
option->name);
return 0;
}
/*
* Reads a data option in secured data configuration file.
*/
@@ -220,7 +183,7 @@ secure_config_data_read_cb (const void *pointer, void *data,
const char *option_name, const char *value)
{
char *buffer, *decrypted, str_error[1024];
int length_buffer, length_decrypted, rc, hash_algo, cipher;
int length_buffer, length_decrypted, rc;
/* make C compiler happy */
(void) pointer;
@@ -274,38 +237,6 @@ secure_config_data_read_cb (const void *pointer, void *data,
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/* get hash algorithm */
hash_algo = weecrypto_get_hash_algo (
config_file_option_string (secure_config_crypt_hash_algo));
if (hash_algo == GCRY_MD_NONE)
{
gui_chat_printf (
NULL,
_("%sFailed to decrypt data \"%s\": hash algorithm \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
option_name,
config_file_option_string (secure_config_crypt_hash_algo));
hashtable_set (secure_hashtable_data_encrypted, option_name, value);
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/* get cipher */
cipher = weecrypto_get_cipher (
config_file_option_string (secure_config_crypt_cipher));
if (cipher == GCRY_CIPHER_NONE)
{
gui_chat_printf (
NULL,
_("%sFailed to decrypt data \"%s\": cipher \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
option_name,
config_file_option_string (secure_config_crypt_cipher));
hashtable_set (secure_hashtable_data_encrypted, option_name, value);
return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
}
/* decrypt data */
buffer = malloc (strlen (value) + 1);
if (!buffer)
@@ -319,8 +250,8 @@ secure_config_data_read_cb (const void *pointer, void *data,
rc = secure_decrypt_data (
buffer,
length_buffer,
hash_algo,
cipher,
secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)],
secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)],
secure_passphrase,
&decrypted,
&length_decrypted);
@@ -380,41 +311,13 @@ secure_config_data_write_map_cb (void *data,
{
struct t_config_file *config_file;
char *buffer, *buffer_base16;
int length_buffer, rc, hash_algo, cipher;
int length_buffer, rc;
/* make C compiler happy */
(void) hashtable;
config_file = (struct t_config_file *)data;
hash_algo = weecrypto_get_hash_algo (
config_file_option_string (secure_config_crypt_hash_algo));
if (hash_algo == GCRY_MD_NONE)
{
gui_chat_printf (
NULL,
_("%sFailed to encrypt data \"%s\": hash algorithm \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
key,
config_file_option_string (secure_config_crypt_hash_algo));
return;
}
cipher = weecrypto_get_cipher (
config_file_option_string (secure_config_crypt_cipher));
if (cipher == GCRY_CIPHER_NONE)
{
gui_chat_printf (
NULL,
_("%sFailed to encrypt data \"%s\": cipher \"%s\" is not "
"available (ligbcrypt version is too old?)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
key,
config_file_option_string (secure_config_crypt_cipher));
return;
}
buffer = NULL;
length_buffer = 0;
@@ -423,8 +326,8 @@ secure_config_data_write_map_cb (void *data,
/* encrypt password using passphrase */
rc = secure_encrypt_data (
value, strlen (value) + 1,
hash_algo,
cipher,
secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)],
secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)],
secure_passphrase,
&buffer,
&length_buffer);
@@ -449,7 +352,7 @@ secure_config_data_write_map_cb (void *data,
else
{
gui_chat_printf (NULL,
_("%sFailed to encrypt data \"%s\" (%d)"),
_("%sError encrypting data \"%s\" (%d)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
key, rc);
}
@@ -566,26 +469,13 @@ secure_config_init_options ()
N_("cipher used to crypt data (the number after algorithm is the "
"size of the key in bits)"),
"aes128|aes192|aes256", 0, 0, "aes256", NULL, 0,
&secure_config_check_crypt_option_cb, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_hash_algo = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"hash_algo", "enum",
N_("hash algorithm used to check the decrypted data; "
"some of them require a specific libgcrypt version: "
"sha3-*: libgcrypt >= 1.7.0, "
"blake2*: libgcrypt >= 1.8.0, "
"sha512-*: libgcrypt >= 1.9.4"),
"sha224|sha256|sha384|sha512"
"|sha512-224|sha512-256"
"|sha3-224|sha3-256|sha3-384|sha3-512"
"|blake2b-160|blake2b-256|blake2b-384|blake2b-512"
"|blake2s-128|blake2s-160|blake2s-224|blake2s-256",
0, 0, "sha256", NULL, 0,
&secure_config_check_crypt_option_cb, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
N_("hash algorithm used to check the decrypted data"),
"sha224|sha256|sha384|sha512", 0, 0, "sha256", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_passphrase_command = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"passphrase_command", "string",
@@ -610,9 +500,7 @@ secure_config_init_options ()
"then you can turn off this option to have always same content "
"in file"),
NULL, 0, 0, "on", NULL, 0,
&secure_config_check_crypt_option_cb, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
/* data */
@@ -644,9 +532,7 @@ secure_config_read ()
secure_data_encrypted = 0;
secure_config_loading = 1;
rc = config_file_read (secure_config_file);
secure_config_loading = 0;
return rc;
}
+17 -19
View File
@@ -46,6 +46,17 @@ struct t_hashtable *secure_hashtable_data = NULL;
/* data still encrypted (if passphrase not set) */
struct t_hashtable *secure_hashtable_data_encrypted = NULL;
/* hash algorithms */
char *secure_hash_algo_string[] = { "sha224", "sha256", "sha384", "sha512",
NULL };
int secure_hash_algo[] = { GCRY_MD_SHA224, GCRY_MD_SHA256, GCRY_MD_SHA384,
GCRY_MD_SHA512 };
/* ciphers */
char *secure_cipher_string[] = { "aes128", "aes192", "aes256", NULL };
int secure_cipher[] = { GCRY_CIPHER_AES128, GCRY_CIPHER_AES192,
GCRY_CIPHER_AES256 };
char *secure_decrypt_error[] = { "memory", "buffer", "key", "cipher", "setkey",
"decrypt", "hash", "hash mismatch" };
@@ -416,10 +427,8 @@ decrypt_end:
* secured data configuration file (because no passphrase was given).
*
* Returns:
* >= 0: number of decrypted data
* -1: error decrypting data (bad passphrase)
* -2: unsupported hash algorithm
* -3: unsupported cipher
* > 0: number of decrypted data
* 0: error decrypting data
*/
int
@@ -427,22 +436,11 @@ secure_decrypt_data_not_decrypted (const char *passphrase)
{
char **keys, *buffer, *decrypted;
const char *value;
int num_ok, num_keys, i, hash_algo, cipher, rc;
int length_buffer, length_decrypted;
int num_ok, num_keys, i, length_buffer, length_decrypted, rc;
/* we need a passphrase to decrypt data! */
if (!passphrase || !passphrase[0])
return -1;
hash_algo = weecrypto_get_hash_algo (
config_file_option_string (secure_config_crypt_hash_algo));
if (hash_algo == GCRY_MD_NONE)
return -2;
cipher = weecrypto_get_cipher (
config_file_option_string (secure_config_crypt_cipher));
if (cipher == GCRY_CIPHER_NONE)
return -3;
return 0;
num_ok = 0;
@@ -471,8 +469,8 @@ secure_decrypt_data_not_decrypted (const char *passphrase)
rc = secure_decrypt_data (
buffer,
length_buffer,
hash_algo,
cipher,
secure_hash_algo[CONFIG_ENUM(secure_config_crypt_hash_algo)],
secure_cipher[CONFIG_ENUM(secure_config_crypt_cipher)],
passphrase,
&decrypted,
&length_decrypted);
+19
View File
@@ -28,9 +28,28 @@
#define SECURE_DATA_PASSPHRASE_FLAG "__passphrase__"
#define SECURE_SALT_SIZE 8
enum t_secure_config_hash_algo
{
SECURE_CONFIG_HASH_SHA224 = 0,
SECURE_CONFIG_HASH_SHA256,
SECURE_CONFIG_HASH_SHA384,
SECURE_CONFIG_HASH_SHA512,
};
enum t_secure_config_cipher
{
SECURE_CONFIG_CIPHER_AES128 = 0,
SECURE_CONFIG_CIPHER_AES192,
SECURE_CONFIG_CIPHER_AES256,
};
extern char *secure_passphrase;
extern struct t_hashtable *secure_hashtable_data;
extern struct t_hashtable *secure_hashtable_data_encrypted;
extern char *secure_hash_algo_string[];
extern int secure_hash_algo[];
extern char *secure_cipher_string[];
extern int secure_cipher[];
extern int secure_data_encrypted;
extern char *secure_decrypt_error[];
-13
View File
@@ -24,7 +24,6 @@
#endif
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
@@ -38,7 +37,6 @@
#include "wee-log.h"
#include "wee-string.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
@@ -295,17 +293,6 @@ signal_handle ()
signal_sigterm_count = 0;
}
/*
* Suspends WeeChat process.
*/
void
signal_suspend ()
{
kill (getpid (), SIGTSTP);
gui_window_ask_refresh (2);
}
/*
* Initializes signal.
*/
-1
View File
@@ -32,7 +32,6 @@ extern int signal_search_number (int signal_number);
extern int signal_search_name (const char *name);
extern void signal_catch (int signum, void (*handler)(int));
extern void signal_handle ();
extern void signal_suspend ();
extern void signal_init ();
#endif /* WEECHAT_SIGNAL_H */
-64
View File
@@ -394,70 +394,6 @@ string_toupper (const char *string)
return string_dyn_free (result, 0);
}
/*
* Converts string to lower case (using a range of chars).
*
* Note: result must be freed after use.
*/
char *
string_tolower_range (const char *string, int range)
{
char *result, *ptr_result;
if (!string)
return NULL;
if (range <= 0)
return string_tolower (string);
result = strdup (string);
if (!result)
return NULL;
ptr_result = result;
while (ptr_result && ptr_result[0])
{
if ((ptr_result[0] >= 'A') && (ptr_result[0] < 'A' + range))
ptr_result[0] += ('a' - 'A');
ptr_result = (char *)utf8_next_char (ptr_result);
}
return result;
}
/*
* Converts string to upper case (using a range of char).
*
* Note: result must be freed after use.
*/
char *
string_toupper_range (const char *string, int range)
{
char *result, *ptr_result;
if (!string)
return NULL;
if (range <= 0)
return string_toupper (string);
result = strdup (string);
if (!result)
return NULL;
ptr_result = result;
while (ptr_result && ptr_result[0])
{
if ((ptr_result[0] >= 'a') && (ptr_result[0] < 'a' + range))
ptr_result[0] -= ('a' - 'A');
ptr_result = (char *)utf8_next_char (ptr_result);
}
return result;
}
/*
* Compares two chars (case sensitive).
*
-2
View File
@@ -44,8 +44,6 @@ extern char *string_reverse_screen (const char *string);
extern char *string_repeat (const char *string, int count);
extern char *string_tolower (const char *string);
extern char *string_toupper (const char *string);
extern char *string_tolower_range (const char *string, int range);
extern char *string_toupper_range (const char *string, int range);
extern int string_charcmp (const char *string1, const char *string2);
extern int string_charcasecmp (const char *string1, const char *string2);
extern int string_charcasecmp_range (const char *string1, const char *string2,
-362
View File
@@ -1,362 +0,0 @@
/*
* wee-sys.c - system actions
*
* Copyright (C) 2023 Sébastien Helleu <flashcode@flashtux.org>
*
* 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/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#include <sys/wait.h>
#include "weechat.h"
#include "wee-config.h"
#include "wee-log.h"
#include "wee-string.h"
#include "wee-sys.h"
#include "wee-util.h"
#include "../gui/gui-chat.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
#ifdef HAVE_SYS_RESOURCE_H
struct t_rlimit_resource rlimit_resource[] =
{
#ifdef RLIMIT_AS
{ "as", RLIMIT_AS },
#endif
#ifdef RLIMIT_CORE
{ "core", RLIMIT_CORE },
#endif
#ifdef RLIMIT_CPU
{ "cpu", RLIMIT_CPU },
#endif
#ifdef RLIMIT_DATA
{ "data", RLIMIT_DATA },
#endif
#ifdef RLIMIT_FSIZE
{ "fsize", RLIMIT_FSIZE },
#endif
#ifdef RLIMIT_LOCKS
{ "locks", RLIMIT_LOCKS },
#endif
#ifdef RLIMIT_MEMLOCK
{ "memlock", RLIMIT_MEMLOCK },
#endif
#ifdef RLIMIT_MSGQUEUE
{ "msgqueue", RLIMIT_MSGQUEUE },
#endif
#ifdef RLIMIT_NICE
{ "nice", RLIMIT_NICE },
#endif
#ifdef RLIMIT_NOFILE
{ "nofile", RLIMIT_NOFILE },
#endif
#ifdef RLIMIT_NPROC
{ "nproc", RLIMIT_NPROC },
#endif
#ifdef RLIMIT_RSS
{ "rss", RLIMIT_RSS },
#endif
#ifdef RLIMIT_RTPRIO
{ "rtprio", RLIMIT_RTPRIO },
#endif
#ifdef RLIMIT_RTTIME
{ "rttime", RLIMIT_RTTIME },
#endif
#ifdef RLIMIT_SIGPENDING
{ "sigpending", RLIMIT_SIGPENDING },
#endif
#ifdef RLIMIT_STACK
{ "stack", RLIMIT_STACK },
#endif
{ NULL, 0 },
};
#endif /* HAVE_SYS_RESOURCE_H */
/*
* Sets resource limit.
*/
#ifdef HAVE_SYS_RESOURCE_H
void
sys_setrlimit_resource (const char *resource_name, long long limit)
{
int i;
struct rlimit rlim;
char str_limit[64];
if (!resource_name)
return;
if (limit == -1)
snprintf (str_limit, sizeof (str_limit), "unlimited");
else
snprintf (str_limit, sizeof (str_limit), "%lld", limit);
for (i = 0; rlimit_resource[i].name; i++)
{
if (strcmp (rlimit_resource[i].name, resource_name) == 0)
{
if (limit < -1)
{
gui_chat_printf (NULL,
_("%sInvalid limit for resource \"%s\": %s "
"(must be >= -1)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
resource_name, str_limit);
return;
}
rlim.rlim_cur = (limit >= 0) ? (rlim_t)limit : RLIM_INFINITY;
rlim.rlim_max = rlim.rlim_cur;
if (setrlimit (rlimit_resource[i].resource, &rlim) == 0)
{
log_printf (_("Limit for resource \"%s\" has been set to %s"),
resource_name, str_limit);
if (gui_init_ok)
{
gui_chat_printf (NULL,
_("Limit for resource \"%s\" has been set "
"to %s"),
resource_name, str_limit);
}
}
else
{
gui_chat_printf (NULL,
_("%sUnable to set resource limit \"%s\" to "
"%s: error %d %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
resource_name,
str_limit,
errno,
strerror (errno));
}
return;
}
}
gui_chat_printf (NULL,
_("%sUnknown resource limit \"%s\" (see /help "
"weechat.startup.sys_rlimit)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
resource_name);
}
#endif /* HAVE_SYS_RESOURCE_H */
/*
* Sets resource limits using value of option "weechat.startup.sys_rlimit".
*/
void
sys_setrlimit ()
{
#ifdef HAVE_SYS_RESOURCE_H
char **items, *pos, *error;
int num_items, i;
long long number;
items = string_split (CONFIG_STRING(config_startup_sys_rlimit), ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
{
pos = strchr (items[i], ':');
if (pos)
{
pos[0] = '\0';
error = NULL;
number = strtoll (pos + 1, &error, 10);
if (error && !error[0])
{
sys_setrlimit_resource (items[i], number);
}
else
{
gui_chat_printf (NULL,
_("%sInvalid limit for resource \"%s\": "
"%s (must be >= -1)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
items[i], pos + 1);
}
}
}
string_free_split (items);
}
#endif /* HAVE_SYS_RESOURCE_H */
}
/*
* Displays resource limits.
*/
void
sys_display_rlimit ()
{
#ifdef HAVE_SYS_RESOURCE_H
struct rlimit rlim;
char str_cur[128], str_max[128];
int i;
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Resource limits (see \"man getrlimit\" for help):"));
for (i = 0; rlimit_resource[i].name; i++)
{
if (getrlimit (rlimit_resource[i].resource, &rlim) == 0)
{
if (rlim.rlim_cur == RLIM_INFINITY)
{
snprintf (str_cur, sizeof (str_cur), "unlimited");
}
else
{
snprintf (str_cur, sizeof (str_cur),
"%lld", (long long)rlim.rlim_cur);
}
if (rlim.rlim_max == RLIM_INFINITY)
{
snprintf (str_max, sizeof (str_max), "unlimited");
}
else
{
snprintf (str_max, sizeof (str_max),
"%lld", (long long)rlim.rlim_max);
}
gui_chat_printf (NULL,
" %-10s: %s (max: %s)",
rlimit_resource[i].name, str_cur, str_max);
}
else
{
gui_chat_printf (NULL,
_("%sUnable to get resource limit \"%s\": "
"error %d %s"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
rlimit_resource[i].name,
errno,
strerror (errno));
}
}
#else /* HAVE_SYS_RESOURCE_H */
gui_chat_printf (NULL,
_("System function \"%s\" is not available"),
"getrlimit");
#endif /* HAVE_SYS_RESOURCE_H */
}
/*
* Displays resource usage.
*/
void
sys_display_rusage ()
{
#ifdef HAVE_SYS_RESOURCE_H
struct rusage usage;
char *str_time;
long long microseconds;
gui_chat_printf (NULL, "");
gui_chat_printf (NULL, _("Resource usage (see \"man getrusage\" for help):"));
getrusage (RUSAGE_SELF, &usage);
/* ru_utime: user CPU time used */
microseconds = ((long long)usage.ru_utime.tv_sec * 1000000)
+ (long long)usage.ru_utime.tv_usec;
str_time = util_get_microseconds_string (microseconds);
if (str_time)
{
gui_chat_printf (NULL, " ru_utime : %s", str_time);
free (str_time);
}
/* ru_stime: system CPU time used */
microseconds = ((long long)usage.ru_stime.tv_sec * 1000000)
+ (long long)usage.ru_stime.tv_usec;
str_time = util_get_microseconds_string (microseconds);
if (str_time)
{
gui_chat_printf (NULL, " ru_stime : %s", str_time);
free (str_time);
}
/* ru_maxrss: maximum resident set size */
gui_chat_printf (NULL, " ru_maxrss : %ld", usage.ru_maxrss);
/* ru_ixrss: integral shared memory size */
gui_chat_printf (NULL, " ru_ixrss : %ld", usage.ru_ixrss);
/* ru_idrss: integral unshared data size */
gui_chat_printf (NULL, " ru_idrss : %ld", usage.ru_idrss);
/* ru_isrss: integral unshared stack size */
gui_chat_printf (NULL, " ru_isrss : %ld", usage.ru_isrss);
/* ru_minflt: page reclaims (soft page faults) */
gui_chat_printf (NULL, " ru_minflt : %ld", usage.ru_minflt);
/* ru_majflt: page faults (hard page faults) */
gui_chat_printf (NULL, " ru_majflt : %ld", usage.ru_majflt);
/* ru_nswap: swaps */
gui_chat_printf (NULL, " ru_nswap : %ld", usage.ru_nswap);
/* ru_inblock: block input operations */
gui_chat_printf (NULL, " ru_inblock : %ld", usage.ru_inblock);
/* ru_oublock: block output operations */
gui_chat_printf (NULL, " ru_oublock : %ld", usage.ru_oublock);
/* ru_msgsnd: IPC messages sent */
gui_chat_printf (NULL, " ru_msgsnd : %ld", usage.ru_msgsnd);
/* ru_msgrcv: IPC messages received */
gui_chat_printf (NULL, " ru_msgrcv : %ld", usage.ru_msgrcv);
/* ru_nsignals: signals received */
gui_chat_printf (NULL, " ru_nsignals: %ld", usage.ru_nsignals);
/* ru_nvcsw: voluntary context switches */
gui_chat_printf (NULL, " ru_nvcsw : %ld", usage.ru_nvcsw);
/* ru_nivcsw: involuntary context switches */
gui_chat_printf (NULL, " ru_nivcsw : %ld", usage.ru_nivcsw);
#else /* HAVE_SYS_RESOURCE_H */
gui_chat_printf (NULL,
_("System function \"%s\" is not available"),
"getrusage");
#endif /* HAVE_SYS_RESOURCE_H */
}
/*
* Calls waitpid() to acknowledge the end of forked processes, thus preventing
* them to become zombies.
*/
void
sys_waitpid ()
{
int i;
/* acknowledge the end of up to 42 forked processes */
i = 0;
while ((i < 42) && (waitpid (-1, NULL, WNOHANG) > 0))
{
i++;
}
}
-36
View File
@@ -1,36 +0,0 @@
/*
* Copyright (C) 2023 Sébastien Helleu <flashcode@flashtux.org>
*
* 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/>.
*/
#ifndef WEECHAT_SYS_H
#define WEECHAT_SYS_H
#ifdef HAVE_SYS_RESOURCE_H
struct t_rlimit_resource
{
char *name; /* name of resource */
int resource; /* value of resource */
};
#endif /* HAVE_SYS_RESOURCE_H */
extern void sys_setrlimit ();
extern void sys_display_rlimit ();
extern void sys_display_rusage ();
extern void sys_waitpid ();
#endif /* WEECHAT_SYS_H */
+11 -141
View File
@@ -44,7 +44,6 @@
{ #__name, CURLOPT_##__name, URL_TYPE_##__type, __constants }
int url_debug = 0;
char *url_type_string[] = { "string", "long", "long long", "mask", "list" };
/*
@@ -1014,6 +1013,8 @@ struct t_url_option url_options[] =
{ NULL, 0, 0, NULL },
};
char url_error[CURL_ERROR_SIZE + 1];
/*
* Searches for a constant in array of constants.
@@ -1115,7 +1116,7 @@ weeurl_search_option (const char *name)
*/
size_t
weeurl_read_stream (void *buffer, size_t size, size_t nmemb, void *stream)
weeurl_read (void *buffer, size_t size, size_t nmemb, void *stream)
{
return (stream) ? fread (buffer, size, nmemb, stream) : 0;
}
@@ -1125,26 +1126,11 @@ weeurl_read_stream (void *buffer, size_t size, size_t nmemb, void *stream)
*/
size_t
weeurl_write_stream (void *buffer, size_t size, size_t nmemb, void *stream)
weeurl_write (void *buffer, size_t size, size_t nmemb, void *stream)
{
return (stream) ? fwrite (buffer, size, nmemb, stream) : 0;
}
/*
* Adds data to a dynamic string (callback called to catch stdout).
*/
size_t
weeurl_write_string (void *buffer, size_t size, size_t nmemb, void *string)
{
if (!string)
return 0;
string_dyn_concat ((char **)string, buffer, size * nmemb);
return size * nmemb;
}
/*
* Sets option in CURL easy handle (callback called for each option in hashtable
* "options").
@@ -1317,17 +1303,6 @@ weeurl_set_proxy (CURL *curl, struct t_proxy *proxy)
/*
* Downloads URL using options.
*
* If output is not NULL, it must be a hashtable with keys and values of type
* "string". The following keys may be added in the hashtable,
* depending on the success or error of the URL transfer:
*
* key | description
* --------------|--------------------------------------------------------
* response_code | HTTP response code (as string)
* headers | HTTP headers in response
* output | stdout (set only if "file_out" was not set in options)
* error | error message (set only in case of error)
*
* Returns:
* 0: OK
* 1: invalid URL
@@ -1337,30 +1312,20 @@ weeurl_set_proxy (CURL *curl, struct t_proxy *proxy)
*/
int
weeurl_download (const char *url, struct t_hashtable *options,
struct t_hashtable *output)
weeurl_download (const char *url, struct t_hashtable *options)
{
CURL *curl;
struct t_url_file url_file[2];
char *url_file_option[2] = { "file_in", "file_out" };
char *url_file_mode[2] = { "rb", "wb" };
char url_error[CURL_ERROR_SIZE + 1], url_error_code[12];
char **string_headers, **string_output;
char str_response_code[32];
CURLoption url_file_opt_func[2] = { CURLOPT_READFUNCTION, CURLOPT_WRITEFUNCTION };
CURLoption url_file_opt_data[2] = { CURLOPT_READDATA, CURLOPT_WRITEDATA };
void *url_file_opt_cb[2] = { &weeurl_read_stream, &weeurl_write_stream };
void *url_file_opt_cb[2] = { &weeurl_read, &weeurl_write };
struct t_proxy *ptr_proxy;
int rc, curl_rc, i, output_to_file;
long response_code;
int rc, curl_rc, i;
rc = 0;
string_headers = NULL;
string_output = NULL;
url_error[0] = '\0';
url_error_code[0] = '\0';
for (i = 0; i < 2; i++)
{
url_file[i].filename = NULL;
@@ -1369,7 +1334,6 @@ weeurl_download (const char *url, struct t_hashtable *options,
if (!url || !url[0])
{
snprintf (url_error, sizeof (url_error), "%s", _("invalid URL"));
rc = 1;
goto end;
}
@@ -1377,7 +1341,6 @@ weeurl_download (const char *url, struct t_hashtable *options,
curl = curl_easy_init ();
if (!curl)
{
snprintf (url_error, sizeof (url_error), "%s", _("not enough memory"));
rc = 3;
goto end;
}
@@ -1395,19 +1358,7 @@ weeurl_download (const char *url, struct t_hashtable *options,
weeurl_set_proxy (curl, ptr_proxy);
}
/* set callback to retrieve HTTP headers */
if (output)
{
string_headers = string_dyn_alloc (1024);
if (string_headers)
{
curl_easy_setopt (curl, CURLOPT_HEADERFUNCTION, &weeurl_write_string);
curl_easy_setopt (curl, CURLOPT_HEADERDATA, string_headers);
}
}
/* set file in/out from options in hashtable */
output_to_file = 0;
if (options)
{
for (i = 0; i < 2; i++)
@@ -1418,33 +1369,15 @@ weeurl_download (const char *url, struct t_hashtable *options,
url_file[i].stream = fopen (url_file[i].filename, url_file_mode[i]);
if (!url_file[i].stream)
{
snprintf (url_error, sizeof (url_error),
(i == 0) ?
_("file \"%s\" not found") :
_("can not write file \"%s\""),
url_file[i].filename);
rc = 4;
goto end;
}
curl_easy_setopt (curl, url_file_opt_func[i], url_file_opt_cb[i]);
curl_easy_setopt (curl, url_file_opt_data[i], url_file[i].stream);
if (i == 1)
output_to_file = 1;
}
}
}
/* redirect stdout if no filename was given (via key "file_out") */
if (output && !output_to_file)
{
string_output = string_dyn_alloc (1024);
if (string_output)
{
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, &weeurl_write_string);
curl_easy_setopt (curl, CURLOPT_WRITEDATA, string_output);
}
}
/* set other options in hashtable */
hashtable_map (options, &weeurl_option_map_cb, curl);
@@ -1453,37 +1386,11 @@ weeurl_download (const char *url, struct t_hashtable *options,
/* perform action! */
curl_rc = curl_easy_perform (curl);
if (curl_rc == CURLE_OK)
if (curl_rc != CURLE_OK)
{
if (output)
{
curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &response_code);
snprintf (str_response_code, sizeof (str_response_code),
"%ld", response_code);
hashtable_set (output, "response_code", str_response_code);
}
}
else
{
if (output)
{
snprintf (url_error_code, sizeof (url_error_code), "%d", curl_rc);
if (!url_error[0])
{
snprintf (url_error, sizeof (url_error),
"%s", _("transfer error"));
}
}
else
{
/*
* URL transfer done in a forked process: display error on stderr,
* which will be sent to the hook_process callback
*/
fprintf (stderr,
_("curl error %d (%s) (URL: \"%s\")\n"),
curl_rc, url_error, url);
}
fprintf (stderr,
_("curl error %d (%s) (URL: \"%s\")\n"),
curl_rc, url_error, url);
rc = 2;
}
@@ -1496,23 +1403,6 @@ end:
if (url_file[i].stream)
fclose (url_file[i].stream);
}
if (output)
{
if (string_headers)
{
hashtable_set (output, "headers", *string_headers);
string_dyn_free (string_headers, 1);
}
if (string_output)
{
hashtable_set (output, "output", *string_output);
string_dyn_free (string_output, 1);
}
if (url_error[0])
hashtable_set (output, "error", url_error);
if (url_error_code[0])
hashtable_set (output, "error_code_curl", url_error_code);
}
return rc;
}
@@ -1573,23 +1463,3 @@ weeurl_option_add_to_infolist (struct t_infolist *infolist,
return 1;
}
/*
* Initializes URL.
*/
void
weeurl_init ()
{
curl_global_init (CURL_GLOBAL_ALL);
}
/*
* Ends URL.
*/
void
weeurl_end ()
{
curl_global_cleanup ();
}

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