summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:36:06 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-05 20:47:20 +0200
commitb6a59be3172cb389e9170b1d60346fa7e8b5a534 (patch)
tree77015d1d00bb912cea6078737fadad429cb490df
parente75c61d7aa892a2daeea352e2011d65b219feb99 (diff)
downloadweechat-b6a59be3172cb389e9170b1d60346fa7e8b5a534.zip
irc: search options `irc.ctcp.*` with lower case ctcp string
-rw-r--r--doc/de/weechat_user.de.adoc5
-rw-r--r--doc/en/weechat_user.en.adoc4
-rw-r--r--doc/fr/weechat_user.fr.adoc4
-rw-r--r--doc/it/weechat_user.it.adoc5
-rw-r--r--doc/ja/weechat_user.ja.adoc5
-rw-r--r--doc/pl/weechat_user.pl.adoc5
-rw-r--r--doc/sr/weechat_user.sr.adoc5
-rw-r--r--src/plugins/irc/irc-ctcp.c19
8 files changed, 49 insertions, 3 deletions
diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc
index 09ce96b26..11a9bef2b 100644
--- a/doc/de/weechat_user.de.adoc
+++ b/doc/de/weechat_user.de.adoc
@@ -3994,6 +3994,11 @@ folgenden Befehl:
/set irc.ctcp.version "I'm running WeeChat $version, it rocks!"
----
+// TRANSLATION MISSING
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
Wenn Sie die Anfrage CTCP "VERSION" blockieren möchten (es wird nicht darauf
geantwortet) dann löschen Sie einfach den Rückgabe-String:
diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc
index 0008b0356..d04104f2b 100644
--- a/doc/en/weechat_user.en.adoc
+++ b/doc/en/weechat_user.en.adoc
@@ -3918,6 +3918,10 @@ For example, to customize reply to CTCP "VERSION", use following command:
/set irc.ctcp.version "I'm running WeeChat $version, it rocks!"
----
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
If you want to block CTCP "VERSION" (do not reply to a query), then set empty
string:
diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc
index a5341b306..c5f524a74 100644
--- a/doc/fr/weechat_user.fr.adoc
+++ b/doc/fr/weechat_user.fr.adoc
@@ -4036,6 +4036,10 @@ commande suivante :
/set irc.ctcp.version "Je suis sous WeeChat $version, ça déchire !"
----
+[NOTE]
+Le nom du CTCP doit être en minuscules. Cela signifie que l'option
+_irc.ctcp.VERSION_ ne fonctionnerait pas.
+
Si vous voulez bloquer le CTCP "VERSION" (ne pas répondre à une demande), alors
affectez une chaîne vide :
diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc
index c33f7d302..3cc12444b 100644
--- a/doc/it/weechat_user.it.adoc
+++ b/doc/it/weechat_user.it.adoc
@@ -4227,6 +4227,11 @@ seguente comando:
/set irc.ctcp.version "Uso WeeChat $version, fico!"
----
+// TRANSLATION MISSING
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
Se si desidera bloccare CTCP "VERSIONE" (non rispondere ad una query),
allora basta impostare una stringa vuota:
diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc
index 096f42ef4..7425da1d7 100644
--- a/doc/ja/weechat_user.ja.adoc
+++ b/doc/ja/weechat_user.ja.adoc
@@ -4081,6 +4081,11 @@ CTCP 応答をカスタマイズしたり、いくつかの CTCP
/set irc.ctcp.version "I'm running WeeChat $version, it rocks!"
----
+// TRANSLATION MISSING
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
CTCP "VERSION" 要求をブロックする (要求に対する応答を行わない)
には、空文字列を設定してください:
diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc
index b96a234f4..14c439b98 100644
--- a/doc/pl/weechat_user.pl.adoc
+++ b/doc/pl/weechat_user.pl.adoc
@@ -3967,6 +3967,11 @@ pomocą polecenia:
/set irc.ctcp.version "I'm running WeeChat $version, it rocks!"
----
+// TRANSLATION MISSING
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
Jeśli chcesz zablokować CTCP "VERSION" (nie odpowiadać na zapytanie), ustaw
pusty ciąg:
diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc
index 4c17663c0..86e50d75a 100644
--- a/doc/sr/weechat_user.sr.adoc
+++ b/doc/sr/weechat_user.sr.adoc
@@ -3706,6 +3706,11 @@ CTCP одговори могу да се прилагоде, или неки CTC
/set irc.ctcp.version "Користим WeeChat $version, одличан је!"
----
+// TRANSLATION MISSING
+[NOTE]
+The name of CTCP must be in lower case. That means option _irc.ctcp.VERSION_
+would not work.
+
Ако желите да блокирате CTCP „VERSION” (да се не пошаље одговор на овај упит), онда поставите празан стринг:
----
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index c37bc150c..2197867ce 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -79,23 +79,36 @@ const char *
irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
{
struct t_config_option *ptr_option;
- char option_name[512];
+ char option_name[512], *ctcp_lower;
- snprintf (option_name, sizeof (option_name), "%s.%s", server->name, ctcp);
+ ctcp_lower = weechat_string_tolower (ctcp);
+ if (!ctcp_lower)
+ return NULL;
+
+ snprintf (option_name, sizeof (option_name),
+ "%s.%s", server->name, ctcp_lower);
/* search for CTCP in configuration file, for server */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
option_name);
if (ptr_option)
+ {
+ free (ctcp_lower);
return weechat_config_string (ptr_option);
+ }
/* search for CTCP in configuration file */
ptr_option = weechat_config_search_option (irc_config_file,
irc_config_section_ctcp,
- ctcp);
+ ctcp_lower);
if (ptr_option)
+ {
+ free (ctcp_lower);
return weechat_config_string (ptr_option);
+ }
+
+ free (ctcp_lower);
/*
* no CTCP reply found in config, then return default reply, or NULL