diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 27f52374d..727ddaad3 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -33,7 +33,7 @@ New features:: * core: display similar command names when a command is unknown (issue #1877) * core, plugins: make many identifiers case sensitive (issue #1872, issue #398, bug #32213) * api: add function config_set_version (issue #1238) - * alias: use lower case for default aliases (issue #1872) + * alias: use lower case for default aliases, rename all aliases to lower case on upgrade (issue #1872) * irc: add command `/rules` (issue #1864) * irc: add command `/knock` (issue #7) * irc: add server option "registered_mode", add fields "authentication_method" and "sasl_mechanism_used" in server (issue #1625) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index f80f2a17f..3d3cc71d1 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -127,44 +127,11 @@ See https://specs.weechat.org/specs/2023-001-case-sensitive-identifiers.html[Cas for more information. Accordingly, default aliases are now in lower case. + -If you upgraded from an old WeeChat version, the aliases are still in upper case -and must be completed/used with upper case. For example `/CLO` + key kbd:[Tab] -completes to `/CLOSE` (and `/close` is not valid any more). + -The default aliases can be converted to lower case with the following commands: +All aliases (default ones and those added manually) are automatically converted +to lower case with a message like this one: ---- -/alias rename AAWAY aaway -/alias rename ANICK anick -/alias rename BEEP beep -/alias rename BYE bye -/alias rename C c -/alias rename CHAT chat -/alias rename CL cl -/alias rename CLOSE close -/alias rename EXIT exit -/alias rename IG ig -/alias rename J j -/alias rename K k -/alias rename KB kb -/alias rename LEAVE leave -/alias rename M m -/alias rename MSGBUF msgbuf -/alias rename MUB mub -/alias rename N n -/alias rename Q q -/alias rename REDRAW redraw -/alias rename SAY say -/alias rename SIGNOFF signoff -/alias rename T t -/alias rename UB ub -/alias rename UMODE umode -/alias rename V v -/alias rename W w -/alias rename WC wc -/alias rename WI wi -/alias rename WII wii -/alias rename WM wm -/alias rename WW ww +Alias converted to lower case: "CLOSE" => "close" ---- [[v4.0.0_insert_multiple_pasted_lines]] diff --git a/po/cs.po b/po/cs.po index c6bd8eb08..fe5590b86 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -5328,6 +5328,10 @@ msgstr "hodnota aliasu" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "%s%s: chyba vytváření doplňování pro alias \"%s\": alias nenalezen" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "ukazatel aliasu (volitelné)" diff --git a/po/de.po b/po/de.po index 3479fd589..42faf43f4 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-31 11:28+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German - Germany \n" @@ -6572,6 +6572,11 @@ msgstr "" "%s%s: Fehler bei der Erstellung der Vervollständigung für den " "Alternativbefehl \"%s\": Alternativbefehl wurde nicht gefunden" +#, fuzzy, c-format +#| msgid "Legacy key converted: \"%s\" => \"%s\"" +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "Veraltete Taste konvertiert: \"%s\" => \"%s\"" + msgid "alias pointer (optional)" msgstr "Alias Pointer (optional)" diff --git a/po/es.po b/po/es.po index 1ae6b9a06..45eebe262 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -5948,6 +5948,10 @@ msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "" "%s%s: error al crear el completador para el alias \"%s\": alias no encontrado" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "puntero del alias (opcional)" diff --git a/po/fr.po b/po/fr.po index 5c29624a6..43d0905f1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" -"PO-Revision-Date: 2023-03-30 22:12+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" +"PO-Revision-Date: 2023-04-01 11:12+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -6435,6 +6435,10 @@ msgstr "" "%s%s : erreur de création de la complétion pour l'alias \"%s\" : alias non " "trouvé" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "Alias converti en minuscules : \"%s\" => \"%s\"" + msgid "alias pointer (optional)" msgstr "pointeur vers l'alias (optionnel)" diff --git a/po/hu.po b/po/hu.po index 182ada2cc..a41a0e5e3 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -4858,6 +4858,10 @@ msgstr "Aliaszok listája:\n" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "%s a \"%s\" opció nem található\n" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + #, fuzzy msgid "alias pointer (optional)" msgstr "konfigurációs paraméterek beállítása" diff --git a/po/it.po b/po/it.po index 530c02bbe..2cd4256b7 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -5610,6 +5610,10 @@ msgstr "" "%s%s: errore nella creazione del completamento per l'alias \"%s\": alias non " "trovato" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "puntatore all'alias (opzionale)" diff --git a/po/ja.po b/po/ja.po index 163404a8e..0fa84c3c0 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "別名のポインタ (任意)" diff --git a/po/pl.po b/po/pl.po index 34655cedd..1795afa77 100644 --- a/po/pl.po +++ b/po/pl.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-27 22:02+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: Polish \n" @@ -6707,6 +6707,10 @@ msgstr "" "%s%s: błąd podczas tworzenia dopełnienia dla aliasu \"%s\": nie znaleziono " "aliasu" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "wskaźnik aliasu (opcjonalny)" diff --git a/po/pt.po b/po/pt.po index c54ec51c1..828348b93 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -6262,6 +6262,10 @@ msgstr "valor do alias" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "%s%s: erro ao criar completação do alias \"%s\": alias não encontrado" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "ponteiro para o alias (opcional)" diff --git a/po/pt_BR.po b/po/pt_BR.po index 55c0f2503..e7c1b0798 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -5535,6 +5535,10 @@ msgstr "valor do atalho" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "ponteiro de atalhos (opcional)" diff --git a/po/ru.po b/po/ru.po index 96b14e24c..5863c17bd 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -4895,6 +4895,10 @@ msgstr "Список сокращений:\n" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "%s параметр конфигурации \"%s\" не найден\n" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + #, fuzzy msgid "alias pointer (optional)" msgstr "настроить параметры конфигурации" diff --git a/po/sr.po b/po/sr.po index a4d91766d..14ff4c641 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-27 22:15+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -6648,6 +6648,10 @@ msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "" "%s%s: грешка приликом креирања довршавања за алијас „%s”: алијас не постоји" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "показивач на алијас (необавезно)" diff --git a/po/tr.po b/po/tr.po index d28bf14f0..df1f83a86 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2023-03-25 21:13+0100\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -6696,6 +6696,10 @@ msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "" "%s%s: \"%s\" arması için tamamlama oluşturulurken hata: Arma bulunamadı" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "arma işaretçisi (isteğe bağlı)" diff --git a/po/weechat.pot b/po/weechat.pot index fcfd840b6..bba8763f2 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-03-30 22:09+0200\n" +"POT-Creation-Date: 2023-04-01 11:12+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -4457,6 +4457,10 @@ msgstr "" msgid "%s%s: error creating completion for alias \"%s\": alias not found" msgstr "" +#, c-format +msgid "Alias converted to lower case: \"%s\" => \"%s\"" +msgstr "" + msgid "alias pointer (optional)" msgstr "" diff --git a/src/core/wee-config.c b/src/core/wee-config.c index d1ca0addf..070194c5a 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -1528,7 +1528,7 @@ config_weechat_update_cb (const void *pointer, void *data, (void) data; (void) config_file; - /* nothing to do if we're already an up-to-date config file */ + /* nothing to do if the config file is already up-to-date */ if (version_read >= WEECHAT_CONFIG_VERSION) return NULL; diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c index 8a03a6061..f6b72f4b0 100644 --- a/src/plugins/alias/alias-config.c +++ b/src/plugins/alias/alias-config.c @@ -356,6 +356,71 @@ alias_config_completion_create_option_cb (const void *pointer, void *data, return WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; } +/* + * Updates options in configuration file while reading the file. + */ + +struct t_hashtable * +alias_config_update_cb (const void *pointer, void *data, + struct t_config_file *config_file, + int version_read, + struct t_hashtable *data_read) +{ + const char *ptr_section, *ptr_option; + char *new_option; + int changes; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) config_file; + + /* nothing to do if the config file is already up-to-date */ + if (version_read >= ALIAS_CONFIG_VERSION) + return NULL; + + changes = 0; + + if (version_read < 2) + { + /* + * changes in v2: + * - aliases are in lower case by default + * (default aliases and those created by users are automatically + * converted to lower case) + */ + ptr_section = weechat_hashtable_get (data_read, "section"); + ptr_option = weechat_hashtable_get (data_read, "option"); + if (ptr_section + && ptr_option + && ((strcmp (ptr_section, "cmd") == 0) + || (strcmp (ptr_section, "completion") == 0))) + { + /* convert alias name to lower case */ + new_option = weechat_string_tolower (ptr_option); + if (new_option) + { + if (strcmp (ptr_option, new_option) != 0) + { + if (strcmp (ptr_section, "cmd") == 0) + { + /* display message only for alias, not for completion */ + weechat_printf ( + NULL, + _("Alias converted to lower case: \"%s\" => \"%s\""), + ptr_option, new_option); + } + weechat_hashtable_set (data_read, "option", new_option); + changes++; + } + free (new_option); + } + } + } + + return (changes) ? data_read : NULL; +} + /* * Initializes alias configuration file. * @@ -374,6 +439,9 @@ alias_config_init () if (!alias_config_file) return 0; + weechat_config_set_version (alias_config_file, ALIAS_CONFIG_VERSION, + &alias_config_update_cb, NULL, NULL); + /* cmd */ ptr_section = weechat_config_new_section ( alias_config_file, "cmd", diff --git a/src/plugins/alias/alias-config.h b/src/plugins/alias/alias-config.h index 77cce9408..ccc61d381 100644 --- a/src/plugins/alias/alias-config.h +++ b/src/plugins/alias/alias-config.h @@ -23,6 +23,8 @@ #define ALIAS_CONFIG_NAME "alias" #define ALIAS_CONFIG_PRIO_NAME (TO_STR(ALIAS_PLUGIN_PRIORITY) "|" ALIAS_CONFIG_NAME) +#define ALIAS_CONFIG_VERSION 2 + extern struct t_config_file *alias_config_file; extern struct t_config_section *alias_config_section_cmd; extern struct t_config_section *alias_config_section_completion;