1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

Compare commits

..

100 Commits

Author SHA1 Message Date
Sébastien Helleu 69078fea3c core: always write all options in theme files
Theme files saved with /theme save and automatic backups now always
contain every themable option (full snapshot), so a theme file is
self-contained and round-trips exactly regardless of the current
configuration. The diff-only mode and the "-full" argument of
/theme save are removed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu c0d15664dd core: fix description of automatic theme backup 2026-07-01 14:01:54 +02:00
Sébastien Helleu 0fbdd58892 core: add /theme rename to rename a user theme file 2026-07-01 14:01:54 +02:00
Sébastien Helleu a40522627d core: auto-detect terminal background and apply light theme on first start
Detect the terminal background (via COLORFGBG or an OSC 11 query) before
GUI init and, on the first start, automatically apply the built-in
"light" theme when a light terminal is detected.

The function gui_term_theme_is_light returns an int (1 if light, 0 otherwise,
0 being the safe value when detection is unsure).
2026-07-01 14:01:54 +02:00
Sébastien Helleu f5909ec122 core: fix style in comments 2026-07-01 14:01:54 +02:00
Sébastien Helleu 15fab2b92c core: display path to theme written with /theme save <name> 2026-07-01 14:01:54 +02:00
Sébastien Helleu 64060e5859 core: add /theme reset to restore original themable defaults 2026-07-01 14:01:54 +02:00
Sébastien Helleu 9d64324b4b tests: cover apply edge cases for /theme command 2026-07-01 14:01:54 +02:00
Sébastien Helleu 7de8e77fbe doc: add ChangeLog entry for /theme command and built-in light theme
Add six entries to the "Added" section of Version 4.10.0 in
CHANGELOG.md:

- the /theme command with its subcommands (list/apply/save/delete/
  info) and the automatic backup mechanism, plus the shipped
  "light" built-in theme;
- the themable flag on configuration options;
- the weechat.look.theme and weechat.look.theme_backup options;
- the theme_register plugin/script API function;
- the t:themable filter in fset.

No UPGRADING.md entry: the change is purely additive — default option
values are unchanged, so existing users see no visible difference
until they explicitly /theme apply light. weechat.look.theme is a new
option (empty by default at first launch) and weechat.look.theme_backup
defaults to "on".
2026-07-01 14:01:54 +02:00
Sébastien Helleu a188546fa6 doc: document /theme command and theme file format
Add the "Themes" section to user guides and plugin API references in
every language where the corresponding adoc exists.

User guide (10 files): English (the new prose) and French (a full
translation, with section title "Thèmes"). For the other languages —
German, Italian, Japanese, Polish, Serbian — the body is the English
text with only the section title localized where the existing Colors
section is localized (Themen / Motywy / Теме); Italian and Japanese
keep the English "Themes" title to match their existing English-only
section titles. Coverage by file:

  - doc/en/weechat_user.en.adoc       (new English section)
  - doc/fr/weechat_user.fr.adoc       (full French translation)
  - doc/de/weechat_user.de.adoc       (English body, "Themen" title)
  - doc/it/weechat_user.it.adoc       (English body and title)
  - doc/ja/weechat_user.ja.adoc       (English body and title)
  - doc/pl/weechat_user.pl.adoc       (English body, "Motywy" title)
  - doc/sr/weechat_user.sr.adoc       (English body, "Теме" title)

Plugin API reference (5 files): same approach — English plus full
French translation; Italian, Japanese and Serbian keep the English
body with their conventional section title:

  - doc/en/weechat_plugin_api.en.adoc (new English section)
  - doc/fr/weechat_plugin_api.fr.adoc (full French translation)
  - doc/it/weechat_plugin_api.it.adoc (English body and title)
  - doc/ja/weechat_plugin_api.ja.adoc (English body and title)
  - doc/sr/weechat_plugin_api.sr.adoc (English body, "Теме" title)

User-guide content covers themable options, /theme apply with the
automatic backup mechanism, /theme save and /theme delete with the
reserved-name rules, the .theme file format with a sample, and the
user-file-shadows-built-in resolution order. The API-reference content
documents weechat_theme_register (prototype, arguments, return value,
C example, Python example) with notes on the themable flag and
per-script auto-cleanup on script unload.

The /theme command's CMD_ARGS_DESC help text and the cmdline option
descriptions are picked up automatically by the doc generator
(doc-autogen), so no manual entries are needed there.
2026-07-01 14:01:54 +02:00
Sébastien Helleu 133fb88d86 script: track per-script theme contributions and purge on script unload
Make individual scripts the unit of ownership for theme contributions
so that loading a script that calls weechat.theme_register(...) and
later unloading it correctly removes the script's overrides.

Plugin API addition (weechat-plugin.h):

  - new function pointer t_weechat_plugin.theme_unregister_script
    delegates to core's theme_unregister_script.
  - new convenience macro weechat_theme_unregister_script(script).
  - WEECHAT_PLUGIN_API_VERSION bumped to 20260527-02.

Script API additions (plugin-script-api.{c,h}):

  - new plugin_script_api_theme_register (plugin, script, name,
    overrides) forwards to the plugin API with the script pointer
    as the contribution owner, so contributions are tracked
    per-script (not per script-language plugin).

Lifecycle wiring (plugin-script.c):

  - new file-local plugin_script_remove_themes (plugin, script)
    calls weechat_theme_unregister_script.
  - plugin_script_remove now calls it alongside the other
    plugin_script_remove_* helpers, so script-unload tears down
    everything (configs, bar items, themes, hooks).

Eight language bindings updated to call
plugin_script_api_theme_register instead of weechat_theme_register
directly, so they pass the script pointer as owner:

  - python, perl, ruby, lua, tcl, javascript, php, guile.

