]> jfr.im git - irc/weechat/specs.weechat.org.git/blob - specs/2023-001-case-sensitive-identifiers.md
63c41c56643fdd2831a87cdad0e98e0aa4c79a9e
[irc/weechat/specs.weechat.org.git] / specs / 2023-001-case-sensitive-identifiers.md
1 # Case sensitive identifiers
2
3 - Author: [Sébastien Helleu](https://github.com/flashcode)
4 - License: CC BY-NC-SA 4.0
5 - Created on: 2022-12-21
6 - Last updated: 2023-01-27
7 - Issue: [#1872](https://github.com/weechat/weechat/issues/1872): case sensitive identifiers
8 - Status: draft
9 - Target WeeChat version: 3.9
10
11 ## Context
12
13 Many identifiers are case insensitive in WeeChat and should not be.
14
15 ## Goals
16
17 Purpose of this specification is to make many identifiers case sensitive in
18 data objects managed by the user, API and internal functions.
19
20 Changes proposed in this specification will also fix the following issues:
21
22 - [#398](https://github.com/weechat/weechat/issues/398): autocomplete wrong case
23 - [#32213](https://savannah.nongnu.org/bugs/?32213): completion problems with uppercase letters
24
25 ## Out of scope
26
27 These identifiers must stay case insensitive:
28
29 - hook config (check if option is matching hook mask)
30 - hooks hsignal and signal (check if signal is matching hook signal masks)
31 - hook line (check if buffer is matching hook mask)
32 - hook modifier name
33 - hook print (check if prefix or message displayed is contained in hook message)
34 - buffer matching condition in filters
35 - system signal name ("kill", "term", "usr1", etc.)
36 - nick completions
37 - nicklist: groups and nicks
38 - fset filters
39 - weelist data (used to keep list sorted)
40 - IRC channel name
41 - IRC nicks
42 - IRC CTCP names
43 - IRC capabilities
44 - relay: IRC commands relayed
45 - relay: IRC commands ignored
46 - filters on trigger monitor buffer
47
48 ## Changes
49
50 These identifiers are currently case insensitive and must become case sensitive:
51
52 - configuration (files, sections, options)
53 - commands
54 - commands parameters
55 - hook command_run
56 - hook info
57 - hook info_hashtable
58 - infolist names
59 - hashtable types
60 - curl constants
61 - curl options
62 - completion items
63 - completions (except nick completions)
64 - infolist variable name
65 - weelist position (beginning/end/sort)
66 - proxy options
67 - proxy types
68 - /secure buffer input (`q` to close)
69 - color names
70 - /color buffer input (`q` to close, etc.)
71 - custom bar item option ("conditions", "content")
72 - bar options
73 - bar types
74 - bar positions
75 - bar conditions ("active", "inactive", "nicklist")
76 - bar names
77 - buffer types ("formatted", "free")
78 - buffer notify levels (none, highlight, etc.)
79 - buffer match list
80 - user buffer input (`q` to close)
81 - function gui_color_get_custom (parameter `color_name`, example: `bold`, `reset`, etc.)
82 - filter names
83 - hotlist priorities ("low", "message", "private", "highlight")
84 - key contexts ("default", "search", "cursor", "mouse")
85 - notify tags in line ("notify_none", "notify_message", etc.)
86 - alias name
87 - IRC server name
88 - IRC raw buffer input (`q` to close)
89 - IRC raw filters
90 - API function prefix (parameter `prefix`, example: `error`, `network`, etc.)
91 - script name
92 - plugin name (eg: `irc` vs `Irc`)
93 - relay buffer input (`q` to close, etc.)
94 - relay compression (off/zlib/zstd)
95 - trigger names
96 - trigger options
97 - trigger types
98 - trigger return codes
99 - trigger post actions
100 - xfer buffer input (`q` to close, etc.)
101 - xfer types
102 - xfer protocols (none/dcc)
103 - functions to set object properties
104
105 ### String comparison functions
106
107 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:
108
109 Function | Replacement
110 ---------------------------- | ---------------------------------------
111 `string_charcasecmp` | `string_charcmp`
112 `string_strcasecmp` | `string_strcmp` or `strcmp`
113 `string_strncasecmp` | `string_strncmp`
114 `string_strcmp_ignore_chars` | Same function with `case_sensitive` = 1
115 `string_strcasestr` | `strstr`
116 `string_match` | Same function with `case_sensitive` = 1
117 `string_match_list` | Same function with `case_sensitive` = 1
118
119 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:
120
121 Function | Replacement
122 ----------------------------- | ---------------------------------------
123 `weechat_string_charcasecmp` | `weechat_string_charcmp`
124 `weechat_strcasecmp` | `weechat_strcmp` or `strcmp`
125 `weechat_strncasecmp` | `weechat_strncmp`
126 `weechat_strcmp_ignore_chars` | Same function with `case_sensitive` = 1
127 `weechat_strcasestr` | `strstr`
128 `weechat_string_match` | Same function with `case_sensitive` = 1
129 `weechat_string_match_list` | Same function with `case_sensitive` = 1
130
131 ### Configuration files, sections, options
132
133 Configuration files, sections and options are made case sensitive.
134
135 Functions to update:
136
137 - config_file_search
138 - config_file_config_find_pos
139 - config_file_section_find_pos
140 - config_file_search_section
141 - config_file_option_find_pos
142 - config_file_new_option
143 - config_file_search_option
144 - config_file_search_section_option
145 - config_file_string_boolean_is_valid
146 - config_file_string_to_boolean
147 - config_file_option_set
148 - config_file_read_internal
149
150 ### Commands, commands parameters, command_runs, aliases and completions
151
152 Commands, commands parameters, hook "command_run", aliases and completions (except nick) are made case sensitive.
153
154 Functions to update:
155
156 - hook_command_search
157 - hook_command_exec
158 - hook_command_run_exec
159 - hook_completion_exec
160 - hook_find_pos
161 - hook_add_to_infolist_type
162 - command_help
163 - input_exec_command
164 - gui_completion_word_compare_cb
165 - gui_completion_search_command
166 - gui_completion_list_add
167 - gui_completion_complete
168 - alias_search
169 - alias_find_pos
170 - all command callbacks (core and plugins)
171
172 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`.
173
174 Regarding commands, a new alias `/AWAY` could be defined to be away on all servers, like this:
175
176 ```text
177 /alias add AWAY /allserv /away
178 ```
179
180 So that `/away` and `/AWAY` (the new alias) are two separate commands,
181 with separate completion: the completion of `/aw` is `/away` (only this one),
182 and the completion of `/AW` is `/AWAY` (only this one).
183
184 Nick completion remains case insensitive, that means if there are nicks "Nick"
185 and "Nick_away", typing "ni" with Tab will complete to partial completion "Nick"
186 and typing "_" and Tab again will complete to "Nick_away".
187
188 Partial completion is not converted to lower case any more, this fixes the issue
189 [#398](https://github.com/weechat/weechat/issues/398) and Savannah bug
190 [#32213](https://savannah.nongnu.org/bugs/?32213).
191
192 That means when partial completion is enabled (`/set weechat.completion.partial_completion_other on`), the result is the following:
193
194 Nicks in channel | Input text | Old completion | New completion
195 -------------------------------- | ------------ | -------------- | --------------
196 `{Andrew}` and `{Andrew}_Mobile` | `{a` or `{A` | `{andrew}` | `{Andrew}`
197 `NickName` and `NickToto` | `ni` or `Ni` | `nick` | `Nick`
198
199 ### Info, info_hashtable, infolist
200
201 Name of "info", "info_hashtable" and "infolist" are made case sensitive.
202
203 Functions to update:
204
205 - hook_info_get
206 - hook_info_get_hashtable
207 - hook_infolist_get
208 - infolist_search_var
209 - infolist_integer
210 - infolist_string
211 - infolist_pointer
212 - infolist_buffer
213 - infolist_time
214
215 ### Bars and bar items
216
217 Name of bar items and all these bar identifiers are made case sensitive:
218
219 - name
220 - options
221 - type
222 - position
223 - conditions
224
225 Functions to update:
226
227 - command_bar
228 - gui_bar_item_custom_search_option
229 - gui_bar_item_custom_search_with_option_name
230 - gui_bar_search_option
231 - gui_bar_search_type
232 - gui_bar_search_position
233 - gui_bar_check_conditions
234 - gui_bar_search
235 - gui_bar_search_with_option_name
236 - gui_bar_default_items
237 - gui_bar_update
238
239 ### Plugins
240
241 Plugin names are made case sensitive.
242
243 Functions to update:
244
245 - command_plugin_list
246 - gui_layout_buffer_get_number
247 - plugin_search
248 - plugin_check_extension_allowed (option `weechat.plugin.extension`)
249 - plugin_check_autoload (option `weechat.plugin.extension`)
250 - xfer_search
251
252 ### Functions to get/set properties
253
254 The functions used to set object properties are updated to be case sensitive for the property to set (parameter `property`):
255
256 - config_file_option_get_string
257 - config_file_option_get_pointer
258 - hashtable_get_integer
259 - hashtable_get_string
260 - hashtable_set_pointer
261 - hdata_get_string
262 - hook_set
263 - proxy_set
264 - gui_bar_set
265 - gui_buffer_get_integer
266 - gui_buffer_get_string
267 - gui_buffer_get_pointer
268 - gui_buffer_set
269 - gui_buffer_set_pointer
270 - gui_completion_get_string
271 - gui_nicklist_group_get_integer
272 - gui_nicklist_group_get_string
273 - gui_nicklist_group_get_pointer
274 - gui_nicklist_group_set
275 - gui_nicklist_nick_get_integer
276 - gui_nicklist_nick_get_string
277 - gui_nicklist_nick_get_pointer
278 - gui_nicklist_nick_set
279 - gui_window_get_integer
280 - gui_window_get_pointer
281
282 ### Curl constants and options
283
284 Curl constants and options are made case sensitive.
285
286 Functions to update:
287
288 - weeurl_search_constant
289 - weeurl_search_option
290
291 ### Hashtables
292
293 Hashtable types are made case sensitive.
294
295 Functions to update:
296
297 - hashtable_get_type
298
299 ### Weelist
300
301 Weelist positions are made case sensitive.
302
303 Functions to update:
304
305 - weelist_insert
306
307 ### Proxies
308
309 Proxy options and types are made case sensitive.
310
311 Proxy names are made case sensitive in read of infolist "proxy".
312
313 Functions to update:
314
315 - proxy_search_option
316 - proxy_search_type
317 - plugin_api_infolist_proxy_cb
318
319 ### Buffers
320
321 Buffer types and notify levels are made case sensitive.
322
323 API function `buffer_match_list` is made case sensitive.
324
325 Buffer names are made case sensitive in read of infolist "buffer".
326
327 Functions to update:
328
329 - gui_buffer_search_type
330 - gui_buffer_search_notify
331 - gui_buffer_match_list
332 - plugin_api_infolist_buffer_cb
333
334 ### Input actions in buffers
335
336 Input actions (like "q" to close buffer) are made case sensitive.
337
338 Functions to update:
339
340 - secure_buffer_input_cb
341 - gui_color_buffer_input_cb
342 - gui_buffer_user_input_cb
343 - irc_input_data
344 - relay_buffer_input_cb
345 - xfer_buffer_input_cb
346
347 ### Colors
348
349 Color names (like `blue`, `red`, etc.) and color attributes (`bold`, `underline`, etc.) are made case sensitive.
350
351 Functions to update:
352
353 - gui_color_search
354 - gui_color_get_custom
355
356 ### Filters
357
358 Filter names are made case sensitive.
359
360 Functions to update:
361
362 - gui_filter_find_pos
363
364 ### Hotlist priorities
365
366 Hotlist priorities ("low", "message", "private", "highlight") are made case sensitive.
367
368 Functions to update:
369
370 - gui_hotlist_search_priority
371
372 ### Key contexts
373
374 Key contexts ("default", "search", "cursor", "mouse") are made case sensitive.
375
376 Functions to update:
377
378 - gui_key_search_context
379
380 ### Notify tags in line
381
382 Notify tags in line ("notify_none", "notify_message", etc.) are made case sensitive.
383
384 Functions to update:
385
386 - gui_line_set_notify_level
387
388 ### IRC servers
389
390 IRC server names are made case sensitive.
391
392 Functions to update:
393
394 - irc_command_exec_all_servers
395 - irc_command_server
396 - irc_ignore_search
397 - irc_ignore_check_server
398 - irc_info_infolist_irc_server_cb
399 - irc_info_infolist_irc_notify_cb
400 - irc_server_casesearch (function removed)
401
402 ### IRC raw filters
403
404 Filters on IRC raw buffer (except command name with `m:xxx`) are made case sensitive
405
406 Functions to update:
407
408 - irc_raw_message_match_filter
409
410 ### API function "prefix"
411
412 The prefix parameter in "prefix" API function is made case sensitive.
413
414 Functions to update:
415
416 - plugin_api_prefix
417
418 ### Scripts
419
420 Script names are made case sensitive.
421
422 Functions to update:
423
424 - plugin_script_search
425 - plugin_script_find_pos
426
427 ### Triggers
428
429 Trigger names, options, types, return codes and post actions are made case sensitive.
430
431 Functions to update:
432
433 - trigger_command_trigger
434 - trigger_search_option
435 - trigger_search_hook_type
436 - trigger_search_return_code
437 - trigger_search_post_action
438 - trigger_search
439
440 ### Xfer
441
442 Xfer types and protocols are made case sensitive.
443
444 Functions to update:
445
446 - xfer_search_type
447 - xfer_search_protocol
448
449 ## Planning
450
451 The changes must be implemented in this order:
452
453 1. Make case sensitive:
454 - configuration files, sections, options
455 - aliases
456 2. Convert default aliases to lower case
457 3. Make case sensitive:
458 - commands, commands parameters, hook "command_run", aliases and completions (except nick)
459 - info, info_hashtable, infolist
460 - bars, bar items
461 - plugins
462 - functions to get/set properties
463 - Curl constants and options
464 - hashtable types
465 - weelist position
466 - proxy options and types, proxy name in infolist "proxy"
467 - buffer types and notify levels, API function buffer_match_list, buffer name in infolist "buffer"
468 - input actions in buffers
469 - color names and attributes
470 - filter names
471 - hotlist priorities
472 - notify tags in line
473 - IRC server names
474 - IRC raw filters
475 - API function "prefix"
476 - script names
477 - trigger names, options, types, return codes and post actions
478 - xfer types and protocols
479
480 ## References
481
482 - Source of this specification: [https://github.com/weechat/specs.weechat.org/blob/main/specs/2023-001-case-sensitive-identifiers.md](https://github.com/weechat/specs.weechat.org/blob/main/specs/2023-001-case-sensitive-identifiers.md)