WeeChat specifications

Case sensitive identifiers

Context

Many identifiers are case insensitive in WeeChat and should not be.

Goals

Purpose of this specification is to make many identifiers case sensitive in data objects managed by the user, API and internal functions.

Changes proposed in this specification will also fix the following issues:

Out of scope

These identifiers must stay case insensitive:

Changes

These identifiers are currently case insensitive and must become case sensitive:

String comparison functions

When a comparison needs to be case sensitive instead of case insensitive, the call to the function must be replaced with another, in WeeChat core:

Function Replacement
string_charcasecmp string_charcmp
string_strcasecmp string_strcmp or strcmp
string_strncasecmp string_strncmp
string_strcmp_ignore_chars Same function with case_sensitive = 1
string_strcasestr strstr
string_match Same function with case_sensitive = 1
string_match_list Same function with case_sensitive = 1

When a comparison needs to be case sensitive instead of case insensitive, the call to the function must be replaced with another, in WeeChat plugins:

Function Replacement
weechat_string_charcasecmp weechat_string_charcmp
weechat_strcasecmp weechat_strcmp or strcmp
weechat_strncasecmp weechat_strncmp
weechat_strcmp_ignore_chars Same function with case_sensitive = 1
weechat_strcasestr strstr
weechat_string_match Same function with case_sensitive = 1
weechat_string_match_list Same function with case_sensitive = 1

Configuration files, sections, options

Configuration files, sections and options are made case sensitive.

Functions to update:

Commands, commands parameters, command_runs, aliases and completions

Commands, commands parameters, hook “command_run”, aliases and completions (except nick) are made case sensitive.

Functions to update:

That means for example /test -o and /test -O (upper case parameter) would have different meaning, -o and -O being two different options for the command /test.

Regarding commands, a new alias /AWAY could be defined to be away on all servers, like this:

/alias add AWAY /allserv /away

So that /away and /AWAY (the new alias) are two separate commands, with separate completion: the completion of /aw is /away (only this one), and the completion of /AW is /AWAY (only this one).

Default aliases are now in lower case by default.
WeeChat automatically converts all aliases from upper to lower case on upgrade, the following messages are displayed:

Alias converted to lower case: "AAWAY" => "aaway"
Alias converted to lower case: "ANICK" => "anick"
Alias converted to lower case: "BEEP" => "beep"
Alias converted to lower case: "BYE" => "bye"
Alias converted to lower case: "C" => "c"
Alias converted to lower case: "CHAT" => "chat"
Alias converted to lower case: "CL" => "cl"
Alias converted to lower case: "CLOSE" => "close"
Alias converted to lower case: "EXIT" => "exit"
Alias converted to lower case: "IG" => "ig"
Alias converted to lower case: "J" => "j"
Alias converted to lower case: "K" => "k"
Alias converted to lower case: "KB" => "kb"
Alias converted to lower case: "LEAVE" => "leave"
Alias converted to lower case: "M" => "m"
Alias converted to lower case: "MSGBUF" => "msgbuf"
Alias converted to lower case: "MUB" => "mub"
Alias converted to lower case: "N" => "n"
Alias converted to lower case: "Q" => "q"
Alias converted to lower case: "REDRAW" => "redraw"
Alias converted to lower case: "SAY" => "say"
Alias converted to lower case: "SIGNOFF" => "signoff"
Alias converted to lower case: "T" => "t"
Alias converted to lower case: "UB" => "ub"
Alias converted to lower case: "UMODE" => "umode"
Alias converted to lower case: "V" => "v"
Alias converted to lower case: "W" => "w"
Alias converted to lower case: "WC" => "wc"
Alias converted to lower case: "WI" => "wi"
Alias converted to lower case: "WII" => "wii"
Alias converted to lower case: "WM" => "wm"
Alias converted to lower case: "WW" => "ww"

Nick completion remains case insensitive, that means if there are nicks “Nick” and “Nick_away”, typing “ni” with Tab will complete to partial completion “Nick” and typing “_” and Tab again will complete to “Nick_away”.

Partial completion is not converted to lower case any more, this fixes the issue #398 and Savannah bug #32213.

That means when partial completion is enabled (/set weechat.completion.partial_completion_other on), the result is the following:

Nicks in channel Input text Old completion New completion
{Andrew} and {Andrew}_Mobile {a or {A {andrew} {Andrew}
NickName and NickToto ni or Ni nick Nick

Info, info_hashtable, infolist

Name of “info”, “info_hashtable” and “infolist” are made case sensitive.

Functions to update:

Bars and bar items

Name of bar items and all these bar identifiers are made case sensitive:

Functions to update:

Plugins

Plugin names are made case sensitive.

Functions to update:

Functions to get/set properties

The functions used to set object properties are updated to be case sensitive for the property to set (parameter property):

Hashtables

Hashtable types are made case sensitive.

Functions to update:

Weelist

Weelist positions are made case sensitive.

Functions to update:

Proxies

Proxy options and types are made case sensitive.

Proxy names are made case sensitive in read of infolist “proxy”.

Functions to update:

Buffers

Buffer types and notify levels are made case sensitive.

API function buffer_match_list is made case sensitive.

Buffer names are made case sensitive in read of infolist “buffer”.

Functions to update:

Input actions in buffers

Input actions (like “q” to close buffer) are made case sensitive.

Functions to update:

Colors

Color names (like blue, red, etc.) and color attributes (bold, underline, etc.) are made case sensitive.

Functions to update:

Filters

Filter names are made case sensitive.

Functions to update:

Hotlist priorities

Hotlist priorities (“low”, “message”, “private”, “highlight”) are made case sensitive.

Functions to update:

Key contexts

Key contexts (“default”, “search”, “cursor”, “mouse”) are made case sensitive.

Functions to update:

Notify tags in line

Notify tags in line (“notify_none”, “notify_message”, etc.) are made case sensitive.

Functions to update:

IRC servers

IRC server names are made case sensitive.

Functions to update:

IRC raw filters

Filters on IRC raw buffer (except command name with m:xxx) are made case sensitive

Functions to update:

API function “prefix”

The prefix parameter in “prefix” API function is made case sensitive.

Functions to update:

Scripts

Script names are made case sensitive.

Functions to update:

Triggers

Trigger names, options, types, return codes and post actions are made case sensitive.

Functions to update:

Xfer

Xfer types and protocols are made case sensitive.

Functions to update:

Planning

The changes must be implemented in this order:

  1. Make case sensitive:
    • configuration files, sections, options
    • aliases
  2. Convert default aliases to lower case
  3. Make case sensitive:
    • commands, commands parameters, hook “command_run”, aliases and completions (except nick)
    • info, info_hashtable, infolist
    • bars, bar items
    • plugins
    • functions to get/set properties
    • hashtable types
    • weelist position
    • proxy options and types, proxy name in infolist “proxy”
    • buffer types and notify levels, API function buffer_match_list, buffer name in infolist “buffer”
    • input actions in buffers
    • color names and attributes
    • filter names
    • hotlist priorities
    • notify tags in line
    • IRC server names
    • IRC raw filters
    • API function “prefix”
    • script names
    • trigger names, options, types, return codes and post actions
    • xfer types and protocols

References