Skip to content

Commit

Permalink
irc: compute color in case insensitive way (closes #194)
Browse files Browse the repository at this point in the history
Reintroduce infos "irc_nick_color" and "irc_nick_color_name" (that were
marked deprecated since version 1.5).

A server name is added in the two infos and is optional, for backward
compatibility.
  • Loading branch information
flashcode committed Aug 24, 2023
1 parent c2426e8 commit 6aa66b5
Show file tree
Hide file tree
Showing 23 changed files with 777 additions and 365 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -22,6 +22,7 @@ New features::
* buflist: increase max number of buflist items from 3 to 5 (issue #1703)
* fset: add variable `allowed_values` in options, add options fset.color.allowed_values and fset.color.allowed_values_selected
* fset: allow long type name in type filter
* irc: compute color in case insensitive way, reintroduce infos "irc_nick_color" and "irc_nick_color_name", add support of server name (issue #194)
* irc: add buffer for /list reply, add options irc.color.list_buffer_line_selected, irc.color.list_buffer_line_selected_bg, irc.look.list_buffer_sort, irc.look.list_buffer_scroll_horizontal, irc.look.new_list_position, irc.look.list_buffer_topic_strip_colors (issue #1972)
* irc: display commands 716/717 in private buffer (if present) (issue #146)
* irc: create default options irc.ctcp.* when file irc.conf is created (issue #1974)
Expand Down
30 changes: 30 additions & 0 deletions ReleaseNotes.adoc
Expand Up @@ -59,6 +59,36 @@ back with the two following commands:
They will then be advertised in reply to "CTCP CLIENTINFO", which is now built
dynamically with these options.

[[v4.1.0_info_irc_nick_color]]
=== Infos irc_nick_color and irc_nick_color_name

The infos irc_nick_color and irc_nick_color_name, that were deprecated since
version 1.5 are now used again, with a change in parameter: the server is now
optional before the nick: "server,nick". +
The nick is first converted to lower case, following the value of CASEMAPPING
on the server, then hashed to compute the color. +
That means the color for a nick is now case insensitive (in the way IRC servers
are case insensitive, so with a limited range of chars only).

If a script was using this info with a comma in nickname (which should not happen
anyway), this is now interpreted as the server name, and the script must be
modified. +
Anyway, it is recommended to always give the server name to respect the
CASEMAPPING of the server and prevent any issue with a comma in the nickname.

For example nick color of "alice" and "ALICE" is now always guaranteed to be the
same:

----
# with server name (recommended)
weechat.info_get("irc_nick_color", "libera,alice") == weechat.info_get("irc_nick_color", "libera,ALICE")
weechat.info_get("irc_nick_color_name", "libera,alice") == weechat.info_get("irc_nick_color_name", "libera,ALICE")
# without server name (allowed but not recommended, kept for compatibility)
weechat.info_get("irc_nick_color", "alice") == weechat.info_get("irc_nick_color", "ALICE")
weechat.info_get("irc_nick_color_name", "alice") == weechat.info_get("irc_nick_color_name", "ALICE")
----

[[v4.1.0_fset_allowed_values]]
=== Allowed values for options on fset buffer

Expand Down
18 changes: 10 additions & 8 deletions po/cs.po
Expand Up @@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-22 09:26+0200\n"
"POT-Creation-Date: 2023-08-24 09:00+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
Expand Down Expand Up @@ -9689,16 +9689,15 @@ msgid "IRC host (like `:nick!name@server.com`)"
msgstr "IRC host (jako `:nick!name@server.com`)"

msgid ""
"get nick color code (*deprecated* since version 1.5, replaced by "
"\"nick_color\")"
"get nick color code (nick is first converted to lower case, following the "
"value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the server "
"is not given)"
msgstr ""

msgid "nickname"
msgstr "přezdívka"

msgid ""
"get nick color name (*deprecated* since version 1.5, replaced by "
"\"nick_color_name\")"
"get nick color name (nick is first converted to lower case, following the "
"value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the server "
"is not given)"
msgstr ""

msgid "get buffer pointer for an IRC server/channel/nick"
Expand Down Expand Up @@ -14318,6 +14317,9 @@ msgstr "%s%s: vypršel časový limit \"%s\" pro %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nemohu se připojit\" neočekávaná chyba (%d)"

#~ msgid "nickname"
#~ msgstr "přezdívka"

#, fuzzy
#~ msgid "color for selected line"
#~ msgstr "sekce konfigu"
Expand Down

0 comments on commit 6aa66b5

Please sign in to comment.