mirror of
https://github.com/weechat/weechat.git
synced 2026-06-14 15:14:47 +02:00
Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e33da6292d | |||
| be6b27c8f9 | |||
| 2d9b133c77 | |||
| 6c36836182 | |||
| 15214f9538 | |||
| 7f13bdb51a | |||
| 49bbc53d7c | |||
| eb17fa24ee | |||
| c7d03668f1 | |||
| 8575546aa2 | |||
| 2c716e8154 | |||
| 49b1cb06b5 | |||
| 75a0755107 | |||
| 79b03d0680 | |||
| f43ed913f5 | |||
| 1fcbdb3bd9 | |||
| 1aab82f20b | |||
| 58141bde79 | |||
| 7f6e626122 | |||
| 15860532f3 | |||
| 8b7513e883 | |||
| 2566fca78c | |||
| a82bfa0e7e | |||
| 48d33521dc | |||
| e3f6dab366 | |||
| 1a05f89586 | |||
| c811072bdf | |||
| 4ae396825c | |||
| 87e47894e6 | |||
| ad75786e15 | |||
| 39fdb1b564 | |||
| c5eb982424 | |||
| e7bf09f4e8 | |||
| 27972b9c5d | |||
| ab7b51db72 | |||
| 647d7033cf | |||
| 4fe1ba7016 | |||
| 29db9b95ee | |||
| 270d64cfa1 | |||
| 4eabcdf840 | |||
| 77911680bb | |||
| bc5b287622 | |||
| 7c0b16df81 | |||
| f3bc66b255 | |||
| a23d8f2198 | |||
| f4c6caabb3 | |||
| f416688e84 | |||
| 1dc7ae6b68 | |||
| b06e09d00b | |||
| 89090b10e8 | |||
| fad7231f90 | |||
| cf1e073446 | |||
| b4fc345a13 | |||
| b2cd9d002b | |||
| 9312211d49 | |||
| 2ad27b41a5 | |||
| ef68312393 | |||
| 7aa490e360 | |||
| 36ea983d04 |
+65
-4
@@ -10,6 +10,67 @@ This document lists all the changes for each version. +
|
||||
For a list of important changes that require manual actions, please look at release notes.
|
||||
|
||||
|
||||
[[v4.0.5]]
|
||||
== Version 4.0.5 (2023-09-24)
|
||||
|
||||
New features::
|
||||
|
||||
* core: automatically backup config file read if it has an unsupported version (issue #2013)
|
||||
* core: display a message when a configuration file is updated to a newer version
|
||||
* python: make stub (weechat.pyi) compatible with Python 3.8 and 3.9 (issue #2006)
|
||||
|
||||
Bug fixes::
|
||||
|
||||
* irc: add option irc.look.open_pv_buffer_echo_msg to open private buffer on self message when capability echo-message is enabled (issue #2016)
|
||||
* irc: fix title of private buffers wrongly set to own address when capability echo-message is enabled (issue #2016)
|
||||
* irc: fix autojoin of channels when private buffers are opened (issue #2012)
|
||||
* irc: fix string comparison when CASEMAPPING is set to "ascii"
|
||||
* script: fix removal of script in system directory while trying to install a script (issue #2019)
|
||||
* script: fix autoload of multiple scripts at once with `/script autoload` (issue #2018)
|
||||
* script: fix crash when a `/script` command triggers another `/script` command (issue #923)
|
||||
* xfer: fix memory leak on plugin unload
|
||||
|
||||
Tests::
|
||||
|
||||
* irc: add tests on server functions
|
||||
|
||||
[[v4.0.4]]
|
||||
== Version 4.0.4 (2023-08-22)
|
||||
|
||||
Bug fixes::
|
||||
|
||||
* core: fix integer overflow when setting integer option with `++N` or `--N`
|
||||
* core: fix increment/decrement of options weechat.notify.*
|
||||
* irc: add missing tags on multiline messages (issue #1987)
|
||||
* irc: fix redirection of command `/list` when the reply doesn't start with message 321 (start of /list)
|
||||
* irc: fix wrong time displayed for CTCP messages received from self nick (issue #2000)
|
||||
* logger: remove trailing empty line in display of backlog (issue #2002)
|
||||
* perl: fix display of non-ASCII chars after load of a script with Perl >= 5.38 (issue #1996)
|
||||
* script: adjust scroll after command `/script go N`
|
||||
* scripts: fix function string_parse_size on 32-bit systems (python and ruby) (issue #1999)
|
||||
* xfer: fix conversion of string to IPv4 on 32-bit systems (issue #1999)
|
||||
|
||||
Tests::
|
||||
|
||||
* irc: fix tests on function irc_join_compare_join_channel (issue #1997)
|
||||
* scripts: fix tests of functions print_date_tag, print_y_date_tags and hook_timer on 32-bit systems (issue #1999)
|
||||
|
||||
[[v4.0.3]]
|
||||
== Version 4.0.3 (2023-08-08)
|
||||
|
||||
Bug fixes::
|
||||
|
||||
* core: fix input length and crash after delete of line (issue #1989)
|
||||
* irc: fix display of self CTCP message containing bold attribute (issue #1981)
|
||||
* irc: fix memory leak in IRC message parser
|
||||
* irc: fix switch to channel manually joined when server option autojoin_dynamic is on and option irc.look.buffer_switch_autojoin is off (issue #1982)
|
||||
* irc: fix display of outgoing notice with channel when capability "echo-message" is enabled (issue #1991)
|
||||
* relay: fix display of IRC CTCP messages received from client (issue #1986)
|
||||
|
||||
Build::
|
||||
|
||||
* doc: display a warning if a locale is missing with fallback to English for auto-generated content (issue #1985)
|
||||
|
||||
[[v4.0.2]]
|
||||
== Version 4.0.2 (2023-07-12)
|
||||
|
||||
@@ -18,8 +79,8 @@ Bug fixes::
|
||||
* core: fix renaming of options with command `/item rename` (issue #1978)
|
||||
* core: don't send "key_pressed" signal again for the same key press (issue #1976)
|
||||
* core: don't send "key_combo_*" signals for incomplete keys (issue #1976)
|
||||
* core: add key ctrl-backspace in /help key (issue #1975)
|
||||
* core: keep keys ctrl-H and ctrl-? (in lower case) if they were manually bound to custom commands in a previous version
|
||||
* core: add key kbd:[Ctrl+Backspace] in /help key (issue #1975)
|
||||
* core: keep keys `ctrl-H` and `ctrl-?` (in lower case) if they were manually bound to custom commands in a previous version
|
||||
|
||||
Tests::
|
||||
|
||||
@@ -57,7 +118,7 @@ New features::
|
||||
* core: insert multiple pasted lines in input instead of sending immediately, add keys to move and delete in a single line and whole input, add option weechat.look.input_multiline_lead_linebreak (issue #1502, issue #1503, issue #1504)
|
||||
* core: render newline characters in chat line messages (issue #1908)
|
||||
* core: don't split on newline characters in printf_date_tags when input_multiline is set (issue #1909)
|
||||
* core: add key @kbd:[l] in cursor mode to quote line, add variable "_chat_focused_line" in function hashtable sent to hook_focus callback (issue #1913, issue #1914)
|
||||
* core: add key kbd:[l] (lower `L`) in cursor mode to quote line, add variable "_chat_focused_line" in function hashtable sent to hook_focus callback (issue #1913, issue #1914)
|
||||
* core: add option `split_return` in command `/input` (issue #1916)
|
||||
* core: send all command line parameters not beginning with a dash to all plugins
|
||||
* core: add command `/reset` to reset options to their default values
|
||||
@@ -1671,7 +1732,7 @@ New features::
|
||||
* core: add option weechat.look.hotlist_add_conditions, remove option weechat.look.hotlist_add_buffer_if_away
|
||||
* core: add option weechat.look.hotlist_remove (issue #99)
|
||||
* core: add options `-beep` and `-current` in command `/print`
|
||||
* core: add bare display mode for easy text selection and click on URLs, new key: kbd:[Alt+l] (`L`), new option "bare" in command `/window`, new options: weechat.look.bare_display_exit_on_input and weechat.look.bare_display_time_format
|
||||
* core: add bare display mode for easy text selection and click on URLs, new key: kbd:[Alt+l] (lower `L`), new option "bare" in command `/window`, new options: weechat.look.bare_display_exit_on_input and weechat.look.bare_display_time_format
|
||||
* core: add signals "key_combo_{default|search|cursor}"
|
||||
* core: add terabyte unit for size displayed
|
||||
* core: display a warning in case of inconsistency between the options weechat.look.save_{config|layout}_on_exit
|
||||
|
||||
+51
-31
@@ -11,6 +11,26 @@ It is recommended to read it when upgrading to a new stable version. +
|
||||
For a complete list of changes, please look at ChangeLog.
|
||||
|
||||
|
||||
[[v4.0.5]]
|
||||
== Version 4.0.5 (2023-09-24)
|
||||
|
||||
No release notes.
|
||||
|
||||
[[v4.0.4]]
|
||||
== Version 4.0.4 (2023-08-22)
|
||||
|
||||
No release notes.
|
||||
|
||||
[[v4.0.3]]
|
||||
== Version 4.0.3 (2023-08-08)
|
||||
|
||||
No release notes.
|
||||
|
||||
[[v4.0.2]]
|
||||
== Version 4.0.2 (2023-07-12)
|
||||
|
||||
No release notes.
|
||||
|
||||
[[v4.0.1]]
|
||||
== Version 4.0.1 (2023-06-30)
|
||||
|
||||
@@ -473,7 +493,7 @@ now any return value is ignored (like it has always been in the C API).
|
||||
[[v3.7.1]]
|
||||
== Version 3.7.1 (2022-10-21)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v3.7]]
|
||||
== Version 3.7 (2022-10-09)
|
||||
@@ -595,7 +615,7 @@ and is now a percentage between `0` and `100`:
|
||||
[[v3.4.1]]
|
||||
== Version 3.4.1 (2022-03-13)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v3.4]]
|
||||
== Version 3.4 (2021-12-18)
|
||||
@@ -753,7 +773,7 @@ For example:
|
||||
[[v3.2.1]]
|
||||
== Version 3.2.1 (2021-09-04)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v3.2]]
|
||||
== Version 3.2 (2021-06-13)
|
||||
@@ -983,7 +1003,7 @@ must adjust the value of the new option, which defaults to 1:
|
||||
[[v3.0.1]]
|
||||
== Version 3.0.1 (2021-01-31)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v3.0]]
|
||||
== Version 3.0 (2020-11-11)
|
||||
@@ -1291,7 +1311,7 @@ version:
|
||||
[[v2.7.1]]
|
||||
== Version 2.7.1 (2020-02-20)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v2.7]]
|
||||
== Version 2.7 (2019-12-08)
|
||||
@@ -1535,7 +1555,7 @@ Functions removed from C API:
|
||||
[[v2.3]]
|
||||
== Version 2.3 (2018-10-21)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v2.2]]
|
||||
== Version 2.2 (2018-07-14)
|
||||
@@ -1671,7 +1691,7 @@ List of options moved:
|
||||
[[v2.0.1]]
|
||||
== Version 2.0.1 (2017-12-20)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v2.0]]
|
||||
== Version 2.0 (2017-12-03)
|
||||
@@ -1766,12 +1786,12 @@ to integer before using it, for example in Python: `int(fd)`.
|
||||
[[v1.9.1]]
|
||||
== Version 1.9.1 (2017-09-23)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v1.9]]
|
||||
== Version 1.9 (2017-06-25)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v1.8]]
|
||||
== Version 1.8 (2017-05-13)
|
||||
@@ -1823,7 +1843,7 @@ Aspell option with color for suggestion on a misspelled word has been renamed:
|
||||
[[v1.7.1]]
|
||||
== Version 1.7.1 (2017-04-22)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v1.7]]
|
||||
== Version 1.7 (2017-01-15)
|
||||
@@ -2070,7 +2090,7 @@ command:
|
||||
[[v1.1.1]]
|
||||
== Version 1.1.1 (2015-01-25)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v1.1]]
|
||||
== Version 1.1 (2015-01-11)
|
||||
@@ -2190,7 +2210,7 @@ instead of milliseconds:
|
||||
[[v1.0.1]]
|
||||
== Version 1.0.1 (2014-09-28)
|
||||
|
||||
Bug fix and maintenance release.
|
||||
No release notes.
|
||||
|
||||
[[v1.0]]
|
||||
== Version 1.0 (2014-08-15)
|
||||
@@ -3016,17 +3036,17 @@ This version fixes a major bug: crash with some special chars in IRC messages.
|
||||
[[v0.2.6]]
|
||||
== Version 0.2.6 (2007-09-06)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.2.5]]
|
||||
== Version 0.2.5 (2007-06-07)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.2.4]]
|
||||
== Version 0.2.4 (2007-03-29)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.2.3]]
|
||||
== Version 0.2.3 (2007-01-10)
|
||||
@@ -3085,7 +3105,7 @@ Which gives something like:
|
||||
[[v0.2.1]]
|
||||
== Version 0.2.1 (2006-10-01)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.2.0]]
|
||||
== Version 0.2.0 (2006-08-19)
|
||||
@@ -3199,74 +3219,74 @@ at startup.
|
||||
[[v0.1.5]]
|
||||
== Version 0.1.5 (2005-09-24)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.1.4]]
|
||||
== Version 0.1.4 (2005-07-30)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.1.3]]
|
||||
== Version 0.1.3 (2005-07-02)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.1.2]]
|
||||
== Version 0.1.2 (2005-05-21)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.1.1]]
|
||||
== Version 0.1.1 (2005-03-20)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.1.0]]
|
||||
== Version 0.1.0 (2005-02-12)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.9]]
|
||||
== Version 0.0.9 (2005-01-01)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.8]]
|
||||
== Version 0.0.8 (2004-10-30)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.7]]
|
||||
== Version 0.0.7 (2004-08-08)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.6]]
|
||||
== Version 0.0.6 (2004-06-05)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.5]]
|
||||
== Version 0.0.5 (2004-02-07)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.4]]
|
||||
== Version 0.0.4 (2004-01-01)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.3]]
|
||||
== Version 0.0.3 (2003-11-03)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.2]]
|
||||
== Version 0.0.2 (2003-10-05)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
[[v0.0.1]]
|
||||
== Version 0.0.1 (2003-09-27)
|
||||
|
||||
No release note.
|
||||
No release notes.
|
||||
|
||||
@@ -6796,7 +6796,7 @@ def config_new_section(config_file: str, name: str,
|
||||
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
|
||||
|
||||
# example
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -6815,7 +6815,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -7056,7 +7056,7 @@ Script (Python):
|
||||
# prototype
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str: ...
|
||||
|
||||
@@ -6819,9 +6819,10 @@ my_section_read_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* ... */
|
||||
|
||||
return WEECHAT_CONFIG_READ_OK;
|
||||
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
|
||||
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
|
||||
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -6911,7 +6912,7 @@ def config_new_section(config_file: str, name: str,
|
||||
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
|
||||
|
||||
# exemple
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -6930,7 +6931,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -7176,7 +7177,7 @@ Script (Python) :
|
||||
# prototype
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str: ...
|
||||
|
||||
@@ -6980,9 +6980,10 @@ my_section_read_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* ... */
|
||||
|
||||
return WEECHAT_CONFIG_READ_OK;
|
||||
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
|
||||
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
|
||||
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -7072,7 +7073,7 @@ def config_new_section(config_file: str, name: str,
|
||||
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
|
||||
|
||||
# esempio
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -7091,7 +7092,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -7337,7 +7338,7 @@ Script (Python):
|
||||
# prototipo
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str: ...
|
||||
|
||||
@@ -6784,9 +6784,10 @@ my_section_read_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* ... */
|
||||
|
||||
return WEECHAT_CONFIG_READ_OK;
|
||||
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
|
||||
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
|
||||
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -6876,7 +6877,7 @@ def config_new_section(config_file: str, name: str,
|
||||
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
|
||||
|
||||
# 例
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -6895,7 +6896,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -7136,7 +7137,7 @@ struct t_config_option *option5 =
|
||||
# プロトタイプ
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str: ...
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ STUB_HEADER = """\
|
||||
# DO NOT EDIT BY HAND!
|
||||
#
|
||||
|
||||
from typing import Dict
|
||||
from typing import Dict, Union
|
||||
"""
|
||||
|
||||
CONSTANT_RE = (
|
||||
|
||||
@@ -6509,9 +6509,10 @@ my_section_read_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* ... */
|
||||
|
||||
return WEECHAT_CONFIG_READ_OK;
|
||||
/* return WEECHAT_CONFIG_READ_MEMORY_ERROR; */
|
||||
/* return WEECHAT_CONFIG_READ_FILE_NOT_FOUND; */
|
||||
return WEECHAT_CONFIG_OPTION_SET_OK_CHANGED;
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_ERROR; */
|
||||
/* return WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -6601,7 +6602,7 @@ def config_new_section(config_file: str, name: str,
|
||||
callback_delete_option: str, callback_delete_option_data: str) -> str: ...
|
||||
|
||||
# пример
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -6620,7 +6621,7 @@ def my_section_write_default_cb(data: str, config_file: str, section_name: str)
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -6844,7 +6845,7 @@ struct t_config_option *option5 =
|
||||
# прототип
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str: ...
|
||||
|
||||
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-25 00:48+0200\n"
|
||||
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -4427,6 +4427,22 @@ msgstr "%sChyba: nemohu vytvořit soubor \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sChyba při zápisu konfiguračního souboru \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: server %s%s%s byl zkopírován do %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: nemůžu načíst soubor \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sVAROVÁNÍ: selhalo čtení konfiguračního souboru \"%s\" (%s)"
|
||||
@@ -9207,6 +9223,10 @@ msgstr ""
|
||||
"když se změní status nepřítomnosti přezdívky (výsledek příkazu whois), "
|
||||
"například: \"notify_highlight\", \"notify_message\" or \"notify_private\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "zavřít buffer, když je na kanálu spuštěn /part"
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-07-05 21:25+0200\n"
|
||||
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
|
||||
"Language-Team: German <kde-i18n-de@kde.org>\n"
|
||||
@@ -5585,6 +5585,22 @@ msgid "%sError writing configuration file \"%s\""
|
||||
msgstr ""
|
||||
"%sEs ist ein Fehler beim Speichern der Konfigurationsdatei \"%s\" aufgetreten"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: Server %s%s%s wurde nach %s%s%s kopiert"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: Kann die Datei \"%s\" nicht laden"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sWARNUNG: Konfigurationsdatei \"%s\" konnte nicht geladen werden (%s)"
|
||||
@@ -11444,6 +11460,10 @@ msgstr ""
|
||||
"(Rückgabe durch Befehl whois), zum Beispiel: \"notify_message\", "
|
||||
"\"notify_private\" oder \"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "schließt den Buffer wenn \"/part\" im Kanal ausgeführt wird"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5052,6 +5052,22 @@ msgstr "%sError: no es posible crear el archivo \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sError al escribir el archivo de configuración \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: servidor %s%s%s copiado como %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: no es posible cargar el archivo \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "Guardando archivo de configuración %s %s"
|
||||
@@ -9906,6 +9922,10 @@ msgstr ""
|
||||
"cuando un apodo cambia su estado de ausencia (resultado del comando whois), "
|
||||
"por ejemplo: \"notify_highlight\", \"notify_message\" o \"notify_private\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "cerrar el buffer cuando /part es usado en un canal"
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"PO-Revision-Date: 2023-07-05 21:25+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-09-14 20:21+0200\n"
|
||||
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: fr\n"
|
||||
@@ -5452,6 +5452,22 @@ msgstr "%sImpossible de créer le fichier \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sErreur d'écriture du fichier de configuration \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%sLe fichier %s a été sauvegardé sous le nom %s"
|
||||
|
||||
#, c-format
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%sErreur : impossible de sauvegarder le fichier %s"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
"%sImportant : le fichier %s a été mis à jour de la version %d à %d, il n'est "
|
||||
"plus compatible et ne peut plus être chargé avec toute version plus ancienne"
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sATTENTION : échec de lecture du fichier de configuration \"%s\" (%s)"
|
||||
@@ -11226,6 +11242,12 @@ msgstr ""
|
||||
"de la commande whois), par exemple : \"notify_message\", \"notify_private\" "
|
||||
"ou \"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
"ouvrir un tampon privé sur son propre message quand la capacité echo-message "
|
||||
"est activée"
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "fermer le tampon lorsque /part est exécuté sur un canal"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -3972,6 +3972,20 @@ msgstr "%s nem sikerült a \"%s\" fájlt létrehozni\n"
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "szerver konfigurációs fájljának újraolvastatása"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "A %s%s%s szerver másolva lett %s%s néven\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "beállítások mentése kilépéskor"
|
||||
@@ -8666,6 +8680,10 @@ msgid ""
|
||||
"\"notify_message\", \"notify_private\" or \"notify_highlight\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -4689,6 +4689,22 @@ msgstr "%sErrore: impossibile creare il file \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sErrore: impossibile scrivere sul file di configurazione \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: il server %s%s%s è stato copiato in %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: impossibile caricare il file \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "Salvataggio del file di configurazione %s %s"
|
||||
@@ -9631,6 +9647,10 @@ msgstr ""
|
||||
"whois), ad esempio: \"notify_message\", \"notify_private\" o "
|
||||
"\"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "chiude buffer quando viene digitato /part nel canale"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
|
||||
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
|
||||
@@ -5294,6 +5294,22 @@ msgstr "%sエラー: ファイル \"%s\" の作成に失敗"
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%s設定ファイル \"%s\" の書き込み中にエラー"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: サーバ %s%s%s を %s%s%s にコピーしました"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: ファイル \"%s\" をロードできません"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%s警告: 設定ファイル \"%s\" (%s) の読み込みに失敗"
|
||||
@@ -10811,6 +10827,10 @@ msgstr ""
|
||||
"よって表示されたメッセージに使われたタグのコンマ区切りリスト、例: "
|
||||
"\"notify_message\"、\"notify_private\"、\"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "/part を実行した場合にバッファを閉じる"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
|
||||
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
|
||||
@@ -5731,6 +5731,22 @@ msgstr "%sNie można utworzyć pliku \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sBłąd podczas zapisu pliku konfiguracyjnego \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: serwer %s%s%s został skopiowany do %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: nie można wczytać pliku \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sUWAGA: nie powiódł się odczyt pliku konfiguracyjnego \"%s\" (%s)"
|
||||
@@ -11807,6 +11823,10 @@ msgstr ""
|
||||
"komendy whois), na przykład: \"notify_message\", \"notify_private\" or "
|
||||
"\"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "zamyka bufor, kiedy na kanale wykonamy /part"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
|
||||
"Language-Team: Portuguese <>\n"
|
||||
@@ -5324,6 +5324,22 @@ msgstr "%sErro: não é possível criar o ficheiro \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sErro ao escrever o ficheiro de configuração \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: o servidor %s%s%s foi copiado para %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: não foi possível carregar o ficheiro \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sAVISO: falha ao ler o ficheiro de configuração \"%s\" (%s)"
|
||||
@@ -10578,6 +10594,10 @@ msgstr ""
|
||||
"whois), por exemplo: \"notify_message\", \"notify_private\" ou "
|
||||
"\"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "fechar o buffer ao executar /part num canal"
|
||||
|
||||
|
||||
+21
-1
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -4698,6 +4698,22 @@ msgstr "%sErro: não foi possível criar arquivo \"%s\""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sErro escrevendo arquivo de configuração \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "Layout \"%s\" has been renamed to \"%s\""
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "Disposição \"%s\" renomeado para \"%s\""
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: não foi possível carregar arquivo \"%s\""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "Escrevendo arquivo de configurações %s %s"
|
||||
@@ -9209,6 +9225,10 @@ msgid ""
|
||||
"\"notify_message\", \"notify_private\" or \"notify_highlight\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "fechar buffer quando o comando /part é executado em um canal"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -4000,6 +4000,20 @@ msgstr "%s не могу создать файл \"%s\"\n"
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "перезагрузить конфигурационный файл сервера"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "Сервер %s%s%s скопирован в %s%s\n"
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "Не могу записать лог-файл \"%s\"\n"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "сохранять конфигурационный файл при выходе"
|
||||
@@ -8698,6 +8712,10 @@ msgid ""
|
||||
"\"notify_message\", \"notify_private\" or \"notify_highlight\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5377,6 +5377,22 @@ msgstr "%sНе може да се креира фајл „%s”"
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%sГрешка при уписивању конфигурационог фајла „%s”"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: сервер %s%s%s је копиран у %s%s%s"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: фајл „%s” не може да се учита"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sУПОЗОРЕЊЕ: није могао да се прочита конфигурациони фајл „%s” (%s)"
|
||||
@@ -11012,6 +11028,10 @@ msgstr ""
|
||||
"се статус одсуства надимка промени (резултат команде whois), на пример: "
|
||||
"„notify_message”, „notify_private” или „notify_highlight”"
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "затварање бафера када се на каналу изврши /part"
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+0200\n"
|
||||
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
|
||||
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -5375,6 +5375,22 @@ msgstr "%s\"%s\" dosyası oluşturulamıyor"
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr "%s\"%s\" yapılandırma dosyası yazılırken hata"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s: server %s%s%s has been copied to %s%s%s"
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr "%s: %s%s%s sunucusu %s%s%s konumuna kopyalandı"
|
||||
|
||||
#, fuzzy, c-format
|
||||
#| msgid "%s%s: unable to load file \"%s\""
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr "%s%s: \"%s\" dosyası yüklenemiyor"
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr "%sUYARI: \"%s\" yapılandırma dosyası okunamadı (%s)"
|
||||
@@ -11377,6 +11393,10 @@ msgstr ""
|
||||
"kullanılan etiketlerin virgülle ayrılmış listesi (komut whois'inin sonucu); "
|
||||
"örneğin: \"notify_message\", \"notify_private\" veya \"notify_highlight\""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr "bir kanalda /part verildiğinde arabelleği kapat"
|
||||
|
||||
|
||||
+19
-1
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2023-07-05 21:24+0200\n"
|
||||
"POT-Creation-Date: 2023-09-14 20:21+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"
|
||||
@@ -3624,6 +3624,20 @@ msgstr ""
|
||||
msgid "%sError writing configuration file \"%s\""
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sFile %s has been backed up as %s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sError: unable to backup file %s"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%sImportant: file %s has been updated from version %d to %d, it is not "
|
||||
"compatible and can not be loaded any more with any older version"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
msgid "%sWARNING: failed to read configuration file \"%s\" (%s)"
|
||||
msgstr ""
|
||||
@@ -7775,6 +7789,10 @@ msgid ""
|
||||
"\"notify_message\", \"notify_private\" or \"notify_highlight\""
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
"open a private buffer on self message when capability echo-message is enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "close buffer when /part is issued on a channel"
|
||||
msgstr ""
|
||||
|
||||
|
||||
+99
-11
@@ -37,6 +37,7 @@
|
||||
#include "wee-config-file.h"
|
||||
#include "wee-arraylist.h"
|
||||
#include "wee-config.h"
|
||||
#include "wee-dir.h"
|
||||
#include "wee-hashtable.h"
|
||||
#include "wee-hdata.h"
|
||||
#include "wee-hook.h"
|
||||
@@ -1527,22 +1528,22 @@ config_file_option_set (struct t_config_option *option, const char *value,
|
||||
{
|
||||
error = NULL;
|
||||
number = strtol (value + 2, &error, 10);
|
||||
if (error && !error[0])
|
||||
if (error && !error[0]
|
||||
&& (long)old_value + number <= (long)(option->max))
|
||||
{
|
||||
value_int = old_value + number;
|
||||
if (value_int <= option->max)
|
||||
new_value_ok = 1;
|
||||
new_value_ok = 1;
|
||||
}
|
||||
}
|
||||
else if (strncmp (value, "--", 2) == 0)
|
||||
{
|
||||
error = NULL;
|
||||
number = strtol (value + 2, &error, 10);
|
||||
if (error && !error[0])
|
||||
if (error && !error[0]
|
||||
&& (long)old_value - number >= (long)(option->min))
|
||||
{
|
||||
value_int = old_value - number;
|
||||
if (value_int >= option->min)
|
||||
new_value_ok = 1;
|
||||
new_value_ok = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3161,6 +3162,66 @@ config_file_parse_version (const char *version)
|
||||
return (number < 1) ? -1 : (int)number;
|
||||
}
|
||||
|
||||
/*
|
||||
* Backups a configuration file if its version is unsupported and cannot be
|
||||
* loaded.
|
||||
*/
|
||||
|
||||
void
|
||||
config_file_backup (const char *filename)
|
||||
{
|
||||
char *filename_backup, str_time[32], str_index[32];
|
||||
int length, index;
|
||||
struct tm *local_time;
|
||||
time_t date;
|
||||
|
||||
if (!filename)
|
||||
return;
|
||||
|
||||
length = strlen (filename) + 128;
|
||||
|
||||
filename_backup = malloc (length);
|
||||
if (!filename_backup)
|
||||
return;
|
||||
|
||||
date = time (NULL);
|
||||
local_time = localtime (&date);
|
||||
if (strftime (str_time, sizeof (str_time), ".%Y%m%d.%H%M%S", local_time) == 0)
|
||||
str_time[0] = '\0';
|
||||
|
||||
index = 1;
|
||||
while (1)
|
||||
{
|
||||
if (index == 1)
|
||||
str_index[0] = '\0';
|
||||
else
|
||||
snprintf (str_index, sizeof (str_index), ".%d", index);
|
||||
snprintf (filename_backup, length,
|
||||
"%s.backup%s%s",
|
||||
filename, str_time, str_index);
|
||||
if (access (filename_backup, F_OK) != 0)
|
||||
break;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (dir_file_copy (filename, filename_backup))
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sFile %s has been backed up as %s"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename, filename_backup);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
_("%sError: unable to backup file %s"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename);
|
||||
}
|
||||
|
||||
free (filename_backup);
|
||||
}
|
||||
|
||||
/*
|
||||
* Updates data read from config file: either section or option + value.
|
||||
* The update callback (if defined in config) is called if the config version
|
||||
@@ -3173,16 +3234,22 @@ config_file_parse_version (const char *version)
|
||||
*
|
||||
* Section can be updated only if option and value are NULL (ie if we are
|
||||
* reading a section line like "[section]").
|
||||
*
|
||||
* Integer warning_update_displayed is set to 1 if a warning is displayed,
|
||||
* when the file is updated to a newer version (then it's not compatible any
|
||||
* more with previous versions).
|
||||
*/
|
||||
|
||||
void
|
||||
config_file_update_data_read (struct t_config_file *config_file,
|
||||
const char *filename,
|
||||
const char *section,
|
||||
const char *option,
|
||||
const char *value,
|
||||
char **ret_section,
|
||||
char **ret_option,
|
||||
char **ret_value)
|
||||
char **ret_value,
|
||||
int *warning_update_displayed)
|
||||
{
|
||||
struct t_hashtable *data_read, *hashtable;
|
||||
const char *ptr_section, *ptr_option, *ptr_value;
|
||||
@@ -3192,6 +3259,21 @@ config_file_update_data_read (struct t_config_file *config_file,
|
||||
if (config_file->version_read >= config_file->version)
|
||||
return;
|
||||
|
||||
if (!*warning_update_displayed
|
||||
&& (config_file->version_read < config_file->version))
|
||||
{
|
||||
gui_chat_printf (
|
||||
NULL,
|
||||
_("%sImportant: file %s has been updated from version %d to %d, "
|
||||
"it is not compatible and can not be loaded any more with any "
|
||||
"older version"),
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename,
|
||||
config_file->version_read,
|
||||
config_file->version);
|
||||
*warning_update_displayed = 1;
|
||||
}
|
||||
|
||||
/* do nothing if there's no update callback */
|
||||
if (!config_file->callback_update)
|
||||
return;
|
||||
@@ -3289,6 +3371,7 @@ int
|
||||
config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
{
|
||||
int filename_length, line_number, rc, length, version;
|
||||
int warning_update_displayed;
|
||||
char *filename, *section, *option, *value;
|
||||
struct t_config_section *ptr_section;
|
||||
struct t_config_option *ptr_option;
|
||||
@@ -3298,6 +3381,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
return WEECHAT_CONFIG_READ_FILE_NOT_FOUND;
|
||||
|
||||
config_file->version_read = 1;
|
||||
warning_update_displayed = 0;
|
||||
|
||||
/* build filename */
|
||||
filename_length = strlen (weechat_config_dir) + strlen (DIR_SEPARATOR) +
|
||||
@@ -3396,9 +3480,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
section = string_strndup (ptr_line + 1, pos - ptr_line - 1);
|
||||
if (section)
|
||||
{
|
||||
config_file_update_data_read (config_file,
|
||||
config_file_update_data_read (config_file, filename,
|
||||
section, NULL, NULL,
|
||||
§ion, NULL, NULL);
|
||||
§ion, NULL, NULL,
|
||||
&warning_update_displayed);
|
||||
ptr_section = config_file_search_section (config_file,
|
||||
section);
|
||||
if (!ptr_section)
|
||||
@@ -3480,6 +3565,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
|
||||
filename, line_number,
|
||||
line);
|
||||
config_file_backup (filename);
|
||||
goto end_file;
|
||||
}
|
||||
else
|
||||
@@ -3496,6 +3582,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
filename,
|
||||
config_file->version_read,
|
||||
config_file->version);
|
||||
config_file_backup (filename);
|
||||
goto end_file;
|
||||
}
|
||||
}
|
||||
@@ -3513,9 +3600,10 @@ config_file_read_internal (struct t_config_file *config_file, int reload)
|
||||
goto end_line;
|
||||
}
|
||||
|
||||
config_file_update_data_read (config_file,
|
||||
config_file_update_data_read (config_file, filename,
|
||||
ptr_section->name, option, value,
|
||||
NULL, &option, &value);
|
||||
NULL, &option, &value,
|
||||
&warning_update_displayed);
|
||||
|
||||
/* option has been ignored by the update callback? */
|
||||
if (!option || !option[0])
|
||||
|
||||
+1
-22
@@ -2466,27 +2466,6 @@ config_weechat_layout_write_cb (const void *pointer, void *data,
|
||||
return WEECHAT_CONFIG_WRITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks notify option value.
|
||||
*
|
||||
* Returns:
|
||||
* 1: value OK
|
||||
* 0: invalid value
|
||||
*/
|
||||
|
||||
int
|
||||
config_weechat_notify_check_cb (const void *pointer, void *data,
|
||||
struct t_config_option *option,
|
||||
const char *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
return (gui_buffer_search_notify (value) >= 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for changes on a notify option.
|
||||
*/
|
||||
@@ -2549,7 +2528,7 @@ config_weechat_notify_create_option_cb (const void *pointer, void *data,
|
||||
option_name, "integer", _("Notify level for buffer"),
|
||||
"none|highlight|message|all",
|
||||
0, 0, "", value, 0,
|
||||
&config_weechat_notify_check_cb, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
&config_weechat_notify_change_cb, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
rc = (ptr_option) ?
|
||||
|
||||
+13
-3
@@ -126,7 +126,7 @@ doc_gen_open_file (const char *path, const char *doc, const char *name,
|
||||
if (!file)
|
||||
{
|
||||
string_fprintf (stderr,
|
||||
"doc generator: ERROR: unable to write file \"%s\"",
|
||||
"doc generator: ERROR: unable to write file \"%s\"\n",
|
||||
filename);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1652,7 +1652,7 @@ doc_generate (const char *path)
|
||||
{
|
||||
string_fprintf (
|
||||
stderr,
|
||||
"doc generator: ERROR: failed to create directory \"%s\")",
|
||||
"doc generator: ERROR: failed to create directory \"%s\")\n",
|
||||
path);
|
||||
goto end;
|
||||
}
|
||||
@@ -1669,7 +1669,17 @@ doc_generate (const char *path)
|
||||
for (i = 0; locales[i]; i++)
|
||||
{
|
||||
setenv ("LANGUAGE", locales[i], 1);
|
||||
setlocale (LC_ALL, locales[i]);
|
||||
if (!setlocale (LC_ALL, locales[i]))
|
||||
{
|
||||
/* warning on missing locale */
|
||||
string_fprintf (
|
||||
stderr,
|
||||
"doc generator: WARNING: failed to set locale \"%s\", "
|
||||
"docs will include auto-generated English content\n",
|
||||
locales[i]);
|
||||
/* fallback to English */
|
||||
setlocale (LC_ALL, "C");
|
||||
}
|
||||
memcpy (lang, locales[i], 2);
|
||||
lang[2] = '\0';
|
||||
for (j = 0; doc_gen_functions[j]; j++)
|
||||
|
||||
+3
-3
@@ -862,7 +862,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
|
||||
{
|
||||
time_t date_printed;
|
||||
char *pos, *pos_end;
|
||||
int one_line = 0;
|
||||
int one_line;
|
||||
|
||||
if (!message)
|
||||
return;
|
||||
@@ -885,9 +885,11 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
|
||||
if (date <= 0)
|
||||
date = date_printed;
|
||||
|
||||
one_line = 0;
|
||||
pos = vbuffer;
|
||||
while (pos)
|
||||
{
|
||||
pos_end = NULL;
|
||||
if (!buffer || !buffer->input_multiline)
|
||||
{
|
||||
/* display until next end of line */
|
||||
@@ -911,9 +913,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
|
||||
}
|
||||
|
||||
if (one_line)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pos = (pos_end && pos_end[1]) ? pos_end + 1 : NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1142,7 +1142,7 @@ gui_input_delete_line (struct t_gui_buffer *buffer)
|
||||
end_of_line = (char *)utf8_end_of_line (start);
|
||||
|
||||
size_deleted = end_of_line - beginning_of_line;
|
||||
length_deleted = utf8_strnlen (start, size_deleted);
|
||||
length_deleted = utf8_strnlen (beginning_of_line, size_deleted);
|
||||
|
||||
memmove (beginning_of_line, end_of_line, strlen (end_of_line));
|
||||
|
||||
|
||||
@@ -876,7 +876,7 @@ weechat_guile_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load guile script */
|
||||
path_script = plugin_script_search_path (weechat_guile_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_guile_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -110,7 +110,7 @@ irc_batch_add_to_list (struct t_irc_server *server, struct t_irc_batch *batch)
|
||||
struct t_irc_batch *
|
||||
irc_batch_start_batch (struct t_irc_server *server, const char *reference,
|
||||
const char *parent_ref, const char *type,
|
||||
const char *parameters)
|
||||
const char *parameters, struct t_hashtable *tags)
|
||||
{
|
||||
struct t_irc_batch *ptr_batch;
|
||||
|
||||
@@ -130,6 +130,7 @@ irc_batch_start_batch (struct t_irc_server *server, const char *reference,
|
||||
ptr_batch->parent_ref = (parent_ref) ? strdup (parent_ref) : NULL;
|
||||
ptr_batch->type = strdup (type);
|
||||
ptr_batch->parameters = (parameters) ? strdup (parameters) : NULL;
|
||||
ptr_batch->tags = (tags) ? weechat_hashtable_dup (tags) : NULL;
|
||||
ptr_batch->start_time = time (NULL);
|
||||
ptr_batch->messages = NULL;
|
||||
ptr_batch->end_received = 0;
|
||||
@@ -188,6 +189,8 @@ irc_batch_free (struct t_irc_server *server, struct t_irc_batch *batch)
|
||||
free (batch->type);
|
||||
if (batch->parameters)
|
||||
free (batch->parameters);
|
||||
if (batch->tags)
|
||||
weechat_hashtable_free (batch->tags);
|
||||
if (batch->messages)
|
||||
weechat_string_dyn_free (batch->messages, 1);
|
||||
|
||||
@@ -226,7 +229,7 @@ irc_batch_process_messages (struct t_irc_server *server,
|
||||
struct t_irc_batch *batch)
|
||||
{
|
||||
char **list_messages, *command, *channel, modifier_data[1024], *new_messages;
|
||||
char *message;
|
||||
char *message, *message2;
|
||||
int i, count_messages;
|
||||
|
||||
if (!batch || !batch->messages)
|
||||
@@ -261,8 +264,13 @@ irc_batch_process_messages (struct t_irc_server *server,
|
||||
if (!message)
|
||||
continue;
|
||||
|
||||
message2 = irc_tag_add_tags_to_message (message,
|
||||
batch->tags);
|
||||
if (!message2)
|
||||
continue;
|
||||
|
||||
irc_message_parse (server,
|
||||
message,
|
||||
message2,
|
||||
NULL, /* tags */
|
||||
NULL, /* message_without_tags */
|
||||
NULL, /* nick */
|
||||
@@ -280,13 +288,13 @@ irc_batch_process_messages (struct t_irc_server *server,
|
||||
NULL); /* pos_text */
|
||||
|
||||
/* add raw message */
|
||||
irc_raw_print (server, IRC_RAW_FLAG_RECV, message);
|
||||
irc_raw_print (server, IRC_RAW_FLAG_RECV, message2);
|
||||
|
||||
/* call receive callback, ignoring batch tags */
|
||||
irc_protocol_recv_command (server, message, command, channel, 1);
|
||||
irc_protocol_recv_command (server, message2, command, channel, 1);
|
||||
|
||||
if (message)
|
||||
free (message);
|
||||
free (message);
|
||||
free (message2);
|
||||
if (command)
|
||||
free (command);
|
||||
if (channel)
|
||||
@@ -562,6 +570,10 @@ irc_batch_print_log (struct t_irc_server *server)
|
||||
weechat_log_printf (" parent_ref. . . . . : '%s'", ptr_batch->parent_ref);
|
||||
weechat_log_printf (" type. . . . . . . . : '%s'", ptr_batch->type);
|
||||
weechat_log_printf (" parameters. . . . . : '%s'", ptr_batch->parameters);
|
||||
weechat_log_printf (" tags. . . . . . . . : 0x%lx (hashtable: '%s')",
|
||||
ptr_batch->tags,
|
||||
weechat_hashtable_get_string (ptr_batch->tags,
|
||||
"keys_values"));
|
||||
weechat_log_printf (" start_time. . . . . : %lld", (long long)ptr_batch->start_time);
|
||||
weechat_log_printf (" message . . . . . . : 0x%lx ('%s')",
|
||||
ptr_batch->messages,
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct t_hashtable;
|
||||
struct t_irc_server;
|
||||
|
||||
struct t_irc_batch
|
||||
@@ -30,6 +31,7 @@ struct t_irc_batch
|
||||
char *parent_ref; /* ref of parent batch (optional) */
|
||||
char *type; /* type */
|
||||
char *parameters; /* parameters */
|
||||
struct t_hashtable *tags; /* batch message tags */
|
||||
time_t start_time; /* start time (to auto-purge if */
|
||||
/* batch end is not received) */
|
||||
char **messages; /* messages separated by '\n' */
|
||||
@@ -46,7 +48,8 @@ extern struct t_irc_batch *irc_batch_start_batch (struct t_irc_server *server,
|
||||
const char *reference,
|
||||
const char *parent_ref,
|
||||
const char *type,
|
||||
const char *parameters);
|
||||
const char *parameters,
|
||||
struct t_hashtable *tags);
|
||||
extern int irc_batch_add_message (struct t_irc_server *server,
|
||||
const char *reference,
|
||||
const char *irc_message);
|
||||
|
||||
@@ -462,7 +462,7 @@ irc_channel_create_buffer (struct t_irc_server *server,
|
||||
if (noswitch
|
||||
|| (!manual_join && !autojoin_join)
|
||||
|| (manual_join && !weechat_config_boolean (irc_config_look_buffer_switch_join))
|
||||
|| (autojoin_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin)))
|
||||
|| (!manual_join && autojoin_join && !weechat_config_boolean (irc_config_look_buffer_switch_autojoin)))
|
||||
{
|
||||
switch_to_channel = 0;
|
||||
}
|
||||
|
||||
@@ -385,6 +385,7 @@ irc_command_me_channel_message (struct t_irc_server *server,
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
server,
|
||||
0, /* date */
|
||||
channel_name,
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
@@ -1970,6 +1971,7 @@ IRC_COMMAND_CALLBACK(ctcp)
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
ctcp_target,
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
@@ -3735,6 +3737,7 @@ IRC_COMMAND_CALLBACK(msg)
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
ptr_channel->name,
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
@@ -3755,6 +3758,7 @@ IRC_COMMAND_CALLBACK(msg)
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
targets[i],
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
@@ -3910,6 +3914,7 @@ IRC_COMMAND_CALLBACK(notice)
|
||||
ptr_message = (const char *)weechat_arraylist_get (list_messages, i);
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
argv[arg_target],
|
||||
NULL, /* address */
|
||||
"notice",
|
||||
@@ -4439,6 +4444,7 @@ IRC_COMMAND_CALLBACK(query)
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
ptr_channel->name,
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
|
||||
@@ -103,6 +103,7 @@ struct t_config_option *irc_config_look_notice_welcome_redirect = NULL;
|
||||
struct t_config_option *irc_config_look_notice_welcome_tags = NULL;
|
||||
struct t_config_option *irc_config_look_notify_tags_ison = NULL;
|
||||
struct t_config_option *irc_config_look_notify_tags_whois = NULL;
|
||||
struct t_config_option *irc_config_look_open_pv_buffer_echo_msg = NULL;
|
||||
struct t_config_option *irc_config_look_part_closes_buffer = NULL;
|
||||
struct t_config_option *irc_config_look_pv_buffer = NULL;
|
||||
struct t_config_option *irc_config_look_pv_tags = NULL;
|
||||
@@ -3266,6 +3267,13 @@ irc_config_init ()
|
||||
"\"notify_highlight\""),
|
||||
NULL, 0, 0, "notify_message", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
irc_config_look_open_pv_buffer_echo_msg = weechat_config_new_option (
|
||||
irc_config_file, irc_config_section_look,
|
||||
"open_pv_buffer_echo_msg", "boolean",
|
||||
N_("open a private buffer on self message when capability "
|
||||
"echo-message is enabled"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
irc_config_look_part_closes_buffer = weechat_config_new_option (
|
||||
irc_config_file, irc_config_section_look,
|
||||
"part_closes_buffer", "boolean",
|
||||
|
||||
@@ -139,6 +139,7 @@ extern struct t_config_option *irc_config_look_notice_welcome_redirect;
|
||||
extern struct t_config_option *irc_config_look_notice_welcome_tags;
|
||||
extern struct t_config_option *irc_config_look_notify_tags_ison;
|
||||
extern struct t_config_option *irc_config_look_notify_tags_whois;
|
||||
extern struct t_config_option *irc_config_look_open_pv_buffer_echo_msg;
|
||||
extern struct t_config_option *irc_config_look_part_closes_buffer;
|
||||
extern struct t_config_option *irc_config_look_pv_buffer;
|
||||
extern struct t_config_option *irc_config_look_pv_tags;
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
|
||||
void
|
||||
irc_input_user_message_display (struct t_irc_server *server,
|
||||
time_t date,
|
||||
const char *target,
|
||||
const char *address,
|
||||
const char *command,
|
||||
@@ -162,7 +163,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer,
|
||||
0,
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
command,
|
||||
@@ -189,7 +190,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer,
|
||||
0,
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
command,
|
||||
@@ -211,7 +212,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer,
|
||||
0,
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
command,
|
||||
@@ -235,7 +236,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer,
|
||||
0,
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
command,
|
||||
@@ -267,7 +268,7 @@ irc_input_user_message_display (struct t_irc_server *server,
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_buffer,
|
||||
0,
|
||||
date,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
command,
|
||||
@@ -333,6 +334,7 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
ptr_server,
|
||||
0, /* date */
|
||||
ptr_channel->name,
|
||||
NULL, /* address */
|
||||
"privmsg",
|
||||
|
||||
@@ -20,9 +20,12 @@
|
||||
#ifndef WEECHAT_PLUGIN_IRC_INPUT_H
|
||||
#define WEECHAT_PLUGIN_IRC_INPUT_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct t_gui_buffer;
|
||||
|
||||
extern void irc_input_user_message_display (struct t_irc_server *server,
|
||||
time_t date,
|
||||
const char *target,
|
||||
const char *address,
|
||||
const char *command,
|
||||
|
||||
@@ -529,6 +529,8 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
|
||||
free (arguments);
|
||||
if (text)
|
||||
free (text);
|
||||
if (params)
|
||||
weechat_string_free_split (params);
|
||||
|
||||
return hashtable;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,8 @@ IRC_PROTOCOL_CALLBACK(batch)
|
||||
params[0] + 1, /* reference */
|
||||
weechat_hashtable_get (tags, "batch"), /* parent ref */
|
||||
params[1], /* type */
|
||||
str_params);
|
||||
str_params,
|
||||
tags);
|
||||
if (str_params)
|
||||
free (str_params);
|
||||
}
|
||||
@@ -2505,8 +2506,11 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
is_channel = irc_channel_is_channel (server, pos_target);
|
||||
is_channel_orig = is_channel;
|
||||
if (is_channel)
|
||||
{
|
||||
channel = strdup (pos_target);
|
||||
else if (weechat_config_boolean (irc_config_look_notice_welcome_redirect))
|
||||
}
|
||||
else if (weechat_config_boolean (irc_config_look_notice_welcome_redirect)
|
||||
&& (irc_server_strcasecmp (server, server->nick, pos_target) == 0))
|
||||
{
|
||||
end_char = ' ';
|
||||
switch (pos_args[0])
|
||||
@@ -2985,6 +2989,7 @@ IRC_PROTOCOL_CALLBACK(pong)
|
||||
|
||||
void
|
||||
irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server,
|
||||
time_t date,
|
||||
const char *target,
|
||||
const char *address,
|
||||
const char *arguments)
|
||||
@@ -2995,7 +3000,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server,
|
||||
if (!arguments || !arguments[0])
|
||||
return;
|
||||
|
||||
pos_end = strchr (arguments + 1, '\01');
|
||||
pos_end = strrchr (arguments + 1, '\01');
|
||||
if (!pos_end)
|
||||
return;
|
||||
|
||||
@@ -3010,6 +3015,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_server *server,
|
||||
|
||||
irc_input_user_message_display (
|
||||
server,
|
||||
date,
|
||||
target,
|
||||
address,
|
||||
"privmsg",
|
||||
@@ -3071,6 +3077,9 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
pos_target++;
|
||||
}
|
||||
|
||||
cap_echo_message = weechat_hashtable_has_key (server->cap_list,
|
||||
"echo-message");
|
||||
|
||||
/* receiver is a channel ? */
|
||||
if (is_channel)
|
||||
{
|
||||
@@ -3089,7 +3098,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
if (nick_is_me)
|
||||
{
|
||||
irc_protocol_privmsg_display_ctcp_send (
|
||||
server, params[0], address, msg_args);
|
||||
server, date, params[0], address, msg_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3194,8 +3203,6 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
/* CTCP to user */
|
||||
if (msg_args[0] == '\01')
|
||||
{
|
||||
cap_echo_message = weechat_hashtable_has_key (server->cap_list,
|
||||
"echo-message");
|
||||
msg_already_received = weechat_hashtable_has_key (
|
||||
server->echo_msg_recv, irc_message);
|
||||
if (!msg_already_received && cap_echo_message)
|
||||
@@ -3207,7 +3214,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
if (nick_is_me && cap_echo_message && !msg_already_received)
|
||||
{
|
||||
irc_protocol_privmsg_display_ctcp_send (
|
||||
server, remote_nick, address, msg_args);
|
||||
server, date, remote_nick, address, msg_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3225,7 +3232,8 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
if (strcmp (ptr_channel->name, remote_nick) != 0)
|
||||
irc_channel_pv_rename (server, ptr_channel, remote_nick);
|
||||
}
|
||||
else
|
||||
else if (!nick_is_me || !cap_echo_message
|
||||
|| weechat_config_boolean (irc_config_look_open_pv_buffer_echo_msg))
|
||||
{
|
||||
ptr_channel = irc_channel_new (server,
|
||||
IRC_CHANNEL_TYPE_PRIVATE,
|
||||
@@ -3241,13 +3249,21 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
}
|
||||
}
|
||||
|
||||
if (weechat_config_boolean (irc_config_look_typing_status_nicks))
|
||||
if (ptr_channel
|
||||
&& weechat_config_boolean (irc_config_look_typing_status_nicks))
|
||||
{
|
||||
irc_typing_channel_set_nick (ptr_channel, nick,
|
||||
IRC_CHANNEL_TYPING_STATE_OFF);
|
||||
}
|
||||
|
||||
irc_channel_set_topic (ptr_channel, address);
|
||||
if (ptr_channel
|
||||
&& (!nick_is_me
|
||||
|| !cap_echo_message
|
||||
|| (irc_server_strcasecmp (server,
|
||||
server->nick, remote_nick) == 0)))
|
||||
{
|
||||
irc_channel_set_topic (ptr_channel, address);
|
||||
}
|
||||
|
||||
if (nick_is_me)
|
||||
{
|
||||
@@ -3290,20 +3306,35 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
free (str_color);
|
||||
msg_args2 = (nick_is_me) ?
|
||||
irc_message_hide_password (server, remote_nick, msg_args) : NULL;
|
||||
weechat_printf_date_tags (
|
||||
ptr_channel->buffer,
|
||||
date,
|
||||
irc_protocol_tags (server, command, tags, str_tags, nick, address),
|
||||
"%s%s",
|
||||
irc_nick_as_prefix (
|
||||
server, NULL, nick,
|
||||
(nick_is_me) ?
|
||||
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)),
|
||||
(msg_args2) ? msg_args2 : msg_args);
|
||||
if (nick_is_me && !ptr_channel)
|
||||
{
|
||||
irc_input_user_message_display (
|
||||
server,
|
||||
date,
|
||||
remote_nick,
|
||||
address,
|
||||
"privmsg",
|
||||
NULL, /* ctcp_type */
|
||||
(msg_args2) ? msg_args2 : msg_args,
|
||||
1); /* decode_colors */
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
ptr_channel->buffer,
|
||||
date,
|
||||
irc_protocol_tags (server, command, tags, str_tags, nick, address),
|
||||
"%s%s",
|
||||
irc_nick_as_prefix (
|
||||
server, NULL, nick,
|
||||
(nick_is_me) ?
|
||||
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick)),
|
||||
(msg_args2) ? msg_args2 : msg_args);
|
||||
}
|
||||
if (msg_args2)
|
||||
free (msg_args2);
|
||||
|
||||
if (ptr_channel->has_quit_server)
|
||||
if (ptr_channel && ptr_channel->has_quit_server)
|
||||
ptr_channel->has_quit_server = 0;
|
||||
|
||||
(void) weechat_hook_signal_send ("irc_pv",
|
||||
@@ -6243,7 +6274,7 @@ IRC_PROTOCOL_CALLBACK(353)
|
||||
free (prefixes);
|
||||
}
|
||||
|
||||
if (!ptr_channel)
|
||||
if (!ptr_channel && str_nicks)
|
||||
{
|
||||
weechat_printf_date_tags (
|
||||
irc_msgbuffer_get_target_buffer (
|
||||
|
||||
@@ -55,7 +55,7 @@ struct t_irc_redirect_pattern irc_redirect_patterns_default[] =
|
||||
* stop: 323: end of /list
|
||||
* extra: -
|
||||
*/
|
||||
"321",
|
||||
"321,322",
|
||||
"323",
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
|
||||
@@ -131,6 +131,8 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] =
|
||||
|
||||
char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] =
|
||||
{ "rfc1459", "strict-rfc1459", "ascii" };
|
||||
int irc_server_casemapping_range[IRC_SERVER_NUM_CASEMAPPING] =
|
||||
{ 30, 29, 26 };
|
||||
|
||||
char *irc_server_utf8mapping_string[IRC_SERVER_NUM_UTF8MAPPING] =
|
||||
{ "none", "rfc8265" };
|
||||
@@ -294,25 +296,15 @@ int
|
||||
irc_server_strcasecmp (struct t_irc_server *server,
|
||||
const char *string1, const char *string2)
|
||||
{
|
||||
int casemapping, rc;
|
||||
int casemapping, range;
|
||||
|
||||
casemapping = (server) ? server->casemapping : IRC_SERVER_CASEMAPPING_RFC1459;
|
||||
switch (casemapping)
|
||||
{
|
||||
case IRC_SERVER_CASEMAPPING_RFC1459:
|
||||
rc = weechat_strcasecmp_range (string1, string2, 30);
|
||||
break;
|
||||
case IRC_SERVER_CASEMAPPING_STRICT_RFC1459:
|
||||
rc = weechat_strcasecmp_range (string1, string2, 29);
|
||||
break;
|
||||
case IRC_SERVER_CASEMAPPING_ASCII:
|
||||
rc = weechat_strcasecmp (string1, string2);
|
||||
break;
|
||||
default:
|
||||
rc = weechat_strcasecmp_range (string1, string2, 30);
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
casemapping = (server) ? server->casemapping : -1;
|
||||
if ((casemapping < 0) || (casemapping >= IRC_SERVER_NUM_CASEMAPPING))
|
||||
casemapping = IRC_SERVER_CASEMAPPING_RFC1459;
|
||||
|
||||
range = irc_server_casemapping_range[casemapping];
|
||||
|
||||
return weechat_strcasecmp_range (string1, string2, range);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -329,25 +321,15 @@ int
|
||||
irc_server_strncasecmp (struct t_irc_server *server,
|
||||
const char *string1, const char *string2, int max)
|
||||
{
|
||||
int casemapping, rc;
|
||||
int casemapping, range;
|
||||
|
||||
casemapping = (server) ? server->casemapping : IRC_SERVER_CASEMAPPING_RFC1459;
|
||||
switch (casemapping)
|
||||
{
|
||||
case IRC_SERVER_CASEMAPPING_RFC1459:
|
||||
rc = weechat_strncasecmp_range (string1, string2, max, 30);
|
||||
break;
|
||||
case IRC_SERVER_CASEMAPPING_STRICT_RFC1459:
|
||||
rc = weechat_strncasecmp_range (string1, string2, max, 29);
|
||||
break;
|
||||
case IRC_SERVER_CASEMAPPING_ASCII:
|
||||
rc = weechat_strncasecmp (string1, string2, max);
|
||||
break;
|
||||
default:
|
||||
rc = weechat_strncasecmp_range (string1, string2, max, 30);
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
casemapping = (server) ? server->casemapping : -1;
|
||||
if ((casemapping < 0) || (casemapping >= IRC_SERVER_NUM_CASEMAPPING))
|
||||
casemapping = IRC_SERVER_CASEMAPPING_RFC1459;
|
||||
|
||||
range = irc_server_casemapping_range[casemapping];
|
||||
|
||||
return weechat_strncasecmp_range (string1, string2, max, range);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -418,6 +400,9 @@ irc_server_eval_fingerprint (struct t_irc_server *server)
|
||||
char *fingerprint_eval, **fingerprints, *str_sizes;
|
||||
int i, j, rc, algo, length;
|
||||
|
||||
if (!server)
|
||||
return NULL;
|
||||
|
||||
ptr_fingerprint = IRC_SERVER_OPTION_STRING(server,
|
||||
IRC_SERVER_OPTION_TLS_FINGERPRINT);
|
||||
|
||||
@@ -1611,6 +1596,25 @@ irc_server_buffer_set_input_multiline (struct t_irc_server *server,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if a server has channels opened.
|
||||
*/
|
||||
|
||||
int
|
||||
irc_server_has_channels (struct t_irc_server *server)
|
||||
{
|
||||
struct t_irc_channel *ptr_channel;
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
if (ptr_channel->type == IRC_CHANNEL_TYPE_CHANNEL)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates a new server and adds it to the servers queue.
|
||||
*
|
||||
@@ -5861,7 +5865,7 @@ irc_server_autojoin_create_buffers (struct t_irc_server *server)
|
||||
* buffers are opened only if auto-join was not already done
|
||||
* and if no channels are currently opened
|
||||
*/
|
||||
if (server->autojoin_done || server->channels)
|
||||
if (server->autojoin_done || irc_server_has_channels (server))
|
||||
return;
|
||||
|
||||
/* evaluate server option "autojoin" */
|
||||
@@ -6022,7 +6026,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!server->autojoin_done && !server->channels)
|
||||
if (!server->autojoin_done && !irc_server_has_channels (server))
|
||||
{
|
||||
/* auto-join when connecting to server for first time */
|
||||
autojoin = irc_server_eval_expression (
|
||||
@@ -6036,7 +6040,7 @@ irc_server_autojoin_channels (struct t_irc_server *server)
|
||||
if (autojoin)
|
||||
free (autojoin);
|
||||
}
|
||||
else if (server->channels)
|
||||
else if (irc_server_has_channels (server))
|
||||
{
|
||||
/* auto-join after disconnection (only rejoins opened channels) */
|
||||
autojoin = irc_server_build_autojoin (server);
|
||||
|
||||
@@ -387,6 +387,7 @@ extern char *irc_server_get_default_msg (const char *default_msg,
|
||||
const char *target_nick);
|
||||
extern void irc_server_buffer_set_input_multiline (struct t_irc_server *server,
|
||||
int multiline);
|
||||
extern int irc_server_has_channels (struct t_irc_server *server);
|
||||
extern struct t_irc_server *irc_server_alloc (const char *name);
|
||||
extern struct t_irc_server *irc_server_alloc_with_url (const char *irc_url);
|
||||
extern void irc_server_apply_command_line_options (struct t_irc_server *server,
|
||||
|
||||
@@ -283,3 +283,159 @@ irc_tag_parse (const char *tags,
|
||||
|
||||
return num_tags;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds tags to a dynamic string, separated by semicolons, with escaped
|
||||
* tag values.
|
||||
*/
|
||||
|
||||
void
|
||||
irc_tag_add_to_string_cb (void *data,
|
||||
struct t_hashtable *hashtable,
|
||||
const void *key,
|
||||
const void *value)
|
||||
{
|
||||
char **string, *escaped;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
|
||||
string = (char **)data;
|
||||
|
||||
if (*string[0])
|
||||
weechat_string_dyn_concat (string, ";", -1);
|
||||
|
||||
weechat_string_dyn_concat (string, key, -1);
|
||||
|
||||
if (value)
|
||||
{
|
||||
weechat_string_dyn_concat (string, "=", -1);
|
||||
escaped = irc_tag_escape_value ((const char *)value);
|
||||
weechat_string_dyn_concat (string,
|
||||
(escaped) ? escaped : (const char *)value,
|
||||
-1);
|
||||
if (escaped)
|
||||
free (escaped);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts hashtable with tags to a string (tags and values are escaped).
|
||||
*
|
||||
* Note: result must be freed after use.
|
||||
*/
|
||||
|
||||
char *
|
||||
irc_tag_hashtable_to_string (struct t_hashtable *tags)
|
||||
{
|
||||
char **string;
|
||||
|
||||
if (!tags)
|
||||
return NULL;
|
||||
|
||||
string = weechat_string_dyn_alloc (64);
|
||||
if (!string)
|
||||
return NULL;
|
||||
|
||||
weechat_hashtable_map (tags, &irc_tag_add_to_string_cb, string);
|
||||
|
||||
return weechat_string_dyn_free (string, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds tags to another hashtable.
|
||||
*/
|
||||
|
||||
void
|
||||
irc_tag_add_to_hashtable_cb (void *data,
|
||||
struct t_hashtable *hashtable,
|
||||
const void *key,
|
||||
const void *value)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
|
||||
if (!weechat_hashtable_has_key ((struct t_hashtable *)data, key))
|
||||
weechat_hashtable_set ((struct t_hashtable *)data, key, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds tags to an IRC message.
|
||||
* Existing tags in message are kept unchanged.
|
||||
*
|
||||
* Note: result must be freed after use.
|
||||
*/
|
||||
|
||||
char *
|
||||
irc_tag_add_tags_to_message (const char *message, struct t_hashtable *tags)
|
||||
{
|
||||
char *msg_str_tags, **result, *new_tags;
|
||||
const char *pos_space, *ptr_message;
|
||||
struct t_hashtable *msg_hash_tags;
|
||||
|
||||
if (!message)
|
||||
return NULL;
|
||||
|
||||
if (!tags)
|
||||
return strdup (message);
|
||||
|
||||
result = NULL;
|
||||
msg_str_tags = NULL;
|
||||
msg_hash_tags = NULL;
|
||||
new_tags = NULL;
|
||||
|
||||
if (message[0] == '@')
|
||||
{
|
||||
pos_space = strchr (message, ' ');
|
||||
if (!pos_space)
|
||||
goto end;
|
||||
msg_str_tags = weechat_strndup (message + 1, pos_space - message - 1);
|
||||
ptr_message = pos_space + 1;
|
||||
while (ptr_message[0] == ' ')
|
||||
{
|
||||
ptr_message++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_message = message;
|
||||
}
|
||||
|
||||
msg_hash_tags = weechat_hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
if (!msg_hash_tags)
|
||||
goto end;
|
||||
|
||||
if (msg_str_tags)
|
||||
irc_tag_parse (msg_str_tags, msg_hash_tags, NULL);
|
||||
|
||||
weechat_hashtable_map (tags, &irc_tag_add_to_hashtable_cb, msg_hash_tags);
|
||||
|
||||
result = weechat_string_dyn_alloc (64);
|
||||
if (!result)
|
||||
goto end;
|
||||
|
||||
new_tags = irc_tag_hashtable_to_string (msg_hash_tags);
|
||||
if (!new_tags)
|
||||
goto end;
|
||||
|
||||
if (new_tags[0])
|
||||
{
|
||||
weechat_string_dyn_concat (result, "@", -1);
|
||||
weechat_string_dyn_concat (result, new_tags, -1);
|
||||
weechat_string_dyn_concat (result, " ", -1);
|
||||
}
|
||||
weechat_string_dyn_concat (result, ptr_message, -1);
|
||||
|
||||
end:
|
||||
if (msg_str_tags)
|
||||
free (msg_str_tags);
|
||||
if (msg_hash_tags)
|
||||
weechat_hashtable_free (msg_hash_tags);
|
||||
if (new_tags)
|
||||
free (new_tags);
|
||||
|
||||
return (result) ? weechat_string_dyn_free (result, 0) : NULL;
|
||||
}
|
||||
|
||||
@@ -30,5 +30,7 @@ extern char *irc_tag_modifier_cb (const void *pointer,
|
||||
extern int irc_tag_parse (const char *tags,
|
||||
struct t_hashtable *hashtable,
|
||||
const char *prefix_key);
|
||||
extern char *irc_tag_add_tags_to_message (const char *message,
|
||||
struct t_hashtable *tags);
|
||||
|
||||
#endif /* WEECHAT_PLUGIN_IRC_TAG_H */
|
||||
|
||||
@@ -657,7 +657,7 @@ weechat_js_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load javascript script */
|
||||
path_script = plugin_script_search_path (weechat_js_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_js_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -168,7 +168,7 @@ struct t_arraylist *
|
||||
logger_backlog_group_messages (struct t_arraylist *lines)
|
||||
{
|
||||
int i, size, time_found;
|
||||
char **message, **old_message, *str_date, *error;
|
||||
char *message, *new_message, *str_date, *error;
|
||||
const char *ptr_line, *pos_message;
|
||||
struct tm tm_line;
|
||||
struct t_arraylist *messages;
|
||||
@@ -176,27 +176,37 @@ logger_backlog_group_messages (struct t_arraylist *lines)
|
||||
if (!lines)
|
||||
return NULL;
|
||||
|
||||
message = NULL;
|
||||
|
||||
size = weechat_arraylist_size (lines);
|
||||
|
||||
messages = weechat_arraylist_new (size, 0, 1,
|
||||
&logger_backlog_msg_cmp_cb, NULL,
|
||||
&logger_backlog_msg_free_cb, NULL);
|
||||
if (!messages)
|
||||
return NULL;
|
||||
|
||||
message = weechat_string_dyn_alloc (256);
|
||||
old_message = weechat_string_dyn_alloc (256);
|
||||
goto error;
|
||||
|
||||
for (i = size - 1; i >= 0; i--)
|
||||
{
|
||||
ptr_line = (const char *)weechat_arraylist_get (lines, i);
|
||||
|
||||
weechat_string_dyn_copy (old_message, *message);
|
||||
weechat_string_dyn_copy (message, ptr_line);
|
||||
if ((*old_message)[0])
|
||||
if (message)
|
||||
{
|
||||
weechat_string_dyn_concat (message, "\n", -1);
|
||||
weechat_string_dyn_concat (message, *old_message, -1);
|
||||
new_message = malloc (strlen (ptr_line) + 1 + strlen (message) + 1);
|
||||
if (!new_message)
|
||||
goto error;
|
||||
strcpy (new_message, ptr_line);
|
||||
strcat (new_message, "\n");
|
||||
strcat (new_message, message);
|
||||
free (message);
|
||||
message = new_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
message = malloc (strlen (ptr_line) + 1);
|
||||
if (!message)
|
||||
goto error;
|
||||
strcpy (message, ptr_line);
|
||||
}
|
||||
|
||||
time_found = 0;
|
||||
@@ -218,18 +228,26 @@ logger_backlog_group_messages (struct t_arraylist *lines)
|
||||
}
|
||||
if (time_found)
|
||||
{
|
||||
weechat_arraylist_insert (messages, 0, strdup (*message));
|
||||
weechat_string_dyn_copy (message, NULL);
|
||||
/* add message (will be freed when arraylist is destroyed) */
|
||||
weechat_arraylist_insert (messages, 0, message);
|
||||
message = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*message)[0])
|
||||
weechat_arraylist_insert (messages, 0, strdup (*message));
|
||||
|
||||
weechat_string_dyn_free (message, 1);
|
||||
weechat_string_dyn_free (old_message, 1);
|
||||
if (message)
|
||||
{
|
||||
/* add message (will be freed when arraylist is destroyed) */
|
||||
weechat_arraylist_insert (messages, 0, message);
|
||||
}
|
||||
|
||||
return messages;
|
||||
|
||||
error:
|
||||
if (message)
|
||||
free (message);
|
||||
if (messages)
|
||||
weechat_arraylist_free (messages);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -100,7 +100,7 @@ logger_tail_lines_free_cb (void *data, struct t_arraylist *arraylist,
|
||||
struct t_arraylist *
|
||||
logger_tail_file (const char *filename, int lines)
|
||||
{
|
||||
int fd;
|
||||
int fd, count_read;
|
||||
off_t file_length, file_pos;
|
||||
size_t to_read;
|
||||
ssize_t bytes_read;
|
||||
@@ -108,21 +108,30 @@ logger_tail_file (const char *filename, int lines)
|
||||
char *ptr_buf, *pos_eol, *part_of_line, *new_part_of_line, *line;
|
||||
struct t_arraylist *list_lines;
|
||||
|
||||
if (!filename || (lines < 1))
|
||||
if (!filename || !filename[0] || (lines < 1))
|
||||
return NULL;
|
||||
|
||||
fd = -1;
|
||||
part_of_line = 0;
|
||||
list_lines = NULL;
|
||||
|
||||
/* allocate arraylist */
|
||||
list_lines = weechat_arraylist_new (lines, 0, 1,
|
||||
&logger_tail_lines_cmp_cb, NULL,
|
||||
&logger_tail_lines_free_cb, NULL);
|
||||
if (!list_lines)
|
||||
goto error;
|
||||
|
||||
/* open file */
|
||||
fd = open (filename, O_RDONLY);
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
goto error;
|
||||
|
||||
/* seek to the end of file */
|
||||
count_read = 0;
|
||||
file_length = lseek (fd, (off_t)0, SEEK_END);
|
||||
if (file_length <= 0)
|
||||
{
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
goto error;
|
||||
to_read = file_length;
|
||||
file_pos = file_length - LOGGER_TAIL_BUFSIZE;
|
||||
if (file_pos < 0)
|
||||
@@ -132,71 +141,51 @@ logger_tail_file (const char *filename, int lines)
|
||||
lseek (fd, file_pos, SEEK_SET);
|
||||
|
||||
/* loop until we have "lines" lines in list */
|
||||
part_of_line = NULL;
|
||||
list_lines = weechat_arraylist_new (lines, 0, 1,
|
||||
&logger_tail_lines_cmp_cb, NULL,
|
||||
&logger_tail_lines_free_cb, NULL);
|
||||
while (lines > 0)
|
||||
{
|
||||
lseek (fd, file_pos, SEEK_SET);
|
||||
bytes_read = read (fd, buf, to_read);
|
||||
if (bytes_read <= 0)
|
||||
{
|
||||
if (part_of_line)
|
||||
free (part_of_line);
|
||||
weechat_arraylist_free (list_lines);
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
goto error;
|
||||
count_read++;
|
||||
buf[bytes_read] = '\0';
|
||||
if ((count_read == 1)
|
||||
&& ((buf[bytes_read - 1] == '\n') || (buf[bytes_read - 1] == '\r')))
|
||||
{
|
||||
/* ignore last new line of the file (on first block read only) */
|
||||
buf[bytes_read - 1] = '\0';
|
||||
bytes_read--;
|
||||
}
|
||||
ptr_buf = buf + bytes_read - 1;
|
||||
while (ptr_buf && (ptr_buf >= buf))
|
||||
{
|
||||
pos_eol = (char *)logger_tail_last_eol (buf, ptr_buf);
|
||||
if ((pos_eol && (pos_eol[1] || part_of_line)) || (file_pos == 0))
|
||||
if (pos_eol)
|
||||
{
|
||||
/* use data and part_of_line (if existing) to build a new line */
|
||||
if (!pos_eol)
|
||||
ptr_buf = pos_eol - 1;
|
||||
pos_eol[0] = '\0';
|
||||
pos_eol++;
|
||||
if (part_of_line)
|
||||
{
|
||||
ptr_buf = NULL;
|
||||
pos_eol = buf;
|
||||
line = malloc ((strlen (pos_eol) +
|
||||
strlen (part_of_line) + 1));
|
||||
if (!line)
|
||||
goto error;
|
||||
strcpy (line, pos_eol);
|
||||
strcat (line, part_of_line);
|
||||
free (part_of_line);
|
||||
part_of_line = NULL;
|
||||
weechat_arraylist_insert (list_lines, 0, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_buf = pos_eol - 1;
|
||||
pos_eol[0] = '\0';
|
||||
pos_eol++;
|
||||
}
|
||||
if (part_of_line || pos_eol[0])
|
||||
{
|
||||
if (part_of_line)
|
||||
{
|
||||
line = malloc ((strlen (pos_eol) +
|
||||
strlen (part_of_line) + 1));
|
||||
if (!line)
|
||||
{
|
||||
free (part_of_line);
|
||||
weechat_arraylist_free (list_lines);
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
strcpy (line, pos_eol);
|
||||
strcat (line, part_of_line);
|
||||
free (part_of_line);
|
||||
part_of_line = NULL;
|
||||
weechat_arraylist_insert (list_lines, 0, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
weechat_arraylist_insert (list_lines, 0,
|
||||
strdup (pos_eol));
|
||||
}
|
||||
lines--;
|
||||
if (lines <= 0)
|
||||
break;
|
||||
weechat_arraylist_insert (list_lines, 0, strdup (pos_eol));
|
||||
}
|
||||
lines--;
|
||||
if (lines <= 0)
|
||||
break;
|
||||
}
|
||||
else if (!pos_eol)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* beginning of read buffer reached without EOL, then we
|
||||
@@ -206,12 +195,7 @@ logger_tail_file (const char *filename, int lines)
|
||||
{
|
||||
new_part_of_line = malloc (strlen (buf) + strlen (part_of_line) + 1);
|
||||
if (!new_part_of_line)
|
||||
{
|
||||
free (part_of_line);
|
||||
weechat_arraylist_free (list_lines);
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
goto error;
|
||||
strcpy (new_part_of_line, buf);
|
||||
strcat (new_part_of_line, part_of_line);
|
||||
free (part_of_line);
|
||||
@@ -220,12 +204,12 @@ logger_tail_file (const char *filename, int lines)
|
||||
else
|
||||
{
|
||||
part_of_line = malloc (strlen (buf) + 1);
|
||||
if (!part_of_line)
|
||||
goto error;
|
||||
strcpy (part_of_line, buf);
|
||||
}
|
||||
ptr_buf = NULL;
|
||||
}
|
||||
else
|
||||
ptr_buf = pos_eol - 1;
|
||||
}
|
||||
if (file_pos == 0)
|
||||
break;
|
||||
@@ -238,9 +222,21 @@ logger_tail_file (const char *filename, int lines)
|
||||
}
|
||||
|
||||
if (part_of_line)
|
||||
free (part_of_line);
|
||||
{
|
||||
/* add part of line (will be freed when arraylist is destroyed) */
|
||||
weechat_arraylist_insert (list_lines, 0, part_of_line);
|
||||
}
|
||||
|
||||
close (fd);
|
||||
|
||||
return list_lines;
|
||||
|
||||
error:
|
||||
if (part_of_line)
|
||||
free (part_of_line);
|
||||
if (list_lines)
|
||||
weechat_arraylist_free (list_lines);
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -975,7 +975,7 @@ weechat_lua_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load lua script */
|
||||
path_script = plugin_script_search_path (weechat_lua_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_lua_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#undef _
|
||||
|
||||
#include <locale.h>
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
@@ -567,6 +568,10 @@ weechat_perl_load (const char *filename, const char *code)
|
||||
temp_script.interpreter = (PerlInterpreter *) perl_current_interpreter;
|
||||
perl_parse (perl_current_interpreter, weechat_perl_api_init,
|
||||
perl_args_count, perl_args, NULL);
|
||||
#if PERL_REVISION >= 6 || (PERL_REVISION == 5 && PERL_VERSION >= 38)
|
||||
/* restore the locale that could be changed by Perl >= 5.38 */
|
||||
Perl_setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
length = strlen (perl_weechat_code) + strlen (str_warning) +
|
||||
strlen (str_error) - 2 + 4 + strlen ((code) ? code : filename) + 4 + 1;
|
||||
perl_code = malloc (length);
|
||||
@@ -958,7 +963,7 @@ weechat_perl_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load perl script */
|
||||
path_script = plugin_script_search_path (weechat_perl_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_perl_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
@@ -1290,6 +1295,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
perl_construct (perl_main);
|
||||
perl_parse (perl_main, weechat_perl_api_init, perl_args_count,
|
||||
perl_args, NULL);
|
||||
#if PERL_REVISION >= 6 || (PERL_REVISION == 5 && PERL_VERSION >= 38)
|
||||
/* restore the locale that could be changed by Perl >= 5.38 */
|
||||
Perl_setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
perl_data.config_file = &perl_config_file;
|
||||
|
||||
@@ -977,7 +977,7 @@ weechat_php_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load PHP script */
|
||||
path_script = plugin_script_search_path (weechat_php_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_php_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
+100
-100
@@ -536,7 +536,8 @@ plugin_script_search_by_full_name (struct t_plugin_script *scripts,
|
||||
|
||||
char *
|
||||
plugin_script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename)
|
||||
const char *filename,
|
||||
int search_system_dir)
|
||||
{
|
||||
char *final_name, *weechat_data_dir, *dir_system;
|
||||
int length;
|
||||
@@ -601,28 +602,31 @@ plugin_script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
free (weechat_data_dir);
|
||||
}
|
||||
|
||||
/* try WeeChat system dir */
|
||||
dir_system = weechat_info_get ("weechat_sharedir", "");
|
||||
if (dir_system)
|
||||
if (search_system_dir)
|
||||
{
|
||||
length = strlen (dir_system) + strlen (weechat_plugin->name) +
|
||||
strlen (filename) + 16;
|
||||
final_name = malloc (length);
|
||||
if (final_name)
|
||||
/* try WeeChat system dir */
|
||||
dir_system = weechat_info_get ("weechat_sharedir", "");
|
||||
if (dir_system)
|
||||
{
|
||||
snprintf (final_name,length,
|
||||
"%s/%s/%s", dir_system, weechat_plugin->name, filename);
|
||||
if ((stat (final_name, &st) == 0) && (st.st_size > 0))
|
||||
length = strlen (dir_system) + strlen (weechat_plugin->name) +
|
||||
strlen (filename) + 16;
|
||||
final_name = malloc (length);
|
||||
if (final_name)
|
||||
{
|
||||
free (dir_system);
|
||||
return final_name;
|
||||
snprintf (final_name,length,
|
||||
"%s/%s/%s", dir_system, weechat_plugin->name, filename);
|
||||
if ((stat (final_name, &st) == 0) && (st.st_size > 0))
|
||||
{
|
||||
free (dir_system);
|
||||
return final_name;
|
||||
}
|
||||
free (final_name);
|
||||
}
|
||||
free (final_name);
|
||||
free (dir_system);
|
||||
}
|
||||
free (dir_system);
|
||||
}
|
||||
|
||||
return strdup (filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1146,17 +1150,9 @@ plugin_script_remove_file (struct t_weechat_plugin *weechat_plugin,
|
||||
i = 0;
|
||||
while (i < 2)
|
||||
{
|
||||
path_script = plugin_script_search_path (weechat_plugin, name);
|
||||
/*
|
||||
* script not found? (if path_script == name, that means the function
|
||||
* above did not find the script)
|
||||
*/
|
||||
if (!path_script || (strcmp (path_script, name) == 0))
|
||||
{
|
||||
if (path_script)
|
||||
free (path_script);
|
||||
path_script = plugin_script_search_path (weechat_plugin, name, 0);
|
||||
if (!path_script)
|
||||
break;
|
||||
}
|
||||
num_found++;
|
||||
if (unlink (path_script) == 0)
|
||||
{
|
||||
@@ -1216,7 +1212,7 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
char **list)
|
||||
{
|
||||
char **argv, *name, *ptr_base_name, *base_name, *new_path, *autoload_path;
|
||||
char *symlink_path, str_signal[128], *ptr_list, *weechat_data_dir, *dir_separator;
|
||||
char *symlink_path, str_signal[128], *ptr_name, *weechat_data_dir, *dir_separator;
|
||||
int argc, i, length, rc, autoload, existing_script, script_loaded;
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -1226,30 +1222,7 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
/* create again directories, just in case they have been removed */
|
||||
plugin_script_create_dirs (weechat_plugin);
|
||||
|
||||
ptr_list = *list;
|
||||
autoload = 0;
|
||||
*quiet = 0;
|
||||
|
||||
while ((ptr_list[0] == ' ') || (ptr_list[0] == '-'))
|
||||
{
|
||||
if (ptr_list[0] == ' ')
|
||||
ptr_list++;
|
||||
else
|
||||
{
|
||||
switch (ptr_list[1])
|
||||
{
|
||||
case 'a': /* autoload */
|
||||
autoload = 1;
|
||||
break;
|
||||
case 'q': /* quiet mode */
|
||||
*quiet = 1;
|
||||
break;
|
||||
}
|
||||
ptr_list += 2;
|
||||
}
|
||||
}
|
||||
|
||||
argv = weechat_string_split (ptr_list, ",", NULL,
|
||||
argv = weechat_string_split (*list, ",", NULL,
|
||||
WEECHAT_STRING_SPLIT_STRIP_LEFT
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
|
||||
@@ -1258,7 +1231,30 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
name = strdup (argv[i]);
|
||||
autoload = 0;
|
||||
*quiet = 0;
|
||||
ptr_name = argv[i];
|
||||
while ((ptr_name[0] == ' ') || (ptr_name[0] == '-'))
|
||||
{
|
||||
if (ptr_name[0] == ' ')
|
||||
{
|
||||
ptr_name++;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ptr_name[1])
|
||||
{
|
||||
case 'a': /* autoload */
|
||||
autoload = 1;
|
||||
break;
|
||||
case 'q': /* quiet mode */
|
||||
*quiet = 1;
|
||||
break;
|
||||
}
|
||||
ptr_name += 2;
|
||||
}
|
||||
}
|
||||
name = strdup (ptr_name);
|
||||
if (name)
|
||||
{
|
||||
ptr_base_name = basename (name);
|
||||
@@ -1350,6 +1346,13 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
free (base_name);
|
||||
if (weechat_data_dir)
|
||||
free (weechat_data_dir);
|
||||
|
||||
/* send signal */
|
||||
snprintf (str_signal, sizeof (str_signal),
|
||||
"%s_script_installed", weechat_plugin->name);
|
||||
(void) weechat_hook_signal_send (str_signal,
|
||||
WEECHAT_HOOK_SIGNAL_STRING,
|
||||
name);
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
@@ -1359,11 +1362,6 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
*quiet = 0;
|
||||
|
||||
snprintf (str_signal, sizeof (str_signal),
|
||||
"%s_script_installed", weechat_plugin->name);
|
||||
(void) weechat_hook_signal_send (str_signal, WEECHAT_HOOK_SIGNAL_STRING,
|
||||
ptr_list);
|
||||
|
||||
free (*list);
|
||||
*list = NULL;
|
||||
}
|
||||
@@ -1383,7 +1381,7 @@ plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
int *quiet,
|
||||
char **list)
|
||||
{
|
||||
char **argv, str_signal[128], *ptr_list;
|
||||
char **argv, str_signal[128], *ptr_name;
|
||||
int argc, i;
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
@@ -1393,15 +1391,7 @@ plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
/* create again directories, just in case they have been removed */
|
||||
plugin_script_create_dirs (weechat_plugin);
|
||||
|
||||
ptr_list = *list;
|
||||
*quiet = 0;
|
||||
if (strncmp (ptr_list, "-q ", 3) == 0)
|
||||
{
|
||||
*quiet = 1;
|
||||
ptr_list += 3;
|
||||
}
|
||||
|
||||
argv = weechat_string_split (ptr_list, ",", NULL,
|
||||
argv = weechat_string_split (*list, ",", NULL,
|
||||
WEECHAT_STRING_SPLIT_STRIP_LEFT
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
|
||||
@@ -1410,25 +1400,35 @@ plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
ptr_name = argv[i];
|
||||
*quiet = 0;
|
||||
if (strncmp (ptr_name, "-q ", 3) == 0)
|
||||
{
|
||||
*quiet = 1;
|
||||
ptr_name += 3;
|
||||
}
|
||||
|
||||
/* unload script, if script is loaded */
|
||||
ptr_script = plugin_script_search_by_full_name (scripts, argv[i]);
|
||||
ptr_script = plugin_script_search_by_full_name (scripts, ptr_name);
|
||||
if (ptr_script)
|
||||
(*script_unload) (ptr_script);
|
||||
|
||||
/* remove script file(s) */
|
||||
(void) plugin_script_remove_file (weechat_plugin, argv[i],
|
||||
(void) plugin_script_remove_file (weechat_plugin, ptr_name,
|
||||
*quiet, 1);
|
||||
|
||||
/* send signal */
|
||||
snprintf (str_signal, sizeof (str_signal),
|
||||
"%s_script_removed", weechat_plugin->name);
|
||||
(void) weechat_hook_signal_send (str_signal,
|
||||
WEECHAT_HOOK_SIGNAL_STRING,
|
||||
ptr_name);
|
||||
}
|
||||
weechat_string_free_split (argv);
|
||||
}
|
||||
|
||||
*quiet = 0;
|
||||
|
||||
snprintf (str_signal, sizeof (str_signal),
|
||||
"%s_script_removed", weechat_plugin->name);
|
||||
(void) weechat_hook_signal_send (str_signal, WEECHAT_HOOK_SIGNAL_STRING,
|
||||
ptr_list);
|
||||
|
||||
free (*list);
|
||||
*list = NULL;
|
||||
}
|
||||
@@ -1443,7 +1443,7 @@ plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
|
||||
char **list)
|
||||
{
|
||||
char **argv, *name, *ptr_base_name, *base_name, *autoload_path;
|
||||
char *symlink_path, *ptr_list, *weechat_data_dir, *dir_separator;
|
||||
char *symlink_path, *ptr_name, *weechat_data_dir, *dir_separator;
|
||||
int argc, i, length, rc, autoload;
|
||||
|
||||
if (!*list)
|
||||
@@ -1452,30 +1452,7 @@ plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
|
||||
/* create again directories, just in case they have been removed */
|
||||
plugin_script_create_dirs (weechat_plugin);
|
||||
|
||||
ptr_list = *list;
|
||||
autoload = 0;
|
||||
*quiet = 0;
|
||||
|
||||
while ((ptr_list[0] == ' ') || (ptr_list[0] == '-'))
|
||||
{
|
||||
if (ptr_list[0] == ' ')
|
||||
ptr_list++;
|
||||
else
|
||||
{
|
||||
switch (ptr_list[1])
|
||||
{
|
||||
case 'a': /* no autoload */
|
||||
autoload = 1;
|
||||
break;
|
||||
case 'q': /* quiet mode */
|
||||
*quiet = 1;
|
||||
break;
|
||||
}
|
||||
ptr_list += 2;
|
||||
}
|
||||
}
|
||||
|
||||
argv = weechat_string_split (ptr_list, ",", NULL,
|
||||
argv = weechat_string_split (*list, ",", NULL,
|
||||
WEECHAT_STRING_SPLIT_STRIP_LEFT
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
|
||||
@@ -1484,7 +1461,30 @@ plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
name = strdup (argv[i]);
|
||||
ptr_name = argv[i];
|
||||
autoload = 0;
|
||||
*quiet = 0;
|
||||
while ((ptr_name[0] == ' ') || (ptr_name[0] == '-'))
|
||||
{
|
||||
if (ptr_name[0] == ' ')
|
||||
{
|
||||
ptr_name++;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ptr_name[1])
|
||||
{
|
||||
case 'a': /* no autoload */
|
||||
autoload = 1;
|
||||
break;
|
||||
case 'q': /* quiet mode */
|
||||
*quiet = 1;
|
||||
break;
|
||||
}
|
||||
ptr_name += 2;
|
||||
}
|
||||
}
|
||||
name = strdup (ptr_name);
|
||||
if (name)
|
||||
{
|
||||
ptr_base_name = basename (name);
|
||||
|
||||
@@ -135,7 +135,8 @@ extern void plugin_script_auto_load (struct t_weechat_plugin *weechat_plugin,
|
||||
extern struct t_plugin_script *plugin_script_search (struct t_plugin_script *scripts,
|
||||
const char *name);
|
||||
extern char *plugin_script_search_path (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename);
|
||||
const char *filename,
|
||||
int search_system_dir);
|
||||
extern struct t_plugin_script *plugin_script_alloc (const char *filename,
|
||||
const char *name,
|
||||
const char *author,
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
return PyLong_FromLong((long)__int)
|
||||
#define API_RETURN_LONG(__long) \
|
||||
return PyLong_FromLong(__long)
|
||||
#define API_RETURN_LONGLONG(__longlong) \
|
||||
return PyLong_FromLongLong(__longlong)
|
||||
|
||||
|
||||
/*
|
||||
@@ -374,14 +376,14 @@ API_FUNC(string_parse_size)
|
||||
char *size;
|
||||
unsigned long long value;
|
||||
|
||||
API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONG(0));
|
||||
API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONGLONG(0));
|
||||
size = NULL;
|
||||
if (!PyArg_ParseTuple (args, "s", &size))
|
||||
API_WRONG_ARGS(API_RETURN_LONG(0));
|
||||
API_WRONG_ARGS(API_RETURN_LONGLONG(0));
|
||||
|
||||
value = weechat_string_parse_size (size);
|
||||
|
||||
API_RETURN_LONG(value);
|
||||
API_RETURN_LONGLONG(value);
|
||||
}
|
||||
|
||||
API_FUNC(string_color_code_size)
|
||||
|
||||
@@ -1201,7 +1201,7 @@ weechat_python_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load python script */
|
||||
path_script = plugin_script_search_path (weechat_python_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_python_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# DO NOT EDIT BY HAND!
|
||||
#
|
||||
|
||||
from typing import Dict
|
||||
from typing import Dict, Union
|
||||
|
||||
WEECHAT_RC_OK: int = 0
|
||||
WEECHAT_RC_OK_EAT: int = 1
|
||||
@@ -539,7 +539,7 @@ def config_new_section(config_file: str, name: str,
|
||||
::
|
||||
|
||||
# example
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -558,7 +558,7 @@ def config_new_section(config_file: str, name: str,
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_ERROR
|
||||
# return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR
|
||||
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int:
|
||||
def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int:
|
||||
# ...
|
||||
return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED
|
||||
# return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE
|
||||
@@ -594,7 +594,7 @@ def config_search_section(config_file: str, section_name: str) -> str:
|
||||
|
||||
def config_new_option(config_file: str, section: str, name: str, type: str, description: str,
|
||||
string_values: str, min: int, max: int,
|
||||
default_value: str | None, value: str | None, null_value_allowed: int,
|
||||
default_value: Union[str, None], value: Union[str, None], null_value_allowed: int,
|
||||
callback_check_value: str, callback_check_value_data: str,
|
||||
callback_change: str, callback_change_data: str,
|
||||
callback_delete: str, callback_delete_data: str) -> str:
|
||||
|
||||
@@ -1581,6 +1581,53 @@ relay_irc_recv_command_capab (struct t_relay_client *client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Parses CTCP message and return CTCP type and parameters.
|
||||
* If message is not a valid CTCP format, type and parameters are set to NULL.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* message | type | params
|
||||
* --------------------------|-----------|-----------
|
||||
* "\01ACTION is testing\01" | "ACTION" | "is testing"
|
||||
* "\01VERSION\01" | "VERSION" | NULL
|
||||
* "\01VERSION" | NULL | NULL
|
||||
* "test" | NULL | NULL
|
||||
*/
|
||||
|
||||
void
|
||||
relay_irc_parse_ctcp (const char *message, char **ctcp_type, char **ctcp_params)
|
||||
{
|
||||
const char *pos_space, *pos_end;
|
||||
|
||||
if (!ctcp_type || !ctcp_params)
|
||||
return;
|
||||
|
||||
*ctcp_type = NULL;
|
||||
*ctcp_params = NULL;
|
||||
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
if (message[0] != '\01')
|
||||
return;
|
||||
|
||||
pos_end = strrchr (message + 1, '\01');
|
||||
if (!pos_end)
|
||||
return;
|
||||
|
||||
pos_space = strchr (message, ' ' );
|
||||
if (pos_space && (pos_space < pos_end))
|
||||
{
|
||||
*ctcp_type = weechat_strndup (message + 1, pos_space - message - 1);
|
||||
*ctcp_params = weechat_strndup (pos_space + 1, pos_end - pos_space - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*ctcp_type = weechat_strndup (message + 1, pos_end - message - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads one message from client.
|
||||
*/
|
||||
@@ -1595,7 +1642,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
|
||||
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 modifier_data[128], *new_data;
|
||||
char modifier_data[128], *new_data, *ctcp_type, *ctcp_params;
|
||||
long num_params;
|
||||
int i, redirect_msg;
|
||||
|
||||
@@ -1933,26 +1980,61 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
|
||||
{
|
||||
str_args = weechat_string_rebuild_split_string (
|
||||
(const char **)params, " ", 1, -1);
|
||||
relay_irc_parse_ctcp (str_args, &ctcp_type, &ctcp_params);
|
||||
irc_is_channel = weechat_info_get ("irc_is_channel", params[0]);
|
||||
if (irc_is_channel && (strcmp (irc_is_channel, "1") == 0))
|
||||
{
|
||||
relay_irc_input_send (client, params[0],
|
||||
"priority_high,user_message",
|
||||
"%s",
|
||||
(str_args) ? str_args : "");
|
||||
if (ctcp_type)
|
||||
{
|
||||
relay_irc_input_send (client, NULL,
|
||||
"priority_high",
|
||||
"/ctcp %s %s%s%s",
|
||||
params[0],
|
||||
ctcp_type,
|
||||
(ctcp_params) ? " " : "",
|
||||
(ctcp_params) ? ctcp_params : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
relay_irc_input_send (client, params[0],
|
||||
"priority_high,user_message",
|
||||
"%s",
|
||||
(str_args) ? str_args : "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
relay_irc_input_send (client, NULL,
|
||||
"priority_high",
|
||||
"/query %s %s",
|
||||
params[0],
|
||||
(str_args) ? str_args : "");
|
||||
if (ctcp_type)
|
||||
{
|
||||
relay_irc_input_send (client, NULL,
|
||||
"priority_high",
|
||||
"/query %s",
|
||||
params[0]);
|
||||
relay_irc_input_send (client, NULL,
|
||||
"priority_high",
|
||||
"/ctcp %s %s%s%s",
|
||||
params[0],
|
||||
ctcp_type,
|
||||
(ctcp_params) ? " " : "",
|
||||
(ctcp_params) ? ctcp_params : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
relay_irc_input_send (client, NULL,
|
||||
"priority_high",
|
||||
"/query %s %s",
|
||||
params[0],
|
||||
(str_args) ? str_args : "");
|
||||
}
|
||||
}
|
||||
if (str_args)
|
||||
free (str_args);
|
||||
if (irc_is_channel)
|
||||
free (irc_is_channel);
|
||||
if (ctcp_type)
|
||||
free (ctcp_type);
|
||||
if (ctcp_params)
|
||||
free (ctcp_params);
|
||||
}
|
||||
}
|
||||
else if (!relay_irc_command_ignored (irc_command))
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
return INT2FIX (__int)
|
||||
#define API_RETURN_LONG(__long) \
|
||||
return LONG2NUM (__long)
|
||||
#define API_RETURN_LONGLONG(__longlong) \
|
||||
return LL2NUM (__longlong)
|
||||
|
||||
|
||||
/*
|
||||
@@ -454,9 +456,9 @@ weechat_ruby_api_string_parse_size (VALUE class, VALUE size)
|
||||
char *c_size;
|
||||
unsigned long long value;
|
||||
|
||||
API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONG(0));
|
||||
API_INIT_FUNC(1, "string_parse_size", API_RETURN_LONGLONG(0));
|
||||
if (NIL_P (size))
|
||||
API_WRONG_ARGS(API_RETURN_LONG(0));
|
||||
API_WRONG_ARGS(API_RETURN_LONGLONG(0));
|
||||
|
||||
Check_Type (size, T_STRING);
|
||||
|
||||
@@ -464,7 +466,7 @@ weechat_ruby_api_string_parse_size (VALUE class, VALUE size)
|
||||
|
||||
value = weechat_string_parse_size (c_size);
|
||||
|
||||
API_RETURN_LONG(value);
|
||||
API_RETURN_LONGLONG(value);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
||||
@@ -1003,7 +1003,7 @@ weechat_ruby_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load ruby script */
|
||||
path_script = plugin_script_search_path (weechat_ruby_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_ruby_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -1254,6 +1254,9 @@ script_action_run_all ()
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
|
||||
0, &num_actions);
|
||||
|
||||
script_action_clear ();
|
||||
|
||||
if (actions)
|
||||
{
|
||||
for (i = 0; i < num_actions; i++)
|
||||
@@ -1511,8 +1514,6 @@ script_action_run_all ()
|
||||
weechat_string_free_split (actions);
|
||||
}
|
||||
|
||||
script_action_clear ();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,20 +144,6 @@ script_command_script (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcmp (argv[1], "go") == 0)
|
||||
{
|
||||
if ((argc > 2) && script_buffer && !script_buffer_detail_script)
|
||||
{
|
||||
error = NULL;
|
||||
value = strtol (argv[2], &error, 10);
|
||||
if (error && !error[0])
|
||||
{
|
||||
script_buffer_set_current_line (value);
|
||||
}
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcmp (argv[1], "search") == 0)
|
||||
{
|
||||
if (scripts_repo)
|
||||
@@ -216,6 +202,21 @@ script_command_script (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcmp (argv[1], "go") == 0)
|
||||
{
|
||||
if ((argc > 2) && script_buffer && !script_buffer_detail_script)
|
||||
{
|
||||
error = NULL;
|
||||
value = strtol (argv[2], &error, 10);
|
||||
if (error && !error[0])
|
||||
{
|
||||
script_buffer_set_current_line (value);
|
||||
script_buffer_check_line_outside_window ();
|
||||
}
|
||||
}
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
if (weechat_strcmp (argv[1], "up") == 0)
|
||||
{
|
||||
if (script_buffer)
|
||||
|
||||
@@ -658,7 +658,7 @@ weechat_tcl_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
/* load tcl script */
|
||||
path_script = plugin_script_search_path (weechat_tcl_plugin,
|
||||
ptr_name);
|
||||
ptr_name, 1);
|
||||
weechat_tcl_load ((path_script) ? path_script : ptr_name,
|
||||
NULL);
|
||||
if (path_script)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#define XFER_CONFIG_PROGRESS_BAR_MAX_SIZE 256
|
||||
|
||||
extern struct t_config_file *xfer_config;
|
||||
extern struct t_config_file *xfer_config_file;
|
||||
|
||||
extern struct t_config_option *xfer_config_look_auto_open_buffer;
|
||||
extern struct t_config_option *xfer_config_look_progress_bar_size;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
@@ -57,17 +58,17 @@ char *
|
||||
xfer_network_convert_integer_to_ipv4 (const char *str_address)
|
||||
{
|
||||
char *error, result[128];
|
||||
long number;
|
||||
long long number;
|
||||
|
||||
if (!str_address || !str_address[0])
|
||||
return NULL;
|
||||
|
||||
number = strtol (str_address, &error, 10);
|
||||
if (!error || error[0] || (number <= 0))
|
||||
number = strtoll (str_address, &error, 10);
|
||||
if (!error || error[0] || (number <= 0) || (number > UINT32_MAX))
|
||||
return NULL;
|
||||
|
||||
snprintf (result, sizeof (result),
|
||||
"%ld.%ld.%ld.%ld",
|
||||
"%lld.%lld.%lld.%lld",
|
||||
(number >> 24) & 0xFF,
|
||||
(number >> 16) & 0xFF,
|
||||
(number >> 8) & 0xFF,
|
||||
|
||||
@@ -1842,5 +1842,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
|
||||
xfer_free_all ();
|
||||
|
||||
weechat_config_free (xfer_config_file);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ def test_strings():
|
||||
check(weechat.string_parse_size('123 b') == 123)
|
||||
check(weechat.string_parse_size('120k') == 120000)
|
||||
check(weechat.string_parse_size('1500m') == 1500000000)
|
||||
check(weechat.string_parse_size('3g') == 3000000000)
|
||||
check(weechat.string_parse_size('2g') == 2000000000)
|
||||
check(weechat.string_color_code_size('') == 0)
|
||||
check(weechat.string_color_code_size('test') == 0)
|
||||
str_color = weechat.color('yellow,red')
|
||||
@@ -397,8 +397,8 @@ def test_display():
|
||||
weechat.prnt('', '## test print core buffer')
|
||||
weechat.prnt_date_tags('', 946681200, 'tag1,tag2',
|
||||
'## test print_date_tags core buffer')
|
||||
weechat.prnt_date_tags('', 5680744830, 'tag1,tag2',
|
||||
'## test print_date_tags core buffer, year 2150')
|
||||
weechat.prnt_date_tags('', 2146383600, 'tag1,tag2',
|
||||
'## test print_date_tags core buffer, 2038-01-06 09:40:00')
|
||||
hdata_buffer = weechat.hdata_get('buffer')
|
||||
hdata_lines = weechat.hdata_get('lines')
|
||||
hdata_line = weechat.hdata_get('line')
|
||||
@@ -407,7 +407,7 @@ def test_display():
|
||||
own_lines = weechat.hdata_pointer(hdata_buffer, buffer, 'own_lines')
|
||||
line = weechat.hdata_pointer(hdata_lines, own_lines, 'last_line')
|
||||
data = weechat.hdata_pointer(hdata_line, line, 'data')
|
||||
check(weechat.hdata_time(hdata_line_data, data, 'date') == 5680744830)
|
||||
check(weechat.hdata_time(hdata_line_data, data, 'date') == 2146383600)
|
||||
buffer = weechat.buffer_new('test_formatted',
|
||||
'buffer_input_cb', '', 'buffer_close_cb', '')
|
||||
check(buffer != '')
|
||||
@@ -423,8 +423,8 @@ def test_display():
|
||||
weechat.prnt_y(buffer, 0, '## test print_y free buffer')
|
||||
weechat.prnt_y_date_tags(buffer, 0, 946681200, 'tag1,tag2',
|
||||
'## test print_y_date_tags free buffer')
|
||||
weechat.prnt_y_date_tags(buffer, 1, 5680744830, 'tag1,tag2',
|
||||
'## test print_y_date_tags free buffer, year 2150')
|
||||
weechat.prnt_y_date_tags(buffer, 1, 2146383600, 'tag1,tag2',
|
||||
'## test print_y_date_tags free buffer, 2038-01-06 09:40:00')
|
||||
weechat.buffer_close(buffer)
|
||||
|
||||
|
||||
@@ -476,12 +476,12 @@ def test_hooks():
|
||||
weechat.unhook(hook_cmd)
|
||||
weechat.unhook(hook_cmplt)
|
||||
# hook_timer
|
||||
hook_timer = weechat.hook_timer(5000111000, 0, 1,
|
||||
hook_timer = weechat.hook_timer(2000111000, 0, 1,
|
||||
'timer_cb', 'timer_cb_data')
|
||||
ptr_infolist = weechat.infolist_get('hook', hook_timer, '')
|
||||
check(ptr_infolist != '')
|
||||
check(weechat.infolist_next(ptr_infolist) == 1)
|
||||
check(weechat.infolist_string(ptr_infolist, 'interval') == '5000111000')
|
||||
check(weechat.infolist_string(ptr_infolist, 'interval') == '2000111000')
|
||||
weechat.infolist_free(ptr_infolist)
|
||||
weechat.unhook(hook_timer)
|
||||
|
||||
@@ -504,8 +504,8 @@ def infolist_cb(data, infolist_name, pointer, arguments):
|
||||
check(weechat.infolist_new_var_pointer(item, 'pointer', '0xabcdef') != '')
|
||||
# Tue Jan 06 2009 08:40:30 GMT+0000
|
||||
check(weechat.infolist_new_var_time(item, 'time1', 1231231230) != '')
|
||||
# Tue Jan 06 2150 08:40:30 GMT+0000
|
||||
check(weechat.infolist_new_var_time(item, 'time2', 5680744830) != '')
|
||||
# Wed Jan 06 2038 09:40:00 GMT+0000
|
||||
check(weechat.infolist_new_var_time(item, 'time2', 2146383600) != '')
|
||||
return infolist
|
||||
|
||||
|
||||
@@ -522,7 +522,7 @@ def test_infolist():
|
||||
check(weechat.infolist_string(ptr_infolist, 'string') == 'test string')
|
||||
check(weechat.infolist_pointer(ptr_infolist, 'pointer') == '0xabcdef')
|
||||
check(weechat.infolist_time(ptr_infolist, 'time1') == 1231231230)
|
||||
check(weechat.infolist_time(ptr_infolist, 'time2') == 5680744830)
|
||||
check(weechat.infolist_time(ptr_infolist, 'time2') == 2146383600)
|
||||
check(weechat.infolist_fields(ptr_infolist) == 'i:integer,s:string,p:pointer,t:time1,t:time2')
|
||||
check(weechat.infolist_next(ptr_infolist) == 0)
|
||||
weechat.infolist_free(ptr_infolist)
|
||||
@@ -549,9 +549,9 @@ def test_hdata():
|
||||
check(hdata_irc_server != '')
|
||||
# create a test buffer with 3 messages
|
||||
buffer2 = weechat.buffer_new('test', 'buffer_input_cb', '', 'buffer_close_cb', '')
|
||||
weechat.prnt_date_tags(buffer2, 5680744830, 'tag1,tag2', 'prefix1\t## msg1')
|
||||
weechat.prnt_date_tags(buffer2, 5680744831, 'tag3,tag4', 'prefix2\t## msg2')
|
||||
weechat.prnt_date_tags(buffer2, 5680744832, 'tag5,tag6', 'prefix3\t## msg3')
|
||||
weechat.prnt_date_tags(buffer2, 2146383600, 'tag1,tag2', 'prefix1\t## msg1')
|
||||
weechat.prnt_date_tags(buffer2, 2146383601, 'tag3,tag4', 'prefix2\t## msg2')
|
||||
weechat.prnt_date_tags(buffer2, 2146383602, 'tag5,tag6', 'prefix3\t## msg3')
|
||||
own_lines = weechat.hdata_pointer(hdata_buffer, buffer2, 'own_lines')
|
||||
line1 = weechat.hdata_pointer(hdata_lines, own_lines, 'first_line')
|
||||
line1_data = weechat.hdata_pointer(hdata_line, line1, 'data')
|
||||
@@ -619,16 +619,16 @@ def test_hdata():
|
||||
check(weechat.hdata_compare(hdata_buffer, buffer2, buffer, 'name', 0) < 0)
|
||||
check(weechat.hdata_compare(hdata_buffer, buffer, buffer, 'name', 0) == 0)
|
||||
# hdata_update
|
||||
check(weechat.hdata_time(hdata_line_data, line1_data, 'date') == 5680744830)
|
||||
check(weechat.hdata_time(hdata_line_data, line1_data, 'date') == 2146383600)
|
||||
check(weechat.hdata_string(hdata_line_data, line1_data, 'prefix') == 'prefix1')
|
||||
check(weechat.hdata_string(hdata_line_data, line1_data, 'message') == '## msg1')
|
||||
update = {
|
||||
'date': '5680744835',
|
||||
'date': '2146383605',
|
||||
'prefix': 'new_prefix1',
|
||||
'message': 'new_message1'
|
||||
}
|
||||
check(weechat.hdata_update(hdata_line_data, line1_data, update) == 3)
|
||||
check(weechat.hdata_time(hdata_line_data, line1_data, 'date') == 5680744835)
|
||||
check(weechat.hdata_time(hdata_line_data, line1_data, 'date') == 2146383605)
|
||||
check(weechat.hdata_string(hdata_line_data, line1_data, 'prefix') == 'new_prefix1')
|
||||
check(weechat.hdata_string(hdata_line_data, line1_data, 'message') == 'new_message1')
|
||||
# hdata_get_string
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
extern "C"
|
||||
{
|
||||
#include <string.h>
|
||||
#include "src/core/wee-hashtable.h"
|
||||
#include "src/plugins/weechat-plugin.h"
|
||||
#include "src/plugins/irc/irc-batch.h"
|
||||
#include "src/plugins/irc/irc-server.h"
|
||||
}
|
||||
@@ -43,14 +45,23 @@ TEST(IrcBatch, Search)
|
||||
{
|
||||
struct t_irc_server *server;
|
||||
struct t_irc_batch *batch1, *batch2;
|
||||
struct t_hashtable *tags;
|
||||
|
||||
server = irc_server_alloc ("server");
|
||||
CHECK(server);
|
||||
|
||||
batch1 = irc_batch_start_batch (server, "ref1", "parent_ref", "type", "params");
|
||||
tags = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
CHECK(tags);
|
||||
hashtable_set (tags, "time", "2023-08-09T07:43:01.830Z");
|
||||
hashtable_set (tags, "msgid", "icqfzy7zdbpix4gy8pvzuv49kw");
|
||||
|
||||
batch1 = irc_batch_start_batch (server, "ref1", "parent_ref", "type", "params", tags);
|
||||
CHECK(batch1);
|
||||
|
||||
batch2 = irc_batch_start_batch (server, "ref2", "parent_ref", "type", "params");
|
||||
batch2 = irc_batch_start_batch (server, "ref2", "parent_ref", "type", "params", NULL);
|
||||
CHECK(batch2);
|
||||
|
||||
POINTERS_EQUAL(NULL, irc_batch_search (NULL, NULL));
|
||||
@@ -105,19 +116,29 @@ TEST(IrcBatch, StartBatch)
|
||||
{
|
||||
struct t_irc_server *server;
|
||||
struct t_irc_batch *batch;
|
||||
struct t_hashtable *tags;
|
||||
|
||||
server = irc_server_alloc ("server");
|
||||
CHECK(server);
|
||||
|
||||
tags = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
CHECK(tags);
|
||||
hashtable_set (tags, "time", "2023-08-09T07:43:01.830Z");
|
||||
hashtable_set (tags, "msgid", "icqfzy7zdbpix4gy8pvzuv49kw");
|
||||
|
||||
POINTERS_EQUAL(NULL, server->batches);
|
||||
|
||||
batch = irc_batch_start_batch (server, "ref", NULL, "type", NULL);
|
||||
batch = irc_batch_start_batch (server, "ref", NULL, "type", NULL, NULL);
|
||||
CHECK(batch);
|
||||
POINTERS_EQUAL(batch, server->batches);
|
||||
STRCMP_EQUAL("ref", batch->reference);
|
||||
POINTERS_EQUAL(NULL, batch->parent_ref);
|
||||
STRCMP_EQUAL("type", batch->type);
|
||||
POINTERS_EQUAL(NULL, batch->parameters);
|
||||
POINTERS_EQUAL(NULL, batch->tags);
|
||||
CHECK(batch->start_time > 0);
|
||||
POINTERS_EQUAL(NULL, batch->messages);
|
||||
LONGS_EQUAL(0, batch->end_received);
|
||||
@@ -126,13 +147,19 @@ TEST(IrcBatch, StartBatch)
|
||||
|
||||
POINTERS_EQUAL(NULL, server->batches);
|
||||
|
||||
batch = irc_batch_start_batch (server, "ref", "parent_ref", "type", "params");
|
||||
batch = irc_batch_start_batch (server, "ref", "parent_ref", "type", "params",
|
||||
tags);
|
||||
CHECK(batch);
|
||||
POINTERS_EQUAL(batch, server->batches);
|
||||
STRCMP_EQUAL("ref", batch->reference);
|
||||
STRCMP_EQUAL("parent_ref", batch->parent_ref);
|
||||
STRCMP_EQUAL("type", batch->type);
|
||||
STRCMP_EQUAL("params", batch->parameters);
|
||||
CHECK(batch->tags);
|
||||
STRCMP_EQUAL("2023-08-09T07:43:01.830Z",
|
||||
(const char *)hashtable_get (batch->tags, "time"));
|
||||
STRCMP_EQUAL("icqfzy7zdbpix4gy8pvzuv49kw",
|
||||
(const char *)hashtable_get (batch->tags, "msgid"));
|
||||
CHECK(batch->start_time > 0);
|
||||
POINTERS_EQUAL(NULL, batch->messages);
|
||||
|
||||
@@ -159,7 +186,8 @@ TEST(IrcBatch, AddMessage)
|
||||
server = irc_server_alloc ("server");
|
||||
CHECK(server);
|
||||
|
||||
batch = irc_batch_start_batch (server, "ref", "parent_ref", "type", "params");
|
||||
batch = irc_batch_start_batch (server, "ref", "parent_ref", "type", "params",
|
||||
NULL);
|
||||
CHECK(batch);
|
||||
|
||||
irc_batch_add_message (server, "ref", ":alice PRIVMSG #test: test1");
|
||||
@@ -187,10 +215,12 @@ TEST(IrcBatch, FreeAll)
|
||||
server = irc_server_alloc ("server");
|
||||
CHECK(server);
|
||||
|
||||
batch1 = irc_batch_start_batch (server, "ref1", "parent_ref", "type", "params");
|
||||
batch1 = irc_batch_start_batch (server, "ref1", "parent_ref", "type", "params",
|
||||
NULL);
|
||||
CHECK(batch1);
|
||||
|
||||
batch2 = irc_batch_start_batch (server, "ref2", "parent_ref", "type", "params");
|
||||
batch2 = irc_batch_start_batch (server, "ref2", "parent_ref", "type", "params",
|
||||
NULL);
|
||||
CHECK(batch2);
|
||||
|
||||
POINTERS_EQUAL(batch1, server->batches);
|
||||
|
||||
@@ -117,7 +117,7 @@ TEST_GROUP(IrcJoin)
|
||||
* irc_join_compare_join_channel
|
||||
*/
|
||||
|
||||
TEST(IrcJoin, CompateJoinChannel)
|
||||
TEST(IrcJoin, CompareJoinChannel)
|
||||
{
|
||||
struct t_irc_join_channel join_chan1, join_chan2;
|
||||
|
||||
@@ -129,24 +129,24 @@ TEST(IrcJoin, CompateJoinChannel)
|
||||
LONGS_EQUAL(0, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
|
||||
join_chan1.name = strdup ("#abc");
|
||||
LONGS_EQUAL(35, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
CHECK(irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2) > 0);
|
||||
|
||||
join_chan2.name = strdup ("#abc");
|
||||
LONGS_EQUAL(0, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
|
||||
join_chan1.key = strdup ("key_abc");
|
||||
LONGS_EQUAL(-1, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
CHECK(irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2) < 0);
|
||||
|
||||
join_chan2.key = strdup ("key_abc");
|
||||
LONGS_EQUAL(0, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
|
||||
free (join_chan2.key);
|
||||
join_chan2.key = strdup ("key2_abc");
|
||||
LONGS_EQUAL(45, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
CHECK(irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2) > 0);
|
||||
|
||||
free (join_chan2.name);
|
||||
join_chan2.name = strdup ("#def");
|
||||
LONGS_EQUAL(-3, irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2));
|
||||
CHECK(irc_join_compare_join_channel (NULL, &join_chan1, &join_chan2) < 0);
|
||||
|
||||
free (join_chan1.name);
|
||||
free (join_chan1.key);
|
||||
|
||||
@@ -154,6 +154,12 @@ extern char *irc_protocol_cap_to_enable (const char *capabilities,
|
||||
FAIL(string_dyn_free (msg, 0)); \
|
||||
}
|
||||
|
||||
#define CHECK_PV_CLOSE(__nick, __prefix, __message, __tags) \
|
||||
CHECK_PV(__nick, __prefix, __message, __tags); \
|
||||
gui_buffer_close ( \
|
||||
gui_buffer_search_by_full_name ("irc." IRC_FAKE_SERVER \
|
||||
"." __nick));
|
||||
|
||||
#define CHECK_NO_MSG \
|
||||
if (arraylist_size (recorded_messages) > 0) \
|
||||
{ \
|
||||
@@ -1625,7 +1631,8 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
|
||||
POINTERS_EQUAL(NULL, irc_batch_search (ptr_server, "ref2"));
|
||||
|
||||
/* multiline */
|
||||
RECV(":server BATCH +ref draft/multiline #test");
|
||||
RECV("@time=2023-08-09T07:43:01.830Z;msgid=icqfzy7zdbpix4gy8pvzuv49kw "
|
||||
":server BATCH +ref draft/multiline #test");
|
||||
CHECK_NO_MSG;
|
||||
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :line 1");
|
||||
CHECK_NO_MSG;
|
||||
@@ -1633,13 +1640,14 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
|
||||
CHECK_NO_MSG;
|
||||
RECV(":server BATCH -ref");
|
||||
CHECK_CHAN("bob", "line 1",
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_batch_type_draft/multiline,"
|
||||
"notify_message,prefix_nick_248,nick_bob,"
|
||||
"host_user_b@host_b,log1");
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_tag_time=2023-08-09T07:43:01.830Z,"
|
||||
"irc_tag_msgid=icqfzy7zdbpix4gy8pvzuv49kw,"
|
||||
"irc_batch_type_draft/multiline,notify_message,prefix_nick_248,"
|
||||
"nick_bob,host_user_b@host_b,log1");
|
||||
CHECK_CHAN("bob", "line 2",
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_batch_type_draft/multiline,"
|
||||
"notify_message,prefix_nick_248,nick_bob,"
|
||||
"host_user_b@host_b,log1");
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_tag_time=2023-08-09T07:43:01.830Z,"
|
||||
"irc_tag_msgid=icqfzy7zdbpix4gy8pvzuv49kw,irc_batch_type_draft/multiline,"
|
||||
"notify_message,prefix_nick_248,nick_bob,host_user_b@host_b,log1");
|
||||
|
||||
/* multiline with CTCP */
|
||||
RECV(":server BATCH +ref draft/multiline #test");
|
||||
@@ -1666,7 +1674,8 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
|
||||
irc_server_buffer_set_input_multiline (ptr_server, 1);
|
||||
|
||||
/* multiline */
|
||||
RECV(":server BATCH +ref draft/multiline #test");
|
||||
RECV("@time=2023-08-09T07:43:01.830Z;msgid=icqfzy7zdbpix4gy8pvzuv49kw "
|
||||
":server BATCH +ref draft/multiline #test");
|
||||
CHECK_NO_MSG;
|
||||
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :line 1");
|
||||
CHECK_NO_MSG;
|
||||
@@ -1675,9 +1684,10 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
|
||||
RECV(":server BATCH -ref");
|
||||
CHECK_CHAN("bob", "line 1\n"
|
||||
"line 2",
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_batch_type_draft/multiline,"
|
||||
"notify_message,prefix_nick_248,nick_bob,host_user_b@host_b,"
|
||||
"log1");
|
||||
"irc_privmsg,irc_tag_batch=ref,irc_tag_time=2023-08-09T07:43:01.830Z,"
|
||||
"irc_tag_msgid=icqfzy7zdbpix4gy8pvzuv49kw,"
|
||||
"irc_batch_type_draft/multiline,notify_message,prefix_nick_248,"
|
||||
"nick_bob,host_user_b@host_b,log1");
|
||||
|
||||
/* multiline with CTCP */
|
||||
RECV(":server BATCH +ref draft/multiline #test");
|
||||
@@ -2423,7 +2433,7 @@ TEST(IrcProtocolWithServer, notice)
|
||||
|
||||
/*
|
||||
* notice to channel/user from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host NOTICE #test :a notice ");
|
||||
CHECK_CHAN("--", "Notice(alice) -> #test: a notice ",
|
||||
@@ -2440,7 +2450,7 @@ TEST(IrcProtocolWithServer, notice)
|
||||
|
||||
/*
|
||||
* notice to ops of channel from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host NOTICE @#test :a notice ");
|
||||
CHECK_CHAN("--", "Notice(alice) -> @#test: a notice ",
|
||||
@@ -2449,7 +2459,7 @@ TEST(IrcProtocolWithServer, notice)
|
||||
|
||||
/*
|
||||
* notice from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host NOTICE alice :a notice ");
|
||||
CHECK_SRV("--", "Notice -> alice: a notice ",
|
||||
@@ -2481,6 +2491,14 @@ TEST(IrcProtocolWithServer, notice)
|
||||
CHECK_CHAN("--", "PvNotice(bob): a notice ",
|
||||
"irc_notice,nick_bob,host_user@host,log1");
|
||||
|
||||
/*
|
||||
* notice to another nick with channel name at beginning
|
||||
* (case of a notice sent if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host NOTICE bob :[#test] a notice ");
|
||||
CHECK_SRV("--", "Notice -> bob: [#test] a notice ",
|
||||
"irc_notice,notify_private,nick_alice,host_user@host,log1");
|
||||
|
||||
/* broken CTCP to channel */
|
||||
RECV(":bob!user@host NOTICE #test :\01");
|
||||
CHECK_SRV("--", "CTCP reply from bob: ",
|
||||
@@ -2725,9 +2743,9 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
"irc_privmsg,notify_message,prefix_nick_248,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG alice :this is the message ");
|
||||
CHECK_PV("bob", "bob", "this is the message ",
|
||||
"irc_privmsg,notify_private,prefix_nick_248,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
CHECK_PV_CLOSE("bob", "bob", "this is the message ",
|
||||
"irc_privmsg,notify_private,prefix_nick_248,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
|
||||
/* message with tags to channel/user */
|
||||
RECV("@tag1=value1;tag2=value2 :bob!user@host PRIVMSG #test "
|
||||
@@ -2737,13 +2755,13 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
"notify_message,prefix_nick_248,nick_bob,host_user@host,log1");
|
||||
RECV("@tag1=value1;tag2=value2 :bob!user@host PRIVMSG alice "
|
||||
":this is the message ");
|
||||
CHECK_PV("bob", "bob", "this is the message ",
|
||||
"irc_privmsg,irc_tag_tag1=value1,irc_tag_tag2=value2,"
|
||||
"notify_private,prefix_nick_248,nick_bob,host_user@host,log1");
|
||||
CHECK_PV_CLOSE("bob", "bob", "this is the message ",
|
||||
"irc_privmsg,irc_tag_tag1=value1,irc_tag_tag2=value2,"
|
||||
"notify_private,prefix_nick_248,nick_bob,host_user@host,log1");
|
||||
|
||||
/*
|
||||
* message to channel/user from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG #test :this is the message ");
|
||||
CHECK_CHAN("alice", "this is the message ",
|
||||
@@ -2757,7 +2775,7 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
|
||||
/*
|
||||
* message to ops of channel from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG @#test :this is the message ");
|
||||
CHECK_CHAN("--", "Msg(alice) -> @#test: this is the message ",
|
||||
@@ -2766,21 +2784,61 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
|
||||
/*
|
||||
* message from self nick in private
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG alice :this is the message ");
|
||||
CHECK_PV("alice", "alice", "this is the message ",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
if (i == 0)
|
||||
{
|
||||
/* without echo-message */
|
||||
RECV(":alice!user@host PRIVMSG bob :this is the message ");
|
||||
CHECK_PV_CLOSE("bob", "alice", "this is the message ",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* with echo-message */
|
||||
RECV(":alice!user@host PRIVMSG bob :this is the message ");
|
||||
CHECK_PV_CLOSE("bob", "alice", "this is the message ",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
/* with echo-message, option irc.look.open_pv_buffer_echo_msg off */
|
||||
config_file_option_set (irc_config_look_open_pv_buffer_echo_msg,
|
||||
"off", 1);
|
||||
RECV(":alice!user@host PRIVMSG bob :this is the message ");
|
||||
CHECK_SRV("--", "Msg(alice) -> bob: this is the message ",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,host_user@host,log1");
|
||||
config_file_option_reset (irc_config_look_open_pv_buffer_echo_msg, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* message from self nick in private, with password hidden (nickserv)
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG nickserv :identify secret");
|
||||
CHECK_PV("nickserv", "alice", "identify ******",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
if (i == 0)
|
||||
{
|
||||
/* without echo-message */
|
||||
RECV(":alice!user@host PRIVMSG nickserv :identify secret");
|
||||
CHECK_PV_CLOSE("nickserv", "alice", "identify ******",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* with echo-message */
|
||||
RECV(":alice!user@host PRIVMSG nickserv :identify secret");
|
||||
CHECK_PV_CLOSE("nickserv", "alice", "identify ******",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"prefix_nick_white,nick_alice,host_user@host,log1");
|
||||
/* with echo-message, option irc.look.open_pv_buffer_echo_msg off */
|
||||
config_file_option_set (irc_config_look_open_pv_buffer_echo_msg,
|
||||
"off", 1);
|
||||
RECV(":alice!user@host PRIVMSG nickserv :identify secret");
|
||||
CHECK_SRV("--", "Msg(alice) -> nickserv: identify ******",
|
||||
"irc_privmsg,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,host_user@host,log1");
|
||||
config_file_option_reset (irc_config_look_open_pv_buffer_echo_msg, 1);
|
||||
}
|
||||
|
||||
/* broken CTCP to channel */
|
||||
RECV(":bob!user@host PRIVMSG #test :\01");
|
||||
@@ -2831,13 +2889,13 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
CHECK_SRV("--", "Unknown CTCP requested by bob: TEST",
|
||||
"irc_privmsg,irc_ctcp,host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG alice :\01ACTION");
|
||||
CHECK_PV("bob", " *", "bob",
|
||||
"irc_privmsg,irc_action,notify_private,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
CHECK_PV_CLOSE("bob", " *", "bob",
|
||||
"irc_privmsg,irc_action,notify_private,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG alice :\01ACTION is testing");
|
||||
CHECK_PV("bob", " *", "bob is testing",
|
||||
"irc_privmsg,irc_action,notify_private,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
CHECK_PV_CLOSE("bob", " *", "bob is testing",
|
||||
"irc_privmsg,irc_action,notify_private,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG alice :\01VERSION");
|
||||
info = irc_ctcp_replace_variables (ptr_server,
|
||||
irc_ctcp_get_reply (ptr_server,
|
||||
@@ -2865,8 +2923,8 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
CHECK_CHAN(" *", "bob",
|
||||
"irc_privmsg,irc_action,notify_message,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing\01");
|
||||
CHECK_CHAN(" *", "bob is testing",
|
||||
RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
|
||||
CHECK_CHAN(" *", "bob is testing with bold",
|
||||
"irc_privmsg,irc_action,notify_message,nick_bob,"
|
||||
"host_user@host,log1");
|
||||
RECV(":bob!user@host PRIVMSG #test :\01VERSION\01");
|
||||
@@ -2884,7 +2942,7 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
|
||||
/*
|
||||
* valid CTCP to channel from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG #test :\01VERSION\01");
|
||||
CHECK_CHAN("--", "CTCP query to #test: VERSION",
|
||||
@@ -2894,14 +2952,14 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
CHECK_CHAN(" *", "alice",
|
||||
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,host_user@host,log1");
|
||||
RECV(":alice!user@host PRIVMSG #test :\01ACTION is testing\01");
|
||||
CHECK_CHAN(" *", "alice is testing",
|
||||
RECV(":alice!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
|
||||
CHECK_CHAN(" *", "alice is testing with bold",
|
||||
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,host_user@host,log1");
|
||||
|
||||
/*
|
||||
* valid CTCP to ops of channel from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG @#test :\01ACTION\01");
|
||||
CHECK_CHAN("--", "Action -> @#test: alice",
|
||||
@@ -2948,7 +3006,7 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
|
||||
/*
|
||||
* valid CTCP to channel from self nick
|
||||
* (case of bouncer of if echo-message capability is enabled)
|
||||
* (case of bouncer or if echo-message capability is enabled)
|
||||
*/
|
||||
RECV(":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
|
||||
if (i == 0)
|
||||
@@ -2962,7 +3020,7 @@ TEST(IrcProtocolWithServer, privmsg)
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_PV("alice", "--", "CTCP query to alice: CLIENTINFO",
|
||||
CHECK_SRV("--", "CTCP query to alice: CLIENTINFO",
|
||||
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,host_user@host,log1");
|
||||
/*
|
||||
|
||||
@@ -32,6 +32,8 @@ extern "C"
|
||||
#include "src/plugins/irc/irc-channel.h"
|
||||
#include "src/plugins/irc/irc-server.h"
|
||||
|
||||
extern int irc_server_fingerprint_search_algo_with_size (int size);
|
||||
extern char *irc_server_eval_fingerprint (struct t_irc_server *server);
|
||||
extern char *irc_server_build_autojoin (struct t_irc_server *server);
|
||||
}
|
||||
|
||||
@@ -92,7 +94,14 @@ TEST(IrcServer, Search)
|
||||
|
||||
TEST(IrcServer, SearchOption)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
LONGS_EQUAL(-1, irc_server_search_option (NULL));
|
||||
LONGS_EQUAL(-1, irc_server_search_option (""));
|
||||
LONGS_EQUAL(-1, irc_server_search_option ("does_not_exist"));
|
||||
|
||||
CHECK(irc_server_search_option ("addresses") >= 0);
|
||||
CHECK(irc_server_search_option ("ADDRESSES") >= 0);
|
||||
CHECK(irc_server_search_option ("autojoin") >= 0);
|
||||
CHECK(irc_server_search_option ("AUTOJOIN") >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -102,7 +111,14 @@ TEST(IrcServer, SearchOption)
|
||||
|
||||
TEST(IrcServer, SearchCasemapping)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
LONGS_EQUAL(-1, irc_server_search_casemapping (NULL));
|
||||
LONGS_EQUAL(-1, irc_server_search_casemapping (""));
|
||||
LONGS_EQUAL(-1, irc_server_search_casemapping ("does_not_exist"));
|
||||
|
||||
CHECK(irc_server_search_casemapping ("rfc1459") >= 0);
|
||||
CHECK(irc_server_search_casemapping ("RFC1459") >= 0);
|
||||
CHECK(irc_server_search_casemapping ("strict-rfc1459") >= 0);
|
||||
CHECK(irc_server_search_casemapping ("STRICT-RFC1459") >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -112,27 +128,89 @@ TEST(IrcServer, SearchCasemapping)
|
||||
|
||||
TEST(IrcServer, SearchUtf8mapping)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
LONGS_EQUAL(-1, irc_server_search_utf8mapping (NULL));
|
||||
LONGS_EQUAL(-1, irc_server_search_utf8mapping (""));
|
||||
LONGS_EQUAL(-1, irc_server_search_utf8mapping ("does_not_exist"));
|
||||
|
||||
CHECK(irc_server_search_utf8mapping ("none") >= 0);
|
||||
CHECK(irc_server_search_utf8mapping ("NONE") >= 0);
|
||||
CHECK(irc_server_search_utf8mapping ("rfc8265") >= 0);
|
||||
CHECK(irc_server_search_utf8mapping ("RFC8265") >= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_strcasecmp
|
||||
* irc_server_strncasecmp
|
||||
*/
|
||||
|
||||
TEST(IrcServer, Strcasecmp)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
struct t_irc_server *server;
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_strncasecmp
|
||||
*/
|
||||
server = irc_server_alloc ("server1");
|
||||
CHECK(server);
|
||||
|
||||
TEST(IrcServer, Strncasecmp)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, NULL, NULL));
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, "", ""));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, NULL, NULL, 0));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "", "", 0));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, NULL, NULL, 1));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "", "", 1));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, "abc", "abc"));
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, "abc", "ABC"));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "abc", "abc", 1));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "abc", "ABC", 1));
|
||||
|
||||
LONGS_EQUAL(-19, irc_server_strcasecmp (NULL, "abc", "test"));
|
||||
LONGS_EQUAL(19, irc_server_strcasecmp (NULL, "test", "abc"));
|
||||
|
||||
LONGS_EQUAL(-19, irc_server_strncasecmp (NULL, "abc", "test", 1));
|
||||
LONGS_EQUAL(19, irc_server_strncasecmp (NULL, "test", "abc", 1));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "atest", "abc", 1));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, "nick[a]", "nick{a}"));
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (NULL, "nick^a", "nick~a"));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "nick[a]", "nick{a}", 10));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (NULL, "nick^a", "nick~a", 10));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (server, "nick[a]", "nick{a}"));
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (server, "nick^a", "nick~a"));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (server, "nick[a]", "nick{a}", 10));
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (server, "nick^a", "nick~a", 10));
|
||||
|
||||
server->casemapping = IRC_SERVER_CASEMAPPING_STRICT_RFC1459;
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strcasecmp (server, "nick[a]", "nick{a}"));
|
||||
LONGS_EQUAL(-32, irc_server_strcasecmp (server, "nick^a", "nick~a"));
|
||||
LONGS_EQUAL(32, irc_server_strcasecmp (server, "nick~a", "nick^a"));
|
||||
|
||||
LONGS_EQUAL(0, irc_server_strncasecmp (server, "nick[a]", "nick{a}", 10));
|
||||
LONGS_EQUAL(-32, irc_server_strncasecmp (server, "nick^a", "nick~a", 10));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick~a", "nick^a", 10));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick_ô", "nick_Ô", 10));
|
||||
|
||||
server->casemapping = IRC_SERVER_CASEMAPPING_ASCII;
|
||||
|
||||
LONGS_EQUAL(-32, irc_server_strcasecmp (server, "nick[a]", "nick{a}"));
|
||||
LONGS_EQUAL(32, irc_server_strcasecmp (server, "nick{a}", "nick[a]"));
|
||||
LONGS_EQUAL(-32, irc_server_strcasecmp (server, "nick^a", "nick~a"));
|
||||
LONGS_EQUAL(32, irc_server_strcasecmp (server, "nick~a", "nick^a"));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick_ô", "nick_Ô", 10));
|
||||
|
||||
LONGS_EQUAL(-32, irc_server_strncasecmp (server, "nick[a]", "nick{a}", 10));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick{a}", "nick[a]", 10));
|
||||
LONGS_EQUAL(-32, irc_server_strncasecmp (server, "nick^a", "nick~a", 10));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick~a", "nick^a", 10));
|
||||
LONGS_EQUAL(32, irc_server_strncasecmp (server, "nick_ô", "nick_Ô", 10));
|
||||
|
||||
irc_server_free (server);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -142,15 +220,124 @@ TEST(IrcServer, Strncasecmp)
|
||||
|
||||
TEST(IrcServer, EvalExpression)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
struct t_irc_server *server;
|
||||
char *str;
|
||||
|
||||
server = irc_server_alloc ("server1");
|
||||
CHECK(server);
|
||||
|
||||
WEE_TEST_STR("", irc_server_eval_expression (NULL, "${server}"));
|
||||
WEE_TEST_STR("", irc_server_eval_expression (NULL, "${irc_server}"));
|
||||
WEE_TEST_STR("", irc_server_eval_expression (NULL, "${irc_server.name}"));
|
||||
|
||||
WEE_TEST_STR("server1", irc_server_eval_expression (server, "${server}"));
|
||||
WEE_TEST_STR("server1", irc_server_eval_expression (server, "${irc_server.name}"));
|
||||
|
||||
str = irc_server_eval_expression (server, "${irc_server}");
|
||||
STRNCMP_EQUAL("0x", str, 2);
|
||||
free (str);
|
||||
|
||||
str = irc_server_eval_expression (server, "${username}");
|
||||
CHECK(str && str[0]);
|
||||
free (str);
|
||||
|
||||
irc_server_free (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_EvalFingerprint
|
||||
* irc_server_fingerprint_search_algo_with_size
|
||||
*/
|
||||
|
||||
TEST(IrcServer, FingerprintSearchAlgoWithSize)
|
||||
{
|
||||
LONGS_EQUAL(-1, irc_server_fingerprint_search_algo_with_size (-1));
|
||||
LONGS_EQUAL(-1, irc_server_fingerprint_search_algo_with_size (0));
|
||||
LONGS_EQUAL(-1, irc_server_fingerprint_search_algo_with_size (-1));
|
||||
LONGS_EQUAL(-1, irc_server_fingerprint_search_algo_with_size (1024));
|
||||
|
||||
LONGS_EQUAL(IRC_FINGERPRINT_ALGO_SHA1,
|
||||
irc_server_fingerprint_search_algo_with_size (160));
|
||||
LONGS_EQUAL(IRC_FINGERPRINT_ALGO_SHA256,
|
||||
irc_server_fingerprint_search_algo_with_size (256));
|
||||
LONGS_EQUAL(IRC_FINGERPRINT_ALGO_SHA512,
|
||||
irc_server_fingerprint_search_algo_with_size (512));
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_eval_fingerprint
|
||||
*/
|
||||
|
||||
TEST(IrcServer, EvalFingerprint)
|
||||
{
|
||||
struct t_irc_server *server;
|
||||
char *str;
|
||||
|
||||
server = irc_server_alloc ("server1");
|
||||
CHECK(server);
|
||||
|
||||
POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (NULL));
|
||||
|
||||
WEE_TEST_STR("", irc_server_eval_fingerprint (server));
|
||||
|
||||
/* invalid: evaluated to empty string */
|
||||
config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"${empty_value}", 1);
|
||||
POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server));
|
||||
|
||||
/* invalid fingerprint value */
|
||||
config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"invalid", 1);
|
||||
POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server));
|
||||
|
||||
/* invalid fingerprint value (same length as SHA-1) */
|
||||
config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"zzzz0aeb5ebce80ad5c201ebc358d616904czzzz", 1);
|
||||
POINTERS_EQUAL(NULL, irc_server_eval_fingerprint (server));
|
||||
|
||||
/* valid SHA-1 fingerprint */
|
||||
config_file_option_set (server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"340b0aeb5ebce80ad5c201ebc358d616904ca84e", 1);
|
||||
WEE_TEST_STR("340b0aeb5ebce80ad5c201ebc358d616904ca84e",
|
||||
irc_server_eval_fingerprint (server));
|
||||
|
||||
/* valid SHA-256 fingerprint */
|
||||
config_file_option_set (
|
||||
server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"6a52951b8c2541c82bf11c83534631447dbae36b6576fe79fa6a5d3467eb3af9", 1);
|
||||
WEE_TEST_STR("6a52951b8c2541c82bf11c83534631447dbae36b6576fe79fa6a5d3467eb3af9",
|
||||
irc_server_eval_fingerprint (server));
|
||||
|
||||
/* valid SHA-256 fingerprint */
|
||||
config_file_option_set (
|
||||
server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"738c7bb821afe25b6be60386883bd8edb3e972bee442f7d75c01aa65155b5887"
|
||||
"c3512362e1008eb71cdd343449440b0ea0559b1e11743009ddf62ab1d3618ace", 1);
|
||||
WEE_TEST_STR(
|
||||
"738c7bb821afe25b6be60386883bd8edb3e972bee442f7d75c01aa65155b5887"
|
||||
"c3512362e1008eb71cdd343449440b0ea0559b1e11743009ddf62ab1d3618ace",
|
||||
irc_server_eval_fingerprint (server));
|
||||
|
||||
/* valid SHA-1 + SHA-256 fingerprints */
|
||||
config_file_option_set (
|
||||
server->options[IRC_SERVER_OPTION_TLS_FINGERPRINT],
|
||||
"340b0aeb5ebce80ad5c201ebc358d616904ca84e,"
|
||||
"6a52951b8c2541c82bf11c83534631447dbae36b6576fe79fa6a5d3467eb3af9", 1);
|
||||
WEE_TEST_STR(
|
||||
"340b0aeb5ebce80ad5c201ebc358d616904ca84e,"
|
||||
"6a52951b8c2541c82bf11c83534631447dbae36b6576fe79fa6a5d3467eb3af9",
|
||||
irc_server_eval_fingerprint (server));
|
||||
|
||||
irc_server_free (server);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_sasl_get_creds
|
||||
*/
|
||||
|
||||
TEST(IrcServer, SaslGetCreds)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
@@ -172,7 +359,13 @@ TEST(IrcServer, SaslEnabled)
|
||||
|
||||
TEST(IrcServer, GetNameWithoutPort)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
char *str;
|
||||
|
||||
POINTERS_EQUAL(NULL, irc_server_get_name_without_port (NULL));
|
||||
|
||||
WEE_TEST_STR("", irc_server_get_name_without_port (""));
|
||||
WEE_TEST_STR("example.com", irc_server_get_name_without_port ("example.com"));
|
||||
WEE_TEST_STR("example.com", irc_server_get_name_without_port ("example.com/6697"));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -604,6 +797,16 @@ TEST(IrcServer, GetDefaultMsg)
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_has_channels
|
||||
*/
|
||||
|
||||
TEST(IrcServer, HasChannels)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_alloc
|
||||
@@ -1125,16 +1328,6 @@ TEST(IrcServer, CreateBuffer)
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_fingerprint_search_algo_with_size
|
||||
*/
|
||||
|
||||
TEST(IrcServer, FingerprintSearchAlgoWithSize)
|
||||
{
|
||||
/* TODO: write tests */
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_server_fingerprint_str_sizes
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
#include "tests/tests.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <stdio.h>
|
||||
@@ -28,6 +30,8 @@ extern "C"
|
||||
#include "src/core/wee-hook.h"
|
||||
#include "src/plugins/irc/irc-tag.h"
|
||||
#include "src/plugins/plugin.h"
|
||||
|
||||
extern char *irc_tag_hashtable_to_string (struct t_hashtable *tags);
|
||||
}
|
||||
|
||||
#define WEE_CHECK_ESCAPE_VALUE(__result, __string) \
|
||||
@@ -161,3 +165,90 @@ TEST(IrcTag, Parse)
|
||||
|
||||
hashtable_free (hashtable);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_tag_add_to_string_cb
|
||||
* irc_tag_hashtable_to_string
|
||||
*/
|
||||
|
||||
TEST(IrcTag, HashtableToString)
|
||||
{
|
||||
char *str;
|
||||
struct t_hashtable *tags;
|
||||
|
||||
POINTERS_EQUAL(NULL, irc_tag_hashtable_to_string (NULL));
|
||||
|
||||
tags = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
CHECK(tags);
|
||||
|
||||
WEE_TEST_STR("", irc_tag_hashtable_to_string (tags));
|
||||
|
||||
hashtable_set (tags, "time", "2023-08-09T07:43:01.830Z");
|
||||
hashtable_set (tags, "msgid", "icqfzy7zdbpix4gy8pvzuv49kw");
|
||||
hashtable_set (tags, "test", "value with spaces");
|
||||
|
||||
WEE_TEST_STR("time=2023-08-09T07:43:01.830Z;"
|
||||
"msgid=icqfzy7zdbpix4gy8pvzuv49kw;"
|
||||
"test=value\\swith\\sspaces",
|
||||
irc_tag_hashtable_to_string (tags));
|
||||
|
||||
hashtable_free (tags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* irc_tag_add_to_hashtable_cb
|
||||
* irc_tag_add_tags_to_message
|
||||
*/
|
||||
|
||||
TEST(IrcTag, AddTagsToMessage)
|
||||
{
|
||||
char *str;
|
||||
struct t_hashtable *tags;
|
||||
|
||||
POINTERS_EQUAL(NULL, irc_tag_add_tags_to_message (NULL, NULL));
|
||||
|
||||
WEE_TEST_STR("", irc_tag_add_tags_to_message ("", NULL));
|
||||
WEE_TEST_STR(":nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
":nick!user@host PRIVMSG #test :hello", NULL));
|
||||
WEE_TEST_STR("@tag1;tag2=value2 :nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
"@tag1;tag2=value2 :nick!user@host PRIVMSG #test :hello",
|
||||
NULL));
|
||||
|
||||
tags = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
CHECK(tags);
|
||||
|
||||
WEE_TEST_STR(":nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
":nick!user@host PRIVMSG #test :hello", tags));
|
||||
WEE_TEST_STR("@tag1;tag2=value2 :nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
"@tag1;tag2=value2 :nick!user@host PRIVMSG #test :hello",
|
||||
tags));
|
||||
|
||||
hashtable_set (tags, "time", "2023-08-09T07:43:01.830Z");
|
||||
hashtable_set (tags, "msgid", "icqfzy7zdbpix4gy8pvzuv49kw");
|
||||
hashtable_set (tags, "test", "value with spaces");
|
||||
|
||||
WEE_TEST_STR("@time=2023-08-09T07:43:01.830Z;msgid=icqfzy7zdbpix4gy8pvzuv49kw;"
|
||||
"test=value\\swith\\sspaces :nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
":nick!user@host PRIVMSG #test :hello", tags));
|
||||
WEE_TEST_STR("@tag1;tag2=value2;time=2023-08-09T07:43:01.830Z;"
|
||||
"msgid=icqfzy7zdbpix4gy8pvzuv49kw;test=value\\swith\\sspaces "
|
||||
":nick!user@host PRIVMSG #test :hello",
|
||||
irc_tag_add_tags_to_message (
|
||||
"@tag1;tag2=value2 :nick!user@host PRIVMSG #test :hello",
|
||||
tags));
|
||||
|
||||
hashtable_free (tags);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,10 @@ TEST(LoggerBacklog, GroupMessages)
|
||||
"end of line",
|
||||
"2023-06-04 21:15:34\t\tFirst line",
|
||||
"of multiline message",
|
||||
"",
|
||||
"end of message",
|
||||
"2023-06-04 21:15:37\t\tTwo lines with empty line",
|
||||
"",
|
||||
"2023-06-04 21:15:40\t\tMessage on one line",
|
||||
NULL,
|
||||
};
|
||||
@@ -207,7 +210,7 @@ TEST(LoggerBacklog, GroupMessages)
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_backlog_group_messages (NULL));
|
||||
|
||||
lines = arraylist_new (3, 0, 1,
|
||||
lines = arraylist_new (32, 0, 1,
|
||||
&test_logger_backlog_msg_cmp_cb, NULL,
|
||||
&test_logger_backlog_msg_free_cb, NULL);
|
||||
|
||||
@@ -234,15 +237,18 @@ TEST(LoggerBacklog, GroupMessages)
|
||||
|
||||
messages = logger_backlog_group_messages (lines);
|
||||
CHECK(messages);
|
||||
LONGS_EQUAL(3, arraylist_size (messages));
|
||||
LONGS_EQUAL(4, arraylist_size (messages));
|
||||
STRCMP_EQUAL("end of line",
|
||||
(const char *)arraylist_get (messages, 0));
|
||||
STRCMP_EQUAL("2023-06-04 21:15:34\t\tFirst line\n"
|
||||
"of multiline message\n"
|
||||
"\n"
|
||||
"end of message",
|
||||
(const char *)arraylist_get (messages, 1));
|
||||
STRCMP_EQUAL("2023-06-04 21:15:40\t\tMessage on one line",
|
||||
STRCMP_EQUAL("2023-06-04 21:15:37\t\tTwo lines with empty line\n",
|
||||
(const char *)arraylist_get (messages, 2));
|
||||
STRCMP_EQUAL("2023-06-04 21:15:40\t\tMessage on one line",
|
||||
(const char *)arraylist_get (messages, 3));
|
||||
arraylist_free (messages);
|
||||
|
||||
|
||||
|
||||
@@ -79,21 +79,24 @@ TEST(LoggerTail, LoggerTailLastEol)
|
||||
|
||||
TEST(LoggerTail, LoggerTailFile)
|
||||
{
|
||||
char *filename;
|
||||
FILE *file;
|
||||
const char *content = "line 1\nline 2\nline 3";
|
||||
const char *content_3_lines = "line 1\nline 2\nline 3\n";
|
||||
const char *content_5_lines = "line 1\nline 2\n\nline 3\n\n";
|
||||
char *filename, line[4096];
|
||||
struct t_arraylist *lines;
|
||||
|
||||
/* write a test file */
|
||||
filename = string_eval_path_home ("${weechat_data_dir}/test_file.txt",
|
||||
NULL, NULL, NULL);
|
||||
file = fopen (filename, "w");
|
||||
fwrite (content, 1, strlen (content), file);
|
||||
fflush (file);
|
||||
fclose (file);
|
||||
FILE *file;
|
||||
int i;
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (NULL, 0));
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (NULL, 1));
|
||||
|
||||
/* write a small test file */
|
||||
filename = string_eval_path_home ("${weechat_data_dir}/test_file.txt",
|
||||
NULL, NULL, NULL);
|
||||
file = fopen (filename, "w");
|
||||
fwrite (content_3_lines, 1, strlen (content_3_lines), file);
|
||||
fflush (file);
|
||||
fclose (file);
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (filename, 0));
|
||||
|
||||
lines = logger_tail_file (filename, 1);
|
||||
@@ -127,4 +130,219 @@ TEST(LoggerTail, LoggerTailFile)
|
||||
|
||||
unlink (filename);
|
||||
free (filename);
|
||||
|
||||
/* write a small test file, with empty lines */
|
||||
filename = string_eval_path_home ("${weechat_data_dir}/test_file.txt",
|
||||
NULL, NULL, NULL);
|
||||
file = fopen (filename, "w");
|
||||
fwrite (content_5_lines, 1, strlen (content_5_lines), file);
|
||||
fflush (file);
|
||||
fclose (file);
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (filename, 0));
|
||||
|
||||
lines = logger_tail_file (filename, 1);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(1, arraylist_size (lines));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 0));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 2);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(2, arraylist_size (lines));
|
||||
STRCMP_EQUAL("line 3", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 3);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(3, arraylist_size (lines));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("line 3", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 2));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 4);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(4, arraylist_size (lines));
|
||||
STRCMP_EQUAL("line 2", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("line 3", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 3));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 5);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(5, arraylist_size (lines));
|
||||
STRCMP_EQUAL("line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("line 2", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("line 3", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 4));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 6);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(5, arraylist_size (lines));
|
||||
STRCMP_EQUAL("line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("line 2", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("line 3", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 4));
|
||||
arraylist_free (lines);
|
||||
|
||||
unlink (filename);
|
||||
free (filename);
|
||||
|
||||
/* write a bigger test file */
|
||||
filename = string_eval_path_home ("${weechat_data_dir}/test_file.txt",
|
||||
NULL, NULL, NULL);
|
||||
file = fopen (filename, "w");
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
snprintf (line, sizeof (line), "this is a test, line %d\n", i + 1);
|
||||
fwrite (line, 1, strlen (line), file);
|
||||
}
|
||||
fflush (file);
|
||||
fclose (file);
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (filename, 0));
|
||||
|
||||
lines = logger_tail_file (filename, 1);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(1, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 0));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 2);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(2, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 1));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 3);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(3, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 2));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 4);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(4, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 997", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 3));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 1000);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(1000, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 2", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 3", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("this is a test, line 4", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 997));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 998));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 999));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 2000);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(1000, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 2", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 3", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("this is a test, line 4", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 997));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 998));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 999));
|
||||
arraylist_free (lines);
|
||||
|
||||
unlink (filename);
|
||||
free (filename);
|
||||
|
||||
/* write a bigger test file, with empty lines */
|
||||
filename = string_eval_path_home ("${weechat_data_dir}/test_file.txt",
|
||||
NULL, NULL, NULL);
|
||||
file = fopen (filename, "w");
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
snprintf (line, sizeof (line), "this is a test, line %d\n\n", i + 1);
|
||||
fwrite (line, 1, strlen (line), file);
|
||||
}
|
||||
fflush (file);
|
||||
fclose (file);
|
||||
|
||||
POINTERS_EQUAL(NULL, logger_tail_file (filename, 0));
|
||||
|
||||
lines = logger_tail_file (filename, 1);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(1, arraylist_size (lines));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 0));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 2);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(2, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 3);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(3, arraylist_size (lines));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 2));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 4);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(4, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 3));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 2000);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(2000, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 2", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("this is a test, line 3", (const char *)arraylist_get (lines, 4));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 5));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 1994));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1995));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 1996));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1997));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 1998));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1999));
|
||||
arraylist_free (lines);
|
||||
|
||||
lines = logger_tail_file (filename, 4000);
|
||||
CHECK(lines);
|
||||
LONGS_EQUAL(2000, arraylist_size (lines));
|
||||
STRCMP_EQUAL("this is a test, line 1", (const char *)arraylist_get (lines, 0));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1));
|
||||
STRCMP_EQUAL("this is a test, line 2", (const char *)arraylist_get (lines, 2));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 3));
|
||||
STRCMP_EQUAL("this is a test, line 3", (const char *)arraylist_get (lines, 4));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 5));
|
||||
STRCMP_EQUAL("this is a test, line 998", (const char *)arraylist_get (lines, 1994));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1995));
|
||||
STRCMP_EQUAL("this is a test, line 999", (const char *)arraylist_get (lines, 1996));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1997));
|
||||
STRCMP_EQUAL("this is a test, line 1000", (const char *)arraylist_get (lines, 1998));
|
||||
STRCMP_EQUAL("", (const char *)arraylist_get (lines, 1999));
|
||||
arraylist_free (lines);
|
||||
|
||||
unlink (filename);
|
||||
free (filename);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ extern void relay_irc_sendf (struct t_relay_client *client,
|
||||
const char *format, ...);
|
||||
extern void relay_irc_parse_cap_message (struct t_relay_client *client,
|
||||
struct t_hashtable *parsed_msg);
|
||||
extern void relay_irc_parse_ctcp (const char *message,
|
||||
char **ctcp_type, char **ctcp_params);
|
||||
extern int relay_irc_tag_relay_client_id (const char *tags);
|
||||
extern void relay_irc_input_send (struct t_relay_client *client,
|
||||
const char *irc_channel,
|
||||
@@ -812,6 +814,72 @@ TEST(RelayIrcWithClient, RelayIrcRecvCommandCapab)
|
||||
LONGS_EQUAL(1, RELAY_IRC_DATA(ptr_relay_client, cap_end_received));
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* relay_irc_parse_ctcp
|
||||
*/
|
||||
|
||||
TEST(RelayIrcWithClient, RelayIrcParseCtcp)
|
||||
{
|
||||
char *ctcp_type, *ctcp_params;
|
||||
|
||||
relay_irc_parse_ctcp (NULL, NULL, NULL);
|
||||
relay_irc_parse_ctcp ("test", NULL, NULL);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp (NULL, &ctcp_type, &ctcp_params);
|
||||
POINTERS_EQUAL(NULL, ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("\01ACTION is testing\01", &ctcp_type, &ctcp_params);
|
||||
STRCMP_EQUAL("ACTION", ctcp_type);
|
||||
STRCMP_EQUAL("is testing", ctcp_params);
|
||||
free (ctcp_type);
|
||||
free (ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("\01ACTION is testing \01 extra", &ctcp_type, &ctcp_params);
|
||||
STRCMP_EQUAL("ACTION", ctcp_type);
|
||||
STRCMP_EQUAL(" is testing ", ctcp_params);
|
||||
free (ctcp_type);
|
||||
free (ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("\01VERSION\01", &ctcp_type, &ctcp_params);
|
||||
STRCMP_EQUAL("VERSION", ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
free (ctcp_type);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("\01ACTION is testing", &ctcp_type, &ctcp_params);
|
||||
POINTERS_EQUAL(NULL, ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("\01VERSION", &ctcp_type, &ctcp_params);
|
||||
POINTERS_EQUAL(NULL, ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("test", &ctcp_type, &ctcp_params);
|
||||
POINTERS_EQUAL(NULL, ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
|
||||
ctcp_type = (char *)0x01;
|
||||
ctcp_params = (char *)0x01;
|
||||
relay_irc_parse_ctcp ("", &ctcp_type, &ctcp_params);
|
||||
POINTERS_EQUAL(NULL, ctcp_type);
|
||||
POINTERS_EQUAL(NULL, ctcp_params);
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests functions:
|
||||
* relay_irc_recv
|
||||
|
||||
@@ -49,6 +49,9 @@ TEST(XferNetwork, ConvertIntegerToIpv4)
|
||||
POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("0"));
|
||||
POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("-1"));
|
||||
|
||||
/* too big: UINT32_MAX + 1 = 4294967296 */
|
||||
POINTERS_EQUAL(NULL, xfer_network_convert_integer_to_ipv4 ("4294967296"));
|
||||
|
||||
WEE_TEST_STR("0.0.0.1", xfer_network_convert_integer_to_ipv4 ("1"));
|
||||
WEE_TEST_STR("0.0.1.0", xfer_network_convert_integer_to_ipv4 ("256"));
|
||||
WEE_TEST_STR("0.1.0.0", xfer_network_convert_integer_to_ipv4 ("65536"));
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@
|
||||
# devel-number the devel version as hex number ("0x04010000" for "4.1.0-dev")
|
||||
#
|
||||
|
||||
WEECHAT_STABLE="4.0.2"
|
||||
WEECHAT_DEVEL="4.0.2"
|
||||
WEECHAT_STABLE="4.0.5"
|
||||
WEECHAT_DEVEL="4.0.5"
|
||||
|
||||
STABLE_MAJOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f1)
|
||||
STABLE_MINOR=$(echo "${WEECHAT_STABLE}" | cut -d"." -f2)
|
||||
|
||||
Reference in New Issue
Block a user