1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

alias: rename all aliases to lower case on upgrade (issue #1872)

This commit is contained in:
Sébastien Helleu
2023-04-01 16:47:23 +02:00
parent e23100c09b
commit 3e9524ee65
19 changed files with 147 additions and 53 deletions
+1 -1
View File
@@ -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)
+3 -36
View File
@@ -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]]
+5 -1
View File
@@ -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 <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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é)"
+6 -1
View File
@@ -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 <weechatter@arcor.de>\n"
"Language-Team: German - Germany <weechatter@arcor.de>\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)"
+5 -1
View File
@@ -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 <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+6 -2
View File
@@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+5 -1
View File
@@ -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 <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -6216,6 +6216,10 @@ msgstr "別名の値"
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 "別名のポインタ (任意)"
+5 -1
View File
@@ -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 <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\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)"
+5 -1
View File
@@ -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 <vascomalmeida@sapo.pt>\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)"
+5 -1
View File
@@ -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 <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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)"
+5 -1
View File
@@ -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 <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "настроить параметры конфигурации"
+5 -1
View File
@@ -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ć <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 "показивач на алијас (необавезно)"
+5 -1
View File
@@ -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 <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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ı)"
+5 -1
View File
@@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""
+1 -1
View File
@@ -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;
+68
View File
@@ -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",
+2
View File
@@ -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;