The behavior change is end-to-end visible only at script unload:
before, an unloaded script's theme overrides lingered in the
registry forever and would be re-applied on the next /theme apply;
after, they vanish when the script unloads. /plugin unload of an
entire script-language plugin already worked via commit 24's hook
in plugin_remove (which drops both plugin-only contributions and
their script-owned children when the language plugin itself goes
away, because the contribution's plugin pointer matches).

No new unit tests in this commit: the underlying theme_unregister_script
function is covered by TEST(CoreTheme, UnregisterByOwner), and the
remaining changes are plumbing.
2026-07-01 14:01:54 +02:00
Sébastien Helleu ca8ccf8c02 core: auto-purge plugin contributions on plugin unload
Call theme_unregister_plugin (plugin) from plugin_remove, right after
config_file_free_all_plugin and before unhook_all_plugin. This drops
every theme contribution whose plugin pointer matches the plugin being
unloaded, so subsequent /theme apply runs no longer try to set
options for an unloaded plugin and per-plugin contributions don't
outlive the plugin.

Script-owned contributions (plugin != NULL && script != NULL) are
left intact - they are cleaned up per-script in the next commit.

This commit is wiring only: the underlying theme_unregister_plugin
function and its semantics are already covered by
TEST(CoreTheme, UnregisterByOwner) in the previous commit.
2026-07-01 14:01:54 +02:00
Sébastien Helleu 63fc3b5cdc core: track per-contributor overrides in theme registry
Refactor the theme registry to store one sub-table per contributor
instead of a single merged hashtable. Each registered theme now holds
a linked list of t_theme_contribution entries:

  struct t_theme_contribution {
      struct t_weechat_plugin *plugin;  /* NULL = core */
      const void *script;               /* NULL for non-script */
      struct t_hashtable *overrides;
      ...
  };

Identity of a contributor is the (plugin, script) pair:

  - (NULL, NULL)     -> core (theme_builtin_init)
  - (plugin, NULL)   -> plugin-level contribution
  - (plugin, script) -> individual script (filled in by next commit)

theme_register is now (plugin, script, name, overrides). It searches
the existing contributions for a matching (plugin, script) and merges
the new overrides into it; otherwise it appends a fresh contribution.
The public macro weechat_theme_register(name, overrides) still takes
two args - it now expands to pass weechat_plugin and NULL for script.

theme_apply iterates contributions in list order, calling
config_file_option_set for each entry; later contributions naturally
win for duplicate keys.

Two new internal helpers prepare for the lifecycle work in the next
two commits:

  - theme_unregister_plugin (plugin): drops every contribution owned
    by that plugin (with script == NULL).
  - theme_unregister_script (plugin, script): drops every contribution
    owned by that script.

Neither is called yet; the auto-purge wiring lands in commits 24
(plugin_unloaded signal) and 25 (script API + script-unload hook).

Other touched code:

  - core-theme-builtin.c switches to theme_register (NULL, NULL, ...).
  - core-command.c /theme info uses theme_overrides_count helper
    instead of reaching into theme->overrides (which no longer
    exists).
  - WEECHAT_PLUGIN_API_VERSION bumped to 20260527-01 (function-pointer
    signature change).

Two new tests cover the new semantics:

  - UnregisterByOwner: registers four contributions from distinct
    (plugin, script) pairs, then prunes by plugin and by script,
    asserting per-contribution removal.
  - RegisterMergesPerContributor: two successive register calls from
    the same (plugin, script) merge into a single contribution with
    later keys overriding earlier ones.

Existing tests are updated to use the new theme_register signature,
theme_overrides_count, and theme_get_override (replacing direct
access to theme->overrides->items_count and hashtable_get on
theme->overrides). No plugin or script call sites change - the
public weechat_theme_register macro keeps the same shape.
2026-07-01 14:01:54 +02:00
Sébastien Helleu 39c1cee950 trigger: contribute "light" theme overrides
Add trigger-theme.{c,h} with the trigger plugin contribution to the
built-in "light" theme: 6 entries (flag_command, flag_conditions,
flag_post_action, flag_regex, flag_return_code, regex) tuned for a
light-background terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu eee38a9ebc spell: contribute "light" theme overrides
Add spell-theme.{c,h} with the spell plugin contribution to the
built-in "light" theme: 1 entry (spell.color.misspelled=red) tuned for
a light-background terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu b9f9bdb6d0 script: contribute "light" theme overrides
Add script-theme.{c,h} with the script plugin contribution to the
built-in "light" theme: 24 entries on script.color.* (status_* and
text_*) tuned for a light-background terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu 1886d370db relay: contribute "light" theme overrides
Add relay-theme.{c,h} with the relay plugin contribution to the
built-in "light" theme: 5 entries (status_auth_failed, status_authenticating,
status_connecting, status_disconnected, text_selected) tuned for a
light-background terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu 999acaa3db logger: contribute "light" theme overrides
Add logger-theme.{c,h} with the logger plugin contribution to the
built-in "light" theme: 2 entries (logger.color.backlog_end=darkgray,
logger.color.backlog_line=darkgray) tuned for a light-background
terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu c13f8d140b exec: contribute "light" theme overrides
Add exec-theme.{c,h} with the exec plugin contribution to the built-in
"light" theme: 2 entries (exec.color.flag_finished=red,
exec.color.flag_running=green) tuned for a light-background terminal.

Same 2D-array pattern as the other plugin contributions.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu a2d6e696e7 xfer: contribute "light" theme overrides
Add xfer-theme.{c,h} with the xfer plugin contribution to the built-in
"light" theme: 7 overrides on xfer.color.* (status_aborted,
status_active, status_connecting, status_done, status_failed,
status_waiting, text_selected) tuned for a light-background terminal.

Same NULL-terminated 2D-array pattern as the irc, fset and buflist
contributions; xfer_theme_init() is called once from
weechat_plugin_init after xfer_config_init / xfer_config_read.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu f7aa0a2f6a buflist: contribute "light" theme overrides
Add buflist-theme.{c,h} with the buflist plugin contribution to the
built-in "light" theme: 5 overrides on buflist.format.* options
(buffer_current, hotlist_low, hotlist_message, lag, number) tuned for
a light-background terminal. Each target is a "string|themable" option
holding an evaluated format expression with embedded ${color:...}
references.

Follows the same pattern as the irc and fset contributions: a
NULL-terminated 2D string table consumed by a tiny local register
helper that builds a hashtable and calls weechat_theme_register;
buflist_theme_init() is called once from weechat_plugin_init after
buflist_config_init / buflist_config_read.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu eee73f233c fset: contribute "light" theme overrides
Add fset-theme.{c,h} with the fset plugin contribution to the built-in
"light" theme: 47 overrides on fset.color.* options (line backgrounds,
selected-row tuning, title and value colors) tuned for a
light-background terminal.

The table is a NULL-terminated 2-column array of strings (no struct
wrapper, matching the pattern adopted for the irc contribution).
fset_theme_register builds a hashtable from the table and calls
weechat_theme_register; fset_theme_init() is called once from
weechat_plugin_init after fset_config_init / fset_config_read.

Default option values are NOT changed.
2026-07-01 14:01:54 +02:00
Sébastien Helleu e9650b21d0 irc: contribute "light" theme overrides
Add irc-theme.{c,h} with the IRC plugin contribution to the built-in
"light" theme: 9 overrides on irc.color.* options tuned for a
light-background terminal (input_nick, item_lag_finished,
item_tls_version_deprecated, list_buffer_line_selected,
message_chghost, message_setname, nick_prefixes, topic_new, topic_old).

The registration is a small wrapper around weechat_theme_register that
builds a hashtable from a static (option, value) table and frees it
after the call. irc_theme_init() is called from weechat_plugin_init
after irc_config_init/read so the option names are already created
when the theme registry references them.

Default option values are NOT changed.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 057e3f2f0b core: register built-in "light" theme
Add a small core-theme-builtin.c module containing the core
contribution to the "light" theme: 33 overrides for
"weechat.bar.{status,title}.color_*" and "weechat.color.*" tuned for
light-background terminals.

theme_builtin_init() builds a hashtable from the static entry table and
calls theme_register("light", overrides), then frees the temporary
hashtable. It is called once from weechat_init right after theme_init.
Calling it twice is a no-op (the registry merges identical keys).

Default option values are NOT changed. Existing configs render exactly
as before; users opt in with "/theme apply light".

Add TEST(CoreTheme, BuiltinInit) covering:
  - the "light" theme is absent before theme_builtin_init();
  - it is present after, with >= 30 overrides;
  - three spot-checked values match the source table;
  - calling theme_builtin_init() a second time does not change the
    override count.

Plugins contribute their own "light" overrides via weechat_theme_register
in subsequent commits.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 55b224427d script: expose theme_register to python, perl, ruby, lua, tcl, javascript, php, guile
Add weechat.theme_register (name, overrides) to all eight script
languages. Each binding is a mechanical translation of the same
signature:

  - name:      string
  - overrides: language-native dict / hash / associative array of
               full_option_name -> value strings
  - returns:   pointer-as-string of the registered t_theme (empty
               string on failure)

Each binding converts the dict to a struct t_hashtable using the
existing per-language helper (weechat_python_dict_to_hashtable,
weechat_perl_hash_to_hashtable, weechat_ruby_hash_to_hashtable,
weechat_lua_tohashtable, weechat_tcl_dict_to_hashtable,
weechat_js_object_to_hashtable, weechat_php_array_to_hashtable,
weechat_guile_alist_to_hashtable), calls weechat_theme_register,
frees the temporary hashtable, and returns the result. The new
function is registered right after the config_* functions so the API
listing stays grouped by topic.

PHP also receives a new arginfo entry (string, array -> string) in
both weechat-php_arginfo.h and weechat-php_legacy_arginfo.h.

This is plumbing only - the underlying theme_register function is
already covered by tests/unit/core/test-core-theme.cpp
(TEST(CoreTheme, Register)). No script-side tests are added here.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 20df571749 api: expose theme_register to plugins
Add a single new entry point to the plugin API:

  struct t_theme *weechat_theme_register (const char *name,
                                          struct t_hashtable *overrides);

Plugins call this at init time to contribute their per-theme color (or
other themable) overrides for a built-in theme like "dark". The
overrides hashtable maps full option names ("irc.color.input_nick") to
their string values; the caller retains ownership and may free it
right after the call. Repeated calls with the same theme name merge
into the existing registry entry, so each plugin can declare its own
contributions independently of core and of other plugins.

Wiring:

- struct t_theme forward-declared in weechat-plugin.h alongside the
  other opaque types.
- theme_register function pointer added to t_weechat_plugin.
- weechat_theme_register convenience macro added.
- plugin.c initializes the pointer to core's theme_register.
- WEECHAT_PLUGIN_API_VERSION bumped to 20260526-01.

This commit is plumbing only: the underlying theme_register function
already has unit-test coverage in tests/unit/core/test-core-theme.cpp
(TEST(CoreTheme, Register)), so no new tests are added here.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 959b3e4f56 core: add theme name completion
Add two completion items hooked alongside "layouts_names":

- "theme_themes_all": all theme names (built-ins from the registry
  plus every *.theme file in <weechat_config_dir>/themes/, including
  backup-*.theme). Used by tab-complete on /theme apply and
  /theme info.
- "theme_themes_user": user theme files only (excludes built-ins
  and backup-*.theme). Used by tab-complete on /theme save and
  /theme delete, so users cannot accidentally try to overwrite a
  built-in name or save a name colliding with the reserved backup
  prefix.

Both callbacks share a small dir_exec_on_files-based helper to filter
the themes directory. The /theme command's completion template in
core-command.c is updated to reference these new items.
2026-07-01 14:01:53 +02:00
Sébastien Helleu be2627c5dc core: implement /theme save and /theme delete
Add two complementary subcommands:

  /theme save <name> [-full]: writes a user theme file at
    ${weechat_config_dir}/themes/<name>.theme containing the current
    themable options. By default only options whose value differs from
    their default (config_file_option_has_changed) are written, which
    keeps the file small and focused. Pass "-full" to write every
    themable option (matches the format used by automatic backups).

    Name validation: refuses any name matching a built-in theme (those
    are reserved for in-memory registrations) and any name starting
    with "backup-" (reserved for /theme apply backups). Both checks
    print an error and abort without writing.

  /theme delete <name>: removes ${weechat_config_dir}/themes/<name>.theme
    via unlink. Refuses to delete a name registered as a built-in
    theme (a built-in has no file on disk to delete, even if the user
    has a shadowing file of the same name they cannot remove it this
    way; they can rename or delete it manually).

The full-snapshot writer used by /theme apply backups is refactored
into theme_write_file (name, description, diff_only). It is reused
by theme_make_backup (diff_only=0) and theme_save (diff_only inverted
from the user's -full flag).

Bug fix while at it: the writer was previously calling
config_file_option_value_to_string (ptr_option, 0, 1, 0); the third
and fourth arguments are "use_colors" and "use_delimiters", so the
call inserted GUI color escape codes into the file output and skipped
quoting strings. Corrected to (ptr_option, 0, 0, 1) so plain text
with proper string quoting is written; the change also fixes the
content of files produced by theme_make_backup in the previous commit.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 3e203d1fd5 core: implement theme file parsing and transient file reads in /theme apply
Add a small INI-style parser for *.theme files and wire it into the
/theme command so user themes living in directory "themes" inside the
WeeChat configuration directory can be applied (and inspected) without
ever being cached.

Parser (theme_file_parse in core-theme.c) accepts two sections:

  [info]
  name = "..."          \ shown by /theme info; ignored for apply
  description = "..."   |
  date = "..."          |
  weechat = "..."       /
  (unknown keys are ignored with a warning)

  [options]
  full.option.name = "value"

Surrounding single or double quotes around a value are stripped (same
rule used by the regular config file reader). The parsed result is a
heap-allocated t_theme; the caller frees with theme_free.

Resolution rule in theme_apply: if the path
"${weechat_config_dir}/themes/<name>.theme" is readable it is parsed
and used (file shadows any built-in of the same name); otherwise the
built-in registry is consulted. The transient t_theme is freed before
the final refresh, so user themes have no steady-state memory
footprint regardless of how many .theme files have accumulated.

/theme list now also scans the themes directory and appends user
files to the listing (each marked "(file)"). backup-*.theme are
hidden by default; pass "-backups" to include them.

/theme info <name> works for both sources: file path is shown when the
information comes from disk; "built-in (in-memory)" otherwise.
2026-07-01 14:01:53 +02:00
Sébastien Helleu f8822f4fbf core: implement /theme apply with themable enforcement and auto-backup
Implement /theme apply <name> for themes currently in the in-memory
registry. The file-shadowing branch (read a .theme file from
${weechat_config_dir}/themes/ when no built-in matches) is added in
the next commit together with the parser.

Apply algorithm (theme_apply in core-theme.c):

- Look up the theme in the registry; abort with an error if unknown.
- If weechat.look.theme_backup is on and the target name does not
  begin with "backup-", write a full snapshot of every themable
  option to ${weechat_config_dir}/themes/backup-<timestamp>.theme
  via theme_make_backup; abort the apply if the backup cannot be
  written, so the user can always undo.
- Iterate the theme's overrides with theme_applying=1 so the
  per-option config_change_color skips its gui refresh; for each
  entry look up the option, refuse it if missing or non-themable
  (warning to core buffer), otherwise call config_file_option_set.
- Perform a single gui_color_init_weechat + gui_window_ask_refresh
  at the end.
- Persist the active label in weechat.look.theme and send signal
  "theme_applied" with the name as data.

Add the new option weechat.look.theme_backup (boolean, default on)
which controls the backup-or-abort behaviour described above.

Wire the new /theme apply subcommand into core-command.c with the
existing /theme registration; update help text accordingly.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 4ea07c0880 core: add /theme command with list and info subcommands
Add the /theme command with two read-only subcommands for now:

- /theme  (or  /theme list): list registered themes; the active theme
  (matching weechat.look.theme) is marked with "->".
- /theme info <name>: show name, description, creation date, WeeChat
  version and override count of a theme.

Both subcommands only consider themes present in the in-memory
registry (registered via core/plugins/scripts). User theme files on
disk are not yet handled: the file parser and transient file reads
land in a later commit together with /theme apply.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 6b00d3de01 core: add weechat.look.theme option and theme_applying guard
Add a new string option "weechat.look.theme" holding the name of the
last theme applied via the upcoming /theme command. It is set
automatically by /theme apply and persisted on disk for /theme info to
display after restart; it is NOT re-applied at startup (the user's
saved color values win to avoid clobbering manual post-apply tweaks).

Amend config_change_color so it skips the gui_color_init_weechat ()
and gui_window_ask_refresh (1) calls when theme_applying is set.
/theme apply will set this flag while iterating overrides so the N
individual option changes do not trigger N redundant screen refreshes;
the apply path then performs a single refresh at the end.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 7c4773138f core: add core-theme skeleton and theme registry
Introduce a new module (core-theme.{c,h}) holding the in-memory registry
of built-in themes used by the upcoming /theme command:

- struct t_theme stores name, description, date and weechat version
  captured at registration time, plus a hashtable of overrides keyed by
  full option name (file.section.option) -> value string.
- theme_register (name, overrides) creates a new theme or merges the
  given overrides into an existing one (later calls override duplicate
  keys); this is the API plugins and scripts will use to contribute
  per-theme color values.
- theme_search and theme_list provide lookup and ordered enumeration.
- theme_init / theme_end are called from weechat_init / weechat_end.

The theme_applying flag is declared here but not yet consumed (it will
gate config_change_color in the next commit to avoid N redundant
window refreshes during /theme apply).

User theme files are not handled by this module: they are read
transiently inside /theme apply (a later commit) and never cached.
2026-07-01 14:01:53 +02:00
Sébastien Helleu f0f145e2ad fset: add "t:themable" filter
Extend the "t:" filter so the special value "themable" matches every
option whose new themable flag is set, regardless of type (color,
string, integer, boolean, enum). This makes the flag interactively
discoverable in the fset buffer and is the natural way to inspect the
surface area that an upcoming /theme command will be allowed to touch.

The themable flag of an option is now mirrored on struct t_fset_option,
exposed via hdata ("themable", integer) and infolist ("themable",
integer), and printed in the log.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 65a772ca38 core: add themable flag to configuration options
Add an "int themable" field on struct t_config_option. The flag is set
automatically for every CONFIG_OPTION_TYPE_COLOR option, and may be set
explicitly on any other type by suffixing the type argument with
"|themable" in the call to config_file_new_option (e.g. "string|themable"
for a string option whose value contains "${color:...}" references).

Opt in the relevant string options in core (buffer_time_format,
day_change_message_*, item_time_format, nick_color_force, prefix_*,
chat_nick_colors, eval_syntax_colors, color palette aliases) and in the
buflist, fset, irc, relay plugins.

The flag is exposed via hdata, infolist, and print_log so scripts and
/debug can read it. This is the foundation for an upcoming /theme
command that will only be allowed to modify themable options.
2026-07-01 14:01:53 +02:00
Sébastien Helleu 5a2c412ded core: set pointers to NULL after free of data when a buffer is closed (closes #2332) 2026-06-29 08:52:10 +02:00
Sébastien Helleu f3e14829ab ci: remove check of gettext files with msgcheck
Use only poexam to check gettext files.
2026-06-28 16:56:15 +02:00
Sébastien Helleu 376ea3cc9e ci: cache poexam binary 2026-06-28 16:55:36 +02:00
Sébastien Helleu df6b994d3b ci: bump poexam to version 0.0.12 2026-06-28 11:10:59 +02:00
Sébastien Helleu 1f9c3784c7 core: fix copyright and gettext headers 2026-06-28 08:59:43 +02:00
Ivan Pešić a217e9f72f Update of the Serbian translations (#2329)
* core: update Serbian translations

* doc: update Serbian translations
2026-06-27 08:59:03 +02:00
weechatter 8858d4b6b4 core: update German translations 2026-06-23 13:29:41 +02:00
Sébastien Helleu e9d998a9bf trigger: add unit for timer interval in /help trigger 2026-06-23 12:15:47 +02:00
Sébastien Helleu bfb34faa97 irc: replace "atol" by "atoll" for variables cast to time_t
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.
2026-06-21 08:19:42 +02:00
Sébastien Helleu a4b8d7aedd tcl: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to Tcl_GetLongFromObj by Tcl_GetWideIntFromObj.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 75b364cd89 ruby: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to NUM2ULONG by NUM2ULL.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 914d3df639 python: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Use "long long" for variables cast to time_t.
2026-06-21 08:19:42 +02:00
Sébastien Helleu a5404172c8 perl: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, the value returned by SvIV can
be 32-bit (its width depends on how Perl was built), whereas time_t is 64-bit.

Read the date with SvNV instead: a double represents all real timestamps
exactly, so the conversion to time_t no longer depends on the size of the Perl
integer type.
2026-06-21 08:19:42 +02:00
Sébastien Helleu 1dd423cb23 lua: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Use "long long" for variables cast to time_t.
2026-06-21 07:43:59 +02:00
Sébastien Helleu 8f33a72c99 guile: fix conversion of dates in the API functions
On modern 32-bit platforms with a 64-bit time_t, long is 32-bit but time_t is
64-bit.

Replace calls to scm_to_long by scm_to_long_long.
2026-06-21 07:42:02 +02:00
Sébastien Helleu f4564a1cb0 core, api: remove unneeded cast to time_t
The field `tv_sec` of struct timeval is already time_t, the cast is not needed.
2026-06-20 21:50:25 +02:00
Sébastien Helleu c4dfb16df0 core: use function util_parse_longlong to parse date in command /print 2026-06-20 17:30:42 +02:00
Sébastien Helleu 6facd390fe core: use function util_parse_longlong to parse time in function hdata_set 2026-06-20 17:30:41 +02:00
Sébastien Helleu 2aada3d0ca xfer: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 791c39cc84 trigger: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu ce6a214ce1 script: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 3c302e078d relay: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 90761d6350 api: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 4eba4f9a47 python: use function util_parse_int in API function hook_signal_send 2026-06-20 17:30:41 +02:00
Sébastien Helleu fcbb508cd7 javascript: use function util_parse_int in API function hook_signal_send 2026-06-20 17:30:41 +02:00
Sébastien Helleu b49eac6f2d irc: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 9b418b4dc2 fset: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 08b173f9b7 exec: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 42b91aa91d buflist: use util functions to parse integers 2026-06-20 17:30:41 +02:00
Sébastien Helleu 4ac2f6c2ad core: use util functions to parse integers in buffer functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 3d804810a0 core: use util functions to parse integers in window functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 987b03da39 core: use util functions to parse integers in nicklist functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu a1f1443fd8 core: use util functions to parse integers in function gui_line_hook_update 2026-06-20 17:30:41 +02:00
Sébastien Helleu ca8312a48c core: use function util_parse_int in function gui_key_grab_init 2026-06-20 17:30:41 +02:00
Sébastien Helleu 971f7b1660 core: use function util_parse_int in function gui_hotlist_clear_level_string 2026-06-20 17:30:41 +02:00
Sébastien Helleu 643f2fab5b core: use function util_parse_int in function gui_focus_info_hashtable_gui_focus_info_cb 2026-06-20 17:30:41 +02:00
Sébastien Helleu 5f36c52935 core: use function util_parse_int in color functions 2026-06-20 17:30:41 +02:00
Sébastien Helleu 92219ba132 core: use function util_parse_longlong in function gui_chat_hsignal_quote_line_cb 2026-06-20 17:30:41 +02:00
Matthew Horan 905a68739e doc/api: note that colors param is supported nicks endpoint 2026-06-20 17:18:23 +02:00
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
Sébastien Helleu 3aeaa70e64 ci: bump poexam to version 0.0.11 2026-06-07 21:56:22 +02:00
Sébastien Helleu 66e633e27e core: add version 4.9.2 2026-06-07 11:51:55 +02:00
Sébastien Helleu 436bbeceff tests: increase buffer size for injection of fake IRC message 2026-06-07 08:47:36 +02:00
118 changed files with 1572 additions and 1205 deletions
+25 -16
View File
@@ -115,10 +115,13 @@ jobs:
checks:
env:
POEXAM_VERSION: "0.0.12"
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -130,13 +133,20 @@ jobs:
run: |
sudo apt-get update -qq
sudo apt-get --yes --no-install-recommends install ${{ env.CHECK_DEPS_UBUNTU }}
pipx install msgcheck ruff
cargo install --version 0.0.10 poexam
pipx install ruff
- name: Check gettext files (msgcheck)
run: msgcheck po/*.po
- name: Cache poexam
id: cache-poexam
uses: actions/cache@v6
with:
path: ~/.cargo/bin/poexam
key: poexam-${{ env.POEXAM_VERSION }}-${{ runner.os }}
- name: Check gettext files (poexam)
- name: Install poexam
if: steps.cache-poexam.outputs.cache-hit != 'true'
run: cargo install --version "$POEXAM_VERSION" poexam
- name: Check gettext files
run: poexam check --file-stats --rule-stats
- name: Check shell and Python scripts
@@ -153,7 +163,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -194,6 +204,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 +215,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 +269,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -304,7 +315,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
- name: "gcc"
cc: "gcc"
@@ -355,7 +366,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
config:
# - name: "gcc"
# cc: "gcc"
@@ -450,7 +461,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -487,7 +498,7 @@ jobs:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-26.04
runs-on: ${{ matrix.os }}
@@ -505,8 +516,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
+2
View File
@@ -7,9 +7,11 @@ select = [
"checks",
]
ignore = [
"acronyms",
"brackets",
"double-quotes",
"double-words",
"functions",
"html-tags",
"paths",
"unchanged",
+27 -6
View File
@@ -12,6 +12,7 @@ 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
@@ -23,22 +24,42 @@ SPDX-License-Identifier: GPL-3.0-or-later
- core: add option weechat.look.theme_backup (boolean, default `on`)
- api: add function `theme_register` (available to plugins and to all script languages)
- fset: add filter `t:themable` (matches every themable option regardless of type)
- 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
- guile, lua, perl, python, ruby, tcl: fix conversion of dates in the API functions
- 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))
- irc: fix conversion of dates in received messages
- 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), [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))
- 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)
### Fixed
- api: fix infinite loop in function string_replace when the search string is empty
- irc: limit size of data received from the server to prevent memory exhaustion
- irc: fix out-of-bounds read on incoming DCC command with a quoted filename ending the message ([#2322](https://github.com/weechat/weechat/issues/2322))
- relay: limit size of 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 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 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))
- 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))
@@ -48,9 +69,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,
+53
View File
@@ -1034,6 +1034,13 @@ Path parameters:
confused with the buffer number, which is different)
* `buffer_name` (string, **required**): buffer name
Query parameters:
* `colors` (string, optional, default: `ansi`): how to return strings with color codes:
** `ansi`: return ANSI color codes
** `weechat`: return WeeChat internal color codes
** `strip`: strip colors
Request example: get nicks of a buffer:
[source,shell]
@@ -1179,6 +1186,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 +1562,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,
+54
View File
@@ -1046,6 +1046,14 @@ Paramètres de chemin :
confondre avec le numéro du tampon, qui est différent)
* `buffer_name` (chaîne, **obligatoire**) : nom du tampon
Paramètres de requête :
* `colors` (chaîne, facultatif, par défaut : `ansi`) : comment les chaînes avec
des couleurs sont retournées :
** `ansi` : retourner les codes couleur ANSI
** `weechat` : retourner les codes couleur internes WeeChat
** `strip` : supprimer les couleurs
Exemple de requête : obtenir les pseudos d'un tampon :
[source,shell]
@@ -1191,6 +1199,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 +1583,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,
+54 -1
View File
@@ -1030,12 +1030,19 @@ GET /api/buffers/{id_бафера}/nicks
GET /api/buffers/{име_бафера}/nicks
----
Параметри упита:
Параметри путање:
* `id_бафера` (цео број, **обавезно**): јединствени идентификатор бафера (не треба
да се помеша са бројем бафера, то је нешто друго)
* `име_бафера` (стринг, **обавезно**): име бафера
Параметри упита:
* `colors` (стринг, није обавезно, подразумевано: `ansi`): како се враћају стрингови са кодовима боје:
** `ansi`: враћају се ANSI кодови боје
** `weechat`: враћају се WeeChat интерни кодови боје
** `strip`: уклањају се боје
Пример захтева: врати надимке бафера:
[source,shell]
@@ -1181,6 +1188,51 @@ HTTP/1.1 200 OK
]
----
[[resource_scripts]]
=== Скрипте
Враћа учитане скрипте (на свим језицима).
Крајња тачка:
----
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 +1562,7 @@ GUID `258EAFA5-E914-47DA-95CA-C5AB0DC85B11` (SHA-1 се кодира у base64).
* `nick_group` (објекат)
* `nick` (објекат)
* `hotlist` (објекат)
* `scripts` (низ)
* `ping` (објекат)
[TIP]
+8 -2
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-23 12:14+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é)"
@@ -16686,7 +16690,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+16 -12
View File
@@ -1,7 +1,8 @@
#
# SPDX-FileCopyrightText: 2005 Rudolf Polzer <weechat-te@durchnull.de>
# SPDX-FileCopyrightText: 2006-2007 Thomas Schuetz <i18n@internet-villa.de>
# SPDX-FileCopyrightText: 2009-2019, 2023, 2024, 2025 Nils Görs <weechatter@arcor.de>
# SPDX-FileCopyrightText: 2009-2026 Nils Görs <weechatter@arcor.de>
# SPDX-FileCopyrightText: 2018 w8rabbit <w8rabbit@mail.i2p>
# SPDX-FileCopyrightText: 2015 Sven Knurr <zeug@tuxproject.de>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@@ -21,18 +22,14 @@
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
#
# w8rabbit <w8rabbit@mail.i2p>, 2018.
# Nils Görs <>, 2022-2026.
#
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"
"Report-Msgid-Bugs-To: weechatter@arcor.de\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:28+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German - Germany <weechat-dev@nongnu.org>\n"
"Language-Team: German <weechatter@arcor.de>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17510,6 +17507,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 "
@@ -18176,10 +18178,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr "> type `command_run`: Befehl(e) (erforderlich)"
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
"> type `timer`: Intervall (erforderlich), an Sekunden anpassen, maximale "
"Anzahl an Aufrufen"
"> type `timer`: Intervall (erforderlich, in Millisekunden), an Sekunde "
"anpassen, maximale Anzahl an Aufrufen"
msgid "> type `config`: name(s) of option (required)"
msgstr "> type `config`: Name der Einstellung (erforderlich)"
+11 -4
View File
@@ -24,10 +24,10 @@ 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-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:46+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: Spanish - Spain <weechat-dev@nongnu.org>\n"
"Language-Team: Spanish <weechat-dev@nongnu.org>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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 ""
@@ -16975,7 +16980,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+11 -6
View File
@@ -23,10 +23,10 @@ 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-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:32+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: French - France <weechat-dev@nongnu.org>\n"
"Language-Team: French <flashcode@flashtux.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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é) "
@@ -17834,10 +17837,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr "> type `command_run` : commande(s) (obligatoire)"
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
"> type `timer` : intervalle (obligatoire), alignement sur la seconde, nombre "
"max d'appels"
"> type `timer` : intervalle (obligatoire, en millisecondes), alignement sur "
"la seconde, nombre max d'appels"
msgid "> type `config`: name(s) of option (required)"
msgstr "> type `config` : nom(s) de l'option (obligatoire)"
+7 -2
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-23 12:14+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 ""
@@ -15907,7 +15910,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+9 -2
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-23 12:14+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 ""
@@ -17065,7 +17070,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+9 -2
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-23 12:14+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 ""
"拡張子を含めたスクリプト名 (ワイルドカード \"*\" を使うことができます) (任意)"
@@ -17640,7 +17645,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+16 -9
View File
@@ -1,5 +1,5 @@
#
# SPDX-FileCopyrightText: 2009-2016 Krzysztof Koroscik <soltys1@gmail.com>
# SPDX-FileCopyrightText: 2009-2026 Krzysztof Koroscik <soltys@soltys.info>
# SPDX-FileCopyrightText: 2010 B.J. Stobiecki <bartek@stobiecki.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@@ -19,21 +19,19 @@
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
# Krzysztof Korościk <soltys@soltys.info>, 2018, 2019, 2020.
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:02+0200\n"
"Report-Msgid-Bugs-To: soltys@soltys.info\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:55+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <weechat-dev@nongnu.org>\n"
"Language-Team: Polish <soltys@soltys.info>\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Poedit 3.8\n"
#. TRANSLATORS: command line option "-a", "--no-connect"
@@ -16747,6 +16745,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)\""
@@ -17383,7 +17386,11 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr "> typ `command_run`: komenda(-y) (wymagane)"
msgid "> type `timer`: interval (required), align on second, max calls"
#, fuzzy
#| msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
"> typ `timer`: interwał (wymagany), wyrównane do sekund, maksymalne wywołania"
+11 -4
View File
@@ -22,10 +22,10 @@ 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:02+0200\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:48+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese - Portugal <weechat-dev@nongnu.org>\n"
"Language-Team: Portuguese <weechat-dev@nongnu.org>\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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) "
@@ -17530,7 +17535,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+10 -4
View File
@@ -46,10 +46,10 @@ 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:02+0200\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:49+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: Portuguese - Brazil <weechat-dev@nongnu.org>\n"
"Language-Team: Portuguese (Brazil) <weechat-dev@nongnu.org>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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 ""
@@ -16462,7 +16466,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+7 -2
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-23 12:14+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 ""
@@ -15959,7 +15962,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+30 -45
View File
@@ -21,17 +21,16 @@
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:02+0200\n"
"Report-Msgid-Bugs-To: ivan.pesic@gmail.com\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:52+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: Serbian <weechat-dev@nongnu.org>\n"
"Language-Team: Serbian <ivan.pesic@gmail.com>\n"
"Language: sr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
#. TRANSLATORS: command line option "-a", "--no-connect"
msgid "disable auto-connect to servers at startup"
@@ -12664,16 +12663,14 @@ msgstr "%s%s: нисте повезани са сервером"
msgid "%s%s: this buffer is not a channel!"
msgstr "%s%s: овај бафер није канал!"
#, fuzzy, c-format
#| msgid ""
#| "%d channels (total: %d) | Filter: %s | Sort: %s | Key(input): ctrl+j=join "
#| "channel, ($)=refresh, (q)=close buffer"
#, c-format
msgid ""
"%d channels (total: %d) | Filter: %s | Sort: %s | Keys: ctrl+j=join channel "
"| Input: $=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer"
msgstr ""
"%d канала (укупно: %d) | Филтер: %s | Сортирање: %s | Тастер(унос): ctrl+j= "
"приступ каналу, ($)=освежавање, (q)=затварање бафера"
"%d канала (укупно: %d) | Филтер: %s | Сортирање: %s | Тастери: ctrl+j="
"приступ каналу | Унос: $=освежавање, s:x,y=сортирање, *=ресет филтера, "
"q=затварање бафера"
msgid "Empty list of channels, try \"$\" to refresh list"
msgstr "Празна листа канала, покушајте „$” да освежите листу"
@@ -15679,14 +15676,6 @@ msgstr ""
"relay.network.allow_empty_password) (напомена: садржај се израчунава, "
"погледајте /help eval)"
#, fuzzy
#| msgid ""
#| "comma separated list of hash algorithms used for password authentication "
#| "in weechat protocol, among these values: \"plain\" (password in plain "
#| "text, not hashed), \"sha256\", \"sha512\", \"pbkdf2+sha256\", "
#| "\"pbkdf2+sha512\"), \"*\" means all algorithms, a name beginning with \"!"
#| "\" is a negative value to prevent an algorithm from being used, wildcard "
#| "\"*\" is allowed in names (examples: \"*\", \"pbkdf2*\", \"*,!plain\")"
msgid ""
"comma separated list of hash algorithms used for password authentication in "
"\"api\" and \"weechat\" protocols, among these values: \"plain\" (password "
@@ -15696,28 +15685,22 @@ msgid ""
"is allowed in names (examples: \"*\", \"pbkdf2*\", \"*,!plain\")"
msgstr ""
"листа хеш алгоритама раздвојених запетама који се користе за аутентификацију "
"лозинке у weechat протоколу, могу бити: „plain” (лозинка је чисти текст, не "
"хешира се), „sha256”, „sha512”, „pbkdf2+sha256”, „pbkdf2+sha512”), „*” значи "
"сви алгоритми, име које почиње са „!” је негативна вредност којим се "
"спречава употреба тог алгоритма, у именима је дозвољена употреба џокера „*” "
"(примери: „*”, „pbkdf2*”, „*,!plain”)"
"лозинке у „api” и „weechat протоколима, који могу бити: „plain” (лозинка је "
"чисти текст, не хешира се), „sha256”, „sha512”, „pbkdf2+sha256”, „pbkdf2+"
"sha512”), „*” значи сви алгоритми, име које почиње са „!” је негативна "
"вредност којим се спречава употреба тог алгоритма, у именима је дозвољена "
"употреба џокера „*” (примери: „*”, „pbkdf2*”, „*,!plain”)"
#, fuzzy
#| msgid ""
#| "number of iterations asked to the client in weechat protocol when a "
#| "hashed password with algorithm PBKDF2 is used for authentication; more "
#| "iterations is better in term of security but is slower to compute; this "
#| "number should not be too high if your CPU is slow"
msgid ""
"number of iterations asked to the client in \"api\" and \"weechat\" "
"protocols when a hashed password with algorithm PBKDF2 is used for "
"authentication; more iterations is better in term of security but is slower "
"to compute; this number should not be too high if your CPU is slow"
msgstr ""
"број итерација који се захтева од клијента у weechat протоколу када се за "
"аутентификацију користи лозинка хеширана PBKDF2 алгоритмом ; више итерација "
"је боље у смислу безбедности, али је спорије за израчунавање; ако је ваш CPU "
"спор, овај број не би требало да буде сувише велики"
"број итерација који се захтева од клијента у „api” и „weechat протоколима "
"када се за аутентификацију користи лозинка хеширана PBKDF2 алгоритмом; више "
"итерација је боље у смислу безбедности, али је спорије за израчунавање; ако "
"је ваш CPU спор, овај број не би требало да буде сувише велики"
msgid ""
"number of seconds to allow before and after the current time for the hash of "
@@ -16303,22 +16286,17 @@ msgstr "(ништа)"
msgid "Alt+key/input: v=back to list d=jump to diff"
msgstr "Alt+тастер/унос: v=назад на листу d=скок на diff"
#, fuzzy, c-format
#| msgid ""
#| "%d/%d scripts (filter: %s) | Sort: %s | Alt+key/input: i=install, "
#| "r=remove, l=load, L=reload, u=unload, A=autoload, h=(un)hold, v=view "
#| "script | Input: q=close, $=refresh, s:x,y=sort, words=filter, *=reset "
#| "filter | Mouse: left=select, right=install/remove"
#, c-format
msgid ""
"%d/%d scripts | Filter: %s | Sort: %s | Alt+key/input: i=install, r=remove, "
"l=load, L=reload, u=unload, A=autoload, h=(un)hold, v=view script | Input: "
"$=refresh, s:x,y=sort, words=filter, *=reset filter, q=close buffer | Mouse: "
"left=select, right=install/remove"
msgstr ""
"%d/%d скрипти илтер: %s) | Сортирање: %s | Alt+тастер/унос: i=инсталација, "
"%d/%d скрипти | Филтер: %s | Сортирање: %s | Alt+тастер/унос: i=инсталација, "
"r=уклањање, l=учитавање, L=поновно учитавање, u=уклањање из меморије, "
"A=аутоучитавање, h=задржавање, v=преглед скрипте | Унос: q=затварање, "
"$=освежавање, s:x,y=сортирање, речи=филтер, *=ресет филтера | Миш: "
"$=освежавање, s:x,y=сортирање, words=филтер, *=ресет филтера | Миш: "
"леви=избор, десни=инсталација/уклањање"
msgid "Scripts"
@@ -16695,6 +16673,9 @@ msgstr "1 ако је скрипта учитана"
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 "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)"
@@ -17328,8 +17309,12 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr "> тип `command_run`: команд(а/е) (обавезно)"
msgid "> type `timer`: interval (required), align on second, max calls"
msgstr "> тип `timer`: интервал (обавезан), поравнање на секунди, макс позива"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
"> тип `timer`: интервал (обавезан, у милисекундама), поравнање на секунди, "
"макс позива"
msgid "> type `config`: name(s) of option (required)"
msgstr "> тип `config`: име(на) опције (обавезно)"
+13 -6
View File
@@ -1,6 +1,6 @@
#
# SPDX-FileCopyrightText: 2013 Hasan Kiran <sunder67@hotmail.com>
# SPDX-FileCopyrightText: 2020-2025 Emir SARI <emir_sari@icloud.com>
# SPDX-FileCopyrightText: 2020-2026 Emir SARI <emir_sari@icloud.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
@@ -22,11 +22,11 @@
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:02+0200\n"
"Report-Msgid-Bugs-To: emir_sari@icloud.com\n"
"POT-Creation-Date: 2026-06-23 12:14+0200\n"
"PO-Revision-Date: 2026-06-28 08:53+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <weechat-dev@nongnu.org>\n"
"Language-Team: Turkish <emir_sari@icloud.com>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\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ı)"
@@ -17750,7 +17755,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+7 -2
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-23 12:14+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 ""
@@ -14576,7 +14579,9 @@ msgstr ""
msgid "> type `command_run`: command(s) (required)"
msgstr ""
msgid "> type `timer`: interval (required), align on second, max calls"
msgid ""
"> type `timer`: interval (required, in milliseconds), align on second, max "
"calls"
msgstr ""
msgid "> type `config`: name(s) of option (required)"
+3 -3
View File
@@ -5537,7 +5537,7 @@ COMMAND_CALLBACK(print)
struct timeval tv_date;
char *tags, *pos, *text, *text2, empty_string[1] = { '\0' };
const char *prefix, *ptr_text;
long value;
long long value;
/* make C compiler happy */
(void) pointer;
@@ -5610,7 +5610,7 @@ COMMAND_CALLBACK(print)
i++;
if ((argv[i][0] == '-') || (argv[i][0] == '+'))
{
if (!util_parse_long (argv[i] + 1, 10, &value))
if (!util_parse_longlong (argv[i] + 1, 10, &value))
COMMAND_ERROR;
gettimeofday (&tv_date, NULL);
tv_date.tv_sec += (argv[i][0] == '+') ? value : value * -1;
@@ -7646,7 +7646,7 @@ command_upgrade_display (struct t_gui_buffer *buffer,
str_first_start[0] = '\0';
str_last_start[0] = '\0';
weechat_last_start_time = (time_t)weechat_current_start_timeval.tv_sec;
weechat_last_start_time = weechat_current_start_timeval.tv_sec;
if (translated_string)
{
+6 -5
View File
@@ -706,8 +706,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, themable;
char *pos, *option_name, *parent_name, *type_name;
const char *ptr_type;
const char *pos, *ptr_type;
char *option_name, *parent_name, *type_name;
new_option = NULL;
option_name = NULL;
@@ -1123,12 +1123,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;
@@ -2583,7 +2584,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
@@ -288,7 +288,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
@@ -1712,7 +1712,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" },
@@ -1742,7 +1742,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 */
@@ -2265,7 +2265,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;
@@ -2344,7 +2345,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;
@@ -2424,7 +2426,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;
@@ -2515,7 +2518,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)
+4 -3
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)
@@ -1312,9 +1313,9 @@ hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
}
break;
case WEECHAT_HDATA_TIME:
if (util_parse_long (value, 10, &number_long) && (number_long >= 0))
if (util_parse_longlong (value, 10, &number_longlong) && (number_longlong >= 0))
{
*((time_t *)(pointer + var->offset)) = (time_t)number_long;
*((time_t *)(pointer + var->offset)) = (time_t)number_longlong;
return 1;
}
break;
+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)
+70 -98
View File
@@ -1764,17 +1764,13 @@ void
gui_buffer_set_notify (struct t_gui_buffer *buffer, const char *notify)
{
const char *ptr_notify;
char *error;
long number;
int mute_old;
int mute_old, number;
if (!buffer)
return;
ptr_notify = NULL;
error = NULL;
number = strtol (notify, &error, 10);
if (error && !error[0])
if (util_parse_int (notify, 10, &number))
{
if (number < GUI_BUFFER_NUM_NOTIFY)
{
@@ -2232,9 +2228,8 @@ void
gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
const char *new_hotlist_max_level_nicks)
{
char **nicks, *pos, *error;
int nicks_count, value, i;
long number;
char **nicks, *pos;
int nicks_count, number, value, i;
if (!buffer)
return;
@@ -2260,13 +2255,10 @@ gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
{
pos[0] = '\0';
pos++;
error = NULL;
number = strtol (pos, &error, 10);
if (error && !error[0])
value = (int)number;
if (util_parse_int (pos, 10, &number))
value = number;
}
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i],
&value);
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], &value);
}
string_free_split (nicks);
}
@@ -2279,9 +2271,8 @@ void
gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
const char *nicks_to_add)
{
char **nicks, *pos, *error;
int nicks_count, value, i;
long number;
char **nicks, *pos;
int nicks_count, number, value, i;
if (!buffer || !nicks_to_add)
return;
@@ -2302,13 +2293,10 @@ gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
{
pos[0] = '\0';
pos++;
error = NULL;
number = strtol (pos, &error, 10);
if (error && !error[0])
value = (int)number;
if (util_parse_int (pos, 10, &number))
value = number;
}
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i],
&value);
hashtable_set (buffer->hotlist_max_level_nicks, nicks[i], &value);
}
string_free_split (nicks);
}
@@ -2454,9 +2442,7 @@ void
gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
{
struct t_gui_line *old_last_read_line;
int i, old_first_line_not_read;
long number;
char *error;
int i, number, old_first_line_not_read;
if (!buffer || (buffer->type != GUI_BUFFER_TYPE_FORMATTED))
return;
@@ -2479,9 +2465,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else if (argument[0] == '-')
{
/* move the unread marker N lines towards the first line */
error = NULL;
number = strtol (argument, &error, 10);
if (error && !error[0] && (number < 0))
if (util_parse_int (argument, 10, &number) && (number < 0))
{
for (i = 0; i > number; i--)
{
@@ -2507,9 +2491,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else if (argument[0] == '+')
{
/* move the unread marker N lines towards the last line */
error = NULL;
number = strtol (argument, &error, 10);
if (error && !error[0] && (number > 0))
if (util_parse_int (argument, 10, &number) && (number > 0))
{
for (i = 0; i < number; i++)
{
@@ -2533,9 +2515,7 @@ gui_buffer_set_unread (struct t_gui_buffer *buffer, const char *argument)
else
{
/* move the unread marker N lines from the end towards the first line */
error = NULL;
number = strtol (argument, &error, 10);
if (error && !error[0] && (number > 0))
if (util_parse_int (argument, 10, &number) && (number > 0))
{
buffer->lines->last_read_line = buffer->lines->last_line;
buffer->lines->first_line_not_read = 0;
@@ -2569,8 +2549,7 @@ void
gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
const char *value)
{
long number;
char *error;
int number;
if (!property || !value)
return;
@@ -2584,9 +2563,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
gui_add_hotlist = 1;
else if (buffer)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
{
if (number < 0)
{
@@ -2614,9 +2591,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
/* properties that need a buffer */
if (strcmp (property, "hotlist_conditions") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
{
if (number < 0)
{
@@ -2650,9 +2625,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (strcmp (property, "hidden") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
{
if (number)
gui_buffer_hide (buffer);
@@ -2662,37 +2635,27 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (strcmp (property, "print_hooks_enabled") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
buffer->print_hooks_enabled = (number) ? 1 : 0;
}
else if (strcmp (property, "day_change") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_day_change (buffer, number);
}
else if (strcmp (property, "clear") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
buffer->clear = (number) ? 1 : 0;
}
else if (strcmp (property, "filter") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_filter (buffer, number);
}
else if (strcmp (property, "number") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0] && (number >= 1))
if (util_parse_int (value, 10, &number) && (number >= 1))
gui_buffer_move_to_number (buffer, number);
}
else if (strcmp (property, "name") == 0)
@@ -2724,30 +2687,22 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (strcmp (property, "time_for_each_line") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_time_for_each_line (buffer, number);
}
else if (strcmp (property, "nicklist") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_nicklist (buffer, number);
}
else if (strcmp (property, "nicklist_case_sensitive") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_nicklist_case_sensitive (buffer, number);
}
else if (strcmp (property, "nicklist_display_groups") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_nicklist_display_groups (buffer, number);
}
else if (strcmp (property, "highlight_words") == 0)
@@ -2816,37 +2771,27 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
}
else if (strcmp (property, "input_pos") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_input_set_pos (buffer, number);
}
else if (strcmp (property, "input_get_any_user_data") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_input_get_any_user_data (buffer, number);
}
else if (strcmp (property, "input_get_unknown_commands") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_input_get_unknown_commands (buffer, number);
}
else if (strcmp (property, "input_get_empty") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_input_get_empty (buffer, number);
}
else if (strcmp (property, "input_multiline") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
gui_buffer_set_input_multiline (buffer, number);
}
else if (strncmp (property, "localvar_set_", 13) == 0)
@@ -3076,7 +3021,6 @@ gui_buffer_search (const char *plugin, const char *name)
struct t_gui_buffer *ptr_buffer;
int plugin_match, plugin_case_sensitive, name_case_sensitive;
long long id;
char *error;
if (!name || !name[0])
return gui_current_window->buffer;
@@ -3086,9 +3030,9 @@ gui_buffer_search (const char *plugin, const char *name)
if (plugin && (strcmp (plugin, "==id") == 0))
{
error = NULL;
id = strtoll (name, &error, 10);
return (error && !error[0]) ? gui_buffer_search_by_id (id) : NULL;
if (util_parse_longlong (name, 10, &id))
return gui_buffer_search_by_id (id);
return NULL;
}
plugin_case_sensitive = 1;
@@ -3317,16 +3261,13 @@ gui_buffer_search_by_id_number_name (const char *string)
{
struct t_gui_buffer *ptr_buffer;
long long number;
char *error;
if (!string)
if (!string || !string[0])
return NULL;
ptr_buffer = NULL;
error = NULL;
number = strtoll (string, &error, 10);
if (error && !error[0])
if (util_parse_longlong (string, 10, &number))
{
ptr_buffer = gui_buffer_search_by_id (number);
if (!ptr_buffer)
@@ -3834,6 +3775,7 @@ gui_buffer_close (struct t_gui_buffer *buffer)
gui_hotlist_remove_buffer (buffer, 1);
free (buffer->hotlist_removed);
buffer->hotlist_removed = NULL;
if (gui_hotlist_initial_buffer == buffer)
gui_hotlist_initial_buffer = NULL;
@@ -3852,55 +3794,85 @@ gui_buffer_close (struct t_gui_buffer *buffer)
/* free all lines */
gui_line_free_all (buffer);
free (buffer->own_lines);
buffer->own_lines = NULL;
free (buffer->mixed_lines);
buffer->mixed_lines = NULL;
/* free some data */
gui_buffer_undo_free_all (buffer);
gui_history_buffer_free (buffer);
gui_completion_free (buffer->completion);
buffer->completion = NULL;
gui_nicklist_remove_all (buffer);
gui_nicklist_remove_group (buffer, buffer->nicklist_root);
buffer->nicklist_root = NULL;
hashtable_free (buffer->hotlist_max_level_nicks);
buffer->hotlist_max_level_nicks = NULL;
gui_key_free_all (-1, &buffer->keys, &buffer->last_key,
&buffer->keys_count, 0);
gui_buffer_local_var_remove_all (buffer);
hashtable_free (buffer->local_variables);
buffer->local_variables = NULL;
free (buffer->plugin_name_for_upgrade);
buffer->plugin_name_for_upgrade = NULL;
free (buffer->name);
buffer->name = NULL;
free (buffer->full_name);
buffer->full_name = NULL;
free (buffer->old_full_name);
buffer->old_full_name = NULL;
free (buffer->short_name);
buffer->short_name = NULL;
free (buffer->title);
buffer->title = NULL;
free (buffer->modes);
buffer->modes = NULL;
free (buffer->input_prompt);
buffer->input_prompt = NULL;
free (buffer->input_buffer);
buffer->input_buffer = NULL;
free (buffer->input_undo_snap);
buffer->input_undo_snap = NULL;
free (buffer->text_search_input);
buffer->text_search_input = NULL;
if (buffer->text_search_regex_compiled)
{
regfree (buffer->text_search_regex_compiled);
free (buffer->text_search_regex_compiled);
buffer->text_search_regex_compiled = NULL;
}
free (buffer->highlight_words);
buffer->highlight_words = NULL;
free (buffer->highlight_disable_regex);
buffer->highlight_disable_regex = NULL;
if (buffer->highlight_disable_regex_compiled)
{
regfree (buffer->highlight_disable_regex_compiled);
free (buffer->highlight_disable_regex_compiled);
buffer->highlight_disable_regex_compiled = NULL;
}
free (buffer->highlight_regex);
buffer->highlight_regex = NULL;
if (buffer->highlight_regex_compiled)
{
regfree (buffer->highlight_regex_compiled);
free (buffer->highlight_regex_compiled);
buffer->highlight_regex_compiled = NULL;
}
free (buffer->highlight_tags_restrict);
buffer->highlight_tags_restrict = NULL;
string_free_split_tags (buffer->highlight_tags_restrict_array);
buffer->highlight_tags_restrict_array = NULL;
free (buffer->highlight_tags);
buffer->highlight_tags = NULL;
string_free_split_tags (buffer->highlight_tags_array);
buffer->highlight_tags_array = NULL;
free (buffer->input_callback_data);
buffer->input_callback_data = NULL;
free (buffer->close_callback_data);
buffer->close_callback_data = NULL;
free (buffer->nickcmp_callback_data);
buffer->nickcmp_callback_data = NULL;
/* remove buffer from buffers list */
if (buffer->prev_buffer)
+5 -9
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,
@@ -1400,7 +1400,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
struct timeval tv;
struct t_gui_line *ptr_line;
int is_nick, rc;
char str_time[128], *str, *error;
char str_time[128], *str;
/* make C compiler happy */
(void) pointer;
@@ -1415,9 +1415,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
hashtable_get (hashtable, "_chat_line_date") : NULL;
if (ptr_date)
{
error = NULL;
number = strtoll (ptr_date, &error, 10);
if (error && !error[0])
if (util_parse_longlong (ptr_date, 10, &number))
{
tv.tv_sec = (time_t)number;
tv.tv_usec = 0;
@@ -1425,9 +1423,7 @@ gui_chat_hsignal_quote_line_cb (const void *pointer, void *data,
hashtable_get (hashtable, "_chat_line_date_usec") : NULL;
if (ptr_date_usec)
{
error = NULL;
number = strtoll (ptr_date_usec, &error, 10);
if (error && !error[0])
if (util_parse_longlong (ptr_date_usec, 10, &number))
tv.tv_usec = (long)number;
}
util_strftimeval (str_time, sizeof (str_time),
+17 -41
View File
@@ -41,6 +41,7 @@
#include "../core/core-list.h"
#include "../core/core-string.h"
#include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-color.h"
#include "gui-chat.h"
@@ -170,8 +171,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 +255,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, *color_attr;
const char *ptr_color_name, *pos_delim, *pos_bg;
/* attribute or other color name (GUI dependent) */
index_color = (index_color + 1) % 32;
@@ -439,9 +439,7 @@ gui_color_get_custom (const char *color_name)
fg_term = gui_color_palette_get_alias (str_fg);
if (fg_term < 0)
{
error = NULL;
term_color = (int)strtol (str_fg, &error, 10);
if (error && !error[0])
if (util_parse_int (str_fg, 10, &term_color))
{
fg_term = term_color;
if (fg_term < 0)
@@ -458,9 +456,7 @@ gui_color_get_custom (const char *color_name)
bg_term = gui_color_palette_get_alias (pos_bg);
if (bg_term < 0)
{
error = NULL;
term_color = (int)strtol (pos_bg, &error, 10);
if (error && !error[0])
if (util_parse_int (pos_bg, 10, &term_color))
{
bg_term = term_color;
if (bg_term < 0)
@@ -1287,7 +1283,7 @@ char *
gui_color_encode_ansi (const char *string)
{
const unsigned char *ptr_string;
char **out, str_concat[128], str_color[8], *error;
char **out, str_concat[128], str_color[8];
int flag, color, length, ansi_color, fg, bg, attrs;
if (!string)
@@ -1321,9 +1317,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 5);
str_color[5] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm",
@@ -1344,9 +1338,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 2);
str_color[2] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat),
@@ -1371,9 +1363,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 5);
str_color[5] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
snprintf (str_concat, sizeof (str_concat),
"\x1B[48;5;%dm",
@@ -1389,9 +1379,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 2);
str_color[2] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat),
@@ -1421,9 +1409,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 5);
str_color[5] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm",
@@ -1444,9 +1430,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 2);
str_color[2] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat),
@@ -1477,9 +1461,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 5);
str_color[5] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
snprintf (str_concat, sizeof (str_concat),
"\x1B[48;5;%dm",
@@ -1496,9 +1478,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 2);
str_color[2] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
ansi_color = gui_color_weechat_to_ansi (color);
snprintf (str_concat, sizeof (str_concat),
@@ -1522,9 +1502,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 5);
str_color[5] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0])
if (util_parse_int (str_color, 10, &color))
{
snprintf (str_concat, sizeof (str_concat),
"\x1B[38;5;%dm",
@@ -1596,9 +1574,7 @@ gui_color_encode_ansi (const char *string)
{
memcpy (str_color, ptr_string, 2);
str_color[2] = '\0';
error = NULL;
color = (int)strtol (str_color, &error, 10);
if (error && !error[0]
if (util_parse_int (str_color, 10, &color)
&& (color >= 0)
&& (color < GUI_COLOR_NUM_COLORS))
{
+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)
+5 -9
View File
@@ -32,6 +32,7 @@
#include "../core/core-hashtable.h"
#include "../core/core-hook.h"
#include "../core/core-string.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-bar.h"
#include "gui-bar-window.h"
@@ -280,11 +281,10 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data,
const char *info_name,
struct t_hashtable *hashtable)
{
char *error;
const char *ptr_value;
int x, y;
struct t_gui_focus_info *focus_info;
struct t_hashtable *focus_hashtable, *ret_hashtable;
const char *ptr_value;
int x, y;
/* make C compiler happy */
(void) pointer;
@@ -298,17 +298,13 @@ gui_focus_info_hashtable_gui_focus_info_cb (const void *pointer, void *data,
ptr_value = hashtable_get (hashtable, "x");
if (!ptr_value)
return NULL;
error = NULL;
x = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
if (!util_parse_int (ptr_value, 10, &x))
return NULL;
ptr_value = hashtable_get (hashtable, "y");
if (!ptr_value)
return NULL;
error = NULL;
y = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
if (!util_parse_int (ptr_value, 10, &y))
return NULL;
/* get focus info */
+3 -7
View File
@@ -623,10 +623,8 @@ void
gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
const char *str_level_mask)
{
long level_mask;
char *error;
struct t_gui_hotlist *ptr_hotlist;
int priority;
int level_mask, priority;
if (str_level_mask)
{
@@ -665,11 +663,9 @@ gui_hotlist_clear_level_string (struct t_gui_buffer *buffer,
else
{
/* clear hotlist using a mask of levels */
error = NULL;
level_mask = strtol (str_level_mask, &error, 10);
if (error && !error[0] && (level_mask > 0))
if (util_parse_int (str_level_mask, 10, &level_mask) && (level_mask > 0))
{
gui_hotlist_clear ((int)level_mask);
gui_hotlist_clear (level_mask);
gui_hotlist_initial_buffer = buffer;
}
}
+4 -6
View File
@@ -44,6 +44,7 @@
#include "../core/core-log.h"
#include "../core/core-string.h"
#include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-key.h"
#include "gui-bar.h"
@@ -193,8 +194,7 @@ gui_key_get_current_context (void)
void
gui_key_grab_init (int grab_command, const char *delay)
{
long milliseconds;
char *error;
int milliseconds;
gui_key_grab = 1;
gui_key_grab_count = 0;
@@ -203,9 +203,7 @@ gui_key_grab_init (int grab_command, const char *delay)
gui_key_grab_delay = CONFIG_INTEGER(config_look_key_grab_delay);
if (delay != NULL)
{
error = NULL;
milliseconds = strtol (delay, &error, 10);
if (error && !error[0] && (milliseconds >= 0))
if (util_parse_int (delay, 10, &milliseconds) && (milliseconds >= 0))
{
gui_key_grab_delay = milliseconds;
if (gui_key_grab_delay == 0)
@@ -1076,7 +1074,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++)
{
+24 -28
View File
@@ -39,6 +39,7 @@
#include "../core/core-infolist.h"
#include "../core/core-log.h"
#include "../core/core-string.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-line.h"
#include "gui-buffer.h"
@@ -1674,10 +1675,10 @@ gui_line_hook_update (struct t_gui_line *line,
const char *ptr_value, *ptr_value2;
struct t_gui_buffer *ptr_buffer;
unsigned long value_pointer;
long value;
char *error, *new_message, *pos_newline;
long long value_longlong;
char *new_message, *pos_newline;
int rc, tags_updated, notify_level_updated, highlight_updated;
int max_notify_level;
int max_notify_level, value;
tags_updated = 0;
notify_level_updated = 0;
@@ -1730,9 +1731,7 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value = hashtable_get (hashtable2, "y");
if (ptr_value)
{
error = NULL;
value = strtol (ptr_value, &error, 10);
if (error && !error[0] && (value >= 0))
if (util_parse_int (ptr_value, 10, &value) && (value >= 0))
line->data->y = value;
}
}
@@ -1740,9 +1739,8 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "notify_level");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0] && (value >= -1) && (value <= GUI_HOTLIST_MAX))
if (util_parse_int (ptr_value2, 10, &value)
&& (value >= -1) && (value <= GUI_HOTLIST_MAX))
{
notify_level_updated = 1;
line->data->notify_level = value;
@@ -1752,9 +1750,7 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "highlight");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0])
if (util_parse_int (ptr_value2, 10, &value))
{
highlight_updated = 1;
line->data->highlight = (value) ? 1 : 0;
@@ -1764,11 +1760,10 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0] && (value >= 0))
if (util_parse_longlong (ptr_value2, 10, &value_longlong)
&& (value_longlong >= 0))
{
line->data->date = (time_t)value;
line->data->date = (time_t)value_longlong;
free (line->data->str_time);
line->data->str_time = gui_chat_get_time_string (
line->data->date,
@@ -1780,11 +1775,10 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date_usec");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0] && (value >= 0) && (value <= 999999))
if (util_parse_int (ptr_value2, 10, &value)
&& (value >= 0) && (value <= 999999))
{
line->data->date_usec = (int)value;
line->data->date_usec = value;
free (line->data->str_time);
line->data->str_time = gui_chat_get_time_string (
line->data->date,
@@ -1796,19 +1790,21 @@ gui_line_hook_update (struct t_gui_line *line,
ptr_value2 = hashtable_get (hashtable2, "date_printed");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0] && (value >= 0))
line->data->date_printed = (time_t)value;
if (util_parse_longlong (ptr_value2, 10, &value_longlong)
&& (value_longlong >= 0))
{
line->data->date_printed = (time_t)value_longlong;
}
}
ptr_value2 = hashtable_get (hashtable2, "date_usec_printed");
if (ptr_value2)
{
error = NULL;
value = strtol (ptr_value2, &error, 10);
if (error && !error[0] && (value >= 0) && (value <= 999999))
line->data->date_usec_printed = (int)value;
if (util_parse_int (ptr_value2, 10, &value)
&& (value >= 0) && (value <= 999999))
{
line->data->date_usec_printed = value;
}
}
ptr_value = hashtable_get (hashtable, "str_time");
+9 -22
View File
@@ -44,6 +44,7 @@
#include "../core/core-log.h"
#include "../core/core-string.h"
#include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-nicklist.h"
#include "gui-buffer.h"
@@ -275,7 +276,6 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
const char *name)
{
const char *ptr_name;
char *error;
long long id;
if ((!buffer && !from_group)
@@ -287,8 +287,7 @@ gui_nicklist_search_group (struct t_gui_buffer *buffer,
if (strncmp (name, "==id:", 5) == 0)
{
id = strtoll (name + 5, &error, 10);
if (error && !error[0])
if (util_parse_longlong (name + 5, 10, &id))
return gui_nicklist_search_group_id (buffer, from_group, id);
}
@@ -570,7 +569,6 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
const char *name)
{
long long id;
char *error;
if ((!buffer && !from_group)
|| !name
@@ -581,8 +579,7 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
if (strncmp (name, "==id:", 5) == 0)
{
id = strtoll (name + 5, &error, 10);
if (error && !error[0])
if (util_parse_longlong (name + 5, 10, &id))
return gui_nicklist_search_nick_id (buffer, from_group, id);
}
@@ -1036,9 +1033,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
const char *property, const char *value)
{
long long id;
long number;
char *error;
int group_changed;
int group_changed, number;
if (!buffer || !group || !property || !value)
return;
@@ -1047,8 +1042,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
if (strcmp (property, "id") == 0)
{
id = strtoll (value, &error, 10);
if (error && !error[0]
if (util_parse_longlong (value, 10, &id)
&& (id != group->id)
&& !gui_nicklist_search_group_id (buffer, NULL, id))
{
@@ -1064,9 +1058,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
}
else if (strcmp (property, "visible") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
group->visible = (number) ? 1 : 0;
group_changed = 1;
}
@@ -1158,9 +1150,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
const char *property, const char *value)
{
long long id;
long number;
char *error;
int nick_changed;
int nick_changed, number;
if (!buffer || !nick || !property || !value)
return;
@@ -1169,8 +1159,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
if (strcmp (property, "id") == 0)
{
id = strtoll (value, &error, 10);
if (error && !error[0]
if (util_parse_longlong (value, 10, &id)
&& (id != nick->id)
&& !gui_nicklist_search_nick_id (buffer, NULL, id))
{
@@ -1198,9 +1187,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
}
else if (strcmp (property, "visible") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
if (error && !error[0])
if (util_parse_int (value, 10, &number))
nick->visible = (number) ? 1 : 0;
nick_changed = 1;
}
+6 -10
View File
@@ -43,6 +43,7 @@
#include "../core/core-log.h"
#include "../core/core-string.h"
#include "../core/core-utf8.h"
#include "../core/core-util.h"
#include "../plugins/plugin.h"
#include "gui-window.h"
#include "gui-bar.h"
@@ -1182,7 +1183,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
int direction, stop, count_msg, scroll_from_end_free_buffer;
char time_letter, saved_char;
time_t old_date, diff_date;
char *pos, *error;
char *pos;
long number;
struct t_gui_line *ptr_line;
struct tm *date_tmp, line_date, old_line_date;
@@ -1231,9 +1232,7 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
time_letter = pos[0];
saved_char = pos[0];
pos[0] = '\0';
error = NULL;
number = strtol (scroll, &error, 10);
if (!error || error[0])
if (!util_parse_long (scroll, 10, &number))
number = 0;
pos[0] = saved_char;
}
@@ -1430,9 +1429,8 @@ gui_window_scroll (struct t_gui_window *window, char *scroll)
void
gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
{
int direction, percentage, start_col;
char saved_char, *pos, *error;
long number;
int direction, percentage, start_col, number;
char saved_char, *pos;
if (!window || !window->buffer->lines->first_line)
return;
@@ -1464,9 +1462,7 @@ gui_window_scroll_horiz (struct t_gui_window *window, char *scroll)
percentage = (pos[0] == '%') ? 1 : 0;
saved_char = pos[0];
pos[0] = '\0';
error = NULL;
number = strtol (scroll, &error, 10);
if (!error || error[0])
if (!util_parse_int (scroll, 10, &number))
number = 0;
pos[0] = saved_char;
}
+8 -19
View File
@@ -40,9 +40,8 @@ struct t_hashtable *
buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
{
const char *ptr_bar_item_name, *ptr_bar_item_line, *keys, *ptr_value;
long item_line;
char *error, str_value[128], **list_keys;
int i, item_index, num_keys, type;
char str_value[128], **list_keys;
int i, item_index, item_line, num_keys, type;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
@@ -64,15 +63,10 @@ buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
ptr_bar_item_line = weechat_hashtable_get (info, "_bar_item_line");
if (!ptr_bar_item_line)
goto end;
error = NULL;
item_line = strtol (ptr_bar_item_line, &error, 10);
if (!error || error[0])
goto end;
if ((item_line < 0)
if (!weechat_util_parse_int (ptr_bar_item_line, 10, &item_line)
|| (item_line < 0)
|| (item_line >= weechat_arraylist_size (buflist_list_buffers[item_index])))
{
goto end;
}
/* check if buffer pointer is still valid */
ptr_buffer = weechat_arraylist_get (buflist_list_buffers[item_index],
@@ -333,10 +327,9 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
const char *ptr_key, *ptr_pointer, *ptr_number, *ptr_number2;
const char *ptr_full_name;
struct t_gui_buffer *ptr_buffer;
char *error, str_command[1024];
long number, number2;
char str_command[1024];
unsigned long value;
int rc, current_buffer_number;
int rc, current_buffer_number, number, number2;
/* make C compiler happy */
(void) pointer;
@@ -360,13 +353,9 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
return WEECHAT_RC_OK;
ptr_buffer = (struct t_gui_buffer *)value;
error = NULL;
number = strtol (ptr_number, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (ptr_number, 10, &number))
return WEECHAT_RC_OK;
error = NULL;
number2 = strtol (ptr_number2, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (ptr_number2, 10, &number2))
return WEECHAT_RC_OK;
current_buffer_number = weechat_buffer_get_integer (
+3 -5
View File
@@ -185,8 +185,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
int argc, char **argv, int start_arg,
int set_command_index)
{
int i, j, end, length, length_total;
char *error;
int i, j, end, length, length_total, timeout;
for (i = start_arg; i < argc; i++)
{
@@ -318,10 +317,9 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
if (i + 1 >= argc)
return 0;
i++;
error = NULL;
cmd_options->timeout = strtol (argv[i], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[i], 10, &timeout))
return 0;
cmd_options->timeout = timeout;
}
else if (weechat_strcmp (argv[i], "-name") == 0)
{
+1 -4
View File
@@ -86,15 +86,12 @@ struct t_exec_cmd *
exec_search_by_id (const char *id)
{
struct t_exec_cmd* ptr_exec_cmd;
char *error;
long number;
if (!id)
return NULL;
error = NULL;
number = strtol (id, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_long (id, 10, &number))
number = -1;
for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd;
+2 -5
View File
@@ -60,15 +60,12 @@ int
fset_command_get_int_arg (int argc, char **argv, int arg_number,
int default_value)
{
long value;
char *error;
int value;
value = default_value;
if (argc > arg_number)
{
error = NULL;
value = strtol (argv[arg_number], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[arg_number], 10, &value))
value = default_value;
}
return (int)value;
+8 -14
View File
@@ -42,11 +42,10 @@ struct t_hashtable *
fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
{
const char *buffer;
int rc, format_number;
int rc, format_number, y, option_index;
unsigned long value;
struct t_gui_buffer *ptr_buffer;
long y, option_index;
char *error, str_value[128];
char str_value[128];
struct t_fset_option *ptr_fset_option;
/* make C compiler happy */
@@ -69,13 +68,11 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
if (!ptr_buffer || (ptr_buffer != fset_buffer))
return info;
error = NULL;
y = strtol (weechat_hashtable_get (info, "_chat_line_y"), &error, 10);
if (!error || error[0])
return info;
if (y < 0)
if (!weechat_util_parse_int (weechat_hashtable_get (info, "_chat_line_y"), 10, &y)
|| (y < 0))
{
return info;
}
format_number = weechat_config_integer (fset_config_look_format_number);
option_index = y / fset_config_format_option_num_lines[format_number - 1];
@@ -87,7 +84,7 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
snprintf (str_value, sizeof (str_value),
"0x%lx", (unsigned long)ptr_fset_option);
weechat_hashtable_set (info, "fset_option", str_value);
snprintf (str_value, sizeof (str_value), "%ld", option_index);
snprintf (str_value, sizeof (str_value), "%d", option_index);
weechat_hashtable_set (info, "fset_option_index", str_value);
weechat_hashtable_set (info, "fset_option_name", ptr_fset_option->name);
weechat_hashtable_set (info, "fset_option_parent_name", ptr_fset_option->parent_name);
@@ -137,15 +134,12 @@ fset_mouse_get_hashtable_int (struct t_hashtable *hashtable,
int default_value)
{
const char *ptr_value;
char *error;
int value;
ptr_value = weechat_hashtable_get (hashtable, variable);
if (!ptr_value)
return default_value;
error = NULL;
value = (int)strtol (ptr_value, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (ptr_value, 10, &value))
return default_value;
return value;
+5 -5
View File
@@ -2122,7 +2122,7 @@ weechat_guile_api_print_date_tags (SCM buffer, SCM date, SCM tags, SCM message)
plugin_script_api_printf_date_tags (weechat_guile_plugin,
guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)),
(time_t)scm_to_long (date),
(time_t)scm_to_long_long (date),
API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message));
@@ -2143,7 +2143,7 @@ weechat_guile_api_print_datetime_tags (SCM buffer, SCM date, SCM date_usec,
weechat_guile_plugin,
guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)),
(time_t)scm_to_long (date),
(time_t)scm_to_long_long (date),
scm_to_int (date_usec),
API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message));
@@ -2182,7 +2182,7 @@ weechat_guile_api_print_y_date_tags (SCM buffer, SCM y, SCM date, SCM tags,
guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)),
scm_to_int (y),
(time_t)scm_to_long (date),
(time_t)scm_to_long_long (date),
API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message));
@@ -2204,7 +2204,7 @@ weechat_guile_api_print_y_datetime_tags (SCM buffer, SCM y, SCM date,
guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)),
scm_to_int (y),
(time_t)scm_to_long (date),
(time_t)scm_to_long_long (date),
scm_to_int (date_usec),
API_SCM_TO_STRING(tags),
"%s", API_SCM_TO_STRING(message));
@@ -4774,7 +4774,7 @@ weechat_guile_api_infolist_new_var_time (SCM item, SCM name, SCM value)
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(API_SCM_TO_STRING(item)),
API_SCM_TO_STRING(name),
(time_t)scm_to_long (value)));
(time_t)scm_to_long_long (value)));
API_RETURN_STRING(result);
}
+15 -28
View File
@@ -96,8 +96,8 @@ char *irc_color_string_decoded[32];
int
irc_color_convert_rgb2term (long rgb)
{
char str_color[64], *info_color, *error;
long number;
char str_color[64], *info_color;
int number;
if (rgb < 0)
return -1;
@@ -111,9 +111,7 @@ irc_color_convert_rgb2term (long rgb)
return -1;
}
error = NULL;
number = strtol (info_color, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (info_color, 10, &number))
{
free (info_color);
return -1;
@@ -121,7 +119,7 @@ irc_color_convert_rgb2term (long rgb)
free (info_color);
return (int)number;
return number;
}
/*
@@ -133,8 +131,8 @@ irc_color_convert_rgb2term (long rgb)
int
irc_color_convert_rgb2irc (long rgb)
{
char str_color[64], *error, *info_color;
long number;
char str_color[64], *info_color;
int number;
if (rgb < 0)
return -1;
@@ -151,9 +149,7 @@ irc_color_convert_rgb2irc (long rgb)
return -1;
}
error = NULL;
number = strtol (info_color, &error, 10);
if (!error || error[0]
if (!weechat_util_parse_int (info_color, 10, &number)
|| (number < 0) || (number >= IRC_COLOR_TERM2IRC_NUM_COLORS))
{
free (info_color);
@@ -174,7 +170,7 @@ irc_color_convert_rgb2irc (long rgb)
int
irc_color_convert_term2irc (int color)
{
char str_color[64], *error, *info_color;
char str_color[64], *info_color;
long number;
snprintf (str_color, sizeof (str_color), "%d", color);
@@ -186,9 +182,8 @@ irc_color_convert_term2irc (int color)
return -1;
}
error = NULL;
number = strtol (info_color, &error, 10);
if (!error || error[0] || (number < 0) || (number > 0xFFFFFF))
if (!weechat_util_parse_long (info_color, 10, &number)
|| (number < 0) || (number > 0xFFFFFF))
{
free (info_color);
return -1;
@@ -211,7 +206,7 @@ irc_color_convert_term2irc (int color)
char *
irc_color_decode (const char *string, int keep_colors)
{
char **out, *error;
char **out;
char str_fg[16], str_bg[16], str_color[128], str_key[128], str_to_add[128];
const char *remapped_color;
unsigned char *ptr_string;
@@ -337,18 +332,14 @@ irc_color_decode (const char *string, int keep_colors)
bg = -1;
if (str_fg[0])
{
error = NULL;
fg = (int)strtol (str_fg, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_fg, 10, &fg))
fg %= IRC_NUM_COLORS;
else
fg = -1;
}
if (str_bg[0])
{
error = NULL;
bg = (int)strtol (str_bg, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_bg, 10, &bg))
bg %= IRC_NUM_COLORS;
else
bg = -1;
@@ -422,16 +413,12 @@ irc_color_decode (const char *string, int keep_colors)
bg_rgb = -1;
if (str_fg[0])
{
error = NULL;
fg_rgb = strtol (str_fg, &error, 16);
if (!error || error[0])
if (!weechat_util_parse_long (str_fg, 16, &fg_rgb))
fg_rgb = -1;
}
if (str_bg[0])
{
error = NULL;
bg_rgb = strtol (str_bg, &error, 16);
if (!error || error[0])
if (!weechat_util_parse_long (str_bg, 16, &bg_rgb))
bg_rgb = -1;
}
str_fg[0] = '\0';
+15 -30
View File
@@ -232,9 +232,8 @@ irc_command_mode_nicks (struct t_irc_server *server,
char **
irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
{
char **str_masks, **masks, *error1, *error2, *pos, str_number[32];
int i, length, added;
long j, number1, number2;
char **str_masks, **masks, *pos, str_number[32];
int i, j, length, added, number1, number2;
if (!argv || (arg_start < 0))
return NULL;
@@ -255,12 +254,8 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
&& (argv[i][length - 1] != '-'))
{
pos[0] = '\0';
error1 = NULL;
number1 = strtol (argv[i], &error1, 10);
error2 = NULL;
number2 = strtol (pos + 1, &error2, 10);
if (error1 && !error1[0]
&& error2 && !error2[0]
if (weechat_util_parse_int (argv[i], 10, &number1)
&& weechat_util_parse_int (pos + 1, 10, &number2)
&& (number1 > 0) && (number1 < 128)
&& (number2 > 0) && (number2 < 128)
&& (number1 < number2))
@@ -269,8 +264,7 @@ irc_command_mode_masks_convert_ranges (char **argv, int arg_start)
{
if ((*str_masks)[0])
weechat_string_dyn_concat (str_masks, " ", -1);
snprintf (str_number, sizeof (str_number),
"%ld", j);
snprintf (str_number, sizeof (str_number), "%d", j);
weechat_string_dyn_concat (str_masks, str_number, -1);
}
added = 1;
@@ -312,14 +306,12 @@ irc_command_mode_masks (struct t_irc_server *server,
const char *set, const char *mode,
char **argv, int pos_masks)
{
int max_modes, modes_added, msg_priority;
int max_modes, modes_added, msg_priority, number;
char **modes, **masks, *mask;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item;
long number;
char *error;
if (irc_mode_get_chanmode_type (server, mode[0]) != 'A')
{
@@ -367,9 +359,7 @@ irc_command_mode_masks (struct t_irc_server *server,
/* use modelist item for number arguments */
if (ptr_modelist && (set[0] == '-'))
{
error = NULL;
number = strtol (argv[pos_masks], &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (argv[pos_masks], 10, &number))
{
ptr_item = irc_modelist_item_search_number (ptr_modelist,
number - 1);
@@ -2622,9 +2612,8 @@ irc_command_ignore_display (struct t_irc_ignore *ignore)
IRC_COMMAND_CALLBACK(ignore)
{
struct t_irc_ignore *ptr_ignore;
char *mask, *regex, *regex2, *ptr_regex, *pos, *server, *channel, *error;
int length, update;
long number;
char *mask, *regex, *regex2, *ptr_regex, *pos, *server, *channel;
int length, number, update;
/* make C compiler happy */
(void) pointer;
@@ -2767,9 +2756,7 @@ IRC_COMMAND_CALLBACK(ignore)
}
else
{
error = NULL;
number = strtol (argv[2], &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (argv[2], 10, &number))
{
ptr_ignore = irc_ignore_search_by_number (number);
if (ptr_ignore)
@@ -2925,7 +2912,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;
@@ -3429,18 +3417,15 @@ int
irc_command_list_get_int_arg (int argc, char **argv, int arg_number,
int default_value)
{
long value;
char *error;
int value;
value = default_value;
if (argc > arg_number)
{
error = NULL;
value = strtol (argv[arg_number], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[arg_number], 10, &value))
value = default_value;
}
return (int)value;
return value;
}
/*
+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;
+13 -15
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, ' ');
@@ -1287,10 +1288,8 @@ irc_config_server_check_value_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
int index_option, proxy_found;
int index_option, number, proxy_found;
const char *pos_error, *proxy_name;
char *error;
long number;
struct t_infolist *infolist;
/* make C compiler happy */
@@ -1363,9 +1362,7 @@ irc_config_server_check_value_cb (const void *pointer, void *data,
case IRC_SERVER_OPTION_SPLIT_MSG_MAX_LENGTH:
if (!value || !value[0])
break;
error = NULL;
number = strtol (value, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (value, 10, &number))
{
/*
* not a valid number, but we return 1 (OK) to let WeeChat
@@ -2811,7 +2808,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 +2938,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 +2995,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\""),
+20 -23
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 */
@@ -984,9 +985,8 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
struct t_irc_channel *ptr_channel;
struct t_irc_modelist *ptr_modelist;
struct t_irc_modelist_item *ptr_item;
char **argv, *error;
int argc;
long number;
char **argv;
int argc, number;
/* make C compiler happy */
(void) pointer;
@@ -1028,15 +1028,12 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
}
if (!obj_pointer && (argc >= 4))
{
error = NULL;
number = strtol (argv[3], &error, 10);
if (!error || error[0] || (number < 0))
if (!weechat_util_parse_int (argv[3], 10, &number) || (number < 0))
{
weechat_string_free_split (argv);
return NULL;
}
obj_pointer = irc_modelist_item_search_number (ptr_modelist,
(int)number);
obj_pointer = irc_modelist_item_search_number (ptr_modelist, number);
if (!obj_pointer)
{
weechat_string_free_split (argv);
+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;
+13 -18
View File
@@ -234,9 +234,8 @@ int
irc_list_channel_match_filter (struct t_irc_server *server,
struct t_irc_list_channel *channel)
{
char *error, *result;
long number;
int match;
char *result;
int match, number;
/* no filter? then any channel is matching */
if (!server->list->filter)
@@ -280,25 +279,22 @@ irc_list_channel_match_filter (struct t_irc_server *server,
else if (strncmp (server->list->filter, "u:>", 3) == 0)
{
/* filter by users (> N)*/
error = NULL;
number = strtol (server->list->filter + 3, &error, 10);
if (error && !error[0] && channel->users > (int)number)
if (weechat_util_parse_int (server->list->filter + 3, 10, &number)
&& (channel->users > number))
return 1;
}
else if (strncmp (server->list->filter, "u:<", 3) == 0)
{
/* filter by users (< N)*/
error = NULL;
number = strtol (server->list->filter + 3, &error, 10);
if (error && !error[0] && channel->users < (int)number)
if (weechat_util_parse_int (server->list->filter + 3, 10, &number)
&& (channel->users < number))
return 1;
}
else if (strncmp (server->list->filter, "u:", 2) == 0)
{
/* filter by users */
error = NULL;
number = strtol (server->list->filter + 2, &error, 10);
if (error && !error[0] && channel->users >= (int)number)
if (weechat_util_parse_int (server->list->filter + 2, 10, &number)
&& (channel->users >= number))
return 1;
}
else
@@ -375,10 +371,9 @@ int
irc_list_parse_messages (struct t_irc_server *server, const char *output)
{
struct t_irc_list_channel *channel;
char **irc_msgs, *command, **params, *error;
char **irc_msgs, *command, **params;
const char *ptr_name;
int i, count_irc_msgs, num_params, length, keep_colors;
long number;
int i, count_irc_msgs, num_params, length, keep_colors, number;
if (server->list->channels)
{
@@ -439,9 +434,9 @@ irc_list_parse_messages (struct t_irc_server *server, const char *output)
ptr_name++;
}
channel->name2 = strdup (ptr_name);
error = NULL;
number = strtol (params[2], &error, 10);
channel->users = (error && !error[0]) ? number : 0;
if (!weechat_util_parse_int (params[2], 10, &number))
number = 0;
channel->users = number;
channel->topic = (num_params > 3) ?
irc_color_decode (params[3], keep_colors) : NULL;
length = weechat_utf8_strlen_screen (channel->name);
+12 -15
View File
@@ -598,8 +598,7 @@ irc_message_parse_cap_multiline_value (struct t_irc_server *server,
{
struct t_hashtable *values;
const char *ptr_value;
char *error;
long number;
int number;
if (!server)
return;
@@ -617,18 +616,14 @@ irc_message_parse_cap_multiline_value (struct t_irc_server *server,
ptr_value = (const char *)weechat_hashtable_get (values, "max-bytes");
if (ptr_value)
{
error = NULL;
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (ptr_value, 10, &number))
server->multiline_max_bytes = number;
}
ptr_value = (const char *)weechat_hashtable_get (values, "max-lines");
if (ptr_value)
{
error = NULL;
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (ptr_value, 10, &number))
server->multiline_max_lines = number;
}
@@ -707,8 +702,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 +751,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 +1177,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 +1506,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 +1566,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;
+26 -39
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;
@@ -4061,9 +4061,8 @@ IRC_PROTOCOL_CALLBACK(001)
IRC_PROTOCOL_CALLBACK(005)
{
char *str_info, *error, *isupport2;
int i, arg_last, length_isupport, length, casemapping, utf8mapping;
long value;
char *str_info, *isupport2;
int i, arg_last, length_isupport, length, casemapping, utf8mapping, value;
IRC_PROTOCOL_MIN_PARAMS(2);
@@ -4081,34 +4080,26 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "LINELEN=", 8) == 0)
{
/* save max message length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->msg_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->msg_max_length = value;
}
else if (strncmp (ctxt->params[i], "NICKLEN=", 8) == 0)
{
/* save max nick length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->nick_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->nick_max_length = value;
}
else if (strncmp (ctxt->params[i], "USERLEN=", 8) == 0)
{
/* save max user length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->user_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->user_max_length = value;
}
else if (strncmp (ctxt->params[i], "HOSTLEN=", 8) == 0)
{
/* save max host length */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->host_max_length = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->host_max_length = value;
}
else if (strncmp (ctxt->params[i], "CASEMAPPING=", 12) == 0)
{
@@ -4144,10 +4135,8 @@ IRC_PROTOCOL_CALLBACK(005)
else if (strncmp (ctxt->params[i], "MONITOR=", 8) == 0)
{
/* save monitor (limit) */
error = NULL;
value = strtol (ctxt->params[i] + 8, &error, 10);
if (error && !error[0] && (value > 0))
ctxt->server->monitor = (int)value;
if (weechat_util_parse_int (ctxt->params[i] + 8, 10, &value) && (value > 0))
ctxt->server->monitor = value;
}
else if (strncmp (ctxt->params[i], "CLIENTTAGDENY=", 14) == 0)
{
@@ -4721,7 +4710,7 @@ IRC_PROTOCOL_CALLBACK(317)
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
datetime = (time_t)(atol (ctxt->params[3]));
datetime = (time_t)(atoll (ctxt->params[3]));
ptr_buffer = irc_msgbuffer_get_target_buffer (ctxt->server, ctxt->params[1],
ctxt->command, "whois", NULL);
@@ -5077,7 +5066,7 @@ IRC_PROTOCOL_CALLBACK(329)
ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]);
datetime = (time_t)(atol (ctxt->params[2]));
datetime = (time_t)(atoll (ctxt->params[2]));
if (ptr_channel)
{
@@ -5301,8 +5290,7 @@ IRC_PROTOCOL_CALLBACK(333)
ptr_channel = irc_channel_search (ctxt->server, ctxt->params[1]);
ptr_nick = (ptr_channel) ?
irc_nick_search (ctxt->server, ptr_channel, topic_nick) : NULL;
datetime = (ctxt->num_params > 3) ?
(time_t)(atol (ctxt->params[3])) : (time_t)(atol (ctxt->params[2]));
datetime = (time_t)(atoll ((ctxt->num_params > 3) ? ctxt->params[3] : ctxt->params[2]));
if (!topic_nick && (datetime == 0))
return WEECHAT_RC_OK;
@@ -5609,7 +5597,7 @@ IRC_PROTOCOL_CALLBACK(346)
irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5)
{
datetime = (time_t)(atol (ctxt->params[4]));
datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
weechat_printf_datetime_tags (
@@ -5788,7 +5776,7 @@ IRC_PROTOCOL_CALLBACK(348)
irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5)
{
datetime = (time_t)(atol (ctxt->params[4]));
datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist)
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3], datetime);
weechat_printf_datetime_tags (
@@ -6818,7 +6806,7 @@ IRC_PROTOCOL_CALLBACK(367)
irc_message_get_address_from_host (ctxt->params[3]));
if (ctxt->num_params >= 5)
{
datetime = (time_t)(atol (ctxt->params[4]));
datetime = (time_t)(atoll (ctxt->params[4]));
if (ptr_modelist)
{
irc_modelist_item_new (ptr_modelist, ctxt->params[2], ctxt->params[3],
@@ -7393,7 +7381,7 @@ IRC_PROTOCOL_CALLBACK(728)
irc_message_get_address_from_host (ctxt->params[4]));
if (ctxt->num_params >= 6)
{
datetime = (time_t)(atol (ctxt->params[5]));
datetime = (time_t)(atoll (ctxt->params[5]));
if (ptr_modelist)
{
irc_modelist_item_new (ptr_modelist, ctxt->params[3], ctxt->params[4],
@@ -7921,12 +7909,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 +8185,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) ?
+7 -18
View File
@@ -404,9 +404,8 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
const char *cmd_filter)
{
struct t_irc_redirect *new_redirect;
char **items[4], *item_upper, *pos, *error;
int i, j, num_items[4];
long value;
char **items[4], *item_upper, *pos;
int i, j, num_items[4], value;
struct t_hashtable *hash_cmd[4];
new_redirect = malloc (sizeof (*new_redirect));
@@ -460,9 +459,7 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
if (pos)
{
pos[0] = '\0';
error = NULL;
value = strtol (pos + 1, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (pos + 1, 10, &value))
value = -1;
}
item_upper = weechat_string_toupper (items[i][j]);
@@ -616,7 +613,7 @@ void
irc_redirect_init_command (struct t_irc_redirect *redirect,
const char *command)
{
char *pos;
const char *pos;
if (!redirect)
return;
@@ -1257,7 +1254,6 @@ irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
struct t_hashtable *hashtable)
{
const char *pattern, *str_timeout, *cmd_start, *cmd_stop, *cmd_extra;
char *error;
int number, timeout;
/* make C compiler happy */
@@ -1295,9 +1291,7 @@ irc_redirect_pattern_hsignal_cb (const void *pointer, void *data,
timeout = 0;
if (str_timeout && str_timeout[0])
{
error = NULL;
number = (int)strtol (str_timeout, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_timeout, 10, &number))
timeout = number;
}
@@ -1325,7 +1319,6 @@ irc_redirect_command_hsignal_cb (const void *pointer, void *data,
{
const char *server, *pattern, *redirect_signal, *str_count, *string;
const char *str_timeout, *cmd_filter;
char *error;
struct t_irc_server *ptr_server;
int number, count, timeout;
@@ -1366,18 +1359,14 @@ irc_redirect_command_hsignal_cb (const void *pointer, void *data,
count = 1;
if (str_count && str_count[0])
{
error = NULL;
number = (int)strtol (str_count, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_count, 10, &number))
count = number;
}
timeout = 0;
if (str_timeout && str_timeout[0])
{
error = NULL;
number = (int)strtol (str_timeout, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_timeout, 10, &number))
timeout = number;
}
+5 -7
View File
@@ -109,7 +109,7 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
const char *sasl_password,
char **sasl_error)
{
char *answer_base64, *string, *username, *username2, *data, **attrs, *error;
char *answer_base64, *string, *username, *username2, *data, **attrs;
char nonce_client[18], nonce_client_base64[24 + 1], *nonce_server;
char *salt_base64, *salt, *verifier_base64, *verifier, *attr_error;
char *auth_no_proof, *auth_message;
@@ -117,10 +117,10 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
char client_signature[512 / 8], client_proof[512 / 8];
char client_proof_base64[((512 / 8) * 4) + 1], server_key[512 / 8];
char server_signature[512 / 8];
int i, rc, length, num_attrs, iterations, salt_size, salted_password_size;
int i, rc, length, num_attrs, iterations, number;
int salt_size, salted_password_size;
int client_key_size, stored_key_size, client_signature_size;
int server_key_size, server_signature_size, verifier_size;
long number;
if (!server || !hash_algo || !data_base64 || !sasl_username
|| !sasl_password)
@@ -202,10 +202,8 @@ irc_sasl_mechanism_scram (struct t_irc_server *server,
}
else if (strncmp (attrs[i], "i=", 2) == 0)
{
error = NULL;
number = strtol (attrs[i] + 2, &error, 10);
if (error && !error[0])
iterations = (int)number;
if (weechat_util_parse_int (attrs[i] + 2, 10, &number))
iterations = number;
}
else if (strncmp (attrs[i], "v=", 2) == 0)
{
+155 -169
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;
@@ -676,10 +676,9 @@ int
irc_server_set_addresses (struct t_irc_server *server, const char *addresses,
int tls)
{
int rc, i, default_port;
char *pos, *error, *addresses_eval;
int rc, i, default_port, number;
char *pos, *addresses_eval;
const char *ptr_addresses;
long number;
if (!server)
return 0;
@@ -753,19 +752,14 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses,
server->addresses_count * sizeof (server->retry_array[0]));
for (i = 0; i < server->addresses_count; i++)
{
server->ports_array[i] = default_port;
pos = strchr (server->addresses_array[i], '/');
if (pos)
{
pos[0] = 0;
pos++;
error = NULL;
number = strtol (pos, &error, 10);
server->ports_array[i] = (error && !error[0]) ?
number : default_port;
}
else
{
server->ports_array[i] = default_port;
if (weechat_util_parse_int (pos, 10, &number))
server->ports_array[i] = number;
}
server->retry_array[i] = 0;
}
@@ -1134,7 +1128,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 +1373,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 +1398,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)
{
@@ -1520,18 +1512,14 @@ int
irc_server_get_max_modes (struct t_irc_server *server)
{
const char *support_modes;
char *error;
long number;
int max_modes;
int max_modes, number;
max_modes = 4;
support_modes = irc_server_get_isupport_value (server, "MODES");
if (support_modes)
{
error = NULL;
number = strtol (support_modes, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (support_modes, 10, &number))
{
max_modes = number;
if (max_modes < 1)
@@ -2443,8 +2431,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 +2490,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 +2987,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 +3001,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 +3436,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);
+13 -24
View File
@@ -356,11 +356,10 @@ irc_upgrade_read_cb (const void *pointer, void *data,
int object_id,
struct t_infolist *infolist)
{
int flags, sock, size, i, index, nicks_count, num_items, utf8mapping;
long number;
int flags, sock, size, i, index, nicks_count, num_items, number, utf8mapping;
long long number_longlong;
time_t join_time;
char *buf, option_name[64], **nicks, *nick_join, *pos, *error;
char **items;
char *buf, option_name[64], **nicks, *nick_join, *pos, **items;
const char *buffer_name, *str, *nick;
struct t_irc_server *ptr_server;
struct t_irc_nick *ptr_nick;
@@ -521,10 +520,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"LINELEN");
if (str)
{
error = NULL;
number = strtol (str, &error, 10);
if (error && !error[0])
irc_upgrade_current_server->msg_max_length = (int)number;
if (weechat_util_parse_int (str, 10, &number))
irc_upgrade_current_server->msg_max_length = number;
}
}
irc_upgrade_current_server->nick_max_length = weechat_infolist_integer (infolist, "nick_max_length");
@@ -540,10 +537,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"USERLEN");
if (str)
{
error = NULL;
number = strtol (str, &error, 10);
if (error && !error[0])
irc_upgrade_current_server->user_max_length = (int)number;
if (weechat_util_parse_int (str, 10, &number))
irc_upgrade_current_server->user_max_length = number;
}
}
/* "host_max_length" is new in WeeChat 2.6 */
@@ -558,10 +553,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"HOSTLEN");
if (str)
{
error = NULL;
number = strtol (str, &error, 10);
if (error && !error[0])
irc_upgrade_current_server->host_max_length = (int)number;
if (weechat_util_parse_int (str, 10, &number))
irc_upgrade_current_server->host_max_length = number;
}
}
irc_upgrade_current_server->casemapping = weechat_infolist_integer (infolist, "casemapping");
@@ -621,10 +614,8 @@ irc_upgrade_read_cb (const void *pointer, void *data,
"MONITOR");
if (str)
{
error = NULL;
number = strtol (str, &error, 10);
if (error && !error[0])
irc_upgrade_current_server->monitor = (int)number;
if (weechat_util_parse_int (str, 10, &number))
irc_upgrade_current_server->monitor = number;
}
}
/* "clienttagdeny" is new in WeeChat 3.3 */
@@ -771,11 +762,9 @@ irc_upgrade_read_cb (const void *pointer, void *data,
pos - nicks[i]);
if (nick_join)
{
error = NULL;
number = strtol (pos + 1, &error, 10);
if (error && !error[0])
if (weechat_util_parse_longlong (pos + 1, 10, &number_longlong))
{
join_time = (time_t)number;
join_time = (time_t)number_longlong;
irc_channel_join_smart_filtered_add (irc_upgrade_current_channel,
nick_join,
join_time);
+1 -4
View File
@@ -3007,7 +3007,6 @@ API_FUNC(hook_signal)
API_FUNC(hook_signal_send)
{
char *error;
int number, rc;
API_INIT_FUNC(1, "hook_signal_send", "sss", API_RETURN_INT(WEECHAT_RC_ERROR));
@@ -3023,9 +3022,7 @@ API_FUNC(hook_signal_send)
}
else if (strcmp (*type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
error = NULL;
number = (int)strtol (*signal_data, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (*signal_data, 10, &number))
rc = weechat_hook_signal_send (*signal, *type_data, &number);
else
rc = WEECHAT_RC_ERROR;
+5 -5
View File
@@ -2199,7 +2199,7 @@ API_FUNC(print)
API_FUNC(print_date_tags)
{
const char *buffer, *tags, *message;
long date;
long long date;
API_INIT_FUNC(1, "print_date_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 4)
@@ -2223,7 +2223,7 @@ API_FUNC(print_date_tags)
API_FUNC(print_datetime_tags)
{
const char *buffer, *tags, *message;
long date;
long long date;
int date_usec;
API_INIT_FUNC(1, "print_datetime_tags", API_RETURN_ERROR);
@@ -2273,7 +2273,7 @@ API_FUNC(print_y_date_tags)
{
const char *buffer, *tags, *message;
int y;
long date;
long long date;
API_INIT_FUNC(1, "print_y_date_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 5)
@@ -2300,7 +2300,7 @@ API_FUNC(print_y_datetime_tags)
{
const char *buffer, *tags, *message;
int y, date_usec;
long date;
long long date;
API_INIT_FUNC(1, "print_y_datetime_tags", API_RETURN_ERROR);
if (lua_gettop (L) < 6)
@@ -5034,7 +5034,7 @@ API_FUNC(infolist_new_var_time)
{
const char *item, *name;
const char *result;
long value;
long long value;
API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
if (lua_gettop (L) < 3)
+5 -5
View File
@@ -2133,7 +2133,7 @@ API_FUNC(print_date_tags)
plugin_script_api_printf_date_tags (weechat_perl_plugin,
perl_current_script,
API_STR2PTR(buffer),
(time_t)(SvIV (ST (1))), /* date */
(time_t)(SvNV (ST (1))), /* date */
tags,
"%s", message);
@@ -2156,7 +2156,7 @@ API_FUNC(print_datetime_tags)
plugin_script_api_printf_datetime_tags (weechat_perl_plugin,
perl_current_script,
API_STR2PTR(buffer),
(time_t)(SvIV (ST (1))), /* date */
(time_t)(SvNV (ST (1))), /* date */
SvIV (ST (2)), /* date_usec */
tags,
"%s", message);
@@ -2202,7 +2202,7 @@ API_FUNC(print_y_date_tags)
perl_current_script,
API_STR2PTR(buffer),
SvIV (ST (1)), /* y */
(time_t)(SvIV (ST (2))), /* date */
(time_t)(SvNV (ST (2))), /* date */
tags,
"%s", message);
@@ -2226,7 +2226,7 @@ API_FUNC(print_y_datetime_tags)
perl_current_script,
API_STR2PTR(buffer),
SvIV (ST (1)), /* y */
(time_t)(SvIV (ST (2))), /* date */
(time_t)(SvNV (ST (2))), /* date */
SvIV (ST (3)), /* date_usec */
tags,
"%s", message);
@@ -4967,7 +4967,7 @@ API_FUNC(infolist_new_var_time)
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item),
name,
(time_t)(SvIV (ST (2))))); /* value */
(time_t)(SvNV (ST (2))))); /* value */
API_RETURN_STRING(result);
}
+29 -47
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 */
@@ -903,9 +904,8 @@ plugin_api_info_nick_color_ignore_case_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char **items, *result, *error;
int num_items, case_range;
long number;
char **items, *result;
int num_items, case_range, number;
/* make C compiler happy */
(void) pointer;
@@ -917,10 +917,8 @@ plugin_api_info_nick_color_ignore_case_cb (const void *pointer, void *data,
case_range = -1;
if (num_items >= 2)
{
error = NULL;
number = strtol (items[1], &error, 10);
if (error && !error[0])
case_range = (int)number;
if (util_parse_int (items[1], 10, &number))
case_range = number;
}
result = gui_nick_find_color (
@@ -942,9 +940,8 @@ plugin_api_info_nick_color_name_ignore_case_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char **items, *result, *error;
int num_items, case_range;
long number;
char **items, *result;
int num_items, case_range, number;
/* make C compiler happy */
(void) pointer;
@@ -956,10 +953,8 @@ plugin_api_info_nick_color_name_ignore_case_cb (const void *pointer, void *data,
case_range = -1;
if (num_items >= 2)
{
error = NULL;
number = strtol (items[1], &error, 10);
if (error && !error[0])
case_range = (int)number;
if (util_parse_int (items[1], 10, &number))
case_range = number;
}
result = gui_nick_find_color_name (
@@ -1047,7 +1042,7 @@ plugin_api_info_uptime_current_cb (const void *pointer, void *data,
(void) info_name;
return plugin_api_info_build_uptime (
(time_t)weechat_current_start_timeval.tv_sec,
weechat_current_start_timeval.tv_sec,
arguments);
}
@@ -1063,9 +1058,9 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char **argv, *ptr_secret, *error, *totp;
int argc, digits;
long number;
char **argv, *ptr_secret, *totp;
int argc, digits, number_int;
long long number_longlong;
time_t totp_time;
/* make C compiler happy */
@@ -1093,19 +1088,15 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
if (argc > 1)
{
error = NULL;
number = (int)strtol (argv[1], &error, 10);
if (!error || error[0] || (number < 0))
if (!util_parse_longlong (argv[1], 10, &number_longlong) || (number_longlong < 0))
goto error;
totp_time = (time_t)number;
totp_time = (time_t)number_longlong;
}
if (argc > 2)
{
error = NULL;
number = (int)strtol (argv[2], &error, 10);
if (!error || error[0] || (number < 0))
if (!util_parse_int (argv[2], 10, &number_int) || (number_int < 0))
goto error;
digits = number;
digits = number_int;
}
totp = weecrypto_totp_generate (ptr_secret, totp_time, digits);
@@ -1134,9 +1125,9 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char value[16], **argv, *ptr_secret, *ptr_otp, *error;
int argc, window, rc;
long number;
char value[16], **argv, *ptr_secret, *ptr_otp;
int argc, window, rc, number_int;
long long number_longlong;
time_t totp_time;
/* make C compiler happy */
@@ -1164,19 +1155,15 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
if (argc > 2)
{
error = NULL;
number = (int)strtol (argv[2], &error, 10);
if (!error || error[0] || (number < 0))
if (!util_parse_longlong (argv[2], 10, &number_longlong) || (number_longlong < 0))
goto error;
totp_time = (time_t)number;
totp_time = (time_t)number_longlong;
}
if (argc > 3)
{
error = NULL;
number = (int)strtol (argv[3], &error, 10);
if (!error || error[0] || (number < 0))
if (!util_parse_int (argv[3], 10, &number_int) || (number_int < 0))
goto error;
window = number;
window = number_int;
}
rc = weecrypto_totp_validate (ptr_secret, totp_time, window, ptr_otp);
@@ -1235,8 +1222,8 @@ plugin_api_info_window_cb (const void *pointer, void *data,
const char *arguments)
{
struct t_gui_window *ptr_window;
long number;
char *error, value[64];
int number;
char value[64];
/* make C compiler happy */
(void) pointer;
@@ -1246,9 +1233,7 @@ plugin_api_info_window_cb (const void *pointer, void *data,
if (!arguments || !arguments[0])
return NULL;
error = NULL;
number = (int)strtol (arguments, &error, 10);
if (!error || error[0])
if (!util_parse_int (arguments, 10, &number))
return NULL;
ptr_window = gui_window_search_by_number (number);
@@ -2040,7 +2025,6 @@ plugin_api_infolist_window_cb (const void *pointer, void *data,
struct t_infolist *ptr_infolist;
struct t_gui_window *ptr_window;
int number;
char *error;
/* make C compiler happy */
(void) pointer;
@@ -2084,9 +2068,7 @@ plugin_api_infolist_window_cb (const void *pointer, void *data,
return NULL;
}
/* check if argument is a window number */
error = NULL;
number = (int)strtol (arguments, &error, 10);
if (error && !error[0])
if (util_parse_int (arguments, 10, &number))
{
ptr_window = gui_window_search_by_number (number);
if (ptr_window)
+3 -4
View File
@@ -38,6 +38,7 @@
#include "../core/core-input.h"
#include "../core/core-proxy.h"
#include "../core/core-string.h"
#include "../core/core-util.h"
#include "../gui/gui-bar.h"
#include "../gui/gui-bar-item.h"
#include "../gui/gui-bar-window.h"
@@ -394,7 +395,7 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options)
{
char *command2, *error;
char *command2;
const char *ptr_commands_allowed, *ptr_delay, *ptr_split_newline;
long delay;
int rc, split_newline;
@@ -412,9 +413,7 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
ptr_delay = hashtable_get (options, "delay");
if (ptr_delay)
{
error = NULL;
delay = strtol (ptr_delay, &error, 10);
if (!error || error[0])
if (!util_parse_long (ptr_delay, 10, &delay))
delay = 0;
}
ptr_split_newline = hashtable_get (options, "split_newline");
+12 -14
View File
@@ -2121,14 +2121,14 @@ API_FUNC(prnt)
API_FUNC(prnt_date_tags)
{
char *buffer, *tags, *message;
long date;
long long date;
API_INIT_FUNC(1, "prnt_date_tags", API_RETURN_ERROR);
buffer = NULL;
date = 0;
tags = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "slss", &buffer, &date, &tags, &message))
if (!PyArg_ParseTuple (args, "sLss", &buffer, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
plugin_script_api_printf_date_tags (weechat_python_plugin,
@@ -2144,7 +2144,7 @@ API_FUNC(prnt_date_tags)
API_FUNC(prnt_datetime_tags)
{
char *buffer, *tags, *message;
long date;
long long date;
int date_usec;
API_INIT_FUNC(1, "prnt_datetime_tags", API_RETURN_ERROR);
@@ -2153,7 +2153,7 @@ API_FUNC(prnt_datetime_tags)
date_usec = 0;
tags = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "sliss", &buffer, &date, &date_usec, &tags,
if (!PyArg_ParseTuple (args, "sLiss", &buffer, &date, &date_usec, &tags,
&message))
API_WRONG_ARGS(API_RETURN_ERROR);
@@ -2193,7 +2193,7 @@ API_FUNC(prnt_y_date_tags)
{
char *buffer, *tags, *message;
int y;
long date;
long long date;
API_INIT_FUNC(1, "prnt_y_date_tags", API_RETURN_ERROR);
buffer = NULL;
@@ -2201,7 +2201,7 @@ API_FUNC(prnt_y_date_tags)
date = 0;
tags = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "silss", &buffer, &y, &date, &tags, &message))
if (!PyArg_ParseTuple (args, "siLss", &buffer, &y, &date, &tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
plugin_script_api_printf_y_date_tags (weechat_python_plugin,
@@ -2219,7 +2219,7 @@ API_FUNC(prnt_y_datetime_tags)
{
char *buffer, *tags, *message;
int y;
long date;
long long date;
int date_usec;
API_INIT_FUNC(1, "prnt_y_datetime_tags", API_RETURN_ERROR);
@@ -2229,7 +2229,7 @@ API_FUNC(prnt_y_datetime_tags)
date_usec = 0;
tags = NULL;
message = NULL;
if (!PyArg_ParseTuple (args, "siliss", &buffer, &y, &date, &date_usec,
if (!PyArg_ParseTuple (args, "siLiss", &buffer, &y, &date, &date_usec,
&tags, &message))
API_WRONG_ARGS(API_RETURN_ERROR);
@@ -3148,7 +3148,7 @@ API_FUNC(hook_signal)
API_FUNC(hook_signal_send)
{
char *signal, *type_data, *signal_data, *error;
char *signal, *type_data, *signal_data;
int number, rc;
API_INIT_FUNC(1, "hook_signal_send", API_RETURN_INT(WEECHAT_RC_ERROR));
@@ -3165,9 +3165,7 @@ API_FUNC(hook_signal_send)
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
{
error = NULL;
number = (int)strtol (signal_data, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (signal_data, 10, &number))
rc = weechat_hook_signal_send (signal, type_data, &number);
else
rc = WEECHAT_RC_ERROR;
@@ -4934,13 +4932,13 @@ API_FUNC(infolist_new_var_time)
{
char *item, *name;
const char *result;
long value;
long long value;
API_INIT_FUNC(1, "infolist_new_var_time", API_RETURN_EMPTY);
item = NULL;
name = NULL;
value = 0;
if (!PyArg_ParseTuple (args, "ssl", &item, &name, &value))
if (!PyArg_ParseTuple (args, "ssL", &item, &name, &value))
API_WRONG_ARGS(API_RETURN_EMPTY);
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(item),
+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 */
+83 -16
View File
@@ -77,7 +77,6 @@ relay_api_protocol_signal_buffer_cb (const void *pointer, void *data,
long long buffer_id;
int nicks;
const char *ptr_id;
char *error;
/* make C compiler happy */
(void) data;
@@ -119,9 +118,7 @@ relay_api_protocol_signal_buffer_cb (const void *pointer, void *data,
ptr_buffer);
if (ptr_id)
{
error = NULL;
buffer_id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_longlong (ptr_id, 10, &buffer_id))
buffer_id = -1;
weechat_hashtable_remove (
RELAY_API_DATA(ptr_client, buffers_closing),
@@ -402,7 +399,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)
{
@@ -496,7 +496,7 @@ invalid_hash_algo:
RELAY_API_PROTOCOL_CALLBACK(version)
{
cJSON *json;
char *version, *error;
char *version;
long number;
json = cJSON_CreateObject ();
@@ -514,9 +514,7 @@ RELAY_API_PROTOCOL_CALLBACK(version)
free (version);
version = weechat_info_get ("version_number", NULL);
error = NULL;
number = strtol (version, &error, 10);
if (error && !error[0])
if (weechat_util_parse_long (version, 10, &number))
{
cJSON_AddItemToObject (json,
"weechat_version_number",
@@ -558,10 +556,9 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
struct t_gui_line_data *ptr_line_data;
long lines, lines_free, line_id;
int colors, nicks;
long lines, lines_free;
int colors, nicks, line_id;
const char *ptr_colors;
char *error;
json = NULL;
@@ -607,9 +604,10 @@ RELAY_API_PROTOCOL_CALLBACK(buffers)
{
if (client->http_req->num_path_items > 4)
{
line_id = strtol (client->http_req->path_items[4], &error, 10);
ptr_line = (error && !error[0]) ?
weechat_line_search_by_id (ptr_buffer, line_id) : NULL;
if (weechat_util_parse_int (client->http_req->path_items[4], 10, &line_id))
ptr_line = weechat_line_search_by_id (ptr_buffer, line_id);
else
ptr_line = NULL;
ptr_line_data = (ptr_line) ?
weechat_hdata_pointer (relay_hdata_line, ptr_line, "data") : NULL;
if (!ptr_line_data)
@@ -764,6 +762,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 +837,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 +969,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 +1352,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 -4
View File
@@ -51,7 +51,6 @@ long long
relay_api_get_buffer_id (struct t_gui_buffer *buffer)
{
const char *ptr_id;
char *error;
long long id;
if (!buffer)
@@ -61,9 +60,7 @@ relay_api_get_buffer_id (struct t_gui_buffer *buffer)
if (!ptr_id)
return -1;
error = NULL;
id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_longlong (ptr_id, 10, &id))
return -1;
return id;
+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) \
@@ -113,7 +113,6 @@ long long
relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer)
{
const char *ptr_id;
char *error;
long long buffer_id;
if (!buffer)
@@ -123,9 +122,7 @@ relay_remote_event_get_buffer_id (struct t_gui_buffer *buffer)
if (!ptr_id)
return -1;
error = NULL;
buffer_id = strtoll (ptr_id, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_longlong (ptr_id, 10, &buffer_id))
return -1;
return buffer_id;
+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:
+25 -23
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,
@@ -420,9 +429,8 @@ relay_irc_signal_irc_in2_cb (const void *pointer, void *data,
int
relay_irc_tag_relay_client_id (const char *tags)
{
char **argv, *error;
int result, argc, i;
long number;
char **argv;
int number, result, argc, i;
result = -1;
@@ -440,9 +448,7 @@ relay_irc_tag_relay_client_id (const char *tags)
{
if (strncmp (argv[i], "relay_client_", 13) == 0)
{
error = NULL;
number = strtol (argv[i] + 13, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (argv[i] + 13, 10, &number))
{
result = number;
break;
@@ -470,10 +476,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 +492,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,13 +1600,12 @@ 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, *str_cmd_lower;
char modifier_data[128], *new_data, *ctcp_type, *ctcp_params, *nick_modes;
long num_params;
int i, redirect_msg;
int i, num_params, redirect_msg;
new_data = NULL;
hash_parsed = NULL;
@@ -1642,9 +1646,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
goto end;
irc_command = weechat_hashtable_get (hash_parsed, "command");
str_num_params = weechat_hashtable_get (hash_parsed, "num_params");
error = NULL;
num_params = strtol (str_num_params, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (str_num_params, 10, &num_params))
num_params = 0;
if (num_params > 0)
{
+5 -11
View File
@@ -283,7 +283,7 @@ relay_auth_parse_pbkdf2 (const char *parameters,
char **salt_hexa, char **salt, int *salt_size,
int *iterations, char **hash)
{
char **argv, *error;
char **argv;
int argc;
if (salt_hexa)
@@ -329,9 +329,7 @@ relay_auth_parse_pbkdf2 (const char *parameters,
}
/* parameter 2: iterations */
error = NULL;
*iterations = (int)strtol (argv[1], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[1], 10, iterations))
*iterations = 0;
/* parameter 3: the PBKDF2 hash */
@@ -362,9 +360,7 @@ int
relay_auth_check_salt (struct t_relay_client *client,
const char *salt_hexa, const char *salt, int salt_size)
{
long number;
int time_window;
char *error;
long long number, time_window;
time_t time_now;
if (!client)
@@ -374,12 +370,10 @@ relay_auth_check_salt (struct t_relay_client *client,
{
if (!salt || (salt_size < 1))
return 0;
error = NULL;
number = strtol (salt, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_longlong (salt, 10, &number))
return 0;
time_now = time (NULL);
time_window = weechat_config_integer (relay_config_network_time_window);
time_window = (long long)weechat_config_integer (relay_config_network_time_window);
return ((number >= time_now - time_window)
&& (number <= time_now + time_window)) ? 1 : 0;
}
+40 -15
View File
@@ -652,23 +652,46 @@ relay_config_check_port_cb (const void *pointer, void *data,
struct t_config_option *option,
const char *value)
{
char *error;
long port;
struct t_relay_server *ptr_server;
int number, port;
long long new_port;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
error = NULL;
port = strtol (value, &error, 10);
ptr_server = relay_server_search_port ((int)port);
if (strncmp (value, "++", 2) == 0)
{
/* relative value: add to the current port */
if (!weechat_util_parse_int (value + 2, 10, &number))
return 1;
new_port = (long long)weechat_config_integer (option) + number;
}
else if (strncmp (value, "--", 2) == 0)
{
/* relative value: subtract from the current port */
if (!weechat_util_parse_int (value + 2, 10, &number))
return 1;
new_port = (long long)weechat_config_integer (option) - number;
}
else
{
/* let WeeChat display the error if value is not a valid integer */
if (!weechat_util_parse_int (value, 10, &port))
return 1;
new_port = port;
}
/* if port is out of range, let WeeChat validate and display the error */
if ((new_port < 0) || (new_port > 65535))
return 1;
ptr_server = relay_server_search_port ((int)new_port);
if (ptr_server)
{
weechat_printf (NULL, _("%s%s: error: port \"%d\" is already used"),
weechat_prefix ("error"),
RELAY_PLUGIN_NAME, (int)port);
RELAY_PLUGIN_NAME, (int)new_port);
return 0;
}
@@ -866,9 +889,8 @@ relay_config_create_option_port_path (const void *pointer, void *data,
const char *option_name,
const char *value)
{
int rc, protocol_number, ipv4, ipv6, tls, unix_socket;
char *error, *protocol, *protocol_args;
long port;
int rc, protocol_number, ipv4, ipv6, tls, unix_socket, port;
char *protocol, *protocol_args;
struct t_relay_server *ptr_server;
/* make C compiler happy */
@@ -925,9 +947,10 @@ relay_config_create_option_port_path (const void *pointer, void *data,
}
else
{
error = NULL;
port = strtol (value, &error, 10);
ptr_server = relay_server_search_port ((int)port);
if (weechat_util_parse_int (value, 10, &port))
ptr_server = relay_server_search_port (port);
else
ptr_server = NULL;
}
if (ptr_server)
{
@@ -999,7 +1022,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 +1268,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;
+22 -29
View File
@@ -212,7 +212,6 @@ relay_http_get_param_long (struct t_relay_http_request *request,
long *value)
{
const char *ptr_value;
char *error;
long number;
if (!value)
@@ -223,8 +222,7 @@ relay_http_get_param_long (struct t_relay_http_request *request,
return 0;
if (ptr_value)
{
number = strtol (ptr_value, &error, 10);
if (!error || error[0])
if (!weechat_util_parse_long (ptr_value, 10, &number))
return 0;
*value = number;
}
@@ -244,7 +242,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,10 +409,9 @@ 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;
int i, num_items;
long number;
char *name, *name_lower, **items;
const char *pos, *existing_value, *ptr_value;
int i, number, num_items;
weechat_string_dyn_concat (request->raw, header, -1);
weechat_string_dyn_concat (request->raw, "\n", -1);
@@ -474,10 +472,8 @@ relay_http_parse_header (struct t_relay_http_request *request,
/* if header is "Content-Length", save the length */
if (strcmp (name_lower, "content-length") == 0)
{
error = NULL;
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
request->content_length = (int)number;
if (weechat_util_parse_int (ptr_value, 10, &number))
request->content_length = number;
}
/*
@@ -605,7 +601,7 @@ relay_http_get_auth_status (struct t_relay_client *client)
{
const char *auth, *sec_websocket_protocol, *client_totp, *pos;
char *relay_password, *totp_secret, *info_totp_args, *info_totp;
char *user_pass, **protocol_array, *error;
char *user_pass, **protocol_array;
int rc, i, length, protocol_count, use_base64url, totp_ok;
long number;
@@ -625,8 +621,8 @@ relay_http_get_auth_status (struct t_relay_client *client)
rc = -4;
goto end;
}
number = strtol (client_totp, &error, 10);
if (!error || error[0] || (number < 0) || (number > 999999))
if (!weechat_util_parse_long (client_totp, 10, &number)
|| (number < 0) || (number > 999999))
{
rc = -4;
goto end;
@@ -999,7 +995,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);
@@ -1494,8 +1491,8 @@ relay_http_parse_response_code (struct t_relay_http_response *response,
const char *response_code)
{
const char *pos, *pos2;
char *error, *return_code;
long value;
char *return_code;
int value;
if (!response)
return 0;
@@ -1526,10 +1523,8 @@ relay_http_parse_response_code (struct t_relay_http_response *response,
if (!return_code)
goto error;
error = NULL;
value = strtol (return_code, &error, 10);
if (error && !error[0])
response->return_code = (int)value;
if (weechat_util_parse_int (return_code, 10, &value))
response->return_code = value;
free (return_code);
@@ -1564,9 +1559,9 @@ 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;
long number;
char *name, *name_lower;
const char *pos, *ptr_value;
int number;
/* empty line => end of headers */
if (!header || !header[0])
@@ -1606,10 +1601,8 @@ relay_http_parse_response_header (struct t_relay_http_response *response,
/* if header is "Content-Length", save the length */
if (strcmp (name_lower, "content-length") == 0)
{
error = NULL;
number = strtol (ptr_value, &error, 10);
if (error && !error[0])
response->content_length = (int)number;
if (weechat_util_parse_int (ptr_value, 10, &number))
response->content_length = number;
}
free (name);
+5 -6
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;
long number;
if (tls)
@@ -270,12 +270,11 @@ relay_remote_parse_url (const char *url,
weechat_strndup (ptr_url, pos - ptr_url) : strdup (ptr_url);
if (!str_port)
return 0;
error = NULL;
number = strtol (str_port, &error, 10);
if (error && !error[0] && (number >= 0) && (number <= 65535))
if (weechat_util_parse_long (str_port, 10, &number)
&& (number >= 0) && (number <= 65535))
{
if (port)
*port = number;
*port = (int)number;
free (str_port);
}
else
+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;
+5 -8
View File
@@ -306,9 +306,8 @@ relay_websocket_parse_extensions (const char *extensions,
struct t_relay_websocket_deflate *ws_deflate,
int ws_deflate_allowed)
{
char **exts, **params, **items, *error;
int i, j, num_exts, num_params, num_items;
long number;
char **exts, **params, **items;
int i, j, number, num_exts, num_params, num_items;
if (!extensions || !ws_deflate)
return;
@@ -351,9 +350,7 @@ relay_websocket_parse_extensions (const char *extensions,
number = 15;
if (num_items >= 2)
{
error = NULL;
number = strtol (items[1], &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (items[1], 10, &number))
{
if (number < 8)
number = 8;
@@ -368,12 +365,12 @@ relay_websocket_parse_extensions (const char *extensions,
if (strcmp (items[0], "server_max_window_bits") == 0)
{
ws_deflate->server_max_window_bits_recv = 1;
ws_deflate->window_bits_deflate = (int)number;
ws_deflate->window_bits_deflate = number;
}
else
{
ws_deflate->client_max_window_bits_recv = 1;
ws_deflate->window_bits_inflate = (int)number;
ws_deflate->window_bits_inflate = number;
}
}
}
+15 -17
View File
@@ -362,7 +362,7 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg,
{
int num_added, i, j, count, count_all, var_type, array_size, max_array_size;
int length;
char *pos, *pos2, *str_count, *error, *name;
char *pos, *pos2, *str_count, *name;
void *sub_pointer;
struct t_hdata *sub_hdata;
const char *sub_hdata_name;
@@ -384,9 +384,7 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg,
count_all = 1;
else
{
error = NULL;
count = (int)strtol (str_count, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (str_count, 10, &count))
{
if (count > 0)
count--;
@@ -586,9 +584,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 +624,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 +649,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 +666,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 +677,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 */
@@ -684,7 +684,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(completion)
struct t_gui_completion_word *word;
struct t_arraylist *ptr_list;
struct t_relay_weechat_msg *msg;
char *error, *pos_data;
char *pos_data;
int i, position, length_data, context, pos_start, size;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -709,9 +709,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(completion)
goto error;
}
error = NULL;
position = (int)strtol (argv[1], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[1], 10, &position))
goto error;
pos_data = strchr (argv_eol[1], ' ');
@@ -1740,8 +1738,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 },
+5 -5
View File
@@ -2634,7 +2634,7 @@ weechat_ruby_api_print_date_tags (VALUE class, VALUE buffer, VALUE date,
Check_Type (message, T_STRING);
c_buffer = StringValuePtr (buffer);
c_date = NUM2ULONG (date);
c_date = NUM2ULL (date);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
@@ -2669,7 +2669,7 @@ weechat_ruby_api_print_datetime_tags (VALUE class, VALUE buffer, VALUE date,
Check_Type (message, T_STRING);
c_buffer = StringValuePtr (buffer);
c_date = NUM2ULONG (date);
c_date = NUM2ULL (date);
c_date_usec = NUM2INT (date_usec);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
@@ -2733,7 +2733,7 @@ weechat_ruby_api_print_y_date_tags (VALUE class, VALUE buffer, VALUE y,
c_buffer = StringValuePtr (buffer);
c_y = NUM2INT (y);
c_date = NUM2ULONG (date);
c_date = NUM2ULL (date);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
@@ -2771,7 +2771,7 @@ weechat_ruby_api_print_y_datetime_tags (VALUE class, VALUE buffer, VALUE y,
c_buffer = StringValuePtr (buffer);
c_y = NUM2INT (y);
c_date = NUM2ULONG (date);
c_date = NUM2ULL (date);
c_date_usec = NUM2INT (date_usec);
c_tags = StringValuePtr (tags);
c_message = StringValuePtr (message);
@@ -6070,7 +6070,7 @@ weechat_ruby_api_infolist_new_var_time (VALUE class, VALUE item,
c_item = StringValuePtr (item);
c_name = StringValuePtr (name);
c_value = NUM2ULONG (value);
c_value = NUM2ULL (value);
result = API_PTR2STR(weechat_infolist_new_var_time (API_STR2PTR(c_item),
c_name,
+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;
+7 -18
View File
@@ -45,9 +45,7 @@ script_command_action (struct t_gui_buffer *buffer,
{
struct t_script_repo *ptr_script;
char str_action[4096];
long value;
char *error;
int quiet;
int quiet, value;
if (arguments)
{
@@ -62,9 +60,7 @@ script_command_action (struct t_gui_buffer *buffer,
arguments++;
}
}
error = NULL;
value = strtol (arguments, &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (arguments, 10, &value))
{
ptr_script = script_repo_search_displayed_by_number (value);
if (ptr_script)
@@ -132,9 +128,8 @@ script_command_script (const void *pointer, void *data,
struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *error, command[128];
long value;
int line;
char command[128];
int line, value;
/* make C compiler happy */
(void) pointer;
@@ -227,9 +222,7 @@ script_command_script (const void *pointer, void *data,
}
else
{
error = NULL;
value = strtol (argv[2], &error, 10);
if (error && !error[0])
if (weechat_util_parse_int (argv[2], 10, &value))
line = value;
}
if (line >= 0)
@@ -248,9 +241,7 @@ script_command_script (const void *pointer, void *data,
value = 1;
if (argc > 2)
{
error = NULL;
value = strtol (argv[2], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[2], 10, &value))
value = 1;
}
if (script_buffer_detail_script)
@@ -282,9 +273,7 @@ script_command_script (const void *pointer, void *data,
value = 1;
if (argc > 2)
{
error = NULL;
value = strtol (argv[2], &error, 10);
if (!error || error[0])
if (!weechat_util_parse_int (argv[2], 10, &value))
value = 1;
}
if (script_buffer_detail_script)
+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 (

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