mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 22:24:47 +02:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93947c8e2d | |||
| a41a96a3c1 | |||
| c74627c01d | |||
| 5297c4345c | |||
| 63022f3482 | |||
| c447013caf | |||
| 2b59a8e888 | |||
| 3a629e08fa | |||
| 1c73310dd1 | |||
| a9b83dc58a | |||
| bc1f9784f8 | |||
| a797e2bf70 | |||
| 594e607764 | |||
| 285a6b8ce4 | |||
| be8e94f3cd | |||
| db7ecc1af1 | |||
| 74a4b3e249 | |||
| be78d185ea | |||
| 58067431de | |||
| 87e84d9053 | |||
| 902332c3e6 | |||
| 0b82429b39 | |||
| 8b2165d441 | |||
| fca2412424 | |||
| d279a80733 | |||
| 4444addf4d | |||
| 4ce74403dc | |||
| 1db29cb1ed | |||
| d8baabd250 | |||
| 4348036e2e | |||
| 93ec10b563 | |||
| cd0486d5bb | |||
| b4f28ed2d4 | |||
| 323f80e914 | |||
| 56903738b5 | |||
| 6d45a69f39 | |||
| 34f2e6cdd0 | |||
| a6e859b7ff | |||
| 103bddcc50 | |||
| 76a64e1280 | |||
| 75c01e8c8d | |||
| e8ce75f20c | |||
| 47f7518c1f | |||
| 9a9a262ea1 | |||
| 7fb3ca6686 | |||
| e98a32373e | |||
| 69d3787b5e | |||
| aa6cbf911e | |||
| cf1c4a689d | |||
| 48568edfe0 | |||
| d7b26e88b8 | |||
| 0407a08888 | |||
| ff3fd38086 | |||
| 847208f196 | |||
| f6ef908740 | |||
| f2bd5d773b | |||
| 6cbb35c644 | |||
| 372e7306bc | |||
| 927a50e366 | |||
| d0c00f7db2 | |||
| 9783256649 | |||
| 8106db400d | |||
| 4d617d0e01 | |||
| acbf1ddfcf |
@@ -194,11 +194,13 @@ jobs:
|
||||
weechat-headless \
|
||||
--dir /tmp/weechat-test-api \
|
||||
--run-command '/set relay.network.password "${{ env.RELAY_PASSWORD }}"' \
|
||||
--run-command '/set relay.network.password_hash_iterations 100' \
|
||||
--run-command '/set relay.network.max_clients 0' \
|
||||
--run-command '/relay add api 9000' \
|
||||
--daemon \
|
||||
;
|
||||
sleep 5
|
||||
./tools/test_relay_api.sh http://localhost:9000
|
||||
schemathesis run --url http://localhost:9000/api ./src/plugins/relay/api/weechat-relay-api.yaml
|
||||
echo '*/quit' >/tmp/weechat-test-api/weechat_fifo_*
|
||||
|
||||
- name: Code coverage
|
||||
|
||||
@@ -29,6 +29,7 @@ Alphabetically:
|
||||
- Asakura
|
||||
- Bazerka
|
||||
- Benoit Papillault (benoit)
|
||||
- Caleb Josue Ruiz Torres
|
||||
- Chris Hills
|
||||
- Christian Duerr
|
||||
- Christian Heinz
|
||||
|
||||
+23
-1
@@ -6,16 +6,34 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# WeeChat ChangeLog
|
||||
|
||||
## Version 4.7.0 (under dev)
|
||||
## Version 4.7.2 (2025-11-23)
|
||||
|
||||
### Fixed
|
||||
|
||||
- api: fix file descriptor leak in hook_url when a timeout occurs or if the hook is removed during the transfer ([#2284](https://github.com/weechat/weechat/issues/2284))
|
||||
- irc: fix colors in messages 367 (ban mask), 728 (quiet mask) and MODE ([#2286](https://github.com/weechat/weechat/issues/2286))
|
||||
- irc: fix reset of color when multiple modes are set with command `/mode`
|
||||
|
||||
## Version 4.7.1 (2025-08-16)
|
||||
|
||||
### Fixed
|
||||
|
||||
- relay/api: fix crash when an invalid HTTP request is received from a client
|
||||
|
||||
## Version 4.7.0 (2025-07-19)
|
||||
|
||||
### Changed
|
||||
|
||||
- **breaking:** core: fix buffer overflow in function utf8_next_char and return NULL for empty string
|
||||
- **breaking:** core: fix integer overflow and return "unsigned long" in function util_version_number
|
||||
- core: write configuration files on disk only if there are changes ([#2250](https://github.com/weechat/weechat/issues/2250))
|
||||
- core: always enable partial completion for templates in option weechat.completion.partial_completion_templates, add option weechat.completion.partial_completion_auto_expand to expand word on new completion ([#2253](https://github.com/weechat/weechat/issues/2253))
|
||||
- core: add script name in output of `/debug hooks <plugin>`
|
||||
- relay/api: return HTTP error 405 (Method Not Allowed) when the method received is not allowed
|
||||
|
||||
### Added
|
||||
|
||||
- core: add support of specifier `%@` for UTC time in function util_strftimeval
|
||||
- api: add function file_compare
|
||||
- irc: add support of strikethrough text in IRC messages ([#2248](https://github.com/weechat/weechat/issues/2248))
|
||||
- buflist: add variables `${number_zero}` and `${number_zero2}` (zero-padded buffer number)
|
||||
@@ -34,6 +52,10 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
- core: fix memory leak in function util_parse_delay
|
||||
- irc: display nick changes and quit messages when option irc.look.ignore_tag_messages is enabled ([#2241](https://github.com/weechat/weechat/issues/2241))
|
||||
- perl: fix build when multiplicity is not available ([#2243](https://github.com/weechat/weechat/issues/2243))
|
||||
- relay/api: reject any invalid or unknown password hash algorithm in handshake resource
|
||||
- relay/api: process HTTP request received as soon as a NULL char is received
|
||||
- relay/weechat: fix empty buffers in client when WeeChat is running on Solaris/illumos
|
||||
- build: fix build on Solaris/illumos (issue #2251)
|
||||
|
||||
## Version 4.6.3 (2025-05-11)
|
||||
|
||||
|
||||
@@ -208,6 +208,7 @@ include(FindPkgConfig)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
check_include_files("langinfo.h" HAVE_LANGINFO_CODESET)
|
||||
check_include_files("sys/resource.h" HAVE_SYS_RESOURCE_H)
|
||||
@@ -218,13 +219,33 @@ check_symbol_exists("malloc_trim" "malloc.h" HAVE_MALLOC_TRIM)
|
||||
check_function_exists(mallinfo HAVE_MALLINFO)
|
||||
check_function_exists(mallinfo2 HAVE_MALLINFO2)
|
||||
|
||||
check_symbol_exists("htonll" "sys/types.h;netinet/in.h;inttypes.h" HAVE_HTONLL)
|
||||
|
||||
check_symbol_exists("eat_newline_glitch" "term.h" HAVE_EAT_NEWLINE_GLITCH)
|
||||
|
||||
# Check if res_init requires libresolv
|
||||
check_function_exists(res_init, LIBC_HAS_RES_INIT)
|
||||
if(NOT LIBC_HAS_RES_INIT)
|
||||
find_library(RESOLV_LIBRARY resolv)
|
||||
if(RESOLV_LIBRARY)
|
||||
check_library_exists("${RESOLV_LIBRARY}" res_init "" LIBRESOLV_HAS_RES_INIT)
|
||||
if(LIBRESOLV_HAS_RES_INIT)
|
||||
list(APPEND EXTRA_LIBS ${RESOLV_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check for Large File Support
|
||||
if(ENABLE_LARGEFILE)
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES)
|
||||
endif()
|
||||
|
||||
# _XPG4_2 is needed for macros like CMSG_SPACE
|
||||
# __EXTENSIONS__ is needed for constants like NI_MAXHOST and for struct timeval
|
||||
if(CMAKE_HOST_SOLARIS)
|
||||
add_definitions(-D_XPG4_2 -D__EXTENSIONS__)
|
||||
endif()
|
||||
|
||||
# Check for libgcrypt
|
||||
pkg_check_modules(LIBGCRYPT REQUIRED libgcrypt)
|
||||
include_directories(${LIBGCRYPT_INCLUDE_DIRS})
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2003-2025 Sébastien Helleu <flashcode@flashtux.org>
|
||||
# SPDX-FileCopyrightText: 2009 Julien Louis <ptitlouis@sysif.net>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# This file is part of WeeChat, the extensible chat client.
|
||||
#
|
||||
# WeeChat is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# WeeChat is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# - Find Python
|
||||
# This module finds if Python is installed and determines where the include files
|
||||
# and libraries are. It also determines what the name of the library is. This
|
||||
# code sets the following variables:
|
||||
#
|
||||
# PYTHON_EXECUTABLE = full path to the python binary
|
||||
# PYTHON_INCLUDE_DIRS = path to where python.h can be found
|
||||
# PYTHON_LIBRARIES = path to where libpython.so* can be found
|
||||
# PYTHON_LDFLAGS = python compiler options for linking
|
||||
|
||||
pkg_check_modules(PYTHON python3-embed IMPORTED_TARGET GLOBAL)
|
||||
if(NOT PYTHON_FOUND)
|
||||
pkg_check_modules(PYTHON python3 IMPORTED_TARGET GLOBAL)
|
||||
endif()
|
||||
@@ -49,6 +49,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#cmakedefine HAVE_MALLINFO2
|
||||
#cmakedefine HAVE_MALLOC_H
|
||||
#cmakedefine HAVE_MALLOC_TRIM
|
||||
#cmakedefine HAVE_HTONLL
|
||||
#cmakedefine HAVE_EAT_NEWLINE_GLITCH
|
||||
#cmakedefine HAVE_ASPELL_VERSION_STRING
|
||||
#cmakedefine HAVE_ENCHANT_GET_VERSION
|
||||
|
||||
@@ -38,6 +38,7 @@ if(ENABLE_MAN OR ENABLE_DOC)
|
||||
if(ASCIIDOCTOR_FOUND)
|
||||
# common asciidoctor arguments
|
||||
set(ASCIIDOCTOR_ARGS
|
||||
-v
|
||||
-a experimental
|
||||
-a reproducible
|
||||
-a "prewrap!"
|
||||
|
||||
@@ -625,7 +625,7 @@ Einige Umgebungsvariablen werden von WeeChat genutzt, sofern sie definiert wurde
|
||||
[width="100%",cols="1m,6",options="header"]
|
||||
|===
|
||||
| Name | Beschreibung
|
||||
| WEECHAT_HOME | Das WeeChat Verzeichnis (beinhaltet Konfigurationsdateien, Protokolldateien, Skripten, ...). Gleiches Verhalten wie <<compile_with_cmake,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | Das WeeChat Verzeichnis (beinhaltet Konfigurationsdateien, Protokolldateien, Skripten, ...). Gleiches Verhalten wie <<build,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | Die Passphrase zum Entschlüsseln von schutzwürdigen Daten.
|
||||
| WEECHAT_EXTRA_LIBDIR | Ein zusätzliches Verzeichnis um Erweiterungen zu installieren (vom "plugins" Verzeichnis in dieses Verzeichnis).
|
||||
|===
|
||||
@@ -3822,7 +3822,7 @@ WeeChat unterstützt folgende https://ircv3.net/irc/[IRCv3 extensions ^↗^^]:
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -3869,7 +3869,7 @@ Spezifikation: https://ircv3.net/specs/extensions/account-tag[account-tag ^↗^
|
||||
Diese Fähigkeit ermöglicht es dem Server, einen Account als Nachrichten-Tag an Befehle zu hängen,
|
||||
die an den Client gesendet werden. +
|
||||
WeeChat analysiert dieses Tag und speichert es in der Nachricht, aber es wird nicht verwendet oder
|
||||
angezeigt. Mit dem <<command_filter,/filter>> Befehl kann man diese Nachrichten explizit filtern,
|
||||
angezeigt. Mit dem <<command_weechat_filter,/filter>> Befehl kann man diese Nachrichten explizit filtern,
|
||||
in dem die Accounts nutzt.
|
||||
|
||||
Beispiel einer empfangenen IRC-Rohnachricht:
|
||||
|
||||
@@ -2165,7 +2165,7 @@ Arguments:
|
||||
Return value:
|
||||
|
||||
* array of strings, NULL if problem (must be freed by calling
|
||||
<<_free_split_command,free_split_command>> after use)
|
||||
<<_string_free_split_command,string_free_split_command>> after use)
|
||||
|
||||
C example:
|
||||
|
||||
@@ -4803,7 +4803,7 @@ This function is not available in scripting API.
|
||||
|
||||
==== util_strftimeval
|
||||
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0._
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
|
||||
|
||||
Format date and time like function `strftime` in C library, using `struct timeval`
|
||||
as input, and supporting extra specifiers.
|
||||
@@ -4820,6 +4820,8 @@ Arguments:
|
||||
* _string_: buffer where the formatted string is stored
|
||||
* _max_: string size
|
||||
* _format_: format, the same as _strftime_ function, with these extra specifiers:
|
||||
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
|
||||
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
|
||||
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
|
||||
(for example `%.3` for milliseconds)
|
||||
** `%f`: alias of `%.6`
|
||||
@@ -4836,8 +4838,8 @@ C example:
|
||||
char time[256];
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509 */
|
||||
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509Z */
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
@@ -11062,6 +11064,16 @@ Arguments:
|
||||
*** _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)
|
||||
*** _error_code_: error code (integer, set only in case of error):
|
||||
**** `1`: invalid URL
|
||||
**** `2`: transfer error (Curl error)
|
||||
**** `3`: not enough memory
|
||||
**** `4`: file error
|
||||
**** `5`: transfer stopped (hook removed during the transfer)
|
||||
**** `6`: transfer timeout
|
||||
**** `100`: thread creation error
|
||||
*** _error_code_pthread_: return code of function _pthread_create_
|
||||
(integer, set only if _error_code_ is `100`)
|
||||
** return value:
|
||||
*** _WEECHAT_RC_OK_
|
||||
*** _WEECHAT_RC_ERROR_
|
||||
|
||||
@@ -621,7 +621,7 @@ Some environment variables are used by WeeChat if they are defined:
|
||||
[width="100%",cols="1m,6",options="header"]
|
||||
|===
|
||||
| Name | Description
|
||||
| WEECHAT_HOME | The WeeChat home (with configuration files, logs, scripts, etc.). Same behavior as <<compile_with_cmake,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | The WeeChat home (with configuration files, logs, scripts, etc.). Same behavior as <<build,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | The passphrase used to decrypt secured data.
|
||||
| WEECHAT_EXTRA_LIBDIR | An extra directory to load plugins (from the "plugins" directory in this path).
|
||||
|===
|
||||
@@ -3760,7 +3760,7 @@ WeeChat supports the following https://ircv3.net/irc/[IRCv3 extensions ^↗^^]:
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -3808,7 +3808,7 @@ Specification: https://ircv3.net/specs/extensions/account-tag[account-tag ^↗^
|
||||
This capability allows the server to send account as message tag to commands
|
||||
sent to the client. +
|
||||
WeeChat parses this tag and saves it in the message, but it is not used or
|
||||
displayed. It can be used in <<command_filter,/filter>> command to filter
|
||||
displayed. It can be used in <<command_weechat_filter,/filter>> command to filter
|
||||
messages matching specific accounts.
|
||||
|
||||
Example of raw IRC message received:
|
||||
|
||||
@@ -2205,7 +2205,7 @@ Paramètres :
|
||||
Valeur de retour :
|
||||
|
||||
* tableau de chaînes, NULL en cas de problème (doit être supprimé par un appel à
|
||||
<<_free_split_command,free_split_command>> après utilisation)
|
||||
<<_string_free_split_command,string_free_split_command>> après utilisation)
|
||||
|
||||
Exemple en C :
|
||||
|
||||
@@ -4882,7 +4882,7 @@ Cette fonction n'est pas disponible dans l'API script.
|
||||
|
||||
==== util_strftimeval
|
||||
|
||||
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0._
|
||||
_WeeChat ≥ 4.2.0, mis à jour dans la 4.3.0, 4.7.0._
|
||||
|
||||
Formatter la date et l'heure comme la fonction `strftime` de la bibliothèque C,
|
||||
en utilisant un `struct timeval` en entrée et en supportant des caractères de
|
||||
@@ -4901,6 +4901,8 @@ Paramètres :
|
||||
* _max_ : taille de la chaîne
|
||||
* _format_ : format, le même que celui de la fonction _strftime_, avec des
|
||||
caractères de conversion supplémentaires :
|
||||
** `%@` : retourner la date exprimée en Temps Universel Coordonné (UTC)
|
||||
au lieu de la date relative au fuseau horaire de l'utilisateur _(WeeChat ≥ 4.7.0)_
|
||||
** `%.N` où `N` est entre 1 and 6: microsecondes remplies avec des zéros sur
|
||||
N chiffres (par exemple `%.3` pour les millisecondes)
|
||||
** `%f` : alias de `%.6`
|
||||
@@ -4917,8 +4919,8 @@ Exemple en C :
|
||||
char time[256];
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
|
||||
/* résultat : 2023-12-26T18:10:04.460509 */
|
||||
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
|
||||
/* résultat : 2023-12-26T18:10:04.460509Z */
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
@@ -11268,6 +11270,16 @@ Paramètres :
|
||||
*** _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)
|
||||
*** _error_code_ : code d'erreur (entier, défini seulement en cas d'erreur) :
|
||||
**** `1` : URL invalide
|
||||
**** `2` : erreur de transfert (erreur Curl)
|
||||
**** `3` : mémoire insuffisante
|
||||
**** `4` : erreur de fichier
|
||||
**** `5` : transfert stoppé (hook supprimé durant le transfert)
|
||||
**** `6` : délai d'attente dépassé pour le transfert ("timeout")
|
||||
**** `100` : erreur de création du thread
|
||||
*** _error_code_pthread_ : code retour de la fonction _pthread_create_
|
||||
(entier, défini seulement si _error_code_ vaut `100`)
|
||||
** valeur de retour :
|
||||
*** _WEECHAT_RC_OK_
|
||||
*** _WEECHAT_RC_ERROR_
|
||||
|
||||
@@ -624,7 +624,7 @@ Des variables d'environnement sont utilisées par WeeChat si elles sont définie
|
||||
[width="100%",cols="1m,6",options="header"]
|
||||
|===
|
||||
| Nom | Description
|
||||
| WEECHAT_HOME | Le répertoire "maison" de WeeChat (avec les fichiers de configuration, logs, scripts, etc.). Même comportement que <<compile_with_cmake,l'option CMake>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | Le répertoire "maison" de WeeChat (avec les fichiers de configuration, logs, scripts, etc.). Même comportement que <<build,l'option CMake>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | La phrase secrète utilisée pour déchiffrer les données sécurisées.
|
||||
| WEECHAT_EXTRA_LIBDIR | Un répertoire supplémentaire pour charger les extensions (depuis le répertoire "plugins" sous ce chemin).
|
||||
|===
|
||||
@@ -3869,7 +3869,7 @@ WeeChat supporte les https://ircv3.net/irc/[extensions IRCv3 ^↗^^] suivantes
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -3917,7 +3917,7 @@ Spécification : https://ircv3.net/specs/extensions/account-tag[account-tag ^
|
||||
Cette capacité autorise le serveur à envoyer le compte comme étiquette de message
|
||||
dans les commandes envoyées au client. +
|
||||
WeeChat extrait cette étiquette et la sauve dans le message, mais elle n'est pas
|
||||
utilisée ni affichée. Elle peut être utilisée dans la commande <<command_filter,/filter>>
|
||||
utilisée ni affichée. Elle peut être utilisée dans la commande <<command_weechat_filter,/filter>>
|
||||
pour filtrer les messages correspondants à des comptes spécifiques.
|
||||
|
||||
Exemple de message IRC brut reçu :
|
||||
|
||||
@@ -2297,7 +2297,7 @@ Argomenti:
|
||||
Valore restituito:
|
||||
|
||||
* array di stringhe, NULL in caso di problemi (deve essere liberata chiamando
|
||||
<<_free_split_command,free_split_command>> dopo l'uso)
|
||||
<<_string_free_split_command,string_free_split_command>> dopo l'uso)
|
||||
|
||||
Esempio in C:
|
||||
|
||||
@@ -5023,7 +5023,7 @@ Questa funzione non è disponibile nelle API per lo scripting.
|
||||
// TRANSLATION MISSING
|
||||
==== util_strftimeval
|
||||
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0._
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
|
||||
|
||||
Format date and time like function `strftime` in C library, using `struct timeval`
|
||||
as input, and supporting extra specifiers.
|
||||
@@ -5040,6 +5040,8 @@ Arguments:
|
||||
* _string_: buffer where the formatted string is stored
|
||||
* _max_: string size
|
||||
* _format_: format, the same as _strftime_ function, with these extra specifiers:
|
||||
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
|
||||
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
|
||||
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
|
||||
(for example `%.3` for milliseconds)
|
||||
** `%f`: alias of `%.6`
|
||||
@@ -5056,8 +5058,8 @@ C example:
|
||||
char time[256];
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509 */
|
||||
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509Z */
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
@@ -11473,6 +11475,16 @@ Argomenti:
|
||||
*** _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)
|
||||
*** _error_code_: error code (integer, set only in case of error):
|
||||
**** `1`: invalid URL
|
||||
**** `2`: transfer error (Curl error)
|
||||
**** `3`: not enough memory
|
||||
**** `4`: file error
|
||||
**** `5`: transfer stopped (hook removed during the transfer)
|
||||
**** `6`: transfer timeout
|
||||
**** `100`: thread creation error
|
||||
*** _error_code_pthread_: return code of function _pthread_create_
|
||||
(integer, set only if _error_code_ is `100`)
|
||||
** return value:
|
||||
*** _WEECHAT_RC_OK_
|
||||
*** _WEECHAT_RC_ERROR_
|
||||
|
||||
@@ -686,7 +686,7 @@ Some environment variables are used by WeeChat if they are defined:
|
||||
[width="100%",cols="1m,6",options="header"]
|
||||
|===
|
||||
| Name | Description
|
||||
| WEECHAT_HOME | The WeeChat home (with configuration files, logs, scripts, ...). Same behavior as <<compile_with_cmake,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | The WeeChat home (with configuration files, logs, scripts, ...). Same behavior as <<build,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | The passphrase used to decrypt secured data.
|
||||
| WEECHAT_EXTRA_LIBDIR | An extra directory to load plugins (from the "plugins" directory in this path).
|
||||
|===
|
||||
@@ -4110,7 +4110,7 @@ WeeChat supports the following https://ircv3.net/irc/[IRCv3 extensions ^↗^^]:
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -4158,7 +4158,7 @@ Specification: https://ircv3.net/specs/extensions/account-tag[account-tag ^↗^
|
||||
This capability allows the server to send account as message tag to commands
|
||||
sent to the client. +
|
||||
WeeChat parses this tag and saves it in the message, but it is not used or
|
||||
displayed. It can be used in <<command_filter,/filter>> command to filter
|
||||
displayed. It can be used in <<command_weechat_filter,/filter>> command to filter
|
||||
messages matching specific accounts.
|
||||
|
||||
Example of raw IRC message received:
|
||||
|
||||
@@ -2232,7 +2232,7 @@ char **weechat_string_split_command (const char *command, char separator);
|
||||
戻り値:
|
||||
|
||||
* 文字列の配列、分割に失敗した場合は NULL (使用後には必ず
|
||||
<<_free_split_command,free_split_command>> を呼び出して領域を開放してください)
|
||||
<<_string_free_split_command,string_free_split_command>> を呼び出して領域を開放してください)
|
||||
|
||||
C 言語での使用例:
|
||||
|
||||
@@ -4937,7 +4937,7 @@ weechat_printf (NULL, "date: %s",
|
||||
// TRANSLATION MISSING
|
||||
==== util_strftimeval
|
||||
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0._
|
||||
_WeeChat ≥ 4.2.0, updated in 4.3.0, 4.7.0._
|
||||
|
||||
Format date and time like function `strftime` in C library, using `struct timeval`
|
||||
as input, and supporting extra specifiers.
|
||||
@@ -4954,6 +4954,8 @@ Arguments:
|
||||
* _string_: buffer where the formatted string is stored
|
||||
* _max_: string size
|
||||
* _format_: format, the same as _strftime_ function, with these extra specifiers:
|
||||
** `%@`: return the date expressed in Coordinated Universal Time (UTC)
|
||||
instead of date relative to the user's specified timezone _(WeeChat ≥ 4.7.0)_
|
||||
** `%.N` where `N` is between 1 and 6: zero-padded microseconds on N digits
|
||||
(for example `%.3` for milliseconds)
|
||||
** `%f`: alias of `%.6`
|
||||
@@ -4970,8 +4972,8 @@ C example:
|
||||
char time[256];
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509 */
|
||||
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
|
||||
/* result: 2023-12-26T18:10:04.460509Z */
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
@@ -11207,6 +11209,16 @@ struct t_hook *weechat_hook_url (const char *url,
|
||||
*** _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)
|
||||
*** _error_code_: error code (integer, set only in case of error):
|
||||
**** `1`: invalid URL
|
||||
**** `2`: transfer error (Curl error)
|
||||
**** `3`: not enough memory
|
||||
**** `4`: file error
|
||||
**** `5`: transfer stopped (hook removed during the transfer)
|
||||
**** `6`: transfer timeout
|
||||
**** `100`: thread creation error
|
||||
*** _error_code_pthread_: return code of function _pthread_create_
|
||||
(integer, set only if _error_code_ is `100`)
|
||||
** return value:
|
||||
*** _WEECHAT_RC_OK_
|
||||
*** _WEECHAT_RC_ERROR_
|
||||
|
||||
@@ -659,7 +659,7 @@ include::includes/cmdline_options.ja.adoc[tag=debug]
|
||||
|===
|
||||
| 変数名 | 説明
|
||||
// TRANSLATION MISSING
|
||||
| WEECHAT_HOME | WeeChat ホームディレクトリ (ここには設定ファイル、ログ、スクリプトなどがあります) Same behavior as <<compile_with_cmake,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | WeeChat ホームディレクトリ (ここには設定ファイル、ログ、スクリプトなどがあります) Same behavior as <<build,CMake option>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | 暗号化データを復号化するためのパスフレーズ
|
||||
| WEECHAT_EXTRA_LIBDIR | プラグインをロードするための追加ディレクトリパス (設定したパス内の "plugins" ディレクトリからロードします)
|
||||
|===
|
||||
@@ -3982,7 +3982,7 @@ WeeChat supports the following https://ircv3.net/irc/[IRCv3 extensions ^↗^^]:
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -4030,7 +4030,7 @@ Specification: https://ircv3.net/specs/extensions/account-tag[account-tag ^↗^
|
||||
This capability allows the server to send account as message tag to commands
|
||||
sent to the client. +
|
||||
WeeChat parses this tag and saves it in the message, but it is not used or
|
||||
displayed. It can be used in <<command_filter,/filter>> command to filter
|
||||
displayed. It can be used in <<command_weechat_filter,/filter>> command to filter
|
||||
messages matching specific accounts.
|
||||
|
||||
Example of raw IRC message received:
|
||||
|
||||
@@ -620,7 +620,7 @@ Niektóre zmienne śwodowiskowe są używane przez WeeChat o ile zostały zdefin
|
||||
[width="100%",cols="1m,6",options="header"]
|
||||
|===
|
||||
| Nazwa | Opis
|
||||
| WEECHAT_HOME | Katalog domowy WeeChat (z plikami konfiguracyjnymi, logami, skryptami, ...). Działa tak samo jak <<compile_with_cmake,opcja CMake>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | Katalog domowy WeeChat (z plikami konfiguracyjnymi, logami, skryptami, ...). Działa tak samo jak <<build,opcja CMake>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | Hasło używane do odszyfrowania zabezpieczonych danych.
|
||||
| WEECHAT_EXTRA_LIBDIR | Dodatkowy katalog do ładowania wtyczek (z katalogu "plugins" znajdującego się pod tą ścieżką).
|
||||
|===
|
||||
@@ -3785,7 +3785,7 @@ WeeChat wspiera następujące https://ircv3.net/irc/[rozszerzenia IRCv3 ^↗^^]
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -3833,7 +3833,7 @@ Specyfikacja: https://ircv3.net/specs/extensions/account-tag[account-tag ^↗^^
|
||||
Ta właściwość pozwala serwerowi na wysyłanie komend konta jako tagów wiadomości
|
||||
do komend wysyłanych do klienta. +
|
||||
WeeChat parsuje te tagi i zapisuje je w wiadomości ale nie jest on używany ani
|
||||
wyświetlany. Można ich użyć w komendzie <<command_filter,/filter>> do filtrowania
|
||||
wyświetlany. Można ich użyć w komendzie <<command_weechat_filter,/filter>> do filtrowania
|
||||
wiadmości pasujących do konkretnych kont:
|
||||
|
||||
Przykład otrzymanej nieprzetworzonej wiadomości:
|
||||
|
||||
+29
-58
@@ -91,33 +91,23 @@ qweechat::
|
||||
| typing/ | Typing додатак.
|
||||
| xfer/ | Xfer додатак (IRC DCC фајл/разговор).
|
||||
| tests/ | Тестови.
|
||||
// TRANSLATION MISSING
|
||||
| fuzz/ | Fuzz testing.
|
||||
// TRANSLATION MISSING
|
||||
| core/ | Fuzz testing for core functions.
|
||||
| fuzz/ | Fuzz тестирање.
|
||||
| core/ | Fuzz тестирање функција језгра.
|
||||
| unit/ | Unit тестови.
|
||||
| core/ | Unit тестови за функције језгра.
|
||||
// TRANSLATION MISSING
|
||||
| hook/ | Unit tests for hook functions.
|
||||
| hook/ | Unit тестову за функције куке.
|
||||
| gui/ | Unit тестови за функције интерфејса.
|
||||
// TRANSLATION MISSING
|
||||
| curses/ | Unit tests for Curses interface functions.
|
||||
| curses/ | Unit тестови за функције Curses интерфејса.
|
||||
| scripts/ | Тестови за API скриптовања.
|
||||
| python/ | Python скрипте за генерисање и покретање тестова за API скриптовања.
|
||||
| plugins/ | Unit тестови за додатке.
|
||||
// TRANSLATION MISSING
|
||||
| alias/ | Unit tests for alias plugin.
|
||||
| alias/ | Unit тестови за alias додатак.
|
||||
| irc/ | Unit тестови за IRC додатак.
|
||||
// TRANSLATION MISSING
|
||||
| logger/ | Unit tests for logger plugin.
|
||||
// TRANSLATION MISSING
|
||||
| relay/ | Unit tests for relay plugin.
|
||||
// TRANSLATION MISSING
|
||||
| trigger/ | Unit tests for trigger plugin.
|
||||
// TRANSLATION MISSING
|
||||
| typing/ | Unit tests for typing plugin.
|
||||
// TRANSLATION MISSING
|
||||
| xfer/ | Unit tests for xfer plugin.
|
||||
| logger/ | Unit тестови за logger додатак.
|
||||
| relay/ | Unit тестови за relay додатак.
|
||||
| trigger/ | Unit тестови за trigger додатак.
|
||||
| typing/ | Unit тестови за typing додатак.
|
||||
| xfer/ | Unit тестови за xfer додатак.
|
||||
| doc/ | Документација.
|
||||
| po/ | Фајлови превода (gettext).
|
||||
| debian/ | Debian паковање.
|
||||
@@ -426,24 +416,15 @@ WeeChat „језгро” се налази у следећим директо
|
||||
|===
|
||||
| Путања/фајл | Опис
|
||||
| tests/ | Корен тестова.
|
||||
// TRANSLATION MISSING
|
||||
| fuzz/ | Root of fuzz testing.
|
||||
// TRANSLATION MISSING
|
||||
| ossfuzz.sh | Build script for https://github.com/google/oss-fuzz[OSS-Fuzz ^↗^^].
|
||||
// TRANSLATION MISSING
|
||||
| core/ | Root of fuzz testing for core.
|
||||
// TRANSLATION MISSING
|
||||
| calc-fuzzer.c | Fuzz testing: калкулација израза.
|
||||
// TRANSLATION MISSING
|
||||
| crypto-fuzzer.c | Fuzz testing: криптографске функције.
|
||||
// TRANSLATION MISSING
|
||||
| secure-fuzzer.c | Fuzz testing: secured data.
|
||||
// TRANSLATION MISSING
|
||||
| string-fuzzer.c | Fuzz testing: стрингови.
|
||||
// TRANSLATION MISSING
|
||||
| utf8-fuzzer.c | Fuzz testing: UTF-8.
|
||||
// TRANSLATION MISSING
|
||||
| util-fuzzer.c | Fuzz testing: utility functions.
|
||||
| fuzz/ | Корен fuzz тестирања.
|
||||
| ossfuzz.sh | Скрипта изградње за https://github.com/google/oss-fuzz[OSS-Fuzz ^↗^^].
|
||||
| core/ | Корен fuzz тестирања за језгро.
|
||||
| calc-fuzzer.c | Fuzz тестирање: калкулација израза.
|
||||
| crypto-fuzzer.c | Fuzz тестирање: криптографске функције.
|
||||
| secure-fuzzer.c | Fuzz тестирање: обезбеђени подаци.
|
||||
| string-fuzzer.c | Fuzz тестирање: стрингови.
|
||||
| utf8-fuzzer.c | Fuzz тестирање: UTF-8.
|
||||
| util-fuzzer.c | Fuzz тестирање: услужне функције.
|
||||
| unit/ | Корен unit тестова.
|
||||
| tests.cpp | Програм који се користи за извршавање свих тестова.
|
||||
| tests-record.cpp | Бележење и претрага у приказаним порукама.
|
||||
@@ -490,13 +471,10 @@ WeeChat „језгро” се налази у следећим директо
|
||||
| test-hook-timer.cpp | Тестови: куке „timer”.
|
||||
| test-hook-url.cpp | Тестови: куке „url”.
|
||||
| gui/ | Корен unit тестова интерфејса.
|
||||
// TRANSLATION MISSING
|
||||
| test-gui-bar-item-custom.cpp | Tests: custom bar item functions.
|
||||
// TRANSLATION MISSING
|
||||
| test-gui-bar-item.cpp | Tests: bar item functions.
|
||||
| test-gui-bar-item-custom.cpp | Тестови: функције ставки прилагођене траке.
|
||||
| test-gui-bar-item.cpp | Тестови: функције ставки траке.
|
||||
| test-gui-bar-window.cpp | Тестови: функције прозора траке.
|
||||
// TRANSLATION MISSING
|
||||
| test-gui-bar.cpp | Tests: bar functions.
|
||||
| test-gui-bar.cpp | Тестови: функције траке.
|
||||
| test-gui-buffer.cpp | Тестови: бафер функције.
|
||||
| test-gui-chat.cpp | Тестови: чет функције.
|
||||
| test-gui-color.cpp | Тестови: боје.
|
||||
@@ -519,10 +497,8 @@ WeeChat „језгро” се налази у следећим директо
|
||||
| test-plugin-config.cpp | Тестови: функције конфигурације додатка.
|
||||
| test-plugin-api-info.cpp | Тестови: инфо функције API додатака.
|
||||
| test-plugins.cpp | Тестови: plugins.
|
||||
// TRANSLATION MISSING
|
||||
| alias/ | Root of unit tests for alias plugin.
|
||||
// TRANSLATION MISSING
|
||||
| test-alias.cpp | Tests: aliases.
|
||||
| alias/ | Корен unit тестова за alias додатак.
|
||||
| test-alias.cpp | Тестови: алијаси.
|
||||
| irc/ | Корен unit тестова IRC додатка.
|
||||
| test-irc-batch.cpp | Тестови: IRC пакетни догађаји.
|
||||
| test-irc-buffer.cpp | Тестови: IRC бафери.
|
||||
@@ -556,12 +532,9 @@ WeeChat „језгро” се налази у следећим директо
|
||||
| test-relay-api.cpp | Тестови: Релеј „api” протокол: опште функције.
|
||||
| test-relay-api-msg.cpp | Тестови: Релеј „api” протокол: поруке.
|
||||
| test-relay-api-protocol.cpp | Тестови: Релеј „api” протокол: протокол.
|
||||
// TRANSLATION MISSING
|
||||
| remote/ | Tests: Relay "api" protocol: remote functions.
|
||||
// TRANSLATION MISSING
|
||||
| test-relay-remote-event.cpp | Tests: Relay "api" protocol: remote events.
|
||||
// TRANSLATION MISSING
|
||||
| test-relay-remote-network.cpp | Tests: Relay "api" protocol: remote network.
|
||||
| remote/ | Тестови: Релеј „api” протокол: удаљене функције.
|
||||
| test-relay-remote-event.cpp | Тестови: Релеј „api” протокол: удаљени догађаји.
|
||||
| test-relay-remote-network.cpp | Тестови: Релеј „api” протокол: удаљена мрежа.
|
||||
| irc/ | Корен unit тестова за Релеј „irc” протокол.
|
||||
| test-relay-irc.cpp | Тестови: Релеј „irc” протокол.
|
||||
| trigger/ | Корен unit тестова за окидач додатак.
|
||||
@@ -1262,13 +1235,11 @@ server->hook_timer_sasl = weechat_hook_timer (timeout * 1000,
|
||||
|
||||
| tests/fuzz
|
||||
| tests/fuzz/*
|
||||
// TRANSLATION MISSING
|
||||
| Fuzz testing
|
||||
| Fuzz тестирање
|
||||
|
||||
| tests/unit
|
||||
| tests/unit/*
|
||||
// TRANSLATION MISSING
|
||||
| Unit tests
|
||||
| Unit тестови
|
||||
|
||||
| doc
|
||||
| doc/*
|
||||
|
||||
@@ -2086,7 +2086,7 @@ char **weechat_string_split_command (const char *command, char separator);
|
||||
|
||||
Повратна вредност:
|
||||
|
||||
* низ стрингова, NULL у случају проблема (након употребе мора да се ослободи позивом <<_free_split_command,free_split_command>>)
|
||||
* низ стрингова, NULL у случају проблема (након употребе мора да се ослободи позивом <<_string_free_split_command,string_free_split_command>>)
|
||||
|
||||
C пример:
|
||||
|
||||
@@ -4484,12 +4484,11 @@ if (weechat_file_compress ("/tmp/test.txt", "/tmp/test.txt.zst", "zstd", 50))
|
||||
[NOTE]
|
||||
Ова функција није доступна у API скриптовања.
|
||||
|
||||
// TRANSLATION MISSING
|
||||
==== file_compare
|
||||
|
||||
_WeeChat ≥ 4.7.0._
|
||||
|
||||
Compare the content of two files.
|
||||
Пореди садржаје два фајла.
|
||||
|
||||
Прототип:
|
||||
|
||||
@@ -4500,14 +4499,14 @@ int weechat_file_compare (const char *filename1, const char *filename2);
|
||||
|
||||
Аргументи:
|
||||
|
||||
* _filename1_: first file to compare
|
||||
* _filename2_: second file to compare
|
||||
* _filename1_: први фајл за поређење
|
||||
* _filename2_: други фајл за поређење
|
||||
|
||||
Повратна вредност:
|
||||
|
||||
* 0: both files have same content
|
||||
* 1: content is different
|
||||
* 2: error (file not found or read error)
|
||||
* 0: оба фајла имају исти садржај
|
||||
* 1: садржај се разликује
|
||||
* 2: грешка (фајл није пронађен или грешка при читању)
|
||||
|
||||
C пример:
|
||||
|
||||
@@ -4515,7 +4514,7 @@ C пример:
|
||||
----
|
||||
if (weechat_file_compare ("/tmp/test.txt", "/tmp/test2.txt") == 0)
|
||||
{
|
||||
/* same content */
|
||||
/* исти садржај */
|
||||
}
|
||||
----
|
||||
|
||||
@@ -4663,7 +4662,7 @@ weechat_printf (NULL, "date: %s",
|
||||
|
||||
==== util_strftimeval
|
||||
|
||||
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0._
|
||||
_WeeChat ≥ 4.2.0, ажурирано у 4.3.0, 4.7.0._
|
||||
|
||||
Форматира датум и време као функција `strftime` из C библиотеке, користећи `struct timeval`
|
||||
као улаз уз подршку за додатне спецификаторе.
|
||||
@@ -4680,6 +4679,8 @@ int weechat_util_strftimeval (char *string, int max, const char *format, struct
|
||||
* _string_: бафер у који се смешта форматирани стринг
|
||||
* _max_: величина стринга
|
||||
* _format_: формат, исто као за _strftime_ функцију, са следећим додатним спецификаторима:
|
||||
** `%@`: враћа датум изражен у Coordinated Universal Time (UTC) уместо као датум
|
||||
релативан у односу на временску зону коју је задао корисник _(WeeChat ≥ 4.7.0)_
|
||||
** `%.N` где је `N` између 1 и 6: микросекунде допуњене нулама на N цифара
|
||||
(на пример `%.3` за милисекунде)
|
||||
** `%f`: алијас за `%.6`
|
||||
@@ -4696,8 +4697,8 @@ C пример:
|
||||
char time[256];
|
||||
struct timeval tv;
|
||||
gettimeofday (&tv, NULL);
|
||||
weechat_util_strftimeval (time, sizeof (time), "%FT%T.%f", &tv);
|
||||
/* резултат: 2023-12-26T18:10:04.460509 */
|
||||
weechat_util_strftimeval (time, sizeof (time), "%@%FT%T.%fZ", &tv);
|
||||
/* резултат: 2023-12-26T18:10:04.460509Z */
|
||||
----
|
||||
|
||||
[NOTE]
|
||||
@@ -10780,6 +10781,16 @@ struct t_hook *weechat_hook_url (const char *url,
|
||||
*** _headers_: HTTP заглавља у одзиву
|
||||
*** _output_: стандардни излаз (поставља се само ако у опцијама није постављено _file_out_)
|
||||
*** _error_: порука о грешки (поставља се само у случају грешке)
|
||||
*** _error_code_: error code (integer, set only in case of error):
|
||||
**** `1`: invalid URL
|
||||
**** `2`: transfer error (Curl error)
|
||||
**** `3`: not enough memory
|
||||
**** `4`: file error
|
||||
**** `5`: transfer stopped (hook removed during the transfer)
|
||||
**** `6`: transfer timeout
|
||||
**** `100`: thread creation error
|
||||
*** _error_code_pthread_: return code of function _pthread_create_
|
||||
(integer, set only if _error_code_ is `100`)
|
||||
** повратна вредност:
|
||||
*** _WEECHAT_RC_OK_
|
||||
*** _WEECHAT_RC_ERROR_
|
||||
|
||||
@@ -595,7 +595,7 @@ include::includes/cmdline_options.sr.adoc[tag=debug]
|
||||
[width="100%", cols="1m,6", options="header"]
|
||||
|===
|
||||
| Име | Опис
|
||||
| WEECHAT_HOME | WeeChat почетни директоријум (са конфигурационим фајловима, логовима, скриптама, итд.). Исто понашање као <<compile_with_cmake,CMake опција>> `WEECHAT_HOME`.
|
||||
| WEECHAT_HOME | WeeChat почетни директоријум (са конфигурационим фајловима, логовима, скриптама, итд.). Исто понашање као <<build,CMake опција>> `WEECHAT_HOME`.
|
||||
| WEECHAT_PASSPHRASE | Тајна реченица која се користи за дешифровање обезбеђених података.
|
||||
| WEECHAT_EXTRA_LIBDIR | Додатни директоријум из кога се учитавају додаци (из „plugins” директоријума на овој путањи).
|
||||
|===
|
||||
@@ -1002,8 +1002,7 @@ WeeChat командна линија (на дну прозора) вам омо
|
||||
kbd:[yyyyyy] | Текст у боји `xxxxxx` и позадина `yyyyyy` (RGB као хексадецимални број).
|
||||
| kbd:[Ctrl+c], kbd:[i] | Текст у курзиву.
|
||||
| kbd:[Ctrl+c], kbd:[o] | Искључивање боје и атрибута.
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Strikethrough text (displayed as half bright in ncurses interface because strikethrough is not supported).
|
||||
| kbd:[Ctrl+c], kbd:[s] | Прецртани текст (у ncurses интерфејсу се приказује као полусветао јер се не подржава прецртавање).
|
||||
| kbd:[Ctrl+c], kbd:[v] | Обрнути видео (боје текста и позадине се замењују једна са другом).
|
||||
| kbd:[Ctrl+c], kbd:[_] | Подвучени текст.
|
||||
|===
|
||||
@@ -1549,8 +1548,7 @@ WeeChat нуди доста подразумеваних тастерских п
|
||||
| kbd:[Ctrl+c], kbd:[d] | Уметање кода за обојени текст (RGB боја, као хексадецимални број). | `+/input insert \x04+`
|
||||
| kbd:[Ctrl+c], kbd:[i] | Уметање кода за текст у курзиву. | `+/input insert \x1D+`
|
||||
| kbd:[Ctrl+c], kbd:[o] | Уметање кода за ресет боје. | `+/input insert \x0F+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+c], kbd:[s] | Insert code for strikethrough text. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[s] | Уметање кода за прецртани текст. | `+/input insert \x1E+`
|
||||
| kbd:[Ctrl+c], kbd:[v] | Уметање кода за обрнуту боју. | `+/input insert \x16+`
|
||||
| kbd:[Ctrl+c], kbd:[_] | Уметање кода за подвучени текст. | `+/input insert \x1F+`
|
||||
|===
|
||||
@@ -3556,7 +3554,7 @@ WeeChat подржава следећа https://ircv3.net/irc/[IRCv3 проши
|
||||
* <<irc_ircv3_batch,batch>>
|
||||
* <<irc_ircv3_cap_notify,cap-notify>>
|
||||
* <<irc_ircv3_chghost,chghost>>
|
||||
* <<irc_ircv3_draft/multiline,draft/multiline>>
|
||||
* <<irc_ircv3_draft_multiline,draft/multiline>>
|
||||
* <<irc_ircv3_echo_message,echo-message>>
|
||||
* <<irc_ircv3_extended_join,extended-join>>
|
||||
* <<irc_ircv3_invite_notify,invite-notify>>
|
||||
@@ -3602,7 +3600,7 @@ WeeChat такве поруке приказује ако је опција
|
||||
|
||||
Ова могућност оспособљава сервер да шаље налог као ознаку поруке у командама које шаље клијенту. +
|
||||
WeeChat парсира ову ознаку у чува је у поруци, али се она не користи нити приказује. Може да се
|
||||
користи у <<command_filter,/filter>> команди за филтрирање порука које се подударају са
|
||||
користи у <<command_weechat_filter,/filter>> команди за филтрирање порука које се подударају са
|
||||
одређеним налозима.
|
||||
|
||||
Пример примљене сирове IRC поруке:
|
||||
|
||||
+1
-2
@@ -81,8 +81,7 @@ foreach(pofile ${PO_FILES})
|
||||
add_custom_command(
|
||||
OUTPUT "${mofile}"
|
||||
COMMAND "${MSGMERGE_EXECUTABLE}" ARGS --quiet -o "${CMAKE_CURRENT_BINARY_DIR}/${pofile}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}" ${POT_FILE_PATH}
|
||||
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
|
||||
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose --output-file=/dev/null "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
|
||||
COMMAND "${MSGFMT_EXECUTABLE}" ARGS -c --statistics --verbose -o "${mofile}" "${CMAKE_CURRENT_BINARY_DIR}/${pofile}"
|
||||
DEPENDS "${POT_FILE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/${pofile}"
|
||||
COMMENT "Compiling ${polang}.po"
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:24+0200\n"
|
||||
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5440,6 +5440,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "upozornit uživatele pokud nastane částečné doplnění"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6375,15 +6379,13 @@ msgstr "Myš je vypnuta"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', velikost: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "chyba"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -14023,6 +14025,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: selhalo parsování příkazu \"%s\" (prosím oznamte to vývojárům):"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: TLS handshake selhal"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
@@ -28,7 +28,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-05 09:24+0200\n"
|
||||
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
|
||||
"Language-Team: German <kde-i18n-de@kde.org>\n"
|
||||
@@ -6199,6 +6199,10 @@ msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr ""
|
||||
"erzeugt eine Mitteilung (BEL) wenn eine teilweise Vervollständigung auftritt"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -7228,15 +7232,12 @@ msgstr "Maus ist inaktiv"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', Größe: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr "WeeChat wird im Hintergrund ausgeführt..."
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr "Fork-Fehler"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -7837,8 +7838,8 @@ msgstr ""
|
||||
|
||||
msgid " - ${number_zero2}: like ${number2} but the number is zero-padded"
|
||||
msgstr ""
|
||||
" - ${number_zero2}: wie ${number2}, aber die Zahl wird mit Nullen"
|
||||
" aufgefüllt"
|
||||
" - ${number_zero2}: wie ${number2}, aber die Zahl wird mit Nullen "
|
||||
"aufgefüllt"
|
||||
|
||||
msgid ""
|
||||
" - ${number_displayed}: \"1\" if the number is displayed, otherwise \"0\""
|
||||
@@ -15418,6 +15419,11 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: Route „%s %s“ für Client %s%s%s konnte nicht ausgeführt werden"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: invalid websocket handshake received for client %s%s%s"
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: ungültigen WebSocket Handshake für Client %s%s%s empfangen"
|
||||
|
||||
#, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr ""
|
||||
@@ -18963,4 +18969,3 @@ msgstr ""
|
||||
"%s%s Datei \"%s\" zum Fortsetzen der Übertragung wird nicht akzeptiert "
|
||||
"(Port: %d, Startposition: %llu): xfer nicht gefunden oder nicht bereit für "
|
||||
"Transfer"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -170,7 +170,7 @@ msgid ""
|
||||
"%sRenumbering is allowed only if option weechat.look.buffer_auto_renumber is "
|
||||
"off"
|
||||
msgstr ""
|
||||
"%sEl renombrado es permitido solo sila opción "
|
||||
"%sEl renombrado es permitido solo si la opción "
|
||||
"weechat.look.buffer_auto_renumber está desactivada (off)"
|
||||
|
||||
#, c-format
|
||||
@@ -846,7 +846,7 @@ msgstr "%sError: opción \"%s\" no encontrada"
|
||||
#, fuzzy
|
||||
#| msgid "Option changed: "
|
||||
msgid "Option unchanged: "
|
||||
msgstr "Opción cambiada: "
|
||||
msgstr "Opción sin cambios: "
|
||||
|
||||
msgid "Option changed: "
|
||||
msgstr "Opción cambiada: "
|
||||
@@ -5577,6 +5577,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "alertar al usuario cuando ocurre un completado parcial"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6559,15 +6563,13 @@ msgstr "Ratón desactivado"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', tamaño: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "error"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -14357,6 +14359,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: falló la ejecución del comando \"%s\" por el cliente %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: agotado el tiempo de espera del saludo TLS del cliente %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
@@ -23,8 +23,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:24+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-08-16 19:27+0200\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: fr\n"
|
||||
@@ -6068,6 +6068,12 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "envoyer une alerte (BEL) lorsqu'une complétion partielle survient"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
"étendre automatiquement le mot après une complétion partielle lors d'une "
|
||||
"nouvelle complétion"
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -7089,15 +7095,12 @@ msgstr "La souris est désactivée"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', taille : %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr "Lancement de WeeChat en tâche de fond..."
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr "erreur de fork"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -15113,6 +15116,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s : échec d'exécution de la route \"%s %s\" pour le client %s%s%s"
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s : données invalides reçues du client %s%s%s"
|
||||
|
||||
#, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr "%sremote[%s] : impossible d'envoyer des données, déconnexion"
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5144,6 +5144,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6037,15 +6041,13 @@ msgstr "Nincs aliasz definiálva.\n"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "%sSzerver: %s%s\n"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "Rendben"
|
||||
|
||||
@@ -13422,6 +13424,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s gnutls kézfogás sikertelen\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr "%s nem sikerült a szervert létrehozni\n"
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5560,6 +5560,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "avvisa l'utente quando si verifica un completamento parziale"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6497,15 +6501,13 @@ msgstr "Mouse disabilitato"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', dimensione %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "errore"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -14359,6 +14361,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: impossibile eseguire il comando \"%s\" per il client %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: set di caratter invalido: \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
|
||||
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
|
||||
@@ -5740,6 +5740,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "補完候補が複数あった場合に警告 (BEL) を送信"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6712,15 +6716,12 @@ msgstr "マウスを無効化しました"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s'、サイズ: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr "WeeChat をバックグラウンドで実行中..."
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr "フォークエラー"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "成功"
|
||||
|
||||
@@ -14848,6 +14849,12 @@ msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr ""
|
||||
"%1$s%2$s: クライアント %4$s%5$s%6$s に対するコマンド \"%3$s\" の実行に失敗"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: invalid websocket handshake received for client %s%s%s"
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr ""
|
||||
"%s%s: クライアント %s%s%s から受け取った不正なウェブソケットハンドシェイク"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
@@ -24,7 +24,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -6037,6 +6037,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "wyślij alarm (BEL), kiedy nastąpi częściowe dopełnienie"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -7080,15 +7084,12 @@ msgstr "Obsługa myszy wyłączona"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', rozmiar: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr "Uruchamianie WeeChat w tle..."
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr "nie udało się utworzyć procesu"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -15044,6 +15045,12 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: nie udało się wykonać trasy „%s %s” dla klienta %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: invalid websocket handshake received for client %s%s%s"
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr ""
|
||||
"%s%s: otrzymano niepoprawny pakiet dla gniazda webowego od klienta %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%sremote[%s]: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
|
||||
"Language-Team: Portuguese <>\n"
|
||||
@@ -5778,6 +5778,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "alertar o utilizador ao completar parcialmente"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6754,15 +6758,13 @@ msgstr "O rato está desativado"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', tamanho: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "erro"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -14732,6 +14734,11 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: falha ao executar o comando \"%s\" do cliente %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: invalid websocket handshake received for client %s%s%s"
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: websocket handshake inválido recebido do cliente %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to create socket"
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
|
||||
+10
-4
@@ -23,7 +23,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5481,6 +5481,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "alertar usuário quando uma completação parcial ocorre"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6404,15 +6408,13 @@ msgstr "Mouse está desabilitado"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM='%s', tamanho: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "%s%s: erro: %s"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -13855,6 +13857,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: falha ao executar comando \"%s\" para cliente %d"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: handshake TLS falhou"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr "%s%s: não foi possível criar pipe"
|
||||
|
||||
@@ -23,7 +23,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5178,6 +5178,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6075,15 +6079,13 @@ msgstr "Сокращения не заданы.\n"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#, fuzzy
|
||||
msgid "fork error"
|
||||
msgstr "%sСервер: %s%s\n"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
@@ -13474,6 +13476,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "Не могу записать лог-файл \"%s\"\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s инициализация gnutls не удалось\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr "%s не могу создать сервер\n"
|
||||
|
||||
@@ -22,8 +22,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"PO-Revision-Date: 2025-05-04 09:25+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2025-07-09 15:48+0400\n"
|
||||
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: sr\n"
|
||||
@@ -5861,6 +5861,11 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr "шаље упозорење (BEL) када се догоди делимично довршавање"
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
"када се поново довршава, аутоматски развија реч након делимичног довршавања"
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -6865,15 +6870,12 @@ msgstr "Миш је искључен"
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr " TERM=’%s’, величина: %dx%d"
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr "WeeChat се извршава у позадини..."
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr "грешка при рачвању"
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr "ОК"
|
||||
|
||||
@@ -7438,10 +7440,10 @@ msgstr ""
|
||||
"бафера"
|
||||
|
||||
msgid " - ${number_zero}: like ${number} but the number is zero-padded"
|
||||
msgstr ""
|
||||
msgstr " - ${number_zero}: као ${number} али се број допуњава нулама"
|
||||
|
||||
msgid " - ${number_zero2}: like ${number2} but the number is zero-padded"
|
||||
msgstr ""
|
||||
msgstr " - ${number_zero2}: као ${number2} али се број допуњава нулама"
|
||||
|
||||
msgid ""
|
||||
" - ${number_displayed}: \"1\" if the number is displayed, otherwise \"0\""
|
||||
@@ -14667,6 +14669,11 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr "%s%s: није успело извршавање руте „%s %s” за клијента %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: invalid websocket handshake received for client %s%s%s"
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr "%s%s: примљено је неважеће вебсокет руковање од клијента %s%s%s"
|
||||
|
||||
#, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr "%sудаљени[%s]: није могао да пошаље податке, веза се прекида"
|
||||
|
||||
+9
-4
@@ -23,7 +23,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2025-05-04 09:21+0200\n"
|
||||
"POT-Creation-Date: 2025-08-16 19:26+0200\n"
|
||||
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -4804,6 +4804,10 @@ msgstr ""
|
||||
msgid "send alert (BEL) when a partial completion occurs"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"automatically expand word after partial completion when completing again"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"partially complete command names (stop when many commands found begin with "
|
||||
"same letters)"
|
||||
@@ -5622,15 +5626,12 @@ msgstr ""
|
||||
msgid " TERM='%s', size: %dx%d"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "Running WeeChat in background..."
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "fork error"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
@@ -12258,6 +12259,10 @@ msgstr ""
|
||||
msgid "%s%s: failed to execute route \"%s %s\" for client %s%s%s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%s%s: invalid data received from client %s%s%s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sremote[%s]: unable to send data, disconnecting"
|
||||
msgstr ""
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# SPDX-FileCopyrightText: 2025 Sébastien Helleu <flashcode@flashtux.org>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
continue-on-failure = true
|
||||
|
||||
[[operations]]
|
||||
include-path-regex = "/sync/?.*"
|
||||
enabled = false
|
||||
|
||||
[auth]
|
||||
basic = { username = "plain", password = "${RELAY_PASSWORD}" }
|
||||
@@ -313,6 +313,7 @@ struct t_config_option *config_completion_nick_first_only = NULL;
|
||||
struct t_config_option *config_completion_nick_ignore_chars = NULL;
|
||||
struct t_config_option *config_completion_nick_ignore_words = NULL;
|
||||
struct t_config_option *config_completion_partial_completion_alert = NULL;
|
||||
struct t_config_option *config_completion_partial_completion_auto_expand = NULL;
|
||||
struct t_config_option *config_completion_partial_completion_command = NULL;
|
||||
struct t_config_option *config_completion_partial_completion_command_arg = NULL;
|
||||
struct t_config_option *config_completion_partial_completion_count = NULL;
|
||||
@@ -5243,6 +5244,13 @@ config_weechat_init_options (void)
|
||||
N_("send alert (BEL) when a partial completion occurs"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_auto_expand = config_file_new_option (
|
||||
weechat_config_file, weechat_config_section_completion,
|
||||
"partial_completion_auto_expand", "boolean",
|
||||
N_("automatically expand word after partial completion when "
|
||||
"completing again"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_completion_partial_completion_command = config_file_new_option (
|
||||
weechat_config_file, weechat_config_section_completion,
|
||||
"partial_completion_command", "boolean",
|
||||
|
||||
@@ -362,6 +362,7 @@ extern struct t_config_option *config_completion_nick_first_only;
|
||||
extern struct t_config_option *config_completion_nick_ignore_chars;
|
||||
extern struct t_config_option *config_completion_nick_ignore_words;
|
||||
extern struct t_config_option *config_completion_partial_completion_alert;
|
||||
extern struct t_config_option *config_completion_partial_completion_auto_expand;
|
||||
extern struct t_config_option *config_completion_partial_completion_command;
|
||||
extern struct t_config_option *config_completion_partial_completion_command_arg;
|
||||
extern struct t_config_option *config_completion_partial_completion_count;
|
||||
|
||||
+10
-6
@@ -36,10 +36,18 @@
|
||||
/* Bring in htobe64 */
|
||||
#ifdef __ANDROID__
|
||||
#define _BSD_SOURCE
|
||||
#define BE_INT64 htobe64
|
||||
#include <endian.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define htobe64 OSSwapHostToBigInt64
|
||||
#define BE_INT64 OSSwapHostToBigInt64
|
||||
#elif defined(HAVE_HTONLL)
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <inttypes.h>
|
||||
#define BE_INT64 htonll
|
||||
#else
|
||||
#define BE_INT64 htobe64
|
||||
#endif
|
||||
|
||||
#include "weechat.h"
|
||||
@@ -49,10 +57,6 @@
|
||||
#include "core-string.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
||||
#ifdef htonll
|
||||
#define htobe64 htonll
|
||||
#endif
|
||||
|
||||
char *weecrypto_hash_algo_string[] = {
|
||||
"crc32",
|
||||
"md5",
|
||||
@@ -536,7 +540,7 @@ weecrypto_totp_generate_internal (const char *secret, int length_secret,
|
||||
int rc, offset, length;
|
||||
unsigned long bin_code;
|
||||
|
||||
moving_factor_swapped = htobe64 (moving_factor);
|
||||
moving_factor_swapped = BE_INT64 (moving_factor);
|
||||
rc = weecrypto_hmac (secret, length_secret,
|
||||
&moving_factor_swapped, sizeof (moving_factor_swapped),
|
||||
GCRY_MD_SHA1,
|
||||
|
||||
@@ -611,6 +611,12 @@ debug_hooks_plugin_types (const char *plugin_mask, const char **hook_types)
|
||||
(ptr_hook->plugin) ?
|
||||
ptr_hook->plugin->name : PLUGIN_CORE,
|
||||
-1);
|
||||
if (ptr_hook->subplugin)
|
||||
{
|
||||
string_dyn_concat (result_type, "(", -1);
|
||||
string_dyn_concat (result_type, ptr_hook->subplugin, -1);
|
||||
string_dyn_concat (result_type, ")", -1);
|
||||
}
|
||||
string_dyn_concat (result_type, ": ", -1);
|
||||
string_dyn_concat (result_type, desc, -1);
|
||||
string_dyn_concat (result_type, "\n", -1);
|
||||
|
||||
@@ -28,13 +28,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* _XPG4_2 is needed on SunOS for macros like CMSG_SPACE */
|
||||
/* __EXTENSIONS__ is needed on SunOS for constants like NI_MAXHOST */
|
||||
#ifdef __sun
|
||||
#define _XPG4_2
|
||||
#define __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
+125
-29
@@ -37,6 +37,7 @@
|
||||
#include "core-infolist.h"
|
||||
#include "core-proxy.h"
|
||||
#include "core-string.h"
|
||||
#include "core-util.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
||||
|
||||
@@ -653,7 +654,9 @@ struct t_url_option url_options[] =
|
||||
URL_DEF_OPTION(SSLENGINE_DEFAULT, LONG, NULL),
|
||||
URL_DEF_OPTION(CAPATH, STRING, NULL),
|
||||
URL_DEF_OPTION(SSL_SESSIONID_CACHE, LONG, NULL),
|
||||
#if LIBCURL_VERSION_NUM < 0x081100 /* < 8.17.0 */
|
||||
URL_DEF_OPTION(KRBLEVEL, STRING, NULL),
|
||||
#endif
|
||||
URL_DEF_OPTION(KEYPASSWD, STRING, NULL),
|
||||
URL_DEF_OPTION(ISSUERCERT, STRING, NULL),
|
||||
URL_DEF_OPTION(CRLFILE, STRING, NULL),
|
||||
@@ -666,7 +669,9 @@ struct t_url_option url_options[] =
|
||||
#endif
|
||||
URL_DEF_OPTION(PINNEDPUBLICKEY, STRING, NULL),
|
||||
URL_DEF_OPTION(SSL_VERIFYSTATUS, LONG, NULL),
|
||||
#if LIBCURL_VERSION_NUM < 0x080F00 /* < 8.15.0 */
|
||||
URL_DEF_OPTION(SSL_FALSESTART, LONG, NULL),
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x073400 /* 7.52.0 */
|
||||
URL_DEF_OPTION(PROXY_CAINFO, STRING, NULL),
|
||||
URL_DEF_OPTION(PROXY_CAPATH, STRING, NULL),
|
||||
@@ -1044,31 +1049,46 @@ weeurl_set_proxy (CURL *curl, struct t_proxy *proxy)
|
||||
* output | stdout (set only if "file_out" was not set in options)
|
||||
* error | error message (set only in case of error)
|
||||
*
|
||||
* If timeout is 0, the function blocks until the end of the transfer.
|
||||
* If timeout (in milliseconds) is > 0, the function returns an error in the
|
||||
* output hashtable if the timeout is reached while the transfer is still
|
||||
* active.
|
||||
*
|
||||
* If stop_download is not NULL, it is checked regularly, and as soon as the
|
||||
* pointed integer becomes different from 0 (set by the caller of this function),
|
||||
* the download is immediately stopped with an error.
|
||||
*
|
||||
* Returns:
|
||||
* 0: OK
|
||||
* 1: invalid URL
|
||||
* 2: error downloading URL
|
||||
* 3: not enough memory
|
||||
* 4: file error
|
||||
* 5: transfer stopped by the caller
|
||||
* 6: transfer timeout
|
||||
*/
|
||||
|
||||
int
|
||||
weeurl_download (const char *url, struct t_hashtable *options,
|
||||
struct t_hashtable *output)
|
||||
long timeout, struct t_hashtable *output,
|
||||
int *stop_transfer)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *multi;
|
||||
CURLMcode curl_mc;
|
||||
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 url_error[4096], 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 };
|
||||
struct t_proxy *ptr_proxy;
|
||||
int rc, curl_rc, i, output_to_file;
|
||||
int rc, i, output_to_file, still_running;
|
||||
long response_code;
|
||||
struct timeval tv_now, tv_end;
|
||||
|
||||
rc = 0;
|
||||
|
||||
@@ -1167,44 +1187,120 @@ weeurl_download (const char *url, struct t_hashtable *options,
|
||||
/* set error buffer */
|
||||
curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, url_error);
|
||||
|
||||
/* perform action! */
|
||||
curl_rc = curl_easy_perform (curl);
|
||||
if (curl_rc == CURLE_OK)
|
||||
/* compute end time for transfer, according to the timeout */
|
||||
if (timeout > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
gettimeofday (&tv_end, NULL);
|
||||
util_timeval_add (&tv_end, ((long long)timeout) * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (output)
|
||||
tv_end.tv_sec = 0;
|
||||
tv_end.tv_usec = 0;
|
||||
}
|
||||
|
||||
/* start the transfer */
|
||||
multi = curl_multi_init ();
|
||||
curl_multi_add_handle (multi, curl);
|
||||
while (1)
|
||||
{
|
||||
curl_mc = curl_multi_perform (multi, &still_running);
|
||||
|
||||
if ((curl_mc == CURLM_OK) && still_running)
|
||||
curl_mc = curl_multi_poll (multi, NULL, 0, 5, NULL);
|
||||
|
||||
if (curl_mc != CURLM_OK)
|
||||
{
|
||||
snprintf (url_error_code, sizeof (url_error_code), "%d", curl_rc);
|
||||
if (!url_error[0])
|
||||
if (output)
|
||||
{
|
||||
snprintf (url_error, sizeof (url_error),
|
||||
"%s", _("transfer error"));
|
||||
snprintf (url_error_code, sizeof (url_error_code), "%d", curl_mc);
|
||||
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_mc, url_error, url);
|
||||
}
|
||||
rc = 2;
|
||||
break;
|
||||
}
|
||||
if (!still_running)
|
||||
{
|
||||
/* transfer 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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (stop_transfer && *stop_transfer)
|
||||
{
|
||||
/* transfer stopped by the caller */
|
||||
if (output)
|
||||
{
|
||||
if (!url_error[0])
|
||||
snprintf (url_error, sizeof (url_error), "transfer stopped");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* URL transfer done in a forked process: display error on stderr,
|
||||
* which will be sent to the hook_process callback
|
||||
*/
|
||||
fprintf (stderr,
|
||||
_("transfer stopped (URL: \"%s\")\n"),
|
||||
url);
|
||||
}
|
||||
rc = 5;
|
||||
break;
|
||||
}
|
||||
if (tv_end.tv_sec > 0)
|
||||
{
|
||||
/* timeout reached? */
|
||||
gettimeofday (&tv_now, NULL);
|
||||
if (util_timeval_cmp (&tv_now, &tv_end) >= 0)
|
||||
{
|
||||
if (output)
|
||||
{
|
||||
if (!url_error[0])
|
||||
{
|
||||
snprintf (url_error, sizeof (url_error),
|
||||
URL_ERROR_TIMEOUT " (%.3fs)",
|
||||
((float)timeout) / 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* URL transfer done in a forked process: display error on stderr,
|
||||
* which will be sent to the hook_process callback
|
||||
*/
|
||||
fprintf (stderr,
|
||||
_("transfer timeout reached (%.3fs) (URL: \"%s\")\n"),
|
||||
((float)timeout) / 1000, url);
|
||||
}
|
||||
rc = 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
rc = 2;
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
curl_multi_remove_handle (multi, curl);
|
||||
curl_easy_cleanup (curl);
|
||||
curl_multi_cleanup (multi);
|
||||
|
||||
end:
|
||||
for (i = 0; i < 2; i++)
|
||||
|
||||
+4
-1
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define URL_ERROR_TIMEOUT "transfer timeout reached"
|
||||
|
||||
struct t_hashtable;
|
||||
struct t_infolist;
|
||||
|
||||
@@ -61,7 +63,8 @@ extern char *url_type_string[];
|
||||
extern struct t_url_option url_options[];
|
||||
|
||||
extern int weeurl_download (const char *url, struct t_hashtable *options,
|
||||
struct t_hashtable *output);
|
||||
long timeout, struct t_hashtable *output,
|
||||
int *stop_transfer);
|
||||
extern int weeurl_option_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_url_option *option);
|
||||
extern void weeurl_init (void);
|
||||
|
||||
+16
-5
@@ -168,6 +168,8 @@ util_get_time_string (const time_t *date)
|
||||
/*
|
||||
* Formats date and time like strftime (but with timeval structure as input)
|
||||
* and adds extra specifiers:
|
||||
* - "%@": return the date expressed in Coordinated Universal Time (UTC)
|
||||
* instead of date relative to the user's specified timezone
|
||||
* - "%.1" to "%.6": first N digits of microseconds, zero-padded
|
||||
* - "%f": alias of "%.6" (microseconds, zero-padded to 6 digits)
|
||||
* - "%!": timestamp as integer, in seconds (value of tv->tv_sec)
|
||||
@@ -178,14 +180,15 @@ util_strftimeval (char *string, int max, const char *format, struct timeval *tv)
|
||||
{
|
||||
char **format2, str_temp[32];
|
||||
const char *ptr_format;
|
||||
struct tm *local_time;
|
||||
int length, bytes;
|
||||
struct tm *date_time;
|
||||
int length, bytes, local_time;
|
||||
long usec;
|
||||
|
||||
if (!string || (max <= 0) || !format || !tv)
|
||||
return 0;
|
||||
|
||||
string[0] = '\0';
|
||||
local_time = 1;
|
||||
|
||||
if (!format[0])
|
||||
return 0;
|
||||
@@ -208,6 +211,11 @@ util_strftimeval (char *string, int max, const char *format, struct timeval *tv)
|
||||
string_dyn_concat (format2, "%%", -1);
|
||||
ptr_format += 2;
|
||||
}
|
||||
else if ((ptr_format[0] == '%') && (ptr_format[1] == '@'))
|
||||
{
|
||||
local_time = 0;
|
||||
ptr_format += 2;
|
||||
}
|
||||
else if ((ptr_format[0] == '%') && (ptr_format[1] == '.'))
|
||||
{
|
||||
if ((ptr_format[2] >= '1') && (ptr_format[2] <= '6'))
|
||||
@@ -244,14 +252,17 @@ util_strftimeval (char *string, int max, const char *format, struct timeval *tv)
|
||||
}
|
||||
}
|
||||
|
||||
local_time = localtime (&(tv->tv_sec));
|
||||
if (!local_time)
|
||||
if (local_time)
|
||||
date_time = localtime (&(tv->tv_sec));
|
||||
else
|
||||
date_time = gmtime (&(tv->tv_sec));
|
||||
if (!date_time)
|
||||
{
|
||||
string_dyn_free (format2, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytes = strftime (string, max, *format2, local_time);
|
||||
bytes = strftime (string, max, *format2, date_time);
|
||||
|
||||
string_dyn_free (format2, 1);
|
||||
|
||||
|
||||
@@ -279,7 +279,9 @@ hook_process_child (struct t_hook *hook_process)
|
||||
}
|
||||
rc = weeurl_download (ptr_url,
|
||||
HOOK_PROCESS(hook_process, options),
|
||||
NULL); /* output */
|
||||
0, /* timeout */
|
||||
NULL, /* output */
|
||||
NULL); /* stop_download */
|
||||
}
|
||||
else if (strncmp (HOOK_PROCESS(hook_process, command), "func:", 5) == 0)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,9 @@ hook_url_transfer_thread (void *hook_pointer)
|
||||
|
||||
url_rc = weeurl_download (HOOK_URL(hook, url),
|
||||
HOOK_URL(hook, options),
|
||||
HOOK_URL(hook, output));
|
||||
HOOK_URL(hook, timeout),
|
||||
HOOK_URL(hook, output),
|
||||
&(HOOK_URL(hook, stop_transfer)));
|
||||
|
||||
if (url_rc != 0)
|
||||
{
|
||||
@@ -159,7 +161,7 @@ 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];
|
||||
char str_error[1024];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -192,11 +194,10 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
|
||||
if (!hashtable_has_key (HOOK_URL(hook, output), "error_code"))
|
||||
{
|
||||
snprintf (str_error, sizeof (str_error),
|
||||
"transfer timeout reached (%.3fs)",
|
||||
URL_ERROR_TIMEOUT " (%.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);
|
||||
hashtable_set (HOOK_URL(hook, output), "error_code", "6");
|
||||
}
|
||||
hook_url_run_callback (hook);
|
||||
if (weechat_debug_core >= 1)
|
||||
@@ -224,7 +225,7 @@ 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];
|
||||
char str_error[1024], str_error_code_pthread[12];
|
||||
|
||||
HOOK_URL(hook, thread_running) = 1;
|
||||
|
||||
@@ -235,11 +236,10 @@ hook_url_transfer (struct t_hook *hook)
|
||||
{
|
||||
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", "100");
|
||||
hashtable_set (HOOK_URL(hook, output), "error_code_pthread",
|
||||
str_error_code_pthread);
|
||||
hook_url_run_callback (hook);
|
||||
@@ -265,7 +265,7 @@ hook_url_transfer (struct t_hook *hook)
|
||||
{
|
||||
if (timeout <= 100)
|
||||
{
|
||||
interval = timeout;
|
||||
interval = timeout + 50;
|
||||
max_calls = 1;
|
||||
}
|
||||
else
|
||||
@@ -274,6 +274,7 @@ hook_url_transfer (struct t_hook *hook)
|
||||
max_calls = timeout / 100;
|
||||
if (timeout % 100 == 0)
|
||||
max_calls++;
|
||||
max_calls++;
|
||||
}
|
||||
}
|
||||
HOOK_URL(hook, hook_timer) = hook_timer (hook->plugin,
|
||||
@@ -323,6 +324,7 @@ hook_url (struct t_weechat_plugin *plugin,
|
||||
new_hook_url->url = strdup (url);
|
||||
new_hook_url->options = (options) ? hashtable_dup (options) : NULL;
|
||||
new_hook_url->timeout = timeout;
|
||||
new_hook_url->stop_transfer = 0;
|
||||
new_hook_url->thread_id = 0;
|
||||
new_hook_url->thread_created = 0;
|
||||
new_hook_url->thread_running = 0;
|
||||
@@ -366,6 +368,26 @@ hook_url_free_data (struct t_hook *hook)
|
||||
if (!hook || !hook->hook_data)
|
||||
return;
|
||||
|
||||
/* stop transfer if it's still active */
|
||||
if (HOOK_URL(hook, thread_created) && HOOK_URL(hook, thread_running))
|
||||
{
|
||||
HOOK_URL(hook, stop_transfer) = 1;
|
||||
usleep (10000);
|
||||
if (!hashtable_has_key (HOOK_URL(hook, output), "error_code"))
|
||||
{
|
||||
hashtable_set (HOOK_URL(hook, output), "error", "transfer stopped");
|
||||
hashtable_set (HOOK_URL(hook, output), "error_code", "5");
|
||||
}
|
||||
hook_url_run_callback (hook);
|
||||
if (weechat_debug_core >= 1)
|
||||
{
|
||||
gui_chat_printf (
|
||||
NULL,
|
||||
_("End of URL transfer '%s', transfer stopped"),
|
||||
HOOK_URL(hook, url));
|
||||
}
|
||||
}
|
||||
|
||||
if (HOOK_URL(hook, url))
|
||||
{
|
||||
free (HOOK_URL(hook, url));
|
||||
@@ -421,6 +443,8 @@ hook_url_add_to_infolist (struct t_infolist_item *item,
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (item, "timeout", (int)(HOOK_URL(hook, timeout))))
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (item, "stop_transfer", HOOK_URL(hook, stop_transfer)))
|
||||
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))))
|
||||
@@ -451,6 +475,7 @@ hook_url_print_log (struct t_hook *hook)
|
||||
hashtable_get_string (HOOK_URL(hook, options),
|
||||
"keys_values"));
|
||||
log_printf (" timeout . . . . . . . : %ld", HOOK_URL(hook, timeout));
|
||||
log_printf (" stop_transfer . . . . : %d", HOOK_URL(hook, stop_transfer));
|
||||
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. . . . . . : %p", HOOK_URL(hook, hook_timer));
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#ifndef WEECHAT_HOOK_URL_H
|
||||
#define WEECHAT_HOOK_URL_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct t_weechat_plugin;
|
||||
struct t_infolist_item;
|
||||
struct t_hashtable;
|
||||
@@ -39,6 +41,7 @@ struct t_hook_url
|
||||
char *url; /* URL */
|
||||
struct t_hashtable *options; /* URL options (see doc) */
|
||||
long timeout; /* timeout (ms) (0 = no timeout) */
|
||||
int stop_transfer; /* 1 is used to stop transfer now */
|
||||
pthread_t thread_id; /* thread id */
|
||||
int thread_created; /* thread created */
|
||||
int thread_running; /* 1 if thread is running */
|
||||
|
||||
@@ -53,11 +53,6 @@ if(ENABLE_ZSTD)
|
||||
list(APPEND EXTRA_LIBS ${LIBZSTD_LDFLAGS})
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# link with resolv lib on macOS
|
||||
list(APPEND EXTRA_LIBS "resolv")
|
||||
endif()
|
||||
|
||||
if(ENABLE_NCURSES)
|
||||
subdirs(normal)
|
||||
endif()
|
||||
|
||||
@@ -49,23 +49,20 @@ daemonize (void)
|
||||
pid_t pid;
|
||||
int fd, i;
|
||||
|
||||
printf (_("Running WeeChat in background..."));
|
||||
printf (" ");
|
||||
printf ("%s ", _("Running WeeChat in background..."));
|
||||
|
||||
pid = fork ();
|
||||
|
||||
if (pid < 0)
|
||||
{
|
||||
printf (_("fork error"));
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("fork error"));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (pid > 0)
|
||||
{
|
||||
/* parent process */
|
||||
printf (_("OK"));
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("OK"));
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ set(LIB_GUI_CURSES_SRC
|
||||
|
||||
find_package(Ncurses)
|
||||
if(NCURSES_FOUND)
|
||||
add_definitions(${NCURSES_CFLAGS})
|
||||
check_include_files(ncursesw/ncurses.h NCURSESW_HEADERS)
|
||||
if(NCURSESW_HEADERS)
|
||||
add_definitions(-DHAVE_NCURSESW_CURSES_H)
|
||||
|
||||
+94
-54
@@ -127,8 +127,8 @@ gui_completion_init (struct t_gui_completion *completion,
|
||||
completion->args = NULL;
|
||||
completion->direction = 0;
|
||||
completion->add_space = 1;
|
||||
completion->force_partial_completion = 0;
|
||||
completion->reverse_partial_completion = 0;
|
||||
completion->partial_completion = 0;
|
||||
completion->template_partial_completion = 0;
|
||||
|
||||
completion->list = arraylist_new (
|
||||
32, 1, 0,
|
||||
@@ -631,7 +631,7 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
|
||||
config_hashtable_completion_partial_templates,
|
||||
custom_completion))
|
||||
{
|
||||
completion->reverse_partial_completion = 1;
|
||||
completion->template_partial_completion = 1;
|
||||
}
|
||||
gui_completion_custom (completion,
|
||||
custom_completion,
|
||||
@@ -907,8 +907,6 @@ gui_completion_find_context (struct t_gui_completion *completion,
|
||||
const char *ptr_command, *ptr_data, *ptr_space, *ptr_newline, *prev_char;
|
||||
|
||||
/* look for context */
|
||||
gui_completion_free_data (completion);
|
||||
gui_completion_init (completion, completion->plugin, completion->buffer);
|
||||
ptr_command = NULL;
|
||||
command_arg = 0;
|
||||
|
||||
@@ -1241,7 +1239,7 @@ gui_completion_partial_build_list (struct t_gui_completion *completion,
|
||||
void
|
||||
gui_completion_complete (struct t_gui_completion *completion)
|
||||
{
|
||||
int length, word_found_seen, other_completion, partial_completion;
|
||||
int length, word_found_seen, other_completion;
|
||||
int common_prefix_size, index, index2;
|
||||
struct t_gui_completion_word *ptr_completion_word, *ptr_completion_word2;
|
||||
|
||||
@@ -1249,34 +1247,15 @@ gui_completion_complete (struct t_gui_completion *completion)
|
||||
word_found_seen = 0;
|
||||
other_completion = 0;
|
||||
|
||||
partial_completion = completion->force_partial_completion;
|
||||
|
||||
if (!partial_completion)
|
||||
{
|
||||
if (completion->context == GUI_COMPLETION_COMMAND)
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command);
|
||||
}
|
||||
else if (completion->context == GUI_COMPLETION_COMMAND_ARG)
|
||||
{
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_command_arg);
|
||||
}
|
||||
else
|
||||
partial_completion = CONFIG_BOOLEAN(config_completion_partial_completion_other);
|
||||
}
|
||||
|
||||
if (completion->reverse_partial_completion)
|
||||
partial_completion ^= 1;
|
||||
|
||||
common_prefix_size = 0;
|
||||
if (partial_completion
|
||||
if (completion->partial_completion
|
||||
&& completion->list && (completion->list->size > 0))
|
||||
{
|
||||
common_prefix_size = gui_completion_common_prefix_size (completion->list,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (partial_completion
|
||||
if (completion->partial_completion
|
||||
&& completion->word_found
|
||||
&& (utf8_strlen (completion->word_found) >= common_prefix_size))
|
||||
{
|
||||
@@ -1355,7 +1334,7 @@ gui_completion_complete (struct t_gui_completion *completion)
|
||||
completion->position = 0;
|
||||
|
||||
/* stop after common prefix, if asked by user */
|
||||
if (partial_completion
|
||||
if (completion->partial_completion
|
||||
&& ((utf8_strlen (completion->word_found) >= common_prefix_size))
|
||||
&& (other_completion > 0))
|
||||
{
|
||||
@@ -1523,7 +1502,7 @@ gui_completion_search (struct t_gui_completion *completion, const char *data,
|
||||
int position, int direction)
|
||||
{
|
||||
char *old_word_found;
|
||||
int real_position;
|
||||
int real_position, force_no_partial;
|
||||
|
||||
if (!completion || !data || (position < 0))
|
||||
return 0;
|
||||
@@ -1532,14 +1511,75 @@ gui_completion_search (struct t_gui_completion *completion, const char *data,
|
||||
|
||||
completion->direction = direction;
|
||||
|
||||
force_no_partial = 0;
|
||||
if ((completion->context != GUI_COMPLETION_NULL)
|
||||
&& (arraylist_size (completion->partial_list) > 0)
|
||||
&& CONFIG_BOOLEAN(config_completion_partial_completion_auto_expand))
|
||||
{
|
||||
force_no_partial = 1;
|
||||
arraylist_clear (completion->partial_list);
|
||||
}
|
||||
|
||||
/* if new completion => look for base word */
|
||||
if (real_position != completion->position)
|
||||
{
|
||||
free (completion->word_found);
|
||||
completion->word_found = NULL;
|
||||
completion->word_found_is_nick = 0;
|
||||
gui_completion_free_data (completion);
|
||||
gui_completion_init (completion, completion->plugin, completion->buffer);
|
||||
completion->partial_completion = (direction < 0);
|
||||
completion->direction = direction;
|
||||
gui_completion_find_context (completion, data, real_position);
|
||||
completion->force_partial_completion = (direction < 0);
|
||||
if (force_no_partial)
|
||||
{
|
||||
completion->partial_completion = 0;
|
||||
completion->direction = 1;
|
||||
}
|
||||
else if (completion->template_partial_completion)
|
||||
{
|
||||
if (completion->direction < 0)
|
||||
{
|
||||
completion->partial_completion = 0;
|
||||
completion->direction = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
completion->partial_completion = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (completion->context)
|
||||
{
|
||||
case GUI_COMPLETION_NULL:
|
||||
break;
|
||||
case GUI_COMPLETION_COMMAND:
|
||||
if (CONFIG_BOOLEAN(config_completion_partial_completion_command))
|
||||
{
|
||||
completion->partial_completion ^= 1;
|
||||
if (completion->direction < 0)
|
||||
completion->direction = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_COMPLETION_COMMAND_ARG:
|
||||
if (CONFIG_BOOLEAN(config_completion_partial_completion_command_arg))
|
||||
{
|
||||
completion->partial_completion ^= 1;
|
||||
if (completion->direction < 0)
|
||||
completion->direction = 1;
|
||||
}
|
||||
break;
|
||||
case GUI_COMPLETION_AUTO:
|
||||
if (CONFIG_BOOLEAN(config_completion_partial_completion_other))
|
||||
{
|
||||
completion->partial_completion ^= 1;
|
||||
if (completion->direction < 0)
|
||||
completion->direction = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* completion */
|
||||
@@ -1656,8 +1696,8 @@ gui_completion_hdata_completion_cb (const void *pointer, void *data,
|
||||
HDATA_VAR(struct t_gui_completion, args, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, direction, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, add_space, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, reverse_partial_completion, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, partial_completion, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, template_partial_completion, INTEGER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, list, POINTER, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, word_found, STRING, 0, NULL, NULL);
|
||||
HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, 0, NULL, NULL);
|
||||
@@ -1731,30 +1771,30 @@ gui_completion_print_log (void)
|
||||
ptr_completion = ptr_completion->next_completion)
|
||||
{
|
||||
log_printf ("[completion (addr:%p)]", ptr_completion);
|
||||
log_printf (" plugin. . . . . . . . . . : %p", ptr_completion->plugin);
|
||||
log_printf (" buffer. . . . . . . . . . : %p ('%s')",
|
||||
log_printf (" plugin. . . . . . . . . . . : %p", ptr_completion->plugin);
|
||||
log_printf (" buffer. . . . . . . . . . . : %p ('%s')",
|
||||
ptr_completion->buffer,
|
||||
ptr_completion->buffer->full_name);
|
||||
log_printf (" context . . . . . . . . . : %d", ptr_completion->context);
|
||||
log_printf (" case_sensitive. . . . . . : %d", ptr_completion->case_sensitive);
|
||||
log_printf (" base_command. . . . . . . : '%s'", ptr_completion->base_command);
|
||||
log_printf (" base_command_arg_index. . : %d", ptr_completion->base_command_arg_index);
|
||||
log_printf (" base_word . . . . . . . . : '%s'", ptr_completion->base_word);
|
||||
log_printf (" base_word_pos . . . . . . : %d", ptr_completion->base_word_pos);
|
||||
log_printf (" position. . . . . . . . . : %d", ptr_completion->position);
|
||||
log_printf (" args. . . . . . . . . . . : '%s'", ptr_completion->args);
|
||||
log_printf (" direction . . . . . . . . : %d", ptr_completion->direction);
|
||||
log_printf (" add_space . . . . . . . . : %d", ptr_completion->add_space);
|
||||
log_printf (" force_partial_completion. : %d", ptr_completion->force_partial_completion);
|
||||
log_printf (" reverse_partial_completion: %d", ptr_completion->reverse_partial_completion);
|
||||
log_printf (" list. . . . . . . . . . . : %p", ptr_completion->list);
|
||||
log_printf (" word_found. . . . . . . . : '%s'", ptr_completion->word_found);
|
||||
log_printf (" word_found_is_nick. . . . : %d", ptr_completion->word_found_is_nick);
|
||||
log_printf (" position_replace. . . . . : %d", ptr_completion->position_replace);
|
||||
log_printf (" diff_size . . . . . . . . : %d", ptr_completion->diff_size);
|
||||
log_printf (" diff_length . . . . . . . : %d", ptr_completion->diff_length);
|
||||
log_printf (" prev_completion . . . . . : %p", ptr_completion->prev_completion);
|
||||
log_printf (" next_completion . . . . . : %p", ptr_completion->next_completion);
|
||||
log_printf (" context . . . . . . . . . . : %d", ptr_completion->context);
|
||||
log_printf (" case_sensitive. . . . . . . : %d", ptr_completion->case_sensitive);
|
||||
log_printf (" base_command. . . . . . . . : '%s'", ptr_completion->base_command);
|
||||
log_printf (" base_command_arg_index. . . : %d", ptr_completion->base_command_arg_index);
|
||||
log_printf (" base_word . . . . . . . . . : '%s'", ptr_completion->base_word);
|
||||
log_printf (" base_word_pos . . . . . . . : %d", ptr_completion->base_word_pos);
|
||||
log_printf (" position. . . . . . . . . . : %d", ptr_completion->position);
|
||||
log_printf (" args. . . . . . . . . . . . : '%s'", ptr_completion->args);
|
||||
log_printf (" direction . . . . . . . . . : %d", ptr_completion->direction);
|
||||
log_printf (" add_space . . . . . . . . . : %d", ptr_completion->add_space);
|
||||
log_printf (" partial_completion. . . . . : %d", ptr_completion->partial_completion);
|
||||
log_printf (" template_partial_completion : %d", ptr_completion->template_partial_completion);
|
||||
log_printf (" list. . . . . . . . . . . . : %p", ptr_completion->list);
|
||||
log_printf (" word_found. . . . . . . . . : '%s'", ptr_completion->word_found);
|
||||
log_printf (" word_found_is_nick. . . . . : %d", ptr_completion->word_found_is_nick);
|
||||
log_printf (" position_replace. . . . . . : %d", ptr_completion->position_replace);
|
||||
log_printf (" diff_size . . . . . . . . . : %d", ptr_completion->diff_size);
|
||||
log_printf (" diff_length . . . . . . . . : %d", ptr_completion->diff_length);
|
||||
log_printf (" prev_completion . . . . . . : %p", ptr_completion->prev_completion);
|
||||
log_printf (" next_completion . . . . . . : %p", ptr_completion->next_completion);
|
||||
if (ptr_completion->list && (ptr_completion->list->size > 0))
|
||||
{
|
||||
log_printf ("");
|
||||
|
||||
@@ -56,8 +56,8 @@ struct t_gui_completion
|
||||
char *args; /* command line args (including base word) */
|
||||
int direction; /* +1=search next word, -1=previous word */
|
||||
int add_space; /* add space after completion? */
|
||||
int force_partial_completion; /* force partial completion? */
|
||||
int reverse_partial_completion; /* reverse partial completion? */
|
||||
int partial_completion; /* partial completion? */
|
||||
int template_partial_completion; /* template with partial completion? */
|
||||
|
||||
/* for command argument completion */
|
||||
struct t_arraylist *list; /* data list for completion */
|
||||
|
||||
@@ -124,8 +124,12 @@ else()
|
||||
endif()
|
||||
|
||||
if(ENABLE_SCRIPTS AND ENABLE_PYTHON)
|
||||
find_package(Python)
|
||||
if(PYTHON_FOUND)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18.0")
|
||||
find_package(Python 3.0 COMPONENTS Development)
|
||||
else()
|
||||
find_package(Python 3.0 COMPONENTS Development.Embed)
|
||||
endif()
|
||||
if(Python_FOUND)
|
||||
add_subdirectory(python)
|
||||
else()
|
||||
message(SEND_ERROR "Python not found")
|
||||
|
||||
+18
-17
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "irc.h"
|
||||
#include "irc-color.h"
|
||||
#include "irc-mode.h"
|
||||
#include "irc-config.h"
|
||||
#include "irc-server.h"
|
||||
@@ -37,18 +38,24 @@
|
||||
|
||||
|
||||
/*
|
||||
* Gets mode arguments: skip colons before arguments.
|
||||
* Gets mode arguments: skips colons before arguments and converts IRC color
|
||||
* codes into WeeChat color codes, so that the result can be displayed in a
|
||||
* buffer.
|
||||
*/
|
||||
|
||||
char *
|
||||
irc_mode_get_arguments (const char *arguments)
|
||||
irc_mode_get_arguments_colors (const char *arguments)
|
||||
{
|
||||
char **argv, **argv2, *new_arguments;
|
||||
char **argv, **new_arguments;
|
||||
int argc, i;
|
||||
|
||||
if (!arguments || !arguments[0])
|
||||
return strdup ("");
|
||||
|
||||
new_arguments = weechat_string_dyn_alloc (1024);
|
||||
if (!new_arguments)
|
||||
return NULL;
|
||||
|
||||
argv = weechat_string_split (arguments, " ", NULL,
|
||||
WEECHAT_STRING_SPLIT_STRIP_LEFT
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
@@ -57,26 +64,20 @@ irc_mode_get_arguments (const char *arguments)
|
||||
if (!argv)
|
||||
return strdup ("");
|
||||
|
||||
argv2 = malloc (sizeof (*argv) * (argc + 1));
|
||||
if (!argv2)
|
||||
{
|
||||
weechat_string_free_split (argv);
|
||||
return strdup ("");;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
argv2[i] = (argv[i][0] == ':') ? argv[i] + 1 : argv[i];
|
||||
if ((*new_arguments)[0])
|
||||
weechat_string_dyn_concat (new_arguments, " ", -1);
|
||||
weechat_string_dyn_concat (
|
||||
new_arguments,
|
||||
(argv[i][0] == ':') ? IRC_COLOR_MSG(argv[i] + 1) : IRC_COLOR_MSG(argv[i]),
|
||||
-1);
|
||||
weechat_string_dyn_concat (new_arguments, IRC_COLOR_RESET, -1);
|
||||
}
|
||||
argv2[argc] = NULL;
|
||||
|
||||
new_arguments = weechat_string_rebuild_split_string (
|
||||
(const char **)argv2, " ", 0, -1);
|
||||
|
||||
weechat_string_free_split (argv);
|
||||
free (argv2);
|
||||
|
||||
return new_arguments;
|
||||
return weechat_string_dyn_free (new_arguments, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
struct t_irc_server;
|
||||
struct t_irc_channel;
|
||||
|
||||
extern char *irc_mode_get_arguments (const char *arguments);
|
||||
extern char *irc_mode_get_arguments_colors (const char *arguments);
|
||||
extern char irc_mode_get_chanmode_type (struct t_irc_server *server,
|
||||
char chanmode);
|
||||
extern int irc_mode_channel_set (struct t_irc_server *server,
|
||||
|
||||
@@ -2178,7 +2178,7 @@ IRC_PROTOCOL_CALLBACK(mode)
|
||||
}
|
||||
ptr_nick = irc_nick_search (ctxt->server, ptr_channel, ctxt->nick);
|
||||
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : ctxt->server->buffer;
|
||||
modes_args = irc_mode_get_arguments (msg_modes_args);
|
||||
modes_args = irc_mode_get_arguments_colors (msg_modes_args);
|
||||
weechat_printf_datetime_tags (
|
||||
irc_msgbuffer_get_target_buffer (ctxt->server, NULL, ctxt->command, NULL,
|
||||
ptr_buffer),
|
||||
@@ -6811,7 +6811,7 @@ IRC_PROTOCOL_CALLBACK(367)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[2], /* banmask */
|
||||
IRC_COLOR_MSG(ctxt->params[2]), /* banmask */
|
||||
IRC_COLOR_RESET,
|
||||
(nick_address[0]) ? nick_address : "?",
|
||||
weechat_util_get_time_string (&datetime));
|
||||
@@ -6834,7 +6834,7 @@ IRC_PROTOCOL_CALLBACK(367)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[2], /* banmask */
|
||||
IRC_COLOR_MSG(ctxt->params[2]), /* banmask */
|
||||
IRC_COLOR_RESET,
|
||||
(nick_address[0]) ? nick_address : "?");
|
||||
}
|
||||
@@ -6857,7 +6857,7 @@ IRC_PROTOCOL_CALLBACK(367)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[2], /* banmask */
|
||||
IRC_COLOR_MSG(ctxt->params[2]), /* banmask */
|
||||
IRC_COLOR_RESET);
|
||||
}
|
||||
|
||||
@@ -7386,7 +7386,7 @@ IRC_PROTOCOL_CALLBACK(728)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[3], /* quietmask */
|
||||
IRC_COLOR_MSG(ctxt->params[3]), /* quietmask */
|
||||
IRC_COLOR_RESET,
|
||||
(nick_address[0]) ? nick_address : "?",
|
||||
weechat_util_get_time_string (&datetime));
|
||||
@@ -7409,7 +7409,7 @@ IRC_PROTOCOL_CALLBACK(728)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[3], /* quietmask */
|
||||
IRC_COLOR_MSG(ctxt->params[3]), /* quietmask */
|
||||
IRC_COLOR_RESET,
|
||||
(nick_address[0]) ? nick_address : "?");
|
||||
}
|
||||
@@ -7432,7 +7432,7 @@ IRC_PROTOCOL_CALLBACK(728)
|
||||
IRC_COLOR_CHAT_DELIMITERS,
|
||||
str_number,
|
||||
IRC_COLOR_CHAT_HOST,
|
||||
ctxt->params[3], /* quietmask */
|
||||
IRC_COLOR_MSG(ctxt->params[3]), /* quietmask */
|
||||
IRC_COLOR_RESET);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ add_library(lua MODULE
|
||||
set_target_properties(lua PROPERTIES PREFIX "")
|
||||
|
||||
if(LUA_FOUND)
|
||||
add_definitions(${LUA_CFLAGS})
|
||||
include_directories(${LUA_INCLUDE_DIRS})
|
||||
target_link_libraries(lua ${LUA_LDFLAGS} weechat_plugins_scripts coverage_config)
|
||||
endif()
|
||||
|
||||
@@ -25,8 +25,10 @@ add_library(python MODULE
|
||||
)
|
||||
set_target_properties(python PROPERTIES PREFIX "")
|
||||
|
||||
if(PYTHON_FOUND)
|
||||
target_link_libraries(python PkgConfig::PYTHON weechat_plugins_scripts coverage_config)
|
||||
if(Python_FOUND)
|
||||
include_directories(${Python_INCLUDE_DIRS})
|
||||
add_definitions(${Python_DEFINITIONS})
|
||||
target_link_libraries(python ${Python_LIBRARIES} weechat_plugins_scripts coverage_config)
|
||||
endif()
|
||||
|
||||
install(TARGETS python LIBRARY DESTINATION "${WEECHAT_LIBDIR}/plugins")
|
||||
|
||||
@@ -59,15 +59,11 @@
|
||||
|
||||
#define MSG_ADD_HDATA_TIME_USEC(__json_name, \
|
||||
__var_name, __var_name_usec) \
|
||||
time_value = weechat_hdata_time (hdata, pointer, __var_name); \
|
||||
local_time = localtime (&time_value); \
|
||||
time_value -= local_time->tm_gmtoff; \
|
||||
local_time = localtime (&time_value); \
|
||||
tv.tv_sec = mktime (local_time); \
|
||||
tv.tv_sec = weechat_hdata_time (hdata, pointer, __var_name); \
|
||||
tv.tv_usec = weechat_hdata_integer (hdata, pointer, \
|
||||
__var_name_usec); \
|
||||
weechat_util_strftimeval (str_time, sizeof (str_time), \
|
||||
"%FT%T.%fZ", &tv); \
|
||||
"%@%FT%T.%fZ", &tv); \
|
||||
MSG_ADD_STR_BUF(__json_name, str_time);
|
||||
|
||||
#define MSG_ADD_HDATA_STR(__json_name, __var_name) \
|
||||
@@ -489,9 +485,7 @@ relay_api_msg_line_data_to_json (struct t_gui_line_data *line_data,
|
||||
const char *ptr_string;
|
||||
char *string, str_time[256], str_var[64];
|
||||
int i, tags_count;
|
||||
time_t time_value;
|
||||
struct timeval tv;
|
||||
struct tm *local_time;
|
||||
|
||||
hdata = relay_hdata_line_data;
|
||||
pointer = line_data;
|
||||
@@ -794,9 +788,7 @@ relay_api_msg_hotlist_to_json (struct t_gui_hotlist *hotlist)
|
||||
struct t_gui_hotlist *pointer;
|
||||
struct t_gui_buffer *buffer;
|
||||
cJSON *json, *json_count;
|
||||
time_t time_value;
|
||||
struct timeval tv;
|
||||
struct tm *local_time;
|
||||
char str_time[256], str_key[32];
|
||||
int i, array_size;
|
||||
long long buffer_id;
|
||||
|
||||
@@ -374,7 +374,7 @@ RELAY_API_PROTOCOL_CALLBACK(options)
|
||||
relay_api_msg_send_json (
|
||||
client,
|
||||
RELAY_HTTP_204_NO_CONTENT,
|
||||
"Access-Control-Allow-Methods: GET, POST, PUT, DELETE\r\n"
|
||||
"Access-Control-Allow-Methods: " RELAY_API_ALLOWED_METHODS "\r\n"
|
||||
"Access-Control-Allow-Headers: origin, content-type, accept, authorization",
|
||||
NULL, /* body_type */
|
||||
NULL); /* json_body */
|
||||
@@ -401,9 +401,13 @@ RELAY_API_PROTOCOL_CALLBACK(handshake)
|
||||
json_body = cJSON_Parse (client->http_req->body);
|
||||
if (json_body)
|
||||
{
|
||||
if (!cJSON_IsObject (json_body))
|
||||
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
|
||||
json_algos = cJSON_GetObjectItem (json_body, "password_hash_algo");
|
||||
if (json_algos)
|
||||
{
|
||||
if (!cJSON_IsArray (json_algos))
|
||||
goto invalid_hash_algo;
|
||||
cJSON_ArrayForEach (json_algo, json_algos)
|
||||
{
|
||||
ptr_algo = (cJSON_IsString (json_algo)) ?
|
||||
@@ -411,7 +415,17 @@ RELAY_API_PROTOCOL_CALLBACK(handshake)
|
||||
if (ptr_algo)
|
||||
{
|
||||
index_hash_algo = relay_auth_password_hash_algo_search (ptr_algo);
|
||||
if ((index_hash_algo >= 0) && (index_hash_algo > hash_algo_found))
|
||||
if (index_hash_algo < 0)
|
||||
{
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Hash algorithm \"%s\" not found",
|
||||
ptr_algo);
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
if (index_hash_algo > hash_algo_found)
|
||||
{
|
||||
if (weechat_string_match_list (
|
||||
relay_auth_password_hash_algo_name[index_hash_algo],
|
||||
@@ -422,6 +436,8 @@ RELAY_API_PROTOCOL_CALLBACK(handshake)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
goto invalid_hash_algo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,6 +476,14 @@ RELAY_API_PROTOCOL_CALLBACK(handshake)
|
||||
cJSON_Delete (json_body);
|
||||
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
|
||||
invalid_hash_algo:
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Invalid hash algorithm");
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -712,57 +736,55 @@ RELAY_API_PROTOCOL_CALLBACK(input)
|
||||
char str_delay[32];
|
||||
|
||||
json_body = cJSON_Parse (client->http_req->body);
|
||||
if (!json_body)
|
||||
if (!json_body || !cJSON_IsObject (json_body))
|
||||
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
|
||||
|
||||
/* get buffer either by id or by name */
|
||||
/* get buffer either by name or by id */
|
||||
ptr_buffer = NULL;
|
||||
json_buffer_id = cJSON_GetObjectItem (json_body, "buffer_id");
|
||||
if (json_buffer_id)
|
||||
json_buffer_name = cJSON_GetObjectItem (json_body, "buffer_name");
|
||||
if (json_buffer_name)
|
||||
{
|
||||
if (cJSON_IsNumber (json_buffer_id))
|
||||
if (cJSON_IsString (json_buffer_name))
|
||||
{
|
||||
snprintf (str_id, sizeof (str_id),
|
||||
"%lld", (long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
ptr_buffer = weechat_buffer_search ("==id", str_id);
|
||||
ptr_buffer_name = cJSON_GetStringValue (json_buffer_name);
|
||||
ptr_buffer = weechat_buffer_search ("==", ptr_buffer_name);
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Buffer \"%lld\" not found",
|
||||
(long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
"Buffer \"%s\" not found",
|
||||
ptr_buffer_name);
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
json_buffer_name = cJSON_GetObjectItem (json_body, "buffer_name");
|
||||
if (json_buffer_name)
|
||||
json_buffer_id = cJSON_GetObjectItem (json_body, "buffer_id");
|
||||
if (json_buffer_id)
|
||||
{
|
||||
if (cJSON_IsString (json_buffer_name))
|
||||
if (cJSON_IsNumber (json_buffer_id))
|
||||
{
|
||||
ptr_buffer_name = cJSON_GetStringValue (json_buffer_name);
|
||||
ptr_buffer = weechat_buffer_search ("==", ptr_buffer_name);
|
||||
snprintf (str_id, sizeof (str_id),
|
||||
"%lld", (long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
ptr_buffer = weechat_buffer_search ("==id", str_id);
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Buffer \"%s\" not found",
|
||||
ptr_buffer_name);
|
||||
"Buffer \"%lld\" not found",
|
||||
(long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buffer = weechat_buffer_search_main ();
|
||||
}
|
||||
}
|
||||
if (!ptr_buffer)
|
||||
ptr_buffer = weechat_buffer_search_main ();
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
cJSON_Delete (json_body);
|
||||
@@ -841,57 +863,55 @@ RELAY_API_PROTOCOL_CALLBACK(completion)
|
||||
struct t_gui_buffer *ptr_buffer;
|
||||
|
||||
json_body = cJSON_Parse (client->http_req->body);
|
||||
if (!json_body)
|
||||
if (!json_body || !cJSON_IsObject(json_body))
|
||||
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
|
||||
|
||||
/* get buffer either by id or by name */
|
||||
/* get buffer either by name or by id */
|
||||
ptr_buffer = NULL;
|
||||
json_buffer_id = cJSON_GetObjectItem (json_body, "buffer_id");
|
||||
if (json_buffer_id)
|
||||
json_buffer_name = cJSON_GetObjectItem (json_body, "buffer_name");
|
||||
if (json_buffer_name)
|
||||
{
|
||||
if (cJSON_IsNumber (json_buffer_id))
|
||||
if (cJSON_IsString (json_buffer_name))
|
||||
{
|
||||
snprintf (str_id, sizeof(str_id),
|
||||
"%lld", (long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
ptr_buffer = weechat_buffer_search ("==id", str_id);
|
||||
ptr_buffer_name = cJSON_GetStringValue (json_buffer_name);
|
||||
ptr_buffer = weechat_buffer_search ("==", ptr_buffer_name);
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Buffer \"%lld\" not found",
|
||||
(long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
"Buffer \"%s\" not found",
|
||||
ptr_buffer_name);
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
json_buffer_name = cJSON_GetObjectItem (json_body, "buffer_name");
|
||||
if (json_buffer_name)
|
||||
json_buffer_id = cJSON_GetObjectItem (json_body, "buffer_id");
|
||||
if (json_buffer_id)
|
||||
{
|
||||
if (cJSON_IsString (json_buffer_name))
|
||||
if (cJSON_IsNumber (json_buffer_id))
|
||||
{
|
||||
ptr_buffer_name = cJSON_GetStringValue (json_buffer_name);
|
||||
ptr_buffer = weechat_buffer_search ("==", ptr_buffer_name);
|
||||
snprintf (str_id, sizeof(str_id),
|
||||
"%lld", (long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
ptr_buffer = weechat_buffer_search ("==id", str_id);
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
relay_api_msg_send_error_json (
|
||||
client,
|
||||
RELAY_HTTP_400_BAD_REQUEST, NULL,
|
||||
"Buffer \"%s\" not found",
|
||||
ptr_buffer_name);
|
||||
"Buffer \"%lld\" not found",
|
||||
(long long)cJSON_GetNumberValue (json_buffer_id));
|
||||
cJSON_Delete (json_body);
|
||||
return RELAY_API_PROTOCOL_RC_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buffer = weechat_buffer_search_main ();
|
||||
}
|
||||
}
|
||||
if (!ptr_buffer)
|
||||
ptr_buffer = weechat_buffer_search_main ();
|
||||
if (!ptr_buffer)
|
||||
{
|
||||
cJSON_Delete (json_body);
|
||||
@@ -1197,7 +1217,7 @@ relay_api_protocol_recv_json (struct t_relay_client *client, const char *json)
|
||||
void
|
||||
relay_api_protocol_recv_http (struct t_relay_client *client)
|
||||
{
|
||||
int i, num_args;
|
||||
int i, num_args, match_method, match_resource;
|
||||
char str_error[1024];
|
||||
enum t_relay_api_protocol_rc return_code;
|
||||
struct t_relay_api_protocol_cb protocol_cb[] = {
|
||||
@@ -1238,18 +1258,22 @@ relay_api_protocol_recv_http (struct t_relay_client *client)
|
||||
|| !client->http_req->path_items[1]
|
||||
|| (strcmp (client->http_req->path_items[0], "api") != 0))
|
||||
{
|
||||
goto error_not_found;
|
||||
goto resource_not_found;
|
||||
}
|
||||
|
||||
num_args = client->http_req->num_path_items - 2;
|
||||
|
||||
for (i = 0; protocol_cb[i].resource; i++)
|
||||
{
|
||||
if (strcmp (protocol_cb[i].method, client->http_req->method) != 0)
|
||||
continue;
|
||||
match_method = (strcmp (protocol_cb[i].method, client->http_req->method) == 0);
|
||||
|
||||
if ((strcmp (protocol_cb[i].resource, "*") != 0)
|
||||
&& (strcmp (protocol_cb[i].resource, client->http_req->path_items[1]) != 0))
|
||||
match_resource = ((strcmp (protocol_cb[i].resource, "*") == 0)
|
||||
|| (strcmp (protocol_cb[i].resource, client->http_req->path_items[1]) == 0));
|
||||
|
||||
if (!match_method && (strcmp (protocol_cb[i].resource, "*") != 0) && match_resource)
|
||||
goto error_method_not_allowed;
|
||||
|
||||
if (!match_method || !match_resource)
|
||||
continue;
|
||||
|
||||
if (protocol_cb[i].auth_required
|
||||
@@ -1331,7 +1355,19 @@ relay_api_protocol_recv_http (struct t_relay_client *client)
|
||||
}
|
||||
}
|
||||
|
||||
goto error_not_found;
|
||||
resource_not_found:
|
||||
if (!client->http_req->method
|
||||
|| ((strcmp (client->http_req->method, "GET") != 0)
|
||||
&& (strcmp (client->http_req->method, "POST") != 0)
|
||||
&& (strcmp (client->http_req->method, "PUT") != 0)
|
||||
&& (strcmp (client->http_req->method, "DELETE") != 0)))
|
||||
{
|
||||
goto error_method_not_allowed;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto error_not_found;
|
||||
}
|
||||
|
||||
error_bad_request:
|
||||
relay_api_msg_send_error_json (client, RELAY_HTTP_400_BAD_REQUEST,
|
||||
@@ -1343,6 +1379,12 @@ error_not_found:
|
||||
NULL, RELAY_HTTP_ERROR_NOT_FOUND);
|
||||
goto error;
|
||||
|
||||
error_method_not_allowed:
|
||||
relay_api_msg_send_error_json (client, RELAY_HTTP_405_METHOD_NOT_ALLOWED,
|
||||
"Allow: " RELAY_API_ALLOWED_METHODS,
|
||||
RELAY_HTTP_ERROR_METHOD_NOT_ALLOWED);
|
||||
goto error;
|
||||
|
||||
error_memory:
|
||||
relay_api_msg_send_error_json (client, RELAY_HTTP_503_SERVICE_UNAVAILABLE,
|
||||
NULL, RELAY_HTTP_ERROR_OUT_OF_MEMORY);
|
||||
@@ -1351,15 +1393,28 @@ error_memory:
|
||||
error:
|
||||
if (weechat_relay_plugin->debug >= 1)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: failed to execute route \"%s %s\" "
|
||||
"for client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
client->http_req->method,
|
||||
client->http_req->path,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
if (client->http_req->method && client->http_req->path)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: failed to execute route \"%s %s\" "
|
||||
"for client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
client->http_req->method,
|
||||
client->http_req->path,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
_("%s%s: invalid data received from client %s%s%s"),
|
||||
weechat_prefix ("error"),
|
||||
RELAY_PLUGIN_NAME,
|
||||
RELAY_COLOR_CHAT_CLIENT,
|
||||
client->desc,
|
||||
RELAY_COLOR_CHAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#ifndef WEECHAT_PLUGIN_RELAY_API_PROTOCOL_H
|
||||
#define WEECHAT_PLUGIN_RELAY_API_PROTOCOL_H
|
||||
|
||||
#define RELAY_API_ALLOWED_METHODS "GET, POST, PUT, DELETE"
|
||||
|
||||
#define RELAY_API_CB(__command) &relay_api_protocol_cb_##__command
|
||||
#define RELAY_API_PROTOCOL_CALLBACK(__command) \
|
||||
enum t_relay_api_protocol_rc \
|
||||
|
||||
@@ -27,7 +27,7 @@ enum t_relay_status;
|
||||
|
||||
#define RELAY_API_VERSION_MAJOR 0
|
||||
#define RELAY_API_VERSION_MINOR 4
|
||||
#define RELAY_API_VERSION_PATCH 0
|
||||
#define RELAY_API_VERSION_PATCH 1
|
||||
#define RELAY_API_VERSION_NUMBER \
|
||||
((RELAY_API_VERSION_MAJOR << 16) \
|
||||
+ (RELAY_API_VERSION_MINOR << 8) \
|
||||
|
||||
@@ -17,7 +17,7 @@ info:
|
||||
license:
|
||||
name: CC BY-NC-SA 4.0
|
||||
url: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
version: 0.4.0
|
||||
version: 0.4.1
|
||||
|
||||
externalDocs:
|
||||
url: https://weechat.org/doc/
|
||||
@@ -50,7 +50,29 @@ paths:
|
||||
This endpoint does not require authentication.
|
||||
operationId: handshake
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/HandshakeBody'
|
||||
description: Handshake request
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
password_hash_algo:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- plain
|
||||
- sha256
|
||||
- sha512
|
||||
- pbkdf2+sha256
|
||||
- pbkdf2+sha512
|
||||
example:
|
||||
- plain
|
||||
- sha256
|
||||
- sha512
|
||||
- pbkdf2+sha256
|
||||
- pbkdf2+sha512
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
@@ -58,6 +80,12 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Handshake'
|
||||
'400':
|
||||
description: Bad Request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'503':
|
||||
description: Out of memory
|
||||
content:
|
||||
@@ -174,7 +202,7 @@ paths:
|
||||
tags:
|
||||
- buffers
|
||||
description: |
|
||||
Get buffer by full name, with optional lines and nicks.
|
||||
Get a single buffer by full name, with optional lines and nicks.
|
||||
operationId: getBufferByName
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/totp'
|
||||
@@ -492,7 +520,31 @@ paths:
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/totp'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/InputBody'
|
||||
description: Buffer and command to execute
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
buffer_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Buffer identifier (≥ 0)
|
||||
buffer_name:
|
||||
type: string
|
||||
description: >-
|
||||
Buffer full name
|
||||
example: 'core.weechat'
|
||||
command:
|
||||
type: string
|
||||
description: text or command to send
|
||||
example: '/print test'
|
||||
required:
|
||||
- command
|
||||
example:
|
||||
buffer_name: 'core.weechat'
|
||||
command: '/print test'
|
||||
responses:
|
||||
'204':
|
||||
description: Successful operation
|
||||
@@ -516,11 +568,42 @@ paths:
|
||||
- completion
|
||||
description: |
|
||||
Complete user command or text.
|
||||
operationId: input
|
||||
operationId: completion
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/totp'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/CompletionBody'
|
||||
description: Buffer and user text/command to complete
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
buffer_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Buffer identifier (≥ 0)
|
||||
buffer_name:
|
||||
type: string
|
||||
description: >-
|
||||
Buffer full name
|
||||
example: 'core.weechat'
|
||||
command:
|
||||
type: string
|
||||
description: user command or text to complete
|
||||
example: '/hel'
|
||||
position:
|
||||
type: integer
|
||||
format: int32
|
||||
description: Position in data (≥ 0)
|
||||
example: 4
|
||||
required:
|
||||
- command
|
||||
- position
|
||||
example:
|
||||
buffer_name: 'core.weechat'
|
||||
command: '/hel'
|
||||
position: 4
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
@@ -552,7 +635,16 @@ paths:
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/totp'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/PingBody'
|
||||
description: Custom data that will be returned in the response
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: string
|
||||
example: '1714854355123456'
|
||||
responses:
|
||||
'200':
|
||||
description: Successful operation
|
||||
@@ -589,7 +681,37 @@ paths:
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/totp'
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/SyncBody'
|
||||
description: Synchronization parameters
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
sync:
|
||||
type: boolean
|
||||
description: Enable synchronization
|
||||
example: true
|
||||
nicks:
|
||||
type: boolean
|
||||
description: Receive nick updates in buffers
|
||||
example: true
|
||||
input:
|
||||
type: boolean
|
||||
description: Receive input changes in buffers (content and cursor position)
|
||||
example: true
|
||||
colors:
|
||||
type: string
|
||||
enum:
|
||||
- ansi
|
||||
- weechat
|
||||
- strip
|
||||
default: ansi
|
||||
description: |
|
||||
How to return strings with color codes:
|
||||
* `ansi`: return ANSI color codes
|
||||
* `weechat`: return WeeChat internal color codes
|
||||
* `strip`: strip colors
|
||||
responses:
|
||||
'204':
|
||||
description: Successful operation
|
||||
@@ -632,6 +754,7 @@ components:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Buffer identifier
|
||||
example: 1709932823238637
|
||||
bufferName:
|
||||
name: buffer_name
|
||||
in: path
|
||||
@@ -900,7 +1023,7 @@ components:
|
||||
type: string
|
||||
format: date-time
|
||||
description: date and time of line
|
||||
example: '"2023-12-05T19:46:03.847625Z'
|
||||
example: '2023-12-05T19:46:03.847625Z'
|
||||
date_printed:
|
||||
type: string
|
||||
format: date-time
|
||||
@@ -1161,11 +1284,11 @@ components:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- 'query'
|
||||
- 'quiet'
|
||||
- 'quit'
|
||||
- 'quote'
|
||||
example:
|
||||
- 'query'
|
||||
- 'quiet'
|
||||
- 'quit'
|
||||
- 'quote'
|
||||
required:
|
||||
- context
|
||||
- base_word
|
||||
@@ -1177,138 +1300,10 @@ components:
|
||||
properties:
|
||||
data:
|
||||
type: string
|
||||
example: 1714854355123456
|
||||
example: '1714854355123456'
|
||||
required:
|
||||
- data
|
||||
|
||||
requestBodies:
|
||||
HandshakeBody:
|
||||
description: Handshake request
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
password_hash_algo:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- plain
|
||||
- sha256
|
||||
- sha512
|
||||
- pbkdf2+sha256
|
||||
- pbkdf2+sha512
|
||||
example:
|
||||
- plain
|
||||
- sha256
|
||||
- sha512
|
||||
- pbkdf2+sha256
|
||||
- pbkdf2+sha512
|
||||
InputBody:
|
||||
description: Buffer and command to execute
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
buffer_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Buffer identifier (≥ 0)
|
||||
example: 1709932823238637
|
||||
buffer_name:
|
||||
type: string
|
||||
description: >-
|
||||
Buffer full name
|
||||
example: 'irc.libera.#weechat'
|
||||
command:
|
||||
type: string
|
||||
description: text or command to send
|
||||
example: 'hello, world!'
|
||||
required:
|
||||
- command
|
||||
example:
|
||||
buffer_id: 1709932823238637
|
||||
command: 'hello, world!'
|
||||
CompletionBody:
|
||||
description: Buffer and user text/command to complete
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
buffer_id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Buffer identifier (≥ 0)
|
||||
example: 1709932823238637
|
||||
buffer_name:
|
||||
type: string
|
||||
description: >-
|
||||
Buffer full name
|
||||
example: 'irc.libera.#weechat'
|
||||
command:
|
||||
type: string
|
||||
description: user command or text to complete
|
||||
example: '/qu'
|
||||
position:
|
||||
type: integer
|
||||
format: int32
|
||||
description: Position in data (≥ 0)
|
||||
example: 3
|
||||
required:
|
||||
- data
|
||||
example:
|
||||
buffer_id: 1709932823238637
|
||||
command: '/qu'
|
||||
PingBody:
|
||||
description: Custom data that will be returned in the response
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: string
|
||||
example: 1714854355123456
|
||||
SyncBody:
|
||||
description: Synchronization parameters
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
sync:
|
||||
type: boolean
|
||||
description: Enable synchronization
|
||||
example: true
|
||||
nicks:
|
||||
type: boolean
|
||||
description: Receive nick updates in buffers
|
||||
example: true
|
||||
input:
|
||||
type: boolean
|
||||
description: Receive input changes in buffers (content and cursor position)
|
||||
example: true
|
||||
colors:
|
||||
type: string
|
||||
enum:
|
||||
- ansi
|
||||
- weechat
|
||||
- strip
|
||||
default: ansi
|
||||
description: |
|
||||
How to return strings with color codes:
|
||||
* `ansi`: return ANSI color codes
|
||||
* `weechat`: return WeeChat internal color codes
|
||||
* `strip`: strip colors
|
||||
|
||||
securitySchemes:
|
||||
password:
|
||||
type: http
|
||||
|
||||
@@ -504,7 +504,8 @@ relay_client_recv_text_buffer (struct t_relay_client *client,
|
||||
if ((client->websocket == RELAY_CLIENT_WEBSOCKET_INITIALIZING)
|
||||
|| (client->recv_data_type == RELAY_CLIENT_DATA_HTTP))
|
||||
{
|
||||
relay_http_recv (client, buffer + index);
|
||||
relay_http_recv (client, buffer + index, length_buffer - index);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -582,7 +583,7 @@ relay_client_read_websocket_frames (struct t_relay_client *client,
|
||||
if ((client->websocket == RELAY_CLIENT_WEBSOCKET_INITIALIZING)
|
||||
|| (client->recv_data_type == RELAY_CLIENT_DATA_HTTP))
|
||||
{
|
||||
relay_http_recv (client, frames[i].payload);
|
||||
relay_http_recv (client, frames[i].payload, frames[i].payload_size);
|
||||
}
|
||||
else if ((client->recv_data_type == RELAY_CLIENT_DATA_TEXT_LINE)
|
||||
|| (client->recv_data_type == RELAY_CLIENT_DATA_TEXT_MULTILINE))
|
||||
@@ -694,7 +695,7 @@ relay_client_recv_buffer (struct t_relay_client *client,
|
||||
if ((client->websocket == RELAY_CLIENT_WEBSOCKET_INITIALIZING)
|
||||
|| (client->recv_data_type == RELAY_CLIENT_DATA_HTTP))
|
||||
{
|
||||
relay_http_recv (client, buffer);
|
||||
relay_http_recv (client, buffer, buffer_size);
|
||||
}
|
||||
else if ((client->recv_data_type == RELAY_CLIENT_DATA_TEXT_LINE)
|
||||
|| (client->recv_data_type == RELAY_CLIENT_DATA_TEXT_MULTILINE))
|
||||
|
||||
@@ -935,11 +935,13 @@ relay_http_process_request (struct t_relay_client *client)
|
||||
*/
|
||||
|
||||
void
|
||||
relay_http_recv (struct t_relay_client *client, const char *data)
|
||||
relay_http_recv (struct t_relay_client *client, const char *data, int size)
|
||||
{
|
||||
char *new_partial, *pos;
|
||||
char *new_partial, *pos, **null_char;
|
||||
int length, ws_deflate_allowed;
|
||||
|
||||
null_char = memchr (data, 0, size);
|
||||
|
||||
if (client->partial_message)
|
||||
{
|
||||
new_partial = realloc (client->partial_message,
|
||||
@@ -1003,8 +1005,11 @@ relay_http_recv (struct t_relay_client *client, const char *data)
|
||||
relay_http_add_to_body (client->http_req, &(client->partial_message));
|
||||
}
|
||||
|
||||
/* process the request if it's ready to be processed (all parsed) */
|
||||
if (client->http_req->status == RELAY_HTTP_END)
|
||||
/*
|
||||
* process the request if it's ready to be processed (all parsed)
|
||||
* or if we received a NULL char in the HTTP message (forbidden)
|
||||
* */
|
||||
if ((client->http_req->status == RELAY_HTTP_END) || null_char)
|
||||
{
|
||||
relay_http_process_request (client);
|
||||
relay_http_request_reinit (client->http_req);
|
||||
|
||||
@@ -40,6 +40,7 @@ enum t_relay_client_http_status
|
||||
#define RELAY_HTTP_401_UNAUTHORIZED 401, "Unauthorized"
|
||||
#define RELAY_HTTP_403_FORBIDDEN 403, "Forbidden"
|
||||
#define RELAY_HTTP_404_NOT_FOUND 404, "Not Found"
|
||||
#define RELAY_HTTP_405_METHOD_NOT_ALLOWED 405, "Method Not Allowed"
|
||||
#define RELAY_HTTP_500_INTERNAL_SERVER_ERROR 500, "Internal Server Error"
|
||||
#define RELAY_HTTP_503_SERVICE_UNAVAILABLE 503, "Service Unavailable"
|
||||
|
||||
@@ -53,6 +54,7 @@ enum t_relay_client_http_status
|
||||
#define RELAY_HTTP_ERROR_INVALID_ITERATIONS "Invalid number of iterations"
|
||||
#define RELAY_HTTP_ERROR_BAD_REQUEST "Bad request"
|
||||
#define RELAY_HTTP_ERROR_NOT_FOUND "Resource not found"
|
||||
#define RELAY_HTTP_ERROR_METHOD_NOT_ALLOWED "Method Not Allowed"
|
||||
#define RELAY_HTTP_ERROR_OUT_OF_MEMORY "Out of memory"
|
||||
|
||||
struct t_relay_http_request
|
||||
@@ -98,7 +100,8 @@ extern long relay_http_get_param_long (struct t_relay_http_request *request,
|
||||
extern int relay_http_parse_method_path (struct t_relay_http_request *request,
|
||||
const char *method_path);
|
||||
extern int relay_http_check_auth (struct t_relay_client *client);
|
||||
extern void relay_http_recv (struct t_relay_client *client, const char *data);
|
||||
extern void relay_http_recv (struct t_relay_client *client,
|
||||
const char *data, int size);
|
||||
extern int relay_http_send (struct t_relay_client *client,
|
||||
int return_code, const char *message,
|
||||
const char *headers,
|
||||
|
||||
@@ -25,6 +25,10 @@ if(NOT DEFINED ENV{LIB_FUZZING_ENGINE})
|
||||
set(ENV{LIB_FUZZING_ENGINE} "-fsanitize=address,fuzzer")
|
||||
endif()
|
||||
|
||||
if ("$ENV{LIB_FUZZING_ENGINE}" MATCHES "-fsanitize=.*fuzzer")
|
||||
set(ENV{LIB_FUZZING_ENGINE} "$ENV{LIB_FUZZING_ENGINE};-fsanitize=fuzzer-no-link")
|
||||
endif()
|
||||
|
||||
remove_definitions(-DHAVE_CONFIG_H)
|
||||
include_directories(
|
||||
${PROJECT_BINARY_DIR}
|
||||
@@ -98,6 +102,6 @@ set(FUZZ_CORE_TARGETS calc eval crypto secure string utf8 util)
|
||||
foreach(fuzz_target ${FUZZ_CORE_TARGETS})
|
||||
add_executable(weechat_core_${fuzz_target}_fuzzer core/${fuzz_target}-fuzzer.cc)
|
||||
target_link_libraries(weechat_core_${fuzz_target}_fuzzer ${FUZZ_TARGET_LINK} coverage_config)
|
||||
set_target_properties(weechat_core_${fuzz_target}_fuzzer PROPERTIES LINK_FLAGS "$ENV{LIB_FUZZING_ENGINE}")
|
||||
set_target_properties(weechat_core_${fuzz_target}_fuzzer PROPERTIES LINK_OPTIONS "$ENV{LIB_FUZZING_ENGINE}")
|
||||
add_dependencies(weechat_core_${fuzz_target}_fuzzer ${FUZZ_TARGET_DEPS})
|
||||
endforeach()
|
||||
|
||||
@@ -35,6 +35,10 @@ extern "C" int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
|
||||
{
|
||||
char *str;
|
||||
|
||||
/* ignore huge data */
|
||||
if (size > 65536)
|
||||
return 0;
|
||||
|
||||
str = (char *)malloc (size + 1);
|
||||
memcpy (str, data, size);
|
||||
str[size] = '\0';
|
||||
|
||||
@@ -61,6 +61,10 @@ LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
|
||||
char *str, hash[1024], *encrypted, *decrypted;
|
||||
int length_encrypted, length_decrypted;
|
||||
|
||||
/* ignore empty or huge data */
|
||||
if ((size == 0) || (size > 65536))
|
||||
return 0;
|
||||
|
||||
str = (char *)malloc (size + 1);
|
||||
memcpy (str, data, size);
|
||||
str[size] = '\0';
|
||||
@@ -68,23 +72,20 @@ LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
|
||||
if (size >= 8)
|
||||
secure_derive_key (str, str, (unsigned char *)hash, sizeof (hash));
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
encrypted = NULL;
|
||||
decrypted = NULL;
|
||||
config_file_option_set (secure_config_crypt_salt, "on", 1);
|
||||
secure_encrypt_data (str, size, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &encrypted, &length_encrypted);
|
||||
secure_decrypt_data (encrypted, length_encrypted, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &decrypted, &length_decrypted);
|
||||
assert ((size_t)length_decrypted == size);
|
||||
assert (memcmp (decrypted, str, length_decrypted) == 0);
|
||||
free (encrypted);
|
||||
free (decrypted);
|
||||
config_file_option_set (secure_config_crypt_salt, "off", 1);
|
||||
encrypted = NULL;
|
||||
secure_encrypt_data (str, size, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &encrypted, &length_encrypted);
|
||||
free (encrypted);
|
||||
config_file_option_reset (secure_config_crypt_salt, 1);
|
||||
}
|
||||
encrypted = NULL;
|
||||
decrypted = NULL;
|
||||
config_file_option_set (secure_config_crypt_salt, "on", 1);
|
||||
secure_encrypt_data (str, size, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &encrypted, &length_encrypted);
|
||||
secure_decrypt_data (encrypted, length_encrypted, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &decrypted, &length_decrypted);
|
||||
assert ((size_t)length_decrypted == size);
|
||||
assert (memcmp (decrypted, str, length_decrypted) == 0);
|
||||
free (encrypted);
|
||||
free (decrypted);
|
||||
config_file_option_set (secure_config_crypt_salt, "off", 1);
|
||||
encrypted = NULL;
|
||||
secure_encrypt_data (str, size, GCRY_MD_SHA512, GCRY_CIPHER_AES256, "test", &encrypted, &length_encrypted);
|
||||
free (encrypted);
|
||||
config_file_option_reset (secure_config_crypt_salt, 1);
|
||||
|
||||
free (str);
|
||||
|
||||
|
||||
@@ -344,6 +344,7 @@ TEST(CoreCalc, Expression)
|
||||
WEE_CHECK_CALC("0.0000000008", "1/1234567890");
|
||||
WEE_CHECK_CALC("0.0000000001", "1/12345678901");
|
||||
WEE_CHECK_CALC("0", "1/123456789012");
|
||||
WEE_CHECK_CALC("1.2222222222", "1+0.22222222222222222222222222222222222");
|
||||
|
||||
/* expressions with parentheses */
|
||||
WEE_CHECK_CALC("6", "((6))");
|
||||
|
||||
@@ -187,6 +187,11 @@ TEST(CoreUtil, Strftimeval)
|
||||
"%H:%M:%S", &tv));
|
||||
STRCMP_EQUAL("10:29:09", str_time);
|
||||
|
||||
strcpy (str_time, "test");
|
||||
LONGS_EQUAL(8, util_strftimeval (str_time, sizeof (str_time),
|
||||
"%@%H:%M:%S", &tv));
|
||||
STRCMP_EQUAL("10:29:09", str_time);
|
||||
|
||||
strcpy (str_time, "test");
|
||||
LONGS_EQUAL(19, util_strftimeval (str_time, sizeof (str_time),
|
||||
"%Y-%m-%d %H:%M:%S", &tv));
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "src/gui/gui-color.h"
|
||||
#include "src/plugins/irc/irc-color.h"
|
||||
#include "src/plugins/irc/irc-mode.h"
|
||||
}
|
||||
|
||||
#define WEE_CHECK_GET_ARGS(__result, __arguments) \
|
||||
str = irc_mode_get_arguments (__arguments); \
|
||||
str = irc_mode_get_arguments_colors (__arguments); \
|
||||
STRCMP_EQUAL(__result, str); \
|
||||
free (str);
|
||||
|
||||
@@ -44,23 +46,93 @@ TEST_GROUP(IrcMode)
|
||||
|
||||
TEST(IrcMode, GetArguments)
|
||||
{
|
||||
char *str;
|
||||
char *str, string[1024], expected[1024];
|
||||
|
||||
/* invalid arguments */
|
||||
WEE_CHECK_GET_ARGS("", irc_mode_get_arguments (NULL));
|
||||
WEE_CHECK_GET_ARGS("", irc_mode_get_arguments (""));
|
||||
WEE_CHECK_GET_ARGS("", irc_mode_get_arguments (" "));
|
||||
WEE_CHECK_GET_ARGS("", NULL);
|
||||
WEE_CHECK_GET_ARGS("", "");
|
||||
WEE_CHECK_GET_ARGS("", " ");
|
||||
|
||||
/* simple arguments */
|
||||
WEE_CHECK_GET_ARGS("abc", irc_mode_get_arguments ("abc"));
|
||||
WEE_CHECK_GET_ARGS("abc def", irc_mode_get_arguments ("abc def"));
|
||||
WEE_CHECK_GET_ARGS("abc def ghi", irc_mode_get_arguments ("abc def ghi"));
|
||||
snprintf (string, sizeof (string), "abc%c02_blue", IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
"abc%c02_blue def%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s def%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
"abc%c02_blue def%c02_blue ghi%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s def%s_blue%s ghi%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
|
||||
/* some arguments starting with a colon */
|
||||
WEE_CHECK_GET_ARGS("abc", irc_mode_get_arguments (":abc"));
|
||||
WEE_CHECK_GET_ARGS("abc def", irc_mode_get_arguments (":abc def"));
|
||||
WEE_CHECK_GET_ARGS("abc def", irc_mode_get_arguments ("abc :def"));
|
||||
WEE_CHECK_GET_ARGS("abc def ghi", irc_mode_get_arguments ("abc :def ghi"));
|
||||
WEE_CHECK_GET_ARGS("abc def ghi", irc_mode_get_arguments ("abc :def :ghi"));
|
||||
WEE_CHECK_GET_ARGS("abc def ghi", irc_mode_get_arguments (":abc :def :ghi"));
|
||||
snprintf (string, sizeof (string), ":abc%c02_blue", IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
":abc%c02_blue def%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s def%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
"abc%c02_blue :def%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
"abc%c02_blue :def%c02_blue ghi%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
snprintf (expected, sizeof (expected),
|
||||
"abc%s_blue%s def%s_blue%s ghi%s_blue%s",
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"),
|
||||
gui_color_get_custom ("|blue"),
|
||||
gui_color_get_custom ("reset"));
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
"abc%c02_blue :def%c02_blue :ghi%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
snprintf (string, sizeof (string),
|
||||
":abc%c02_blue :def%c02_blue :ghi%c02_blue",
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR,
|
||||
IRC_COLOR_COLOR_CHAR);
|
||||
WEE_CHECK_GET_ARGS(expected, string);
|
||||
}
|
||||
|
||||
@@ -2316,6 +2316,22 @@ TEST(IrcProtocolWithServer, mode)
|
||||
"irc_mode,nick_admin,host_user@host,log3");
|
||||
STRCMP_EQUAL(NULL, ptr_channel->modes);
|
||||
|
||||
/* bans added on channel */
|
||||
RECV(":admin!user@host MODE #test +bb "
|
||||
"bob!user_\00304red@host_\00304red "
|
||||
"carol!user_\00304red@host_\00304red");
|
||||
CHECK_CHAN("--", "Mode #test [+bb bob!user_red@host_red "
|
||||
"carol!user_red@host_red] by admin",
|
||||
"irc_mode,nick_admin,host_user@host,log3");
|
||||
|
||||
/* bans removed from channel */
|
||||
RECV(":admin!user@host MODE #test -bb "
|
||||
"bob!user_\00304red@host_\00304red "
|
||||
"carol!user_\00304red@host_\00304red");
|
||||
CHECK_CHAN("--", "Mode #test [-bb bob!user_red@host_red "
|
||||
"carol!user_red@host_red] by admin",
|
||||
"irc_mode,nick_admin,host_user@host,log3");
|
||||
|
||||
/* nick mode '@' on channel #test */
|
||||
RECV(":admin!user@host MODE #test +o alice ");
|
||||
CHECK_CHAN("--", "Mode #test [+o alice] by admin",
|
||||
@@ -5600,30 +5616,32 @@ TEST(IrcProtocolWithServer, 367)
|
||||
RECV(":server 367 alice #test");
|
||||
CHECK_ERROR_PARAMS("367", 2, 3);
|
||||
|
||||
RECV(":server 367 alice #test nick1!user1@host1");
|
||||
CHECK_CHAN("--", "[#test] [1] nick1!user1@host1 banned",
|
||||
RECV(":server 367 alice #test nick1!user1@host1_\00304red");
|
||||
CHECK_CHAN("--", "[#test] [1] nick1!user1@host1_red banned",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
RECV(":server 367 alice #test nick1!user1@host1 nick2!user2@host2 ");
|
||||
RECV(":server 367 alice #test nick1!user1_\00304red@host1_\00304red "
|
||||
"nick2!user2_\00304red@host2_\00304red ");
|
||||
CHECK_CHAN("--",
|
||||
"[#test] [2] nick1!user1@host1 banned by nick2 (user2@host2)",
|
||||
"[#test] [2] nick1!user1_red@host1_red banned by nick2 (user2_red@host2_red)",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
RECV(":server 367 alice #test nick1!user1@host1 nick2!user2@host2 "
|
||||
"1205585109 ");
|
||||
RECV(":server 367 alice #test nick1!user1_\00304red@host1_\00304red "
|
||||
"nick2!user2_\00304red@host2_\00304red 1205585109 ");
|
||||
CHECK_CHAN("--",
|
||||
"[#test] [3] nick1!user1@host1 banned "
|
||||
"by nick2 (user2@host2) on Sat, 15 Mar 2008 12:45:09",
|
||||
"[#test] [3] nick1!user1_red@host1_red banned "
|
||||
"by nick2 (user2_red@host2_red) on Sat, 15 Mar 2008 12:45:09",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
|
||||
/* channel not found */
|
||||
RECV(":server 367 alice #xyz nick1!user1@host1");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 banned",
|
||||
RECV(":server 367 alice #xyz nick1!user1_\00304red@host1_\00304red");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red banned",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
RECV(":server 367 alice #xyz nick1!user1@host1 nick2!user2@host2");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 banned by nick2 (user2@host2)",
|
||||
RECV(":server 367 alice #xyz nick1!user1_\00304red@host1_\00304red "
|
||||
"nick2!user2_\00304red@host2_\00304red");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red banned by nick2 (user2_red@host2_red)",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
RECV(":server 367 alice #xyz nick1!user1@host1 nick2!user2@host2 "
|
||||
"1205585109");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 banned by nick2 (user2@host2) "
|
||||
RECV(":server 367 alice #xyz nick1!user1_\00304red@host1_\00304red "
|
||||
"nick2!user2_\00304red@host2_\00304red 1205585109");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red banned by nick2 (user2_red@host2_red) "
|
||||
"on Sat, 15 Mar 2008 12:45:09",
|
||||
"irc_367,irc_numeric,nick_server,log3");
|
||||
}
|
||||
@@ -7208,29 +7226,30 @@ TEST(IrcProtocolWithServer, 728)
|
||||
RECV(":server 728 alice #test q");
|
||||
CHECK_ERROR_PARAMS("728", 3, 4);
|
||||
|
||||
RECV(":server 728 alice #test q nick1!user1@host1");
|
||||
CHECK_CHAN("--", "[#test] nick1!user1@host1 quieted",
|
||||
RECV(":server 728 alice #test q nick1!user1_\00304red@host1_\00304red");
|
||||
CHECK_CHAN("--", "[#test] nick1!user1_red@host1_red quieted",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
RECV(":server 728 alice #test q nick1!user1@host1 alice!user@host");
|
||||
CHECK_CHAN("--", "[#test] nick1!user1@host1 quieted by alice (user@host)",
|
||||
RECV(":server 728 alice #test q nick1!user1_\00304red@host1_\00304red "
|
||||
"alice!user_\00304red@host_\00304red");
|
||||
CHECK_CHAN("--", "[#test] nick1!user1_red@host1_red quieted by alice (user_red@host_red)",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
RECV(":server 728 alice #test q nick1!user1@host1 alice!user@host "
|
||||
"1351350090 ");
|
||||
RECV(":server 728 alice #test q nick1!user1_\00304red@host1_\00304red "
|
||||
"alice!user_\00304red@host_\00304red 1351350090 ");
|
||||
CHECK_CHAN("--",
|
||||
"[#test] nick1!user1@host1 quieted by alice (user@host) "
|
||||
"[#test] nick1!user1_red@host1_red quieted by alice (user_red@host_red) "
|
||||
"on Sat, 27 Oct 2012 15:01:30",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
|
||||
/* channel not found */
|
||||
RECV(":server 728 alice #xyz q nick1!user1@host1");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 quieted",
|
||||
RECV(":server 728 alice #xyz q nick1!user1_\00304red@host1_\00304red");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red quieted",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
RECV(":server 728 alice #xyz q nick1!user1@host1 alice!user@host");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 quieted by alice (user@host)",
|
||||
RECV(":server 728 alice #xyz q nick1!user1_\00304red@host1_\00304red alice!user_\00304red@host_\00304red");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red quieted by alice (user_red@host_red)",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
RECV(":server 728 alice #xyz q nick1!user1@host1 alice!user@host "
|
||||
RECV(":server 728 alice #xyz q nick1!user1_\00304red@host1_\00304red alice!user_\00304red@host_\00304red "
|
||||
"1351350090 ");
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1@host1 quieted by alice (user@host) "
|
||||
CHECK_SRV("--", "[#xyz] nick1!user1_red@host1_red quieted by alice (user_red@host_red) "
|
||||
"on Sat, 27 Oct 2012 15:01:30",
|
||||
"irc_728,irc_numeric,nick_server,log3");
|
||||
}
|
||||
|
||||
@@ -419,12 +419,12 @@ TEST(RelayApiMsg, LinesToJson)
|
||||
gmtime_r (&(gui_buffers->own_lines->last_line->prev_line->data->date), &gm_time);
|
||||
tv.tv_sec = mktime (&gm_time);
|
||||
tv.tv_usec = gui_buffers->own_lines->last_line->prev_line->data->date_usec;
|
||||
util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv);
|
||||
util_strftimeval (str_date, sizeof (str_date), "%@%FT%T.%fZ", &tv);
|
||||
WEE_CHECK_OBJ_STR(str_date, json_line, "date");
|
||||
gmtime_r (&(gui_buffers->own_lines->last_line->prev_line->data->date_printed), &gm_time);
|
||||
tv.tv_sec = mktime (&gm_time);
|
||||
tv.tv_usec = gui_buffers->own_lines->last_line->prev_line->data->date_usec_printed;
|
||||
util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv);
|
||||
util_strftimeval (str_date, sizeof (str_date), "%@%FT%T.%fZ", &tv);
|
||||
WEE_CHECK_OBJ_STR(str_date, json_line, "date_printed");
|
||||
WEE_CHECK_OBJ_BOOL(0, json_line, "highlight");
|
||||
WEE_CHECK_OBJ_STR("nick1", json_line, "prefix");
|
||||
@@ -455,12 +455,12 @@ TEST(RelayApiMsg, LinesToJson)
|
||||
gmtime_r (&(gui_buffers->own_lines->last_line->data->date), &gm_time);
|
||||
tv.tv_sec = mktime (&gm_time);
|
||||
tv.tv_usec = gui_buffers->own_lines->last_line->data->date_usec;
|
||||
util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv);
|
||||
util_strftimeval (str_date, sizeof (str_date), "%@%FT%T.%fZ", &tv);
|
||||
WEE_CHECK_OBJ_STR(str_date, json_line, "date");
|
||||
gmtime_r (&(gui_buffers->own_lines->last_line->data->date_printed), &gm_time);
|
||||
tv.tv_sec = mktime (&gm_time);
|
||||
tv.tv_usec = gui_buffers->own_lines->last_line->data->date_usec_printed;
|
||||
util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv);
|
||||
util_strftimeval (str_date, sizeof (str_date), "%@%FT%T.%fZ", &tv);
|
||||
WEE_CHECK_OBJ_STR(str_date, json_line, "date_printed");
|
||||
WEE_CHECK_OBJ_BOOL(0, json_line, "highlight");
|
||||
WEE_CHECK_OBJ_STR("", json_line, "prefix");
|
||||
@@ -626,7 +626,7 @@ TEST(RelayApiMsg, HotlistToJson)
|
||||
gmtime_r (&time_value, &gm_time);
|
||||
tv.tv_sec = mktime (&gm_time);
|
||||
tv.tv_usec = hdata_integer (relay_hdata_hotlist, gui_hotlist, "time_usec");
|
||||
util_strftimeval (str_date, sizeof (str_date), "%FT%T.%fZ", &tv);
|
||||
util_strftimeval (str_date, sizeof (str_date), "%@%FT%T.%fZ", &tv);
|
||||
WEE_CHECK_OBJ_STR(str_date, json, "date");
|
||||
WEE_CHECK_OBJ_NUM(gui_buffers->id, json, "buffer_id");
|
||||
json_count = cJSON_GetObjectItem (json, "count");
|
||||
|
||||
@@ -321,14 +321,23 @@ TEST(RelayApiProtocolWithClient, CbHandshake)
|
||||
/* unknown password hash algorithm */
|
||||
test_client_recv_http ("POST /api/handshake", NULL,
|
||||
"{\"password_hash_algo\": [\"invalid\"]}");
|
||||
STRCMP_EQUAL("HTTP/1.1 200 OK\r\n"
|
||||
STRCMP_EQUAL("HTTP/1.1 400 Bad Request\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
"Content-Length: 74\r\n"
|
||||
"Content-Length: 48\r\n"
|
||||
"\r\n"
|
||||
"{\"password_hash_algo\":null,"
|
||||
"\"password_hash_iterations\":100000,"
|
||||
"\"totp\":false}",
|
||||
"{\"error\":\"Hash algorithm \\\"invalid\\\" not found\"}",
|
||||
data_sent[0]);
|
||||
|
||||
/* invalid password hash algorithm */
|
||||
test_client_recv_http ("POST /api/handshake", NULL,
|
||||
"{\"password_hash_algo\": [{}]}");
|
||||
STRCMP_EQUAL("HTTP/1.1 400 Bad Request\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
"Content-Length: 34\r\n"
|
||||
"\r\n"
|
||||
"{\"error\":\"Invalid hash algorithm\"}",
|
||||
data_sent[0]);
|
||||
|
||||
/* two supported hash algorithms */
|
||||
@@ -964,7 +973,7 @@ TEST(RelayApiProtocolWithClient, RecvJson)
|
||||
TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
{
|
||||
/* resource not found: error 404 */
|
||||
test_client_recv_http ("GET / HTTP/1.1", NULL, NULL);
|
||||
test_client_recv_http ("GET /", NULL, NULL);
|
||||
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
@@ -974,7 +983,7 @@ TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
data_sent[0]);
|
||||
|
||||
/* resource not found: error 404 */
|
||||
test_client_recv_http ("GET /unknown HTTP/1.1", NULL, NULL);
|
||||
test_client_recv_http ("GET /unknown", NULL, NULL);
|
||||
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
@@ -984,7 +993,7 @@ TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
data_sent[0]);
|
||||
|
||||
/* resource not found: error 404 */
|
||||
test_client_recv_http ("GET /unknown/abc HTTP/1.1", NULL, NULL);
|
||||
test_client_recv_http ("GET /unknown/abc", NULL, NULL);
|
||||
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
@@ -994,7 +1003,7 @@ TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
data_sent[0]);
|
||||
|
||||
/* resource not found: error 404 */
|
||||
test_client_recv_http ("GET /api HTTP/1.1", NULL, NULL);
|
||||
test_client_recv_http ("GET /api", NULL, NULL);
|
||||
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
@@ -1004,7 +1013,7 @@ TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
data_sent[0]);
|
||||
|
||||
/* resource not found: error 404 */
|
||||
test_client_recv_http ("GET /api/unknown HTTP/1.1", NULL, NULL);
|
||||
test_client_recv_http ("GET /api/unknown", NULL, NULL);
|
||||
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
@@ -1022,7 +1031,7 @@ TEST(RelayApiProtocolWithClient, RecvHttp404)
|
||||
TEST(RelayApiProtocolWithClient, RecvHttpMissingPassword)
|
||||
{
|
||||
/* unauthorized: missing password */
|
||||
test_client_recv_http_raw ("GET /api/version HTTP/1.1\r\n"
|
||||
test_client_recv_http_raw ("GET /api/version\r\n"
|
||||
"\r\n");
|
||||
STRCMP_EQUAL("HTTP/1.1 401 Unauthorized\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
@@ -1041,7 +1050,7 @@ TEST(RelayApiProtocolWithClient, RecvHttpMissingPassword)
|
||||
TEST(RelayApiProtocolWithClient, RecvHttpInvalidPassword)
|
||||
{
|
||||
/* unauthorized: invalid password: "plain:invalid" */
|
||||
test_client_recv_http_raw ("GET /api/version HTTP/1.1\r\n"
|
||||
test_client_recv_http_raw ("GET /api/version\r\n"
|
||||
"Authorization: Basic cGxhaW46aW52YWxpZA==\r\n"
|
||||
"\r\n");
|
||||
STRCMP_EQUAL("HTTP/1.1 401 Unauthorized\r\n"
|
||||
@@ -1052,3 +1061,44 @@ TEST(RelayApiProtocolWithClient, RecvHttpInvalidPassword)
|
||||
"{\"error\":\"Invalid password\"}",
|
||||
data_sent[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* relay_api_protocol_recv_http (method not allowed)
|
||||
*/
|
||||
|
||||
TEST(RelayApiProtocolWithClient, RecvHttpMethodNotAllowed)
|
||||
{
|
||||
/* method not allowed (PATCH) with existing resource (/api/ping) */
|
||||
test_client_recv_http ("PATCH /api/ping", NULL, "{\"data\": \"abcdef\"}");
|
||||
STRCMP_EQUAL("HTTP/1.1 405 Method Not Allowed\r\n"
|
||||
"Allow: GET, POST, PUT, DELETE\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
"Content-Length: 30\r\n"
|
||||
"\r\n"
|
||||
"{\"error\":\"Method Not Allowed\"}",
|
||||
data_sent[0]);
|
||||
|
||||
/* method not allowed (PATCH) with unknown resource (/api/unknown) */
|
||||
test_client_recv_http ("PATCH /api/unknown", NULL, "{\"data\": \"abcdef\"}");
|
||||
STRCMP_EQUAL("HTTP/1.1 405 Method Not Allowed\r\n"
|
||||
"Allow: GET, POST, PUT, DELETE\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
"Content-Length: 30\r\n"
|
||||
"\r\n"
|
||||
"{\"error\":\"Method Not Allowed\"}",
|
||||
data_sent[0]);
|
||||
|
||||
/* method not allowed (PATCH) with unknown resource (/unknown) */
|
||||
test_client_recv_http ("PATCH /unknown", NULL, "{\"data\": \"abcdef\"}");
|
||||
STRCMP_EQUAL("HTTP/1.1 405 Method Not Allowed\r\n"
|
||||
"Allow: GET, POST, PUT, DELETE\r\n"
|
||||
"Access-Control-Allow-Origin: *\r\n"
|
||||
"Content-Type: application/json; charset=utf-8\r\n"
|
||||
"Content-Length: 30\r\n"
|
||||
"\r\n"
|
||||
"{\"error\":\"Method Not Allowed\"}",
|
||||
data_sent[0]);
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024-2025 Sébastien Helleu <flashcode@flashtux.org>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
#
|
||||
# Test WeeChat relay HTTP REST API.
|
||||
#
|
||||
# Environment variables that can be used:
|
||||
#
|
||||
# RELAY_PASSWORD Password for WeeChat relay
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
|
||||
# default values for options from environment variables
|
||||
default_relay_password="test"
|
||||
|
||||
usage ()
|
||||
{
|
||||
rc=$1
|
||||
cat <<-EOF
|
||||
|
||||
Syntax: $0 url
|
||||
|
||||
url URL of the running WeeChat with relay api (without "/api")
|
||||
|
||||
Environment variables used:
|
||||
|
||||
RELAY_PASSWORD password for the relay (default: "${default_relay_password}")
|
||||
|
||||
Example:
|
||||
|
||||
RELAY_PASSWORD="test" $0 http://localhost:9000
|
||||
|
||||
EOF
|
||||
exit "${rc}"
|
||||
}
|
||||
|
||||
error_usage ()
|
||||
{
|
||||
echo >&2 "ERROR: $*"
|
||||
usage 1
|
||||
}
|
||||
|
||||
# ================================== START ==================================
|
||||
|
||||
# relay password
|
||||
[ -z "${RELAY_PASSWORD}" ] && RELAY_PASSWORD="${default_relay_password}"
|
||||
|
||||
# check command line arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
usage 0
|
||||
fi
|
||||
if [ $# -lt 1 ]; then
|
||||
error_usage "missing arguments"
|
||||
fi
|
||||
|
||||
# command line arguments
|
||||
url="$1"
|
||||
|
||||
schemathesis run \
|
||||
--checks all \
|
||||
--show-trace \
|
||||
--validate-schema=true \
|
||||
--experimental=openapi-3.1 \
|
||||
--base-url "${url}/api" \
|
||||
--auth "plain:${RELAY_PASSWORD}" \
|
||||
./src/plugins/relay/api/weechat-relay-api.yaml \
|
||||
;
|
||||
|
||||
exit 0
|
||||
+2
-2
@@ -41,8 +41,8 @@
|
||||
# devel-number the devel version as hex number ("0x04010000" for "4.1.0-dev")
|
||||
#
|
||||
|
||||
weechat_stable="4.6.3"
|
||||
weechat_devel="4.7.0-dev"
|
||||
weechat_stable="4.7.2"
|
||||
weechat_devel="4.7.3-dev"
|
||||
|
||||
stable_major=$(echo "${weechat_stable}" | cut -d"." -f1)
|
||||
stable_minor=$(echo "${weechat_stable}" | cut -d"." -f2)
|
||||
|
||||
Reference in New Issue
Block a user