1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-19 01:24:46 +02:00

Compare commits

...

23 Commits

Author SHA1 Message Date
Sébastien Helleu 3200a05c00 relay/api: fix memory leak in resources "handshake", "input" and "completion" 2026-06-17 21:54:15 +02:00
Sébastien Helleu 861f589fc2 core: update ChangeLog (#2326) 2026-06-17 21:31:03 +02:00
aizu-m c40261aed1 xfer: fix out-of-bounds write in xfer_dcc_resume_hash (#2326) 2026-06-17 21:29:45 +02:00
Sébastien Helleu 770e733303 ci: switch from Ubuntu 24.04 to 26.04 2026-06-15 21:55:54 +02:00
Sébastien Helleu 9bd2aaa25d core: mute compiler warning on calls to dup() function 2026-06-15 08:22:03 +02:00
Sébastien Helleu 4e206ee3ae trigger: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:55:20 +02:00
Sébastien Helleu 7ff71d2b0e spell: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:55:10 +02:00
Sébastien Helleu 203fdca3e8 script: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:54:40 +02:00
Sébastien Helleu e3ba25df19 relay: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:54:10 +02:00
Sébastien Helleu 64566629c5 irc: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:52:12 +02:00
Sébastien Helleu 7e3afaf46d core, api: use "const char *" variables for result of string functions with const parameter 2026-06-15 07:52:10 +02:00
Sébastien Helleu cf702d541f api: change type of parameter "pos_option_name" to "const char **" in function config_search_with_string 2026-06-15 07:29:33 +02:00
Sébastien Helleu a8067751eb doc/plugin: fix parameters of mkdir functions
The directory parameter is always `const char *` and not `char *`.
2026-06-15 07:29:28 +02:00
Sébastien Helleu a696a100d8 core: update ChangeLog (#2325) 2026-06-12 13:02:05 +02:00
aizu-m e60786d059 core: fix buffer overflow in function network_pass_socks5proxy (#2325)
bound the configured proxy username and password before they are copied into the fixed stack buffer in network_pass_socks5proxy, otherwise a login longer than the buffer (a long password or token) overruns it while building the SOCKS5 auth request.
2026-06-12 13:00:17 +02:00
Sébastien Helleu d78105ddf5 core: add CVE IDs in ChangeLog 2026-06-09 22:10:17 +02:00
weechatter 2a8c86242b core: update German translations 2026-06-09 10:42:23 +02:00
Sébastien Helleu dd9ef2f4d9 tests: add missing include of string.h 2026-06-08 23:17:19 +02:00
Sébastien Helleu 4c6c55befe core: update translations 2026-06-08 23:15:00 +02:00
Sébastien Helleu de878b2303 relay/api: remove error 400 which is never returned in response to GET /api/scripts 2026-06-08 23:11:27 +02:00
Sébastien Helleu 80a47b6731 relay/api: add missing fields in script object in OpenAPI document 2026-06-08 23:11:06 +02:00
Sébastien Helleu 551c12e049 relay/api: add resource GET /api/scripts 2026-06-08 23:04:40 +02:00
Sébastien Helleu 12016c4c05 script: add info "script_languages" 2026-06-08 18:54:06 +02:00
82 changed files with 975 additions and 386 deletions
+10 -11
View File
@@ -118,7 +118,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -153,7 +153,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -194,6 +194,8 @@ jobs:
name: "install (${{ matrix.os }}, ${{ matrix.config.name }})"
runs-on: ${{ matrix.os }}
env:
PHP_INI_SCAN_DIR: /tmp/php-noscan # embed PHP loads no add-on extensions (see #2009)
steps:
@@ -203,8 +205,7 @@ jobs:
run: |
sudo apt-get update -qq
sudo apt-get --yes --no-install-recommends install ${{ env.WEECHAT_DEPS_UBUNTU }}
# uninstall php imagick as is causes a crash when loading php plugin (see #2009)
sudo apt-get --yes purge php8.3-imagick
mkdir -p /tmp/php-noscan
pipx install schemathesis
- name: Build and run tests
@@ -258,7 +259,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -304,7 +305,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -355,7 +356,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
# - name: "gcc"
# cc: "gcc"
@@ -450,7 +451,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -487,7 +488,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -505,8 +506,6 @@ jobs:
run: |
sudo apt-get update -qq
sudo apt-get --yes --no-install-recommends install ${{ env.WEECHAT_DEPS_UBUNTU }}
# uninstall php imagick as is causes a crash when loading php plugin (see #2009)
sudo apt-get --yes purge php8.3-imagick
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
+12 -6
View File
@@ -12,28 +12,34 @@ SPDX-License-Identifier: GPL-3.0-or-later
- core: add condition on connected relay api clients in default value of option weechat.look.hotlist_add_conditions
- core: add `/mute` in default command for key `Alt`+`=` (toggle filters)
- api: change type of parameter "pos_option_name" to "const char **" in function config_search_with_string
- relay/api: add field "last_read_line_id" in GET /api/buffers
### Added
- relay/api: add resource `GET /api/scripts`
- relay: add option relay.network.unix_socket_permissions ([#2317](https://github.com/weechat/weechat/issues/2317))
- script: add info "script_languages"
### Fixed
- core: fix option weechat.look.color_real_white not applied when color is "white" on 16+ colors terminals ([#1742](https://github.com/weechat/weechat/issues/1742))
- core: fix buffer overflow in connection to SOCKS5 proxy ([#2325](https://github.com/weechat/weechat/issues/2325))
- api: fix infinite loop in function string_replace when the search string is empty
- irc: fix tag in message with list of names when joining a channel
- fset: remove error displayed in core buffer when clicking with the mouse below the last option displayed
- irc: limit size of data received from the server to prevent memory exhaustion
- irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322))
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3))
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524))
- relay: limit size of received websocket frame and HTTP body to prevent memory exhaustion
- relay: limit size of partial message received while reading an HTTP request to prevent memory exhaustion
- relay: fix timing attack on password authentication ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc))
- relay: fix timing attack on password authentication ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
- relay: fix out-of-bounds read in dump of data ([#2324](https://github.com/weechat/weechat/issues/2324))
- api, relay: fix timing attack on TOTP validation ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc))
- relay/api: fix memory leak in resources "handshake", "input" and "completion"
- api, relay: fix timing attack on TOTP validation ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
- xfer: replace directory separator in remote nick by underscore in download filename to prevent writing the file outside the download directory ([#2321](https://github.com/weechat/weechat/issues/2321))
- xfer: fix out-of-bounds read when receiving empty line in DCC chat ([#2323](https://github.com/weechat/weechat/issues/2323))
- xfer: fix out-of-bounds write in xfer file transfer resume ([#2326](https://github.com/weechat/weechat/issues/2326))
## Version 4.9.2 (2026-06-07)
@@ -54,9 +60,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
- core: fix option weechat.look.color_real_white not applied when color is "white" on 16+ colors terminals ([#1742](https://github.com/weechat/weechat/issues/1742))
- irc: fix tag in message with list of names when joining a channel
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3))
- relay: fix timing attack on password authentication ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc))
- api, relay: fix timing attack on TOTP validation ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc))
- relay: limit size of decompressed websocket frame with permessage-deflate to prevent memory exhaustion ([GHSA-v2v4-45wm-5cr3](https://github.com/weechat/weechat/security/advisories/GHSA-v2v4-45wm-5cr3), [CVE-2026-53524](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53524))
- relay: fix timing attack on password authentication ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
- api, relay: fix timing attack on TOTP validation ([GHSA-vhv8-g2r9-cwcc](https://github.com/weechat/weechat/security/advisories/GHSA-vhv8-g2r9-cwcc), [CVE-2026-53525](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-53525))
## Version 4.9.0 (2026-03-29)
+5 -5
View File
@@ -4348,7 +4348,7 @@ Prototype:
[source,c]
----
int weechat_mkdir_home (char *directory, int mode);
int weechat_mkdir_home (const char *directory, int mode);
----
Arguments:
@@ -4395,7 +4395,7 @@ Prototype:
[source,c]
----
int weechat_mkdir (char *directory, int mode);
int weechat_mkdir (const char *directory, int mode);
----
Arguments:
@@ -4436,7 +4436,7 @@ Prototype:
[source,c]
----
int weechat_mkdir_parents (char *directory, int mode);
int weechat_mkdir_parents (const char *directory, int mode);
----
Arguments:
@@ -7709,7 +7709,7 @@ void weechat_config_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
----
Arguments:
@@ -7731,7 +7731,7 @@ C example:
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_name;
const char *option_name;
weechat_config_search_with_string ("file.section.option",
&ptr_config_file,
+46
View File
@@ -1179,6 +1179,51 @@ HTTP/1.1 200 OK
]
----
[[resource_scripts]]
=== Scripts
Return loaded scripts (all languages).
Endpoint:
----
GET /api/scripts
----
Request example:
[source,shell]
----
curl -L -u 'plain:secret_password' 'https://localhost:9000/api/scripts'
----
Response:
[source,http]
----
HTTP/1.1 200 OK
----
[source,json]
----
[
{
"name": "highmon.pl",
"version": "2.7",
"description": "Highlight Monitor",
"author": "KenjiE20",
"license": "GPL3"
},
{
"name": "go.py",
"version": "3.1.1",
"description": "Quick jump to buffers",
"author": "Sébastien Helleu <flashcode@flashtux.org>",
"license": "GPL3"
}
]
----
[[resource_input]]
=== Input
@@ -1510,6 +1555,7 @@ Body types that can be returned:
* `nick_group` (object)
* `nick` (object)
* `hotlist` (object)
* `scripts` (array)
* `ping` (object)
[TIP]
+5 -5
View File
@@ -4424,7 +4424,7 @@ Prototype :
[source,c]
----
int weechat_mkdir_home (char *directory, int mode);
int weechat_mkdir_home (const char *directory, int mode);
----
Paramètres :
@@ -4471,7 +4471,7 @@ Prototype :
[source,c]
----
int weechat_mkdir (char *directory, int mode);
int weechat_mkdir (const char *directory, int mode);
----
Paramètres :
@@ -4512,7 +4512,7 @@ Prototype :
[source,c]
----
int weechat_mkdir_parents (char *directory, int mode);
int weechat_mkdir_parents (const char *directory, int mode);
----
Paramètres :
@@ -7838,7 +7838,7 @@ void weechat_config_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
----
Paramètres :
@@ -7861,7 +7861,7 @@ Exemple en C :
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_name;
const char *option_name;
weechat_config_search_with_string ("fichier.section.option",
&ptr_config_file,
+46
View File
@@ -1191,6 +1191,51 @@ HTTP/1.1 200 OK
]
----
[[resource_scripts]]
=== Scripts
Retourner la liste des scripts chargés (tous les langages).
Point de terminaison:
----
GET /api/scripts
----
Exemple de requête:
[source,shell]
----
curl -L -u 'plain:secret_password' 'https://localhost:9000/api/scripts'
----
Réponse:
[source,http]
----
HTTP/1.1 200 OK
----
[source,json]
----
[
{
"name": "highmon.pl",
"version": "2.7",
"description": "Highlight Monitor",
"author": "KenjiE20",
"license": "GPL3"
},
{
"name": "go.py",
"version": "3.1.1",
"description": "Quick jump to buffers",
"author": "Sébastien Helleu <flashcode@flashtux.org>",
"license": "GPL3"
}
]
----
[[resource_input]]
=== Entrée
@@ -1530,6 +1575,7 @@ Les types de corps qui peuvent être retournés :
* `nick_group` (objet)
* `nick` (objet)
* `hotlist` (objet)
* `scripts` (tableau)
* `ping` (objet)
[TIP]
+5 -5
View File
@@ -4549,7 +4549,7 @@ Prototipo:
[source,c]
----
int weechat_mkdir_home (char *directory, int mode);
int weechat_mkdir_home (const char *directory, int mode);
----
Argomenti:
@@ -4597,7 +4597,7 @@ Prototipo:
[source,c]
----
int weechat_mkdir (char *directory, int mode);
int weechat_mkdir (const char *directory, int mode);
----
Argomenti:
@@ -4638,7 +4638,7 @@ Prototipo:
[source,c]
----
int weechat_mkdir_parents (char *directory, int mode);
int weechat_mkdir_parents (const char *directory, int mode);
----
Argomenti:
@@ -8011,7 +8011,7 @@ void weechat_config_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
----
Argomenti:
@@ -8034,7 +8034,7 @@ Esempio in C:
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_name;
const char *option_name;
weechat_config_search_with_string ("file.section.option",
&ptr_config_file,
+5 -5
View File
@@ -4477,7 +4477,7 @@ WeeChat ホームディレクトリの下にディレクトリを作成。
[source,c]
----
int weechat_mkdir_home (char *directory, int mode);
int weechat_mkdir_home (const char *directory, int mode);
----
引数:
@@ -4525,7 +4525,7 @@ weechat.mkdir_home("${weechat_cache_dir}/temp", 0755)
[source,c]
----
int weechat_mkdir (char *directory, int mode);
int weechat_mkdir (const char *directory, int mode);
----
引数:
@@ -4566,7 +4566,7 @@ weechat.mkdir("/tmp/mydir", 0755)
[source,c]
----
int weechat_mkdir_parents (char *directory, int mode);
int weechat_mkdir_parents (const char *directory, int mode);
----
引数:
@@ -7816,7 +7816,7 @@ void weechat_config_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
----
引数:
@@ -7838,7 +7838,7 @@ C 言語での使用例:
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_name;
const char *option_name;
weechat_config_search_with_string ("file.section.option",
&ptr_config_file,
+5 -5
View File
@@ -4209,7 +4209,7 @@ _Ажурирано у верзији 3.2._
[source,c]
----
int weechat_mkdir_home (char *directory, int mode);
int weechat_mkdir_home (const char *directory, int mode);
----
Аргументи:
@@ -4255,7 +4255,7 @@ weechat.mkdir_home("${weechat_cache_dir}/temp", 0755)
[source,c]
----
int weechat_mkdir (char *directory, int mode);
int weechat_mkdir (const char *directory, int mode);
----
Аргументи:
@@ -4296,7 +4296,7 @@ weechat.mkdir("/tmp/mydir", 0755)
[source,c]
----
int weechat_mkdir_parents (char *directory, int mode);
int weechat_mkdir_parents (const char *directory, int mode);
----
Аргументи:
@@ -7492,7 +7492,7 @@ void weechat_config_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
----
Аргументи:
@@ -7510,7 +7510,7 @@ C пример:
struct t_config_file *ptr_config_file;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *option_name;
const char *option_name;
weechat_config_search_with_string ("file.section.option",
&ptr_config_file,
+48
View File
@@ -1181,6 +1181,53 @@ HTTP/1.1 200 OK
]
----
// TRANSLATION MISSING
[[resource_scripts]]
=== Scripts
// TRANSLATION MISSING
Return loaded scripts (all languages).
Крајња тачка:
----
GET /api/scripts
----
Пример захтева:
[source,shell]
----
curl -L -u 'plain:secret_password' 'https://localhost:9000/api/scripts'
----
Одговор:
[source,http]
----
HTTP/1.1 200 OK
----
[source,json]
----
[
{
"name": "highmon.pl",
"version": "2.7",
"description": "Highlight Monitor",
"author": "KenjiE20",
"license": "GPL3"
},
{
"name": "go.py",
"version": "3.1.1",
"description": "Quick jump to buffers",
"author": "Sébastien Helleu <flashcode@flashtux.org>",
"license": "GPL3"
}
]
----
[[resource_input]]
=== Input
@@ -1510,6 +1557,7 @@ GUID `258EAFA5-E914-47DA-95CA-C5AB0DC85B11` (SHA-1 се кодира у base64).
* `nick_group` (објекат)
* `nick` (објекат)
* `hotlist` (објекат)
* `scripts` (низ)
* `ping` (објекат)
[TIP]
+5 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: Czech <weechat-dev@nongnu.org>\n"
@@ -16068,6 +16068,10 @@ msgstr "načteny %s skripty:"
msgid "script name with extension"
msgstr "seznam skriptů"
#, fuzzy
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "čárkami oddělený seznam slovníků, které použít pro tento buffer"
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr "jméno serveru (zástupný znak \"*\" je povolen) (volitelné)"
+7 -2
View File
@@ -29,8 +29,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-06-09 10:41+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German - Germany <weechat-dev@nongnu.org>\n"
"Language: de\n"
@@ -17510,6 +17510,11 @@ msgstr "1 falls Skript geladen wurde"
msgid "script name with extension"
msgstr "Skriptname mit Erweiterung"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr ""
"durch Kommata getrennte Liste von Erweiterungen: Endung mit unterstützen "
"Sprachen"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"Name des Skriptes, mit Dateierweiterung (Platzhalter \"*\" kann verwendet "
+6 -1
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: Spanish - Spain <weechat-dev@nongnu.org>\n"
@@ -16346,6 +16346,11 @@ msgstr "scripts en %s cargados:"
msgid "script name with extension"
msgstr "lista de scripts"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "lista separada por comas de extensiones de archivo para plugins"
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+5 -2
View File
@@ -23,8 +23,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-06-08 23:14+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: French - France <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -17182,6 +17182,9 @@ msgstr "1 si le script est chargé"
msgid "script name with extension"
msgstr "nom du script avec l'extension"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "liste de extension:extension_fichier avec les langages supportés"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"nom du script avec extension (le caractère joker \"*\" est autorisé) "
+4 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: Hungarian <weechat-dev@nongnu.org>\n"
@@ -15314,6 +15314,9 @@ msgstr "FIFO cső bezárva\n"
msgid "script name with extension"
msgstr "Aliaszok listája:\n"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+6 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: Italian <weechat-dev@nongnu.org>\n"
@@ -16432,6 +16432,11 @@ msgstr "script %s caricati:"
msgid "script name with extension"
msgstr "elenco degli script"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "elenco separato da virgole di estensioni dei nomi file per i plugin"
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+6 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <weechat-dev@nongnu.org>\n"
@@ -16996,6 +16996,11 @@ msgstr "ロードされた %s スクリプト:"
msgid "script name with extension"
msgstr "スクリプトの拡張子のリスト"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "プラグインのファイル拡張子のコンマ区切りリスト"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"拡張子を含めたスクリプト名 (ワイルドカード \"*\" を使うことができます) (任意)"
+6 -1
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <weechat-dev@nongnu.org>\n"
@@ -16747,6 +16747,11 @@ msgstr "1 jeśli skrypt jest załadowany"
msgid "script name with extension"
msgstr "nazwa skryptu z rozszerzeniem"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "oddzielona przecinkami lista rozszerzeń nazw plików dla wtyczek"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"nazwa skryptu z rozszerzeniem (wildcard \"*\" jest dozwolony) (opcjonalne)\""
+6 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese - Portugal <weechat-dev@nongnu.org>\n"
@@ -16869,6 +16869,11 @@ msgstr "scripts %s carregados:"
msgid "script name with extension"
msgstr "lista de extensões de script"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "lista de extensões de ficheiros separadas por vírgula para os plugins"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
"nome do script com extensão (o caráter universal \"*\" é permitido) "
+5 -1
View File
@@ -46,7 +46,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: Portuguese - Brazil <weechat-dev@nongnu.org>\n"
@@ -15838,6 +15838,10 @@ msgstr "scripts %s carregados:"
msgid "script name with extension"
msgstr "list de scripts"
#, fuzzy
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "lista de dicionários (separados por vírgula) para uso neste buffer"
#, fuzzy
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+4 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: Russian <weechat-dev@nongnu.org>\n"
@@ -15367,6 +15367,9 @@ msgstr "FIFO pipe закрыт\n"
msgid "script name with extension"
msgstr "Список сокращений:\n"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+6 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: Serbian <weechat-dev@nongnu.org>\n"
@@ -16695,6 +16695,11 @@ msgstr "1 ако је скрипта учитана"
msgid "script name with extension"
msgstr "име скрипте са екстензијом"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "листа екстензија имена фајлова за додатке раздвојених запетама"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)"
+6 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <weechat-dev@nongnu.org>\n"
@@ -17120,6 +17120,11 @@ msgstr "Hiçbir betik yüklenmedi"
msgid "script name with extension"
msgstr "betik uzantılarının listesi"
#, fuzzy
#| msgid "comma separated list of file name extensions for plugins"
msgid "comma-separated list of plugin:extension with supported languages"
msgstr "eklentiler için dosya adı uzantılarının virgülle ayrılmış listesi"
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr "betik adı, uzantı ile (\"*\" jokerine izin verilir) (isteğe bağlı)"
+4 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-05-30 14:00+0200\n"
"POT-Creation-Date: 2026-06-08 22:23+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"
@@ -14018,6 +14018,9 @@ msgstr ""
msgid "script name with extension"
msgstr ""
msgid "comma-separated list of plugin:extension with supported languages"
msgstr ""
msgid "script name with extension (wildcard \"*\" is allowed) (optional)"
msgstr ""
+6 -4
View File
@@ -705,7 +705,8 @@ config_file_new_option (struct t_config_file *config_file,
{
struct t_config_option *new_option;
int var_type, int_value, argc, i, index_value, number;
char *pos, *option_name, *parent_name;
const char *pos;
char *option_name, *parent_name;
new_option = NULL;
option_name = NULL;
@@ -1095,12 +1096,13 @@ config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name)
const char **pos_option_name)
{
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *file_name, *pos_section, *section_name, *pos_option;
const char *pos_section, *pos_option;
char *file_name, *section_name;
if (config_file)
*config_file = NULL;
@@ -2553,7 +2555,7 @@ config_file_option_set_with_string (const char *option_name, const char *value)
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *pos_option;
const char *pos_option;
rc = WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND;
+1 -1
View File
@@ -286,7 +286,7 @@ extern void config_file_search_with_string (const char *option_name,
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
extern int config_file_string_to_boolean (const char *text);
extern int config_file_option_reset (struct t_config_option *option,
int run_callback);
+10 -6
View File
@@ -1709,7 +1709,7 @@ config_weechat_update_cb (const void *pointer, void *data,
int version_read,
struct t_hashtable *data_read)
{
const char *ptr_config, *ptr_section, *ptr_option, *ptr_value;
const char *ptr_config, *ptr_section, *ptr_option, *ptr_value, *pos_option;
char *new_commands[][2] = {
/* old command, new command */
{ "/input jump_smart", "/buffer jump smart" },
@@ -1739,7 +1739,7 @@ config_weechat_update_cb (const void *pointer, void *data,
{ "number_desc" "-buffer.number" },
{ NULL, NULL },
};
char *new_option, *new_value, *pos_option;
char *new_option, *new_value;
int changes, i;
/* make C compiler happy */
@@ -2262,7 +2262,8 @@ config_weechat_proxy_read_cb (const void *pointer, void *data,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *proxy_name;
const char *pos_option;
char *proxy_name;
struct t_proxy *ptr_temp_proxy;
int index_option;
@@ -2341,7 +2342,8 @@ config_weechat_bar_read_cb (const void *pointer, void *data,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *bar_name;
const char *pos_option;
char *bar_name;
struct t_gui_bar *ptr_temp_bar;
int index_option;
@@ -2421,7 +2423,8 @@ config_weechat_custom_bar_item_read_cb (const void *pointer, void *data,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *item_name;
const char *pos_option;
char *item_name;
struct t_gui_bar_item_custom *ptr_temp_item;
int index_option;
@@ -2512,7 +2515,8 @@ config_weechat_layout_read_cb (const void *pointer, void *data,
const char *option_name, const char *value)
{
int argc, force_current_layout, number1, number2, number3, number4;
char **argv, *pos, *layout_name;
const char *pos;
char **argv, *layout_name;
const char *ptr_option_name;
struct t_gui_layout *ptr_layout;
struct t_gui_layout_window *parent;
+14 -9
View File
@@ -508,7 +508,8 @@ eval_string_repeat (const char *text)
char *
eval_string_split (const char *text)
{
char *pos, *pos2, *pos3, *str_number, *separators, **items, *value;
const char *pos, *pos2, *pos3;
char *str_number, *separators, **items, *value;
char str_value[32], *str_flags, **list_flags, *strip_items, **ptr_flag;
int num_items, count_items, random_item, flags, max_items;
long number;
@@ -655,7 +656,8 @@ end:
char *
eval_string_split_shell (const char *text)
{
char *pos, *str_number, **items, *value, str_value[32];
const char *pos;
char *str_number, **items, *value, str_value[32];
int num_items, count_items, random_item;
long number;
@@ -1046,7 +1048,8 @@ eval_string_if (const char *text, struct t_eval_context *eval_context)
char *
eval_string_random (const char *text)
{
char *pos, *tmp, result[128];
const char *pos;
char *tmp, result[128];
long long min_number, max_number;
if (!text || !text[0])
@@ -1112,7 +1115,8 @@ eval_string_translate (const char *text)
void
eval_string_define (const char *text, struct t_eval_context *eval_context)
{
char *pos, *name;
const char *pos;
char *name;
pos = strchr (text, ',');
if (!pos)
@@ -1139,7 +1143,8 @@ eval_hdata_count (const char *text, struct t_eval_context *eval_context)
struct t_hdata *hdata;
unsigned long ptr_value;
void *pointer;
char *pos1, *pos2, *value, *hdata_name, *pointer_name, str_count[64];
const char *pos1, *pos2;
char *value, *hdata_name, *pointer_name, str_count[64];
int rc, count;
value = NULL;
@@ -1211,8 +1216,8 @@ char *
eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path,
struct t_eval_context *eval_context)
{
char *value, *var_name, str_value[128], *pos, *property;
const char *ptr_value, *hdata_name, *ptr_var_name, *pos_open_paren;
char *value, *var_name, str_value[128], *property;
const char *ptr_value, *hdata_name, *ptr_var_name, *pos, *pos_open_paren;
int type, debug_id;
struct t_hashtable *hashtable;
@@ -1539,8 +1544,8 @@ eval_syntax_highlight_add_markers (const char *prefix, const char *text,
char *
eval_syntax_highlight_colorize (const char *value)
{
const char *ptr_value;
char **result, *pos;
const char *ptr_value, *pos;
char **result;
int color;
if (!value)
+2 -1
View File
@@ -688,7 +688,8 @@ hdata_count (struct t_hdata *hdata, void *pointer)
void
hdata_get_index_and_name (const char *name, int *index, const char **ptr_name)
{
char *pos, *str_index;
const char *pos;
char *str_index;
int number;
if (index)
+8 -3
View File
@@ -242,8 +242,8 @@ int
input_data (struct t_gui_buffer *buffer, const char *data,
const char *commands_allowed, int split_newline, int user_data)
{
char *pos, str_buffer[128], *new_data, *buffer_full_name;
const char *ptr_data, *ptr_data_for_buffer;
const char *ptr_data_for_buffer;
char *pos, str_buffer[128], *new_data, *buffer_full_name, *ptr_data;
int first_command, rc;
if (!buffer || !gui_buffer_valid (buffer) || !data)
@@ -272,8 +272,13 @@ input_data (struct t_gui_buffer *buffer, const char *data,
if (data[0] && new_data && !new_data[0])
goto end;
if (!new_data)
new_data = strdup (data);
if (!new_data)
goto end;
first_command = 1;
ptr_data = (new_data) ? new_data : data;
ptr_data = new_data;
while (ptr_data)
{
/*
+19 -1
View File
@@ -582,7 +582,13 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
int port)
{
struct t_network_socks5 socks5;
unsigned char buffer[288];
/*
* buffer must be large enough for the username/password authentication
* request, which is the longest message sent/received here; according to
* RFC 1929 it is: version (1) + username length (1) + username (max 255)
* + password length (1) + password (max 255)
*/
unsigned char buffer[2 + 255 + 1 + 255];
int username_len, password_len, addr_len, addr_buffer_len;
unsigned char *addr_buffer;
char *username, *password;
@@ -631,6 +637,18 @@ network_pass_socks5proxy (struct t_proxy *proxy, int sock, const char *address,
username_len = strlen (username);
password_len = strlen (password);
/*
* username and password length are each stored on a single byte
* (RFC 1929), so they cannot exceed 255 bytes: reject longer values,
* otherwise the memcpy calls below would overflow the buffer
*/
if ((username_len > 255) || (password_len > 255))
{
free (username);
free (password);
return 0;
}
/* make username/password buffer */
buffer[0] = 1;
buffer[1] = (unsigned char) username_len;
+6 -6
View File
@@ -1686,9 +1686,8 @@ string_mask_to_regex (const char *mask)
const char *
string_regex_flags (const char *regex, int default_flags, int *flags)
{
const char *ptr_regex, *ptr_flags;
const char *ptr_regex, *ptr_flags, *pos;
int set_flag, flag;
char *pos;
if (flags)
*flags = default_flags;
@@ -2966,8 +2965,9 @@ char **
string_split_command (const char *command, char separator)
{
int nb_substr, arr_idx, str_idx, type;
const char *p;
char **array, **array2;
char *buffer, *p;
char *buffer;
const char *ptr;
if (!command || !command[0])
@@ -4138,8 +4138,7 @@ string_is_command_char (const char *string)
const char *
string_input_for_buffer (const char *string)
{
char *pos_slash, *pos_space, *pos_newline;
const char *next_char;
const char *pos_slash, *pos_space, *pos_newline, *next_char;
if (!string)
return NULL;
@@ -4476,7 +4475,8 @@ string_get_priority_and_name (const char *string,
int *priority, const char **name,
int default_priority)
{
char *pos, *str_priority;
const char *pos;
char *str_priority;
int number;
if (priority)
+2 -2
View File
@@ -416,8 +416,8 @@ util_strftimeval (char *string, int max, const char *format, struct timeval *tv)
int
util_parse_time (const char *datetime, struct timeval *tv)
{
char *string, *pos, *pos2, *pos_colon, *pos_hyphen, *pos_dot;
char str_usec[16], str_date[128];
const char *pos_colon, *pos_hyphen, *pos_dot;
char *pos, *pos2, *string, str_usec[16], str_date[128];
struct tm tm_date, tm_date_gm, tm_date_local, *local_time;
time_t time_now, time_gm, time_local;
long long value;
+2 -2
View File
@@ -597,8 +597,8 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
struct t_hook *hook_plugin, *hook_other_plugin, *hook_other_plugin2;
struct t_hook *hook_incomplete_command;
struct t_hook_exec_cb hook_exec_cb;
char **argv, **argv_eol, *command_name, *pos;
const char *ptr_string;
char **argv, **argv_eol, *command_name;
const char *ptr_string, *pos;
int argc, rc, length_command_name, allow_incomplete_commands;
int count_other_plugin, count_incomplete_commands, flags;
+2 -1
View File
@@ -132,7 +132,8 @@ void
hook_signal_extract_flags (const char *signal, const char **ptr_signal,
int *stop_on_error, int *ignore_eat)
{
char *pos, *str_flags, **flags;
const char *pos;
char *str_flags, **flags;
int i, num_flags;
if (!signal || !ptr_signal || !stop_on_error || !ignore_eat)
+4 -3
View File
@@ -47,7 +47,7 @@ void
daemonize (void)
{
pid_t pid;
int fd, i;
int fd, i, rc;
printf ("%s ", _("Running WeeChat in background..."));
@@ -77,8 +77,9 @@ daemonize (void)
close (i);
}
fd = open ("/dev/null", O_RDWR);
(void) dup (fd);
(void) dup (fd);
rc = dup (fd);
rc = dup (fd);
(void) rc;
}
/*
+2 -1
View File
@@ -138,7 +138,8 @@ gui_bar_item_custom_search (const char *item_name)
struct t_gui_bar_item_custom *
gui_bar_item_custom_search_with_option_name (const char *option_name)
{
char *item_name, *pos_option;
const char *pos_option;
char *item_name;
struct t_gui_bar_item_custom *ptr_item;
if (!option_name)
+9 -9
View File
@@ -1880,9 +1880,9 @@ gui_bar_item_buffer_nicklist_cb (const void *pointer, void *data,
{
if (strchr (ptr_nick->prefix_color, '.'))
{
config_file_search_with_string (ptr_nick->prefix_color,
NULL, NULL, &ptr_option,
NULL);
config_file_search_with_string (
ptr_nick->prefix_color,
NULL, NULL, &ptr_option, NULL);
if (ptr_option)
{
string_dyn_concat (
@@ -1907,9 +1907,9 @@ gui_bar_item_buffer_nicklist_cb (const void *pointer, void *data,
{
if (strchr (ptr_nick->color, '.'))
{
config_file_search_with_string (ptr_nick->color,
NULL, NULL, &ptr_option,
NULL);
config_file_search_with_string (
ptr_nick->color,
NULL, NULL, &ptr_option, NULL);
if (ptr_option)
{
string_dyn_concat (
@@ -1940,9 +1940,9 @@ gui_bar_item_buffer_nicklist_cb (const void *pointer, void *data,
{
if (strchr (ptr_group->color, '.'))
{
config_file_search_with_string (ptr_group->color,
NULL, NULL, &ptr_option,
NULL);
config_file_search_with_string (
ptr_group->color,
NULL, NULL, &ptr_option, NULL);
if (ptr_option)
{
string_dyn_concat (
+2 -1
View File
@@ -515,7 +515,8 @@ gui_bar_search (const char *name)
struct t_gui_bar *
gui_bar_search_with_option_name (const char *option_name)
{
char *bar_name, *pos_option;
const char *pos_option;
char *bar_name;
struct t_gui_bar *ptr_bar;
if (!option_name)
+2 -2
View File
@@ -118,8 +118,8 @@ gui_chat_init (void)
void
gui_chat_prefix_build (void)
{
const char *ptr_prefix;
char prefix[512], *pos_color;
const char *ptr_prefix, *pos_color;
char prefix[512];
int prefix_color[GUI_CHAT_NUM_PREFIXES] =
{ GUI_COLOR_CHAT_PREFIX_ERROR, GUI_COLOR_CHAT_PREFIX_NETWORK,
GUI_COLOR_CHAT_PREFIX_ACTION, GUI_COLOR_CHAT_PREFIX_JOIN,
+3 -4
View File
@@ -170,8 +170,7 @@ gui_color_search_config (const char *color_name)
/* search in any configuration file (example: "irc.color.message_quit") */
if (strchr (color_name, '.'))
{
config_file_search_with_string (color_name, NULL, NULL, &ptr_option,
NULL);
config_file_search_with_string (color_name, NULL, NULL, &ptr_option, NULL);
if (ptr_option)
return gui_color_from_option (ptr_option);
}
@@ -255,8 +254,8 @@ gui_color_get_custom (const char *color_name)
static char color[32][96];
static int index_color = 0;
char color_fg[32], color_bg[32];
char *pos_delim, *str_fg, *pos_bg, *error, *color_attr;
const char *ptr_color_name;
char *str_fg, *error, *color_attr;
const char *ptr_color_name, *pos_delim, *pos_bg;
/* attribute or other color name (GUI dependent) */
index_color = (index_color + 1) % 32;
+2 -2
View File
@@ -366,8 +366,8 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
{
struct t_gui_filter *new_filter;
regex_t *regex1, *regex2;
char *pos_tab, *regex_prefix, buf[512], str_error[1024];
const char *ptr_start_regex, *pos_regex_message;
char *regex_prefix, buf[512], str_error[1024];
const char *ptr_start_regex, *pos_regex_message, *pos_tab;
int rc;
if (!name || !buffer_name || !tags || !regex)
+1 -1
View File
@@ -1076,7 +1076,7 @@ gui_key_set_area_type_name (const char *area,
int *area_type, char **area_name)
{
int focus, length;
char *pos_end;
const char *pos_end;
for (focus = 0; focus < GUI_KEY_NUM_FOCUS; focus++)
{
+2 -1
View File
@@ -2925,7 +2925,8 @@ void
irc_command_join_server (struct t_irc_server *server, const char *arguments,
int manual_join, int noswitch)
{
char *new_args, **channels, **keys, *pos_space, *pos_keys, *pos_channel;
const char *pos_space, *pos_keys;
char *new_args, **channels, **keys, *pos_channel;
char *channel_name_lower;
int i, num_channels, num_keys, length;
time_t time_now;
+3 -2
View File
@@ -470,7 +470,7 @@ irc_completion_modelist_masks_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
char *pos;
const char *pos;
struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item;
@@ -512,7 +512,8 @@ irc_completion_modelist_numbers_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
char *pos, str_number[32];
const char *pos;
char str_number[32];
struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item;
+11 -9
View File
@@ -201,7 +201,8 @@ struct t_irc_server *
irc_config_get_server_from_option_name (const char *name)
{
struct t_irc_server *ptr_server;
char *pos_option, *server_name;
const char *pos_option;
char *server_name;
ptr_server = NULL;
@@ -274,7 +275,7 @@ irc_config_compute_nick_colors (void)
int
irc_config_display_channel_modes_arguments (const char *modes)
{
char *pos_space, *pos;
const char *pos_space, *pos;
const char *ptr_mode;
pos_space = strchr (modes, ' ');
@@ -2811,7 +2812,8 @@ irc_config_server_read_cb (const void *pointer, void *data,
{
struct t_irc_server *ptr_server;
int index_option, rc, i;
char *pos_option, *server_name;
const char *pos_option;
char *server_name;
/* make C compiler happy */
(void) pointer;
@@ -2940,9 +2942,9 @@ irc_config_update_cb (const void *pointer, void *data,
int version_read,
struct t_hashtable *data_read)
{
const char *ptr_config, *ptr_section, *ptr_option, *ptr_value;
const char *ptr_config, *ptr_section, *ptr_option, *ptr_value, *pos_option;
const char *option_autojoin_delay = "autojoin_delay";
char *new_option, *pos_option, *new_value;
char *new_option, *pos_new_option, *new_value;
int changes, length;
/* make C compiler happy */
@@ -2997,11 +2999,11 @@ irc_config_update_cb (const void *pointer, void *data,
new_option = strdup (ptr_option);
if (new_option)
{
pos_option = strrchr (new_option, '.');
if (pos_option)
pos_new_option = strrchr (new_option, '.');
if (pos_new_option)
{
pos_option++;
memcpy (pos_option, "tls", 3);
pos_new_option++;
memcpy (pos_new_option, "tls", 3);
weechat_printf (
NULL,
_("IRC option renamed: \"irc.%s.%s\" => \"irc.%s.%s\""),
+16 -15
View File
@@ -67,8 +67,8 @@ irc_info_info_irc_is_channel_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *pos_channel;
char *server;
const char *pos_channel, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
@@ -106,8 +106,8 @@ irc_info_info_irc_is_nick_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *pos_nick;
char *server;
const char *pos_nick, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
@@ -233,8 +233,8 @@ irc_info_info_irc_buffer_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *pos_comma2, *server, *channel, *host;
const char *nick;
char *server, *channel, *host;
const char *nick, *pos_comma, *pos_comma2;
struct t_irc_server *ptr_server;
struct t_irc_channel *ptr_channel;
@@ -332,8 +332,8 @@ irc_info_info_irc_server_isupport_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *isupport_value;
char *server;
const char *isupport_value, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
@@ -373,8 +373,8 @@ irc_info_info_irc_server_isupport_value_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *isupport_value;
char *server;
const char *isupport_value, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
@@ -414,7 +414,8 @@ irc_info_info_irc_server_cap_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
char *server;
const char *pos_comma;
int has_cap;
struct t_irc_server *ptr_server;
@@ -455,8 +456,8 @@ irc_info_info_irc_server_cap_value_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *cap_value;
char *server;
const char *cap_value, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
@@ -496,8 +497,8 @@ irc_info_info_irc_is_message_ignored_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char *pos_comma, *server;
const char *pos_message;
char *server;
const char *pos_message, *pos_comma;
struct t_irc_server *ptr_server;
/* make C compiler happy */
+1 -1
View File
@@ -457,7 +457,7 @@ irc_input_send_cb (const void *pointer, void *data,
const char *type_data, void *signal_data)
{
const char *ptr_string, *ptr_message;
char *pos_semicol1, *pos_semicol2, *pos_semicol3, *pos_semicol4;
const char *pos_semicol1, *pos_semicol2, *pos_semicol3, *pos_semicol4;
char *server, *channel, *options, *tags, *data_with_colors, **list_options;
int i, num_options, flags, force_user_message;
struct t_irc_server *ptr_server;
+9 -7
View File
@@ -707,8 +707,8 @@ const char *
irc_message_get_nick_from_host (const char *host)
{
static char nick[128];
char host2[128], *pos_space, *pos;
const char *ptr_host;
char host2[128];
const char *ptr_host, *pos_space, *pos;
if (!host)
return NULL;
@@ -756,8 +756,8 @@ const char *
irc_message_get_address_from_host (const char *host)
{
static char address[256];
char host2[256], *pos_space, *pos;
const char *ptr_host;
char host2[256];
const char *ptr_host, *pos_space, *pos;
if (!host)
return NULL;
@@ -1182,8 +1182,9 @@ irc_message_split_join (struct t_irc_message_split_context *context,
{
int channels_count, keys_count, length, length_no_channel;
int length_to_add, index_channel;
char **channels, **keys, *pos, *str;
char **channels, **keys, *str;
char msg_to_send[16384], keys_to_add[16384];
const char *pos;
max_length -= 2; /* by default: 512 - 2 = 510 bytes */
@@ -1510,7 +1511,7 @@ irc_message_split_privmsg_notice (struct t_irc_message_split_context *context,
int
irc_message_split_005 (struct t_irc_message_split_context *context,
const char *tags, const char *host, const char *command,
const char *target, const char *arguments,
const char *target, char *arguments,
int max_length)
{
char *pos, suffix[4096];
@@ -1570,7 +1571,8 @@ irc_message_split (struct t_irc_server *server, const char *message)
{
struct t_irc_message_split_context split_context;
char **argv, **argv_eol, *tags, *host, *command, *arguments, target[4096];
char *pos, monitor_action[3];
char monitor_action[3];
const char *pos;
int split_ok, split_privmsg, argc, index_args, max_length_nick;
int max_length_user, max_length_host, max_length_nick_user_host;
int split_msg_max_length, multiline, multiline_max_bytes;
+2 -2
View File
@@ -104,8 +104,8 @@ irc_mode_get_arguments_colors (const char *arguments)
char
irc_mode_get_chanmode_type (struct t_irc_server *server, char chanmode)
{
char chanmode_type, *pos;
const char *chanmodes, *ptr_chanmodes;
char chanmode_type;
const char *chanmodes, *ptr_chanmodes, *pos;
/*
* assume it is type 'B' if mode is in prefix
+2 -3
View File
@@ -785,9 +785,8 @@ int
irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
struct t_hashtable *hashtable)
{
const char *error, *server, *pattern, *command, *output;
char **messages, **nicks_sent, **nicks_recv, *irc_cmd, *arguments;
char *ptr_args, *pos;
const char *error, *server, *pattern, *command, *output, *ptr_args;
char **messages, **nicks_sent, **nicks_recv, *irc_cmd, *arguments, *pos;
int i, j, num_messages, num_nicks_sent, num_nicks_recv, nick_was_sent;
int away_message_updated, no_such_nick;
struct t_irc_server *ptr_server;
+7 -8
View File
@@ -2499,8 +2499,8 @@ IRC_PROTOCOL_CALLBACK(note)
IRC_PROTOCOL_CALLBACK(notice)
{
char *notice_args, *pos, end_char, *channel, str_tags[1024];
const char *pos_target, *pos_args, *nick_address;
char *notice_args, end_char, *channel, str_tags[1024];
const char *pos, *pos_target, *pos_args, *nick_address;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
int notify_private, is_channel, is_channel_orig, display_host;
@@ -7921,12 +7921,11 @@ irc_protocol_recv_command (struct t_irc_server *server,
int ignore_batch_tag)
{
int i, cmd_found, return_code, ignored;
char *pos_space, *tags;
struct t_irc_channel *ptr_channel;
t_irc_recv_func *cmd_recv_func;
const char *ptr_msg_after_tags, *ptr_batch_ref, *ptr_tag_time;
const char *nick1, *address1, *host1;
char *host, *host_no_color;
const char *pos_space, *nick1, *address1, *host1;
char *tags, *host, *host_no_color, *pos_space_host;
struct t_irc_protocol_ctxt ctxt;
struct timeval tv;
@@ -8198,9 +8197,9 @@ irc_protocol_recv_command (struct t_irc_server *server,
host = (host1) ? strdup (host1) : NULL;
if (host)
{
pos_space = strchr (host, ' ');
if (pos_space)
pos_space[0] = '\0';
pos_space_host = strchr (host, ' ');
if (pos_space_host)
pos_space_host[0] = '\0';
}
host_no_color = (host) ? irc_color_decode (host, 0) : NULL;
ctxt.host = (host) ?
+1 -1
View File
@@ -616,7 +616,7 @@ void
irc_redirect_init_command (struct t_irc_redirect *redirect,
const char *command)
{
char *pos;
const char *pos;
if (!redirect)
return;
+148 -152
View File
@@ -588,7 +588,7 @@ irc_server_sasl_enabled (struct t_irc_server *server)
char *
irc_server_get_name_without_port (const char *name)
{
char *pos;
const char *pos;
if (!name)
return NULL;
@@ -1134,7 +1134,7 @@ void
irc_server_set_prefix_modes_chars (struct t_irc_server *server,
const char *prefix)
{
char *pos;
const char *pos;
int i, old_length_chars, length_modes, length_chars;
if (!server || !prefix)
@@ -1379,8 +1379,7 @@ irc_server_get_prefix_chars (struct t_irc_server *server)
int
irc_server_get_prefix_mode_index (struct t_irc_server *server, char mode)
{
const char *prefix_modes;
char *pos;
const char *prefix_modes, *pos;
if (server)
{
@@ -1405,8 +1404,7 @@ int
irc_server_get_prefix_char_index (struct t_irc_server *server,
char prefix_char)
{
const char *prefix_chars;
char *pos;
const char *prefix_chars, *pos;
if (server)
{
@@ -2443,8 +2441,8 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
{
struct t_irc_server *new_server;
struct t_infolist *infolist;
char *mask, *pos;
const char *option_name;
const char *option_name, *pos;
char *mask;
int index_option;
/* check if another server exists with this name */
@@ -2502,9 +2500,9 @@ irc_server_copy (struct t_irc_server *server, const char *new_name)
int
irc_server_rename (struct t_irc_server *server, const char *new_name)
{
char *mask, *pos_option, *new_option_name, charset_modifier[1024];
char *mask, *new_option_name, charset_modifier[1024];
char *buffer_name;
const char *option_name;
const char *option_name, *pos_option;
struct t_infolist *infolist;
struct t_config_option *ptr_option;
struct t_irc_channel *ptr_channel;
@@ -2999,8 +2997,8 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
const char *tags)
{
static char buffer[4096];
const char *ptr_msg, *ptr_chan_nick;
char *new_msg, *pos, *tags_to_send, *msg_encoded;
const char *ptr_chan_nick;
char *new_msg, *ptr_msg, *pos, *tags_to_send, *msg_encoded;
char str_modifier[128], modifier_data[1024];
int first_message, queue_msg, pos_channel, pos_text, pos_encode;
struct t_irc_redirect *ptr_redirect;
@@ -3013,150 +3011,148 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
server->name,
message);
/* no changes in new message */
if (new_msg && (strcmp (message, new_msg) == 0))
{
free (new_msg);
new_msg = NULL;
}
/* message not dropped? */
if (!new_msg || new_msg[0])
{
first_message = 1;
ptr_msg = (new_msg) ? new_msg : message;
msg_encoded = NULL;
irc_message_parse (server,
ptr_msg,
NULL, /* tags */
NULL, /* message_without_tags */
NULL, /* nick */
NULL, /* user */
NULL, /* host */
NULL, /* command */
NULL, /* channel */
NULL, /* arguments */
NULL, /* text */
NULL, /* params */
NULL, /* num_params */
NULL, /* pos_command */
NULL, /* pos_arguments */
&pos_channel,
&pos_text);
switch (IRC_SERVER_OPTION_ENUM(server,
IRC_SERVER_OPTION_CHARSET_MESSAGE))
{
case IRC_SERVER_CHARSET_MESSAGE_MESSAGE:
pos_encode = 0;
break;
case IRC_SERVER_CHARSET_MESSAGE_CHANNEL:
pos_encode = (pos_channel >= 0) ? pos_channel : pos_text;
break;
case IRC_SERVER_CHARSET_MESSAGE_TEXT:
pos_encode = pos_text;
break;
default:
pos_encode = 0;
break;
}
if (pos_encode >= 0)
{
ptr_chan_nick = (channel) ? channel : nick;
if (ptr_chan_nick)
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
server->name,
ptr_chan_nick);
}
else
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s",
weechat_plugin->name,
server->name);
}
/*
* when UTF8ONLY is enabled, clients must not send non-UTF-8 data
* to the server; the charset encoding below is then done only if
* UTF8ONLY is *NOT* enabled
* (see: https://ircv3.net/specs/extensions/utf8-only)
*/
if (!server->utf8only)
{
msg_encoded = irc_message_convert_charset (ptr_msg, pos_encode,
"charset_encode",
modifier_data);
}
}
if (msg_encoded)
ptr_msg = msg_encoded;
while (ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
snprintf (buffer, sizeof (buffer), "%s\r\n", ptr_msg);
if (flags & IRC_SERVER_SEND_OUTQ_PRIO_IMMEDIATE)
queue_msg = 0;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_HIGH)
queue_msg = 1;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_LOW)
queue_msg = 2;
else
{
/*
* if connected to server (message 001 received), consider
* it's low priority (otherwise send immediately)
*/
queue_msg = (server->is_connected) ? 2 : 0;
}
tags_to_send = irc_server_get_tags_to_send (tags);
ptr_redirect = irc_redirect_search_available (server);
/* queue message (do not send anything now) */
irc_server_outqueue_add (server,
queue_msg,
command,
(new_msg && first_message) ? message : NULL,
buffer,
(new_msg) ? 1 : 0,
tags_to_send,
ptr_redirect);
/* mark redirect as "used" */
if (ptr_redirect)
ptr_redirect->assigned_to_command = 1;
free (tags_to_send);
if (pos)
{
pos[0] = '\n';
ptr_msg = pos + 1;
}
else
ptr_msg = NULL;
first_message = 0;
}
free (msg_encoded);
}
else
/* message dropped? */
if (new_msg && !new_msg[0])
{
irc_raw_print (server, IRC_RAW_FLAG_SEND | IRC_RAW_FLAG_MODIFIED,
_("(message dropped)"));
free (new_msg);
return;
}
if (!new_msg)
new_msg = strdup (message);
if (!new_msg)
return;
first_message = 1;
ptr_msg = new_msg;
msg_encoded = NULL;
irc_message_parse (server,
ptr_msg,
NULL, /* tags */
NULL, /* message_without_tags */
NULL, /* nick */
NULL, /* user */
NULL, /* host */
NULL, /* command */
NULL, /* channel */
NULL, /* arguments */
NULL, /* text */
NULL, /* params */
NULL, /* num_params */
NULL, /* pos_command */
NULL, /* pos_arguments */
&pos_channel,
&pos_text);
switch (IRC_SERVER_OPTION_ENUM(server,
IRC_SERVER_OPTION_CHARSET_MESSAGE))
{
case IRC_SERVER_CHARSET_MESSAGE_MESSAGE:
pos_encode = 0;
break;
case IRC_SERVER_CHARSET_MESSAGE_CHANNEL:
pos_encode = (pos_channel >= 0) ? pos_channel : pos_text;
break;
case IRC_SERVER_CHARSET_MESSAGE_TEXT:
pos_encode = pos_text;
break;
default:
pos_encode = 0;
break;
}
if (pos_encode >= 0)
{
ptr_chan_nick = (channel) ? channel : nick;
if (ptr_chan_nick)
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s.%s",
weechat_plugin->name,
server->name,
ptr_chan_nick);
}
else
{
snprintf (modifier_data, sizeof (modifier_data),
"%s.%s",
weechat_plugin->name,
server->name);
}
/*
* when UTF8ONLY is enabled, clients must not send non-UTF-8 data
* to the server; the charset encoding below is then done only if
* UTF8ONLY is *NOT* enabled
* (see: https://ircv3.net/specs/extensions/utf8-only)
*/
if (!server->utf8only)
{
msg_encoded = irc_message_convert_charset (ptr_msg, pos_encode,
"charset_encode",
modifier_data);
}
}
if (msg_encoded)
ptr_msg = msg_encoded;
while (ptr_msg && ptr_msg[0])
{
pos = strchr (ptr_msg, '\n');
if (pos)
pos[0] = '\0';
snprintf (buffer, sizeof (buffer), "%s\r\n", ptr_msg);
if (flags & IRC_SERVER_SEND_OUTQ_PRIO_IMMEDIATE)
queue_msg = 0;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_HIGH)
queue_msg = 1;
else if (flags & IRC_SERVER_SEND_OUTQ_PRIO_LOW)
queue_msg = 2;
else
{
/*
* if connected to server (message 001 received), consider
* it's low priority (otherwise send immediately)
*/
queue_msg = (server->is_connected) ? 2 : 0;
}
tags_to_send = irc_server_get_tags_to_send (tags);
ptr_redirect = irc_redirect_search_available (server);
/* queue message (do not send anything now) */
irc_server_outqueue_add (server,
queue_msg,
command,
(new_msg && first_message) ? message : NULL,
buffer,
(new_msg) ? 1 : 0,
tags_to_send,
ptr_redirect);
/* mark redirect as "used" */
if (ptr_redirect)
ptr_redirect->assigned_to_command = 1;
free (tags_to_send);
if (pos)
{
pos[0] = '\n';
ptr_msg = pos + 1;
}
else
ptr_msg = NULL;
first_message = 0;
}
free (msg_encoded);
free (new_msg);
}
@@ -3450,7 +3446,7 @@ irc_server_msgq_add_unterminated (struct t_irc_server *server,
*/
void
irc_server_msgq_add_buffer (struct t_irc_server *server, const char *buffer)
irc_server_msgq_add_buffer (struct t_irc_server *server, char *buffer)
{
char *pos_cr, *pos_lf;
+1 -1
View File
@@ -427,7 +427,7 @@ extern struct t_arraylist *irc_server_sendf (struct t_irc_server *server,
const char *tags,
const char *format, ...);
extern void irc_server_msgq_add_buffer (struct t_irc_server *server,
const char *buffer);
char *buffer);
extern void irc_server_msgq_flush (void);
extern void irc_server_set_buffer_title (struct t_irc_server *server);
extern struct t_gui_buffer *irc_server_create_buffer (struct t_irc_server *server);
+2 -1
View File
@@ -802,7 +802,8 @@ plugin_api_info_color_rgb2term_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char value[32], *pos, *color;
const char *pos;
char value[32], *color;
int rgb, limit;
/* make C compiler happy */
+37
View File
@@ -848,3 +848,40 @@ relay_api_msg_hotlist_to_json (struct t_gui_hotlist *hotlist)
return json;
}
/*
* Create a JSON object with a script.
*/
cJSON *
relay_api_msg_script_to_json (struct t_hdata *hdata, void *script, const char *extension)
{
cJSON *json;
void *pointer;
const char *ptr_string;
char name[1024];
if (!hdata)
return NULL;
pointer = script;
json = cJSON_CreateObject ();
if (!json)
return NULL;
if (!script)
return json;
snprintf (name, sizeof (name),
"%s.%s",
weechat_hdata_string (hdata, script, "name"),
extension);
MSG_ADD_STR_BUF("name", name);
MSG_ADD_HDATA_STR("version", "version");
MSG_ADD_HDATA_STR("description", "description");
MSG_ADD_HDATA_STR("author", "author");
MSG_ADD_HDATA_STR("license", "license");
return json;
}
+2
View File
@@ -58,5 +58,7 @@ extern cJSON *relay_api_msg_nick_group_to_json (struct t_gui_nick_group *nick_gr
enum t_relay_api_colors colors);
extern cJSON *relay_api_msg_completion_to_json (struct t_gui_completion *completion);
extern cJSON *relay_api_msg_hotlist_to_json (struct t_gui_hotlist *hotlist);
extern cJSON *relay_api_msg_script_to_json (struct t_hdata *hdata, void *script,
const char *extension);
#endif /* WEECHAT_PLUGIN_RELAY_API_MSG_H */
+74 -2
View File
@@ -402,7 +402,10 @@ RELAY_API_PROTOCOL_CALLBACK(handshake)
if (json_body)
{
if (!cJSON_IsObject (json_body))
{
cJSON_Delete (json_body);
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
}
json_algos = cJSON_GetObjectItem (json_body, "password_hash_algo");
if (json_algos)
{
@@ -764,6 +767,64 @@ RELAY_API_PROTOCOL_CALLBACK(hotlist)
return RELAY_API_PROTOCOL_RC_OK;
}
/*
* Callback for resource "scripts".
*
* Routes:
* GET /api/scripts
*/
RELAY_API_PROTOCOL_CALLBACK(scripts)
{
cJSON *json;
char *info_languages, **languages, hdata_name[256], *pos;
int num_languages, i;
struct t_hdata *ptr_hdata;
void *ptr_script;
json = cJSON_CreateArray ();
if (!json)
return RELAY_API_PROTOCOL_RC_MEMORY;
info_languages = weechat_info_get ("script_languages", NULL);
if (info_languages)
{
languages = weechat_string_split (info_languages, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_languages);
if (languages)
{
for (i = 0; i < num_languages; i++)
{
pos = strchr (languages[i], ':');
if (pos)
{
pos[0] = '\0';
snprintf (hdata_name, sizeof (hdata_name),
"%s_script", languages[i]);
ptr_hdata = weechat_hdata_get (hdata_name);
ptr_script = weechat_hdata_get_list (ptr_hdata, "scripts");
while (ptr_script)
{
cJSON_AddItemToArray (
json,
relay_api_msg_script_to_json (ptr_hdata, ptr_script, pos + 1));
ptr_script = weechat_hdata_move (ptr_hdata, ptr_script, 1);
}
}
}
weechat_string_free_split (languages);
}
free (info_languages);
}
relay_api_msg_send_json (client, RELAY_HTTP_200_OK, NULL, "scripts", json);
cJSON_Delete (json);
return RELAY_API_PROTOCOL_RC_OK;
}
/*
* Callback for resource "input".
*
@@ -781,8 +842,13 @@ RELAY_API_PROTOCOL_CALLBACK(input)
char str_delay[32];
json_body = cJSON_Parse (client->http_req->body);
if (!json_body || !cJSON_IsObject (json_body))
if (!json_body)
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
if (!cJSON_IsObject (json_body))
{
cJSON_Delete (json_body);
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
}
/* get buffer either by name or by id */
ptr_buffer = NULL;
@@ -908,8 +974,13 @@ RELAY_API_PROTOCOL_CALLBACK(completion)
struct t_gui_buffer *ptr_buffer;
json_body = cJSON_Parse (client->http_req->body);
if (!json_body || !cJSON_IsObject(json_body))
if (!json_body)
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
if (!cJSON_IsObject(json_body))
{
cJSON_Delete (json_body);
return RELAY_API_PROTOCOL_RC_BAD_REQUEST;
}
/* get buffer either by name or by id */
ptr_buffer = NULL;
@@ -1286,6 +1357,7 @@ relay_api_protocol_recv_http (struct t_relay_client *client)
{ "GET", "version", 1, 0, 0, RELAY_API_CB(version) },
{ "GET", "buffers", 1, 0, 3, RELAY_API_CB(buffers) },
{ "GET", "hotlist", 1, 0, 3, RELAY_API_CB(hotlist) },
{ "GET", "scripts", 1, 0, 0, RELAY_API_CB(scripts) },
{ "POST", "input", 1, 0, 0, RELAY_API_CB(input) },
{ "POST", "completion", 1, 0, 0, RELAY_API_CB(completion) },
{ "POST", "ping", 1, 0, 0, RELAY_API_CB(ping) },
+1 -1
View File
@@ -26,7 +26,7 @@ struct t_relay_client;
enum t_relay_status;
#define RELAY_API_VERSION_MAJOR 0
#define RELAY_API_VERSION_MINOR 5
#define RELAY_API_VERSION_MINOR 6
#define RELAY_API_VERSION_PATCH 0
#define RELAY_API_VERSION_NUMBER \
((RELAY_API_VERSION_MAJOR << 16) \
+60 -3
View File
@@ -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.5.0
version: 0.6.0
externalDocs:
url: https://weechat.org/doc/
@@ -32,6 +32,7 @@ tags:
- name: version
- name: buffers
- name: hotlist
- name: scripts
- name: input
- name: completion
- name: ping
@@ -96,7 +97,7 @@ paths:
get:
tags:
- version
description: Get the WeeChat and API versions
description: Get the WeeChat and API versions.
parameters:
- $ref: '#/components/parameters/totp'
operationId: getVersion
@@ -531,7 +532,7 @@ paths:
get:
tags:
- hotlist
description: Get hotlist
description: Get hotlist.
operationId: getHotlist
parameters:
- $ref: '#/components/parameters/totp'
@@ -564,6 +565,37 @@ paths:
$ref: '#/components/schemas/Error'
security:
- password: []
/scripts:
get:
tags:
- scripts
description: Get list of loaded scripts.
operationId: getScripts
parameters:
- $ref: '#/components/parameters/totp'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Script'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: Out of memory
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- password: []
/input:
post:
tags:
@@ -1336,6 +1368,31 @@ components:
- date
- buffer_id
- count
Script:
type: object
properties:
name:
type: string
description: script name
example: 'go.py'
version:
type: string
example: '3.1.1'
description:
type: string
example: 'Quick jump to buffers'
author:
type: string
example: 'Sébastien Helleu <flashcode@flashtux.org>'
license:
type: string
example: 'GPL3'
required:
- name
- version
- description
- author
- license
Completion:
type: object
properties:
+20 -12
View File
@@ -202,9 +202,9 @@ void
relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
{
int number;
char *pos, hash_key[32], *message, *new_msg1, *new_msg2;
char *pos, hash_key[32], *message, *new_msg1, *new_msg2, *ptr_msg1, *ptr_msg2;
char modifier_data[128];
const char *str_message, *ptr_msg1, *ptr_msg2;
const char *str_message;
struct t_hashtable *hashtable_in, *hashtable_out;
if (!client || !format)
@@ -234,7 +234,12 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
if (new_msg1 && !new_msg1[0])
goto end;
ptr_msg1 = (new_msg1) ? new_msg1 : vbuffer;
if (!new_msg1)
new_msg1 = strdup (vbuffer);
if (!new_msg1)
goto end;
ptr_msg1 = new_msg1;
pos = strchr (ptr_msg1, '\r');
if (pos)
@@ -275,7 +280,11 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...)
/* message not dropped? */
if (!new_msg2 || new_msg2[0])
{
ptr_msg2 = (new_msg2) ? new_msg2 : str_message;
if (!new_msg2)
new_msg2 = strdup (str_message);
if (!new_msg2)
break;
ptr_msg2 = new_msg2;
if (weechat_asprintf (&message, "%s\r\n", ptr_msg2) >= 0)
{
relay_client_send (client, RELAY_MSG_STANDARD,
@@ -470,10 +479,9 @@ relay_irc_signal_irc_outtags_cb (const void *pointer, void *data,
{
struct t_relay_client *client;
struct t_hashtable *hash_parsed;
const char *irc_command, *irc_args, *host, *ptr_message;
char *pos, *tags, *irc_channel, *message;
const char *irc_command, *irc_args, *host, *ptr_message, *pos;
char *pos_cr, *tags, *irc_channel, *message, str_infolist_args[256];
struct t_infolist *infolist_nick;
char str_infolist_args[256];
/* make C compiler happy */
(void) data;
@@ -487,9 +495,9 @@ relay_irc_signal_irc_outtags_cb (const void *pointer, void *data,
message = strdup ((char *)signal_data);
if (!message)
goto end;
pos = strchr (message, '\r');
if (pos)
pos[0] = '\0';
pos_cr = strchr (message, '\r');
if (pos_cr)
pos_cr[0] = '\0';
ptr_message = message;
@@ -1595,10 +1603,10 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
struct t_hashtable *hash_parsed, *hash_redirect;
struct t_infolist *infolist_server;
const char *irc_command, *str_num_params, *isupport, *pos_password;
const char *ptr_data, *ptr_nick_modes;
const char *ptr_data, *ptr_nick_modes, *pos;
char str_time[128], str_signal[128], str_server_channel[256], *nick;
char str_param[128], *str_args, *version, str_command[128], **params;
char *pos, *password, *irc_is_channel, *info, *error, *str_cmd_lower;
char *password, *irc_is_channel, *info, *error, *str_cmd_lower;
char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes;
long num_params;
int i, redirect_msg;
+4 -2
View File
@@ -999,7 +999,8 @@ struct t_relay_remote *
relay_config_get_remote_from_option_name (const char *name)
{
struct t_relay_remote *ptr_remote;
char *pos_option, *remote_name;
const char *pos_option;
char *remote_name;
ptr_remote = NULL;
@@ -1244,7 +1245,8 @@ relay_config_remote_read_cb (const void *pointer, void *data,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *remote_name;
const char *pos_option;
char *remote_name;
struct t_relay_remote *ptr_temp_remote;
int index_option;
+8 -6
View File
@@ -244,7 +244,8 @@ relay_http_parse_path (const char *path,
char ***paths, int *num_paths,
struct t_hashtable *params)
{
char *pos, *str_path, *str_params, **items_path, **items2_path;
const char *pos;
char *str_path, *str_params, **items_path, **items2_path;
char **items_params, *name, *value;
int i, num_items_path, num_items_params;
@@ -410,8 +411,8 @@ relay_http_parse_header (struct t_relay_http_request *request,
const char *header,
int ws_deflate_allowed)
{
char *pos, *name, *name_lower, *error, **items;
const char *existing_value, *ptr_value;
char *name, *name_lower, *error, **items;
const char *pos, *existing_value, *ptr_value;
int i, num_items;
long number;
@@ -999,7 +1000,8 @@ relay_http_process_request (struct t_relay_client *client)
void
relay_http_recv (struct t_relay_client *client, const char *data, int size)
{
char *new_partial, *pos, **null_char;
const void *null_char;
char *new_partial, *pos;
int length, ws_deflate_allowed;
null_char = memchr (data, 0, size);
@@ -1564,8 +1566,8 @@ int
relay_http_parse_response_header (struct t_relay_http_response *response,
const char *header)
{
char *pos, *name, *name_lower, *error;
const char *ptr_value;
char *name, *name_lower, *error;
const char *pos, *ptr_value;
long number;
/* empty line => end of headers */
+2 -2
View File
@@ -202,8 +202,8 @@ int
relay_remote_parse_url (const char *url,
int *tls, char **address, int *port)
{
const char *ptr_url;
char *pos, *str_port, *error;
const char *ptr_url, *pos;
char *str_port, *error;
long number;
if (tls)
+1 -1
View File
@@ -79,7 +79,7 @@ relay_server_get_protocol_args (const char *protocol_and_args,
char **protocol, char **protocol_args)
{
int opt_ipv4, opt_ipv6, opt_tls, opt_unix_socket;
char *pos;
const char *pos;
opt_ipv4 = -1;
opt_ipv6 = -1;
+13 -13
View File
@@ -586,9 +586,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
const char *path, const char *keys)
{
struct t_hdata *ptr_hdata_head, *ptr_hdata;
char *hdata_head, *pos, **list_keys, *keys_types, **list_path;
char *path_returned;
const char *hdata_name, *array_size;
char *hdata_head, **list_keys, *keys_types, **list_path;
char *path_returned, *pos_paren;
const char *hdata_name, *array_size, *pos;
void *pointer, **path_pointers;
unsigned long value;
int rc, num_keys, num_path, i, type, pos_count, count, rc_sscanf;
@@ -626,9 +626,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
/* extract pointer from first path (direct pointer or list name) */
pointer = NULL;
pos = strchr (list_path[0], '(');
if (pos)
pos[0] = '\0';
pos_paren = strchr (list_path[0], '(');
if (pos_paren)
pos_paren[0] = '\0';
if (strncmp (list_path[0], "0x", 2) == 0)
{
rc_sscanf = sscanf (list_path[0], "%lx", &value);
@@ -651,8 +651,8 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
}
else
pointer = weechat_hdata_get_list (ptr_hdata_head, list_path[0]);
if (pos)
pos[0] = '(';
if (pos_paren)
pos_paren[0] = '(';
if (!pointer)
goto end;
@@ -668,9 +668,9 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
strcpy (path_returned, hdata_head);
for (i = 1; i < num_path; i++)
{
pos = strchr (list_path[i], '(');
if (pos)
pos[0] = '\0';
pos_paren = strchr (list_path[i], '(');
if (pos_paren)
pos_paren[0] = '\0';
hdata_name = weechat_hdata_get_var_hdata (ptr_hdata, list_path[i]);
if (!hdata_name)
goto end;
@@ -679,8 +679,8 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
goto end;
strcat (path_returned, "/");
strcat (path_returned, hdata_name);
if (pos)
pos[0] = '(';
if (pos_paren)
pos_paren[0] = '(';
}
/* split keys */
@@ -1740,8 +1740,8 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(quit)
void
relay_weechat_protocol_recv (struct t_relay_client *client, const char *data)
{
const char *ptr_data;
char *data_unescaped, *pos, *id, *command, **argv, **argv_eol;
const char *ptr_data, *pos;
char *data_unescaped, *id, *command, **argv, **argv_eol;
int i, argc, return_code;
struct t_relay_weechat_protocol_cb protocol_cb[] =
{ { "handshake", &relay_weechat_protocol_cb_handshake },
+8 -6
View File
@@ -184,7 +184,8 @@ script_action_run_list_input (struct t_gui_buffer *buffer,
void
script_action_run_load (const char *name, int quiet)
{
char *pos, str_command[1024];
const char *pos;
char str_command[1024];
int language;
language = -1;
@@ -227,8 +228,8 @@ script_action_run_load (const char *name, int quiet)
void
script_action_run_unload (const char *name, int quiet)
{
char *pos, hdata_name[128], *filename, *ptr_base_name, str_command[1024];
const char *ptr_filename, *ptr_registered_name;
char hdata_name[128], *filename, *ptr_base_name, str_command[1024];
const char *pos, *ptr_filename, *ptr_registered_name;
int language, found, i;
struct t_hdata *hdata;
void *ptr_script;
@@ -332,8 +333,8 @@ script_action_run_unload (const char *name, int quiet)
void
script_action_run_reload (const char *name, int quiet)
{
char *pos, hdata_name[128], *filename, *ptr_base_name, str_command[1024];
const char *ptr_filename, *ptr_registered_name;
char hdata_name[128], *filename, *ptr_base_name, str_command[1024];
const char *pos, *ptr_filename, *ptr_registered_name;
int language, found, i;
struct t_hdata *hdata;
void *ptr_script;
@@ -443,7 +444,8 @@ void
script_action_run_autoload (const char *name, int quiet, int autoload)
{
struct t_script_repo *ptr_script;
char *pos, str_signal[256], *weechat_data_dir, *filename;
char str_signal[256], *weechat_data_dir, *filename;
const char *pos;
int language, script_found, script_autoloaded;
struct stat st;
+2 -2
View File
@@ -156,8 +156,8 @@ void
script_completion_exec_file_cb (void *data, const char *filename)
{
struct t_gui_completion *completion;
const char *extension;
char *pos, *filename2, *ptr_base_name;
const char *extension, *pos;
char *filename2, *ptr_base_name;
completion = (struct t_gui_completion *)(((void **)data)[0]);
extension = (const char *)(((void **)data)[1]);
+36
View File
@@ -159,6 +159,37 @@ script_info_info_script_loaded_cb (const void *pointer, void *data,
return NULL;
}
/*
* Return script info "script_languages".
*/
char *
script_info_info_languages_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char **output;
int i;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) info_name;
(void) arguments;
output = weechat_string_dyn_alloc (256);
for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++)
{
if (i > 0)
weechat_string_dyn_concat (output, ",", -1);
weechat_string_dyn_concat (output, script_language[i], -1);
weechat_string_dyn_concat (output, ":", -1);
weechat_string_dyn_concat (output, script_extension[i], -1);
}
return weechat_string_dyn_free (output, 0);
}
/*
* Return script infolist "script_script".
*/
@@ -235,6 +266,11 @@ script_info_init (void)
N_("1 if script is loaded"),
N_("script name with extension"),
&script_info_info_script_loaded_cb, NULL, NULL);
weechat_hook_info (
"script_languages",
N_("comma-separated list of plugin:extension with supported languages"),
NULL,
&script_info_info_languages_cb, NULL, NULL);
/* infolist hooks */
weechat_hook_infolist (
+1 -2
View File
@@ -714,8 +714,7 @@ script_repo_remove_all (void)
int
script_repo_script_is_held (struct t_script_repo *script)
{
const char *hold;
char *pos;
const char *hold, *pos;
int length;
hold = weechat_config_string (script_config_scripts_hold);
+2 -1
View File
@@ -140,7 +140,8 @@ void
spell_command_speller_list_dicts (void)
{
#ifndef USE_ENCHANT
char *country, *lang, *pos, *iso;
const char *pos;
char *country, *lang, *iso;
char str_dict[256], str_country[128];
struct AspellConfig *config;
AspellDictInfoList *list;
+1 -1
View File
@@ -391,7 +391,7 @@ spell_string_is_url (const char *word)
*/
int
spell_string_is_nick (struct t_gui_buffer *buffer, const char *word)
spell_string_is_nick (struct t_gui_buffer *buffer, char *word)
{
char *pos, *pos_nick_completer, *pos_space, saved_char;
const char *buffer_type, *buffer_nick, *buffer_channel;
+2 -2
View File
@@ -810,8 +810,8 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
const char *modifier, const char *modifier_data,
const char *string)
{
const char *ptr_string;
char *string_modified, *pos, *buffer_pointer;
const char *ptr_string, *pos;
char *string_modified, *buffer_pointer;
char *str_tags, **tags, *prefix, *string_no_color;
unsigned long value;
int num_tags, rc;
+2 -1
View File
@@ -550,7 +550,8 @@ trigger_config_trigger_read_cb (const void *pointer, void *data,
struct t_config_section *section,
const char *option_name, const char *value)
{
char *pos_option, *trigger_name;
const char *pos_option;
char *trigger_name;
struct t_trigger *ptr_temp_trigger;
int index_option;
+1 -2
View File
@@ -239,8 +239,7 @@ trigger_search (const char *name)
struct t_trigger *
trigger_search_with_option (struct t_config_option *option)
{
const char *ptr_name;
char *pos_option;
const char *ptr_name, *pos_option;
struct t_trigger *ptr_trigger;
int num_chars;
+2 -2
View File
@@ -76,7 +76,7 @@ struct t_weelist_item;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20260530-01"
#define WEECHAT_PLUGIN_API_VERSION "20260614-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -671,7 +671,7 @@ struct t_weechat_plugin
struct t_config_file **config_file,
struct t_config_section **section,
struct t_config_option **option,
char **pos_option_name);
const char **pos_option_name);
int (*config_string_to_boolean) (const char *text);
int (*config_option_reset) (struct t_config_option *option,
int run_callback);
+2 -2
View File
@@ -242,8 +242,8 @@ int
xfer_dcc_resume_hash (struct t_xfer *xfer)
{
char *buf;
unsigned long long total_read;
ssize_t length_buf, to_read, num_read;
unsigned long long total_read, length_buf, to_read;
ssize_t num_read;
int ret, fd;
total_read = 0;
+1 -1
View File
@@ -526,7 +526,7 @@ TEST(CoreConfigFile, SearchWithString)
struct t_config_file *ptr_config;
struct t_config_section *ptr_section;
struct t_config_option *ptr_option;
char *pos_option_name;
const char *pos_option_name;
ptr_config = (struct t_config_file *)0x1;
ptr_section = (struct t_config_section *)0x1;
@@ -23,13 +23,18 @@
#include "CppUTest/TestHarness.h"
#include "tests.h"
extern "C"
{
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <cjson/cJSON.h>
#include "src/core/core-hdata.h"
#include "src/core/core-hook.h"
#include "src/core/core-util.h"
#include "src/core/weechat.h"
#include "src/gui/gui-buffer.h"
#include "src/gui/gui-chat.h"
#include "src/gui/gui-color.h"
@@ -653,3 +658,63 @@ TEST(RelayApiMsg, HotlistToJson)
gui_hotlist_remove_buffer (gui_buffers, 1);
}
/*
* Test functions:
* relay_api_msg_script_to_json
*/
TEST(RelayApiMsg, ScriptToJson)
{
struct t_hdata *ptr_hdata;
void *ptr_script;
cJSON *json, *json_obj;
char path_testapigen[PATH_MAX], path_testapi[PATH_MAX];
char *test_scripts_dir, str_command[(PATH_MAX * 2) + 128];
const char *ptr_test_scripts_dir;
POINTERS_EQUAL(NULL, relay_api_msg_script_to_json (NULL, NULL, NULL));
ptr_hdata = hook_hdata_get (NULL, "python_script");
json = relay_api_msg_script_to_json (ptr_hdata, NULL, NULL);
CHECK(json);
CHECK(cJSON_IsObject (json));
cJSON_Delete (json);
/* load a python script for this test */
ptr_test_scripts_dir = getenv ("WEECHAT_TESTS_SCRIPTS_DIR");
test_scripts_dir = strdup (
(ptr_test_scripts_dir) ?
ptr_test_scripts_dir : "./scripts/python");
snprintf (path_testapigen, sizeof (path_testapigen),
"%s%s%s",
test_scripts_dir,
DIR_SEPARATOR,
"testapigen.py");
snprintf (path_testapi, sizeof (path_testapi),
"%s%s%s",
test_scripts_dir,
DIR_SEPARATOR,
"testapi.py");
snprintf (str_command, sizeof (str_command),
"/script load %s", path_testapigen);
run_cmd (str_command);
ptr_script = hdata_get_list (ptr_hdata, "scripts");
CHECK(ptr_script);
json = relay_api_msg_script_to_json (ptr_hdata, ptr_script, "py");
CHECK(json);
CHECK(cJSON_IsObject (json));
WEE_CHECK_OBJ_STR("testapigen.py", json, "name");
WEE_CHECK_OBJ_STR("0.1", json, "version");
WEE_CHECK_OBJ_STR("Generate scripting API test scripts", json, "description");
WEE_CHECK_OBJ_STR("Sébastien Helleu <flashcode@flashtux.org>", json, "author");
WEE_CHECK_OBJ_STR("GPL3", json, "license");
cJSON_Delete (json);
/* unload script */
snprintf (str_command, sizeof (str_command),
"/script unload -q weechat_testapi.py");
run_cmd (str_command);
}
@@ -23,6 +23,7 @@
#include "CppUTest/TestHarness.h"
#include "tests.h"
#include "tests-record.h"
extern "C"
@@ -34,6 +35,7 @@ extern "C"
#include "src/core/core-string.h"
#include "src/core/core-util.h"
#include "src/core/core-version.h"
#include "src/core/weechat.h"
#include "src/gui/gui-buffer.h"
#include "src/gui/gui-chat.h"
#include "src/gui/gui-hotlist.h"
@@ -611,6 +613,65 @@ TEST(RelayApiProtocolWithClient, CbHotlist)
gui_hotlist_remove_buffer (gui_buffers, 1);
}
/*
* Test functions:
* relay_api_protocol_cb_scripts
*/
TEST(RelayApiProtocolWithClient, CbScripts)
{
cJSON *json, *json_obj;
char path_testapigen[PATH_MAX], path_testapi[PATH_MAX];
char *test_scripts_dir, str_command[(PATH_MAX * 2) + 128];
const char *ptr_test_scripts_dir;
/* get scripts (no scripts loaded) */
test_client_recv_http ("GET /api/scripts", NULL, NULL);
WEE_CHECK_HTTP_CODE(200, "OK");
CHECK(json_body_sent[0]);
CHECK(cJSON_IsArray (json_body_sent[0]));
LONGS_EQUAL(0, cJSON_GetArraySize (json_body_sent[0]));
/* load a python script for this test */
ptr_test_scripts_dir = getenv ("WEECHAT_TESTS_SCRIPTS_DIR");
test_scripts_dir = strdup (
(ptr_test_scripts_dir) ?
ptr_test_scripts_dir : "./scripts/python");
snprintf (path_testapigen, sizeof (path_testapigen),
"%s%s%s",
test_scripts_dir,
DIR_SEPARATOR,
"testapigen.py");
snprintf (path_testapi, sizeof (path_testapi),
"%s%s%s",
test_scripts_dir,
DIR_SEPARATOR,
"testapi.py");
snprintf (str_command, sizeof (str_command),
"/script load %s", path_testapigen);
run_cmd (str_command);
/* get scripts (one loaded) */
test_client_recv_http ("GET /api/scripts", NULL, NULL);
WEE_CHECK_HTTP_CODE(200, "OK");
CHECK(json_body_sent[0]);
CHECK(cJSON_IsArray (json_body_sent[0]));
LONGS_EQUAL(1, cJSON_GetArraySize (json_body_sent[0]));
json = cJSON_GetArrayItem (json_body_sent[0], 0);
CHECK(json);
CHECK(cJSON_IsObject (json));
WEE_CHECK_OBJ_STR("testapigen.py", json, "name");
WEE_CHECK_OBJ_STR("0.1", json, "version");
WEE_CHECK_OBJ_STR("Generate scripting API test scripts", json, "description");
WEE_CHECK_OBJ_STR("Sébastien Helleu <flashcode@flashtux.org>", json, "author");
WEE_CHECK_OBJ_STR("GPL3", json, "license");
/* unload script */
snprintf (str_command, sizeof (str_command),
"/script unload -q weechat_testapi.py");
run_cmd (str_command);
}
/*
* Test functions:
* relay_api_protocol_cb_completion