summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-01-31 18:37:27 +0100
committerSébastien Helleu <flashcode@flashtux.org>2023-01-31 18:37:27 +0100
commit9f5ca3b1a9fbf891d7450d6191c6f16818ea9ebe (patch)
treec2475f87357351e1856ec78d8cd20a59cdbb11b4
parent4c0d2ab3b16c3ffa99b063671fa3fb0f4ef78d68 (diff)
downloadweechat-9f5ca3b1a9fbf891d7450d6191c6f16818ea9ebe.zip
irc: add command `/knock` (closes #7)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/de/includes/autogen_user_commands.de.adoc10
-rw-r--r--doc/en/includes/autogen_user_commands.en.adoc10
-rw-r--r--doc/fr/includes/autogen_user_commands.fr.adoc10
-rw-r--r--doc/it/includes/autogen_user_commands.it.adoc10
-rw-r--r--doc/ja/includes/autogen_user_commands.ja.adoc10
-rw-r--r--doc/pl/includes/autogen_user_commands.pl.adoc10
-rw-r--r--doc/sr/includes/autogen_user_commands.sr.adoc10
-rw-r--r--po/cs.po24
-rw-r--r--po/de.po24
-rw-r--r--po/es.po24
-rw-r--r--po/fr.po33
-rw-r--r--po/hu.po20
-rw-r--r--po/it.po24
-rw-r--r--po/ja.po24
-rw-r--r--po/pl.po24
-rw-r--r--po/pt.po24
-rw-r--r--po/pt_BR.po24
-rw-r--r--po/ru.po20
-rw-r--r--po/sr.po24
-rw-r--r--po/tr.po24
-rw-r--r--po/weechat.pot16
-rw-r--r--src/plugins/irc/irc-command.c38
-rw-r--r--src/plugins/irc/irc-protocol.c87
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp113
25 files changed, 622 insertions, 16 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 542b77543..13d5b743e 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -24,6 +24,7 @@ New features::
* core: force ctrl keys to lower case when they are added (issue #1875)
* core, plugins: make many identifiers case sensitive (issue #1872, issue #398, bug #32213)
* alias: use lower case for default aliases (issue #1872)
+ * irc: add command `/knock` (issue #7)
* irc: add server option "registered_mode", add fields "authentication_method" and "sasl_mechanism_used" in server (issue #1625)
* irc: add option `join` in command `/autojoin`
diff --git a/doc/de/includes/autogen_user_commands.de.adoc b/doc/de/includes/autogen_user_commands.de.adoc
index 5b691e7a1..f51b5c381 100644
--- a/doc/de/includes/autogen_user_commands.de.adoc
+++ b/doc/de/includes/autogen_user_commands.de.adoc
@@ -453,6 +453,16 @@ Beispiel:
reason: Grund der Abmeldung
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: alle Servernamen auflisten, die dem antwortenden Server bekannt sind
diff --git a/doc/en/includes/autogen_user_commands.en.adoc b/doc/en/includes/autogen_user_commands.en.adoc
index 7f36ba357..e9e2f9395 100644
--- a/doc/en/includes/autogen_user_commands.en.adoc
+++ b/doc/en/includes/autogen_user_commands.en.adoc
@@ -453,6 +453,16 @@ Example:
reason: reason
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: list all server names which are known by the server answering the query
diff --git a/doc/fr/includes/autogen_user_commands.fr.adoc b/doc/fr/includes/autogen_user_commands.fr.adoc
index ce5ed6ca8..18d56c50e 100644
--- a/doc/fr/includes/autogen_user_commands.fr.adoc
+++ b/doc/fr/includes/autogen_user_commands.fr.adoc
@@ -453,6 +453,16 @@ pseudo : pseudo
raison : raison
----
+[[command_irc_knock]]
+* `+knock+`: envoyer une notice à un canal en invitation seulement, en demandant une invitation
+
+----
+/knock <canal> [<message>]
+
+ canal : nom du canal
+message : message à envoyer
+----
+
[[command_irc_links]]
* `+links+`: lister tous les noms de serveurs connus du serveur qui répondent à la requête
diff --git a/doc/it/includes/autogen_user_commands.it.adoc b/doc/it/includes/autogen_user_commands.it.adoc
index 89c7e4dc1..1656c4b99 100644
--- a/doc/it/includes/autogen_user_commands.it.adoc
+++ b/doc/it/includes/autogen_user_commands.it.adoc
@@ -453,6 +453,16 @@ Example:
motivo: motivo
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: list all server names which are known by the server answering the query
diff --git a/doc/ja/includes/autogen_user_commands.ja.adoc b/doc/ja/includes/autogen_user_commands.ja.adoc
index 69f0fb5c0..46650bdac 100644
--- a/doc/ja/includes/autogen_user_commands.ja.adoc
+++ b/doc/ja/includes/autogen_user_commands.ja.adoc
@@ -453,6 +453,16 @@ Example:
reason: 理由
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: list all server names which are known by the server answering the query
diff --git a/doc/pl/includes/autogen_user_commands.pl.adoc b/doc/pl/includes/autogen_user_commands.pl.adoc
index eda4ed615..4ef65e838 100644
--- a/doc/pl/includes/autogen_user_commands.pl.adoc
+++ b/doc/pl/includes/autogen_user_commands.pl.adoc
@@ -453,6 +453,16 @@ Przykład:
powód: powód
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: wyświetla wszystkie nazwy serwerów, które są znane serwerowi odpowiadającemu na zapytanie
diff --git a/doc/sr/includes/autogen_user_commands.sr.adoc b/doc/sr/includes/autogen_user_commands.sr.adoc
index 42cfed99d..38f5170ce 100644
--- a/doc/sr/includes/autogen_user_commands.sr.adoc
+++ b/doc/sr/includes/autogen_user_commands.sr.adoc
@@ -453,6 +453,16 @@ Examples:
разлог: разлог
----
+[[command_irc_knock]]
+* `+knock+`: send a notice to an invitation-only channel, requesting an invite
+
+----
+/knock <channel> [<message>]
+
+channel: channel name
+message: message to send
+----
+
[[command_irc_links]]
* `+links+`: листа свих имена сервера који су познати серверу одговарајући на упит
diff --git a/po/cs.po b/po/cs.po
index b992b44f4..bd0df942e 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7460,6 +7460,25 @@ msgstr ""
"přezdívka: přezdívka\n"
" důvod: důvod"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<zpráva>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"kanál: jméno kanálu\n"
+" text: text pro poslání"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -9938,6 +9957,9 @@ msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s: přezdívka \"%s\" je nedostupná, zkouším přezdívku číslo %d (\"%s\")"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/de.po b/po/de.po
index d0ebd6452..b6290eb46 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2023-01-31 07:52+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German - Germany <weechatter@arcor.de>\n"
@@ -9413,6 +9413,25 @@ msgstr ""
" nick: Nickname\n"
"reason: Grund der Abmeldung"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<message>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"channel: Name des Kanals\n"
+" text: Text der versendet werden soll"
+
msgid "list all server names which are known by the server answering the query"
msgstr "alle Servernamen auflisten, die dem antwortenden Server bekannt sind"
@@ -12221,6 +12240,9 @@ msgstr ""
"%s%s: Der Nickname \"%s\" ist nicht verfügbar. Es wird nun versucht den "
"Nicknamen \"%s\" zu nutzen"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/es.po b/po/es.po
index a16c23354..300508e24 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8040,6 +8040,25 @@ msgstr ""
"apodo: apodo\n"
"razón: razón de la salida"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<mensaje>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"canal: nombre del canal\n"
+" texto: texto a enviar"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -10593,6 +10612,9 @@ msgstr "%s%s: el apodo \"%s\" ya está en uso, probando con el apodo \"%s\""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: el apodo \"%s\" no está disponible, probando con el apodo \"%s\""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/fr.po b/po/fr.po
index e684acbb0..11c0a1fa1 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-01-30 22:06+0100\n"
-"PO-Revision-Date: 2023-01-30 22:07+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
+"PO-Revision-Date: 2023-01-31 18:35+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -9233,6 +9233,21 @@ msgstr ""
"pseudo : pseudo\n"
"raison : raison"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+"envoyer une notice à un canal en invitation seulement, en demandant une "
+"invitation"
+
+msgid "<channel> [<message>]"
+msgstr "<canal> [<message>]"
+
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+" canal : nom du canal\n"
+"message : message à envoyer"
+
msgid "list all server names which are known by the server answering the query"
msgstr ""
"lister tous les noms de serveurs connus du serveur qui répondent à la requête"
@@ -11966,6 +11981,9 @@ msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
"%s%s : le pseudo \"%s\" n'est pas disponible, essai avec le pseudo \"%s\""
+msgid "has asked for an invite"
+msgstr "a demandé une invitation"
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
@@ -16238,6 +16256,17 @@ msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s : impossible de se connecter : erreur inattendue (%d)"
#~ msgid ""
+#~ "channel: channel name\n"
+#~ "message: message to send\n"
+#~ "\n"
+#~ "Examples:\n"
+#~ " /knock #channel\n"
+#~ " /knock #channel please let me in"
+#~ msgstr ""
+#~ "canal : nom du canal\n"
+#~ "message : message à envoyer"
+
+#~ msgid ""
#~ "a WeeChat color name (default, black, (dark)gray, white, (light)red, "
#~ "(light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a "
#~ "terminal color number or an alias; attributes are allowed before color "
diff --git a/po/hu.po b/po/hu.po
index 27f96c3b3..0a133ec32 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\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"
@@ -6956,6 +6956,21 @@ msgstr ""
" név: meghívandó név\n"
"szoba: meghívandó szoba"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+msgid "<channel> [<message>]"
+msgstr "[-all] [üzenet]"
+
+#, fuzzy
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"szoba: a szoba neve, ahová csatlakozni szeretnénk\n"
+"kulcs: a csatlakozáshoz szükséges kulcs"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -9423,6 +9438,9 @@ msgstr "%s: a(z) \"%s\" név már foglalt, próbálom a második nevet: \"%s\"\n
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s: a(z) \"%s\" név már foglalt, próbálom a második nevet: \"%s\"\n"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/it.po b/po/it.po
index d88a7e262..c6273ed23 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7802,6 +7802,25 @@ msgstr ""
" nick: nick\n"
"motivo: motivo"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<messaggio>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"canale: nome del canale\n"
+" testo: testo da inviare"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -10380,6 +10399,9 @@ msgstr "%s%s: il nick \"%s\" è già in uso, tentativo con il nick \"%s\""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: il nick \"%s\" non è disponibile, tentativo con il nick \"%s\""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/ja.po b/po/ja.po
index 6bf471ff2..0ecd53b6a 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -8814,6 +8814,25 @@ msgstr ""
" nick: ニックネーム\n"
"reason: 理由"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<message>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"channel: チャンネル名\n"
+" text: 送信テキスト"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr "このクエリに応答するサーバが知っている全てのサーバ名をリストアップ"
@@ -11463,6 +11482,9 @@ msgstr ""
"%s%s: ニックネーム \"%s\" は利用できません、ニックネーム \"%s\" を試行してい"
"ます"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/pl.po b/po/pl.po
index c0f6ca63d..90f3dd87c 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-12-30 14:10+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -9342,6 +9342,25 @@ msgstr ""
" nick: nick\n"
"powód: powód"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<wiadomość>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"kanał: nazwa kanału\n"
+" tekst:tekst do wysłania"
+
msgid "list all server names which are known by the server answering the query"
msgstr ""
"wyświetla wszystkie nazwy serwerów, które są znane serwerowi odpowiadającemu "
@@ -12033,6 +12052,9 @@ msgstr "%s%s: nick \"%s\" jest już używany, próbuje nick \"%s\""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: nick \"%s\" jest niedostępny, próbuje nicku \"%s\""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/pt.po b/po/pt.po
index f5576b79d..9b947fcb7 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -8565,6 +8565,25 @@ msgstr ""
" nick: nick\n"
"razão: razão"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<mensagem>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"canal: nome do canal\n"
+"texto: texto a enviar"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr "listar todos os servidores conhecidos pelo servidor consultado"
@@ -11256,6 +11275,9 @@ msgstr "%s%s: o nick \"%s\" já está a ser usado, a tentar com o nick \"%s\""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: o nick \"%s\" não está disponível, a tentar com o nick \"%s\""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 74b778984..2e4316539 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7595,6 +7595,25 @@ msgid ""
"reason: reason"
msgstr ""
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<mensagem>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name to leave\n"
+#| "message: part message (displayed to other users)"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"channel: nome do cair que quer sair\n"
+"message: mensagem de saida (mostrado para os outros usuários)"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -9897,6 +9916,9 @@ msgstr "%s%s: apelido \"%s\" já está em uso, tentando apelido \"%s\""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: apelido \"%s\" está indisponível, tentando apelido \"%s\""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/ru.po b/po/ru.po
index c32738542..cbb99a113 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6996,6 +6996,21 @@ msgstr ""
" ник: приглашаемый ник\n"
"канал: целевой канал"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+msgid "<channel> [<message>]"
+msgstr "[-all] [сообщение]"
+
+#, fuzzy
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"канал: название канала\n"
+" ключ: ключ для входа на канал"
+
#, fuzzy
msgid "list all server names which are known by the server answering the query"
msgstr "перечислить все серверы известные серверу, отвечающему на запрос"
@@ -9465,6 +9480,9 @@ msgstr "%s: ник \"%s\" уже используется, пробую втор
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s: ник \"%s\" уже используется, пробую второй ник \"%s\"\n"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, fuzzy, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/sr.po b/po/sr.po
index 3fab1c192..22f464fe6 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-12-05 09:44+0400\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9522,6 +9522,25 @@ msgstr ""
"надимак: надимак\n"
" разлог: разлог"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<порука>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"канал: име канала\n"
+"текст: текст који се шаље"
+
msgid "list all server names which are known by the server answering the query"
msgstr "листа свих имена сервера који су познати серверу одговарајући на упит"
@@ -12198,6 +12217,9 @@ msgstr "%s%s: надимак „%s” се већ користи, покушав
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: надимак „%s” није доступан, покушава се са надимком „%s”"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/tr.po b/po/tr.po
index 525da5c89..edc1a6b7d 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9561,6 +9561,25 @@ msgstr ""
"takmaad: Takma ad\n"
" neden: Neden"
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+#, fuzzy
+#| msgid "[-all] [<message>]"
+msgid "<channel> [<message>]"
+msgstr "[-all] [<ileti>]"
+
+#, fuzzy
+#| msgid ""
+#| "channel: channel name\n"
+#| " text: text to send"
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+"kanal: Kanal adı\n"
+"metin: Gönderilecek metin"
+
msgid "list all server names which are known by the server answering the query"
msgstr "sorguya yanıt veren tüm sunucu adlarını listele"
@@ -12230,6 +12249,9 @@ msgstr "%s%s: \"%s\" takma adı zaten kullanılıyor, \"%s\" takma adı deneniyo
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr "%s%s: \"%s\" takma adı kullanılamıyor, \"%s\" takma adı deneniyor"
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/po/weechat.pot b/po/weechat.pot
index 8e16f6458..3f751480e 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-01-30 22:06+0100\n"
+"POT-Creation-Date: 2023-01-31 18:33+0100\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"
@@ -6376,6 +6376,17 @@ msgid ""
"reason: reason"
msgstr ""
+msgid "send a notice to an invitation-only channel, requesting an invite"
+msgstr ""
+
+msgid "<channel> [<message>]"
+msgstr ""
+
+msgid ""
+"channel: channel name\n"
+"message: message to send"
+msgstr ""
+
msgid "list all server names which are known by the server answering the query"
msgstr ""
@@ -8475,6 +8486,9 @@ msgstr ""
msgid "%s%s: nickname \"%s\" is unavailable, trying nickname \"%s\""
msgstr ""
+msgid "has asked for an invite"
+msgstr ""
+
#. TRANSLATORS: "%s" after "on" is a date
#, c-format
msgid "%s%s[%s%s%s] %s%s%s%s quieted by %s on %s"
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 1620953ac..c48a2fbc5 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -3258,6 +3258,36 @@ IRC_COMMAND_CALLBACK(kill)
}
/*
+ * Callback for command "/knock": sends a notice to an invitation-only channel,
+ * requesting an invite.
+ */
+
+IRC_COMMAND_CALLBACK(knock)
+{
+ IRC_BUFFER_GET_SERVER(buffer);
+ IRC_COMMAND_CHECK_SERVER("knock", 1, 1);
+
+ /* make C compiler happy */
+ (void) pointer;
+ (void) data;
+
+ WEECHAT_COMMAND_MIN_ARGS(2, "");
+
+ if (argc < 3)
+ {
+ irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
+ "KNOCK %s", argv[1]);
+ }
+ else
+ {
+ irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
+ "KNOCK %s :%s", argv[1], argv_eol[2]);
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Callback for command "/links": lists all server names which are known by the
* server answering the query.
*/
@@ -7148,6 +7178,14 @@ irc_command_init ()
"reason: reason"),
"%(nicks) %-", &irc_command_kill, NULL, NULL);
weechat_hook_command (
+ "knock",
+ N_("send a notice to an invitation-only channel, requesting an invite"),
+ N_("<channel> [<message>]"),
+ N_("channel: channel name\n"
+ "message: message to send"),
+ "%(irc_channels)",
+ &irc_command_knock, NULL, NULL);
+ weechat_hook_command (
"links",
N_("list all server names which are known by the server answering the "
"query"),
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index a4eba464d..e9e430cf4 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -348,7 +348,7 @@ irc_protocol_string_params (const char **params, int arg_start, int arg_end)
*
* Called by callbacks for commands: FAIL, WARN, NOTE.
*
- * Commands looks like:
+ * Commands look like:
* FAIL * NEED_REGISTRATION :You need to be registered to continue
* FAIL ACC REG_INVALID_CALLBACK REGISTER :Email address is not valid
* FAIL BOX BOXES_INVALID STACK CLOCKWISE :Given boxes are not supported
@@ -1921,6 +1921,41 @@ IRC_PROTOCOL_CALLBACK(kill)
}
/*
+ * Callback for an IRC KNOCK reply.
+ *
+ * Commands look like:
+ * 711 nick #channel :Your KNOCK has been delivered.
+ * 712 nick #channel :Too many KNOCKs (channel).
+ * 713 nick #channel :Channel is open.
+ * 714 nick #channel :You are already on that channel.
+ */
+
+IRC_PROTOCOL_CALLBACK(knock_reply)
+{
+ char *str_message;
+
+ IRC_PROTOCOL_MIN_PARAMS(3);
+
+ str_message = irc_protocol_string_params (params, 2, num_params - 1);
+
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (server, params[0], command, NULL, NULL),
+ date,
+ irc_protocol_tags (command, tags, NULL, NULL, NULL),
+ "%s%s%s%s: %s",
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ params[1],
+ IRC_COLOR_RESET,
+ str_message);
+
+ if (str_message)
+ free (str_message);
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Callback for the IRC command "MODE".
*
* Command looks like:
@@ -6825,6 +6860,51 @@ IRC_PROTOCOL_CALLBACK(help)
}
/*
+ * Callback for the IRC command "710": has asked for an invite (knock).
+ *
+ * Command looks like:
+ * 710 #channel #channel nick!user@host :has asked for an invite.
+ */
+
+IRC_PROTOCOL_CALLBACK(710)
+{
+ struct t_irc_channel *ptr_channel;
+ const char *nick_address;
+ char *str_message;
+
+ IRC_PROTOCOL_MIN_PARAMS(3);
+
+ if (ignored)
+ return WEECHAT_RC_OK;
+
+ ptr_channel = irc_channel_search (server, params[1]);
+ if (!ptr_channel)
+ return WEECHAT_RC_ERROR;
+
+ nick_address = irc_protocol_nick_address (
+ server, 1, NULL, irc_message_get_nick_from_host (params[2]),
+ irc_message_get_address_from_host (params[2]));
+
+ str_message = irc_protocol_string_params (params, 3, num_params - 1);
+
+ weechat_printf_date_tags (
+ irc_msgbuffer_get_target_buffer (
+ server, NULL, command, NULL, ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, tags, "notify_message", NULL, NULL),
+ "%s%s %s",
+ weechat_prefix ("network"),
+ (nick_address[0]) ? nick_address : "?",
+ (str_message && str_message[0]) ?
+ str_message : _("has asked for an invite"));
+
+ if (str_message)
+ free (str_message);
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Callback for the IRC command "728": quietlist.
*
* Command looks like:
@@ -7500,6 +7580,11 @@ irc_protocol_recv_command (struct t_irc_server *server,
IRCB(704, 1, 0, help), /* start of HELP/HELPOP */
IRCB(705, 1, 0, help), /* body of HELP/HELPOP */
IRCB(706, 1, 0, help), /* end of HELP/HELPOP */
+ IRCB(710, 1, 0, 710), /* knock: has asked for an invite */
+ IRCB(711, 1, 0, knock_reply), /* knock: has been delivered */
+ IRCB(712, 1, 0, knock_reply), /* knock: too many knocks */
+ IRCB(713, 1, 0, knock_reply), /* knock: channel is open */
+ IRCB(714, 1, 0, knock_reply), /* knock: already on that channel */
IRCB(728, 1, 0, 728), /* quietlist */
IRCB(729, 1, 0, 729), /* end of quietlist */
IRCB(730, 1, 0, 730), /* monitored nicks online */
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index fa5d4158a..d3c3efe6e 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -4099,6 +4099,119 @@ TEST(IrcProtocolWithServer, 706)
/*
* Tests functions:
+ * irc_protocol_cb_710 (knock: has asked for an invite)
+ */
+
+TEST(IrcProtocolWithServer, 710)
+{
+ SRV_INIT_JOIN;
+
+ /* not enough parameters */
+ RECV(":server 710");
+ CHECK_ERROR_PARAMS("710", 0, 3);
+ RECV(":server 710 #test");
+ CHECK_ERROR_PARAMS("710", 1, 3);
+ RECV(":server 710 #test #test");
+ CHECK_ERROR_PARAMS("710", 2, 3);
+
+ RECV(":server 710 #test #test nick1!user1@host1");
+ CHECK_CHAN("-- nick1 (user1@host1) has asked for an invite");
+ RECV(":server 710 #test #test nick1!user1@host1 :has asked for an invite.");
+ CHECK_CHAN("-- nick1 (user1@host1) has asked for an invite.");
+
+ /* channel not found */
+ RECV(":server 710 #xyz #xyz nick1!user1@host1");
+ CHECK_ERROR_PARSE("710", ":server 710 #xyz #xyz nick1!user1@host1");
+ RECV(":server 710 #xyz #xyz nick1!user1@host1 :has asked for an invite.");
+ CHECK_ERROR_PARSE("710", ":server 710 #xyz #xyz nick1!user1@host1 :has asked for an invite.");
+}
+
+/*
+ * Tests functions:
+ * irc_protocol_cb_711 (knock: has been delivered)
+ */
+
+TEST(IrcProtocolWithServer, 711)
+{
+ SRV_INIT;
+
+ /* not enough parameters */
+ RECV(":server 711");
+ CHECK_ERROR_PARAMS("711", 0, 3);
+ RECV(":server 711 alice");
+ CHECK_ERROR_PARAMS("711", 1, 3);
+ RECV(":server 711 alice #test");
+ CHECK_ERROR_PARAMS("711", 2, 3);
+
+ RECV(":server 711 alice #test :Your KNOCK has been delivered.");
+ CHECK_SRV("-- #test: Your KNOCK has been delivered.");
+}
+
+/*
+ * Tests functions:
+ * irc_protocol_cb_712 (knock: too many knocks)
+ */
+
+TEST(IrcProtocolWithServer, 712)
+{
+ SRV_INIT;
+
+ /* not enough parameters */
+ RECV(":server 712");
+ CHECK_ERROR_PARAMS("712", 0, 3);
+ RECV(":server 712 alice");
+ CHECK_ERROR_PARAMS("712", 1, 3);
+ RECV(":server 712 alice #test");
+ CHECK_ERROR_PARAMS("712", 2, 3);
+
+ RECV(":server 712 alice #test :Too many KNOCKs (channel).");
+ CHECK_SRV("-- #test: Too many KNOCKs (channel).");
+}
+
+/*
+ * Tests functions:
+ * irc_protocol_cb_713 (knock: channel is open)
+ */
+
+TEST(IrcProtocolWithServer, 713)
+{
+ SRV_INIT;
+
+ /* not enough parameters */
+ RECV(":server 713");
+ CHECK_ERROR_PARAMS("713", 0, 3);
+ RECV(":server 713 alice");
+ CHECK_ERROR_PARAMS("713", 1, 3);
+ RECV(":server 713 alice #test");
+ CHECK_ERROR_PARAMS("713", 2, 3);
+
+ RECV(":server 713 alice #test :Channel is open.");
+ CHECK_SRV("-- #test: Channel is open.");
+}
+
+/*
+ * Tests functions:
+ * irc_protocol_cb_714 (knock: already on that channel)
+ */
+
+TEST(IrcProtocolWithServer, 714)
+{
+ SRV_INIT_JOIN;
+
+ /* not enough parameters */
+ RECV(":server 714");
+ CHECK_ERROR_PARAMS("714", 0, 3);
+ RECV(":server 714 alice");
+ CHECK_ERROR_PARAMS("714", 1, 3);
+ RECV(":server 714 alice #test");
+ CHECK_ERROR_PARAMS("714", 2, 3);
+
+ RECV(":server 714 alice #test :You are already on that channel.");
+ CHECK_SRV("-- #test: You are already on that channel.");
+}
+
+/*
+ * Tests functions:
* irc_protocol_cb_728 (quietlist)
*/