summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-02-11 09:12:57 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-02-11 09:12:57 +0100
commit0cfc61a17e68c9c565afc6dca10bb54b5bb9810d (patch)
tree93e67e557150b2c5ea7ec08d5f74dc9e727742fb
parentf153b6e6c3bc2c81b0f784ce7eabe50799b879c4 (diff)
downloadweechat-0cfc61a17e68c9c565afc6dca10bb54b5bb9810d.zip
irc: add server option "autojoin_delay" (closes #862)
The server option "autojoin_delay" adds a delay before autojoin. The server option "command_delay" is now used to add a delay before the execution of the command. On upgrade from an old version, the option "command_delay" is copied to "autojoin_delay" (in old versions, "command_delay" was applied after the execution of command and before the autojoin).
-rw-r--r--ChangeLog.adoc1
-rw-r--r--po/cs.po19
-rw-r--r--po/de.po26
-rw-r--r--po/es.po21
-rw-r--r--po/fr.po24
-rw-r--r--po/hu.po18
-rw-r--r--po/it.po19
-rw-r--r--po/ja.po24
-rw-r--r--po/pl.po24
-rw-r--r--po/pt.po26
-rw-r--r--po/pt_BR.po20
-rw-r--r--po/ru.po18
-rw-r--r--po/sr.po26
-rw-r--r--po/tr.po25
-rw-r--r--po/weechat.pot13
-rw-r--r--src/plugins/irc/irc-command.c26
-rw-r--r--src/plugins/irc/irc-config.c78
-rw-r--r--src/plugins/irc/irc-config.h2
-rw-r--r--src/plugins/irc/irc-protocol.c58
-rw-r--r--src/plugins/irc/irc-server.c97
-rw-r--r--src/plugins/irc/irc-server.h10
-rw-r--r--src/plugins/irc/irc-upgrade.c1
-rw-r--r--tests/unit/plugins/irc/test-irc-server.cpp10
23 files changed, 408 insertions, 178 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 4708cecd6..852c0abc9 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -19,6 +19,7 @@ New features::
* core: use function util_strftimeval in evaluation of expression `date:xxx`
* api: add support of specifier `%!` for timestamp in function util_strftimeval
* api: add support of base64url in encode/decode functions
+ * irc: add server option "autojoin_delay" (delay before autojoin), use option "command_delay" before execution of the command (issue #862)
* relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands, add option relay.network.time_window (issue #2066)
* relay: add support of websocket extension "permessage-deflate" (issue #1549)
diff --git a/po/cs.po b/po/cs.po
index 9457b0ef1..69d5a9870 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10139,6 +10139,11 @@ msgstr ""
"$channel a $server jsou přepsány svou hodnotou)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr "doba (v sekundách) před novým znovupřipojením (po vykopnutí)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10153,8 +10158,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"počkání (v sekundách) po spuštění příkazu (například: dád nějaký čas pro "
"autorizaci)"
@@ -14959,14 +14964,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%sChyba: selhalo vytvoření pole \"%s\""
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "Pole \"%s\" vytvořeno"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%sChyba: selhalo vytvoření pole \"%s\""
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: server \"%s\" nenalezen"
diff --git a/po/de.po b/po/de.po
index d17c84838..13fc76d9e 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2024-01-27 14:34+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -11201,6 +11201,13 @@ msgstr ""
"wird evaluiert, siehe /help eval; Serveroptionen sind mittels ${irc_server."
"xxx} evaluiert und ${server} wird durch den eigentlichen Servernamen ersetzt)"
+#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"Wartezeit, in Sekunden, die verstreichen soll bevor man den Kanal "
+"automatisch erneut betritt (nachdem man rausgeworfen wurde)"
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -11217,9 +11224,14 @@ msgstr ""
"eval; Serveroptionen sind mittels ${irc_server.xxx} evaluiert und ${server} "
"wird durch den eigentlichen Servernamen ersetzt)"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"Wartezeit (in Sekunden) nach Ausführung des Befehls und bevor Kanäle "
"automatisch betreten werden (Beispiel: es wird eine gewisse Zeit gewartet, "
@@ -16470,14 +16482,14 @@ msgstr ""
"die Option \"addreplace\" um vorhandenen Trigger zu überschreiben)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: Trigger \"%s\" konnte nicht erstellt werden"
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "Trigger \"%s\" erstellt"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: Trigger \"%s\" konnte nicht erstellt werden"
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: Trigger, \"%s\", nicht gefunden"
diff --git a/po/es.po b/po/es.po
index fc63be2ca..7dfcfb3cc 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10362,6 +10362,13 @@ msgstr ""
"valores)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"espera (en segundos) antes de unirse automáticamente (después de ser "
+"expulsado)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10377,8 +10384,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"espera (en segundos) después de que el comando sea ejecutado (ejemplo: dar "
"algo de tiempo para la autenticación)"
@@ -15251,14 +15258,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%sError: no se pudo crear la barra \"%s\""
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "Barra \"%s\" creada"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%sError: no se pudo crear la barra \"%s\""
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%sTecla \"%s\" no encontrada"
diff --git a/po/fr.po b/po/fr.po
index 6b550bf37..c11773c5a 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: 2024-02-01 21:36+0100\n"
-"PO-Revision-Date: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
+"PO-Revision-Date: 2024-02-11 08:55+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -10997,6 +10997,9 @@ msgstr ""
"sont évaluées avec ${irc_server.xxx} et ${server} est remplacé par le nom du "
"serveur)"
+msgid "delay (in seconds) before execution of command"
+msgstr "délai (en secondes) avant l'exécution de la commande"
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -11013,12 +11016,11 @@ msgstr ""
"${irc_server.xxx} et ${server} est remplacé par le nom du serveur)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
-"délai (en secondes) après exécution de la commande et avant le \"join\" "
-"automatique des canaux (exemple : donner du temps pour l'authentification "
-"avant de rejoindre les canaux)"
+"délai (en secondes) avant le \"join\" automatique des canaux (exemple : "
+"donner du temps pour l'authentification avant de rejoindre les canaux)"
msgid ""
"comma separated list of channels to join after connection to server (and "
@@ -16116,14 +16118,14 @@ msgstr ""
"l'option \"addreplace\" pour l'écraser)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s : impossible de créer le trigger \"%s\""
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "Trigger \"%s\" créé"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s : impossible de créer le trigger \"%s\""
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s : trigger \"%s\" non trouvé"
diff --git a/po/hu.po b/po/hu.po
index 41c19d1fb..e87b600d9 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9751,6 +9751,10 @@ msgstr ""
"értéke kerül)"
#, fuzzy
+msgid "delay (in seconds) before execution of command"
+msgstr "két újracsatlakozási próba közti szünet (másodpercben)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -9766,8 +9770,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"szünet (másodpercben) a parancs futtatása után (például: hagyni némi időt az "
"azonosításra)"
@@ -14362,14 +14366,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s nem sikerült a modul opciókat elmenteni\n"
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "A \"%s\" => \"%s\" aliasz elkészült\n"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s nem sikerült a modul opciókat elmenteni\n"
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s a \"%s\" szerver nem található\n"
diff --git a/po/it.po b/po/it.po
index 86596e5df..e9b584516 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10361,6 +10361,11 @@ msgstr ""
"il contenuto viene valutato, consultare /help eval)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr "ritardo (in secondi) prima di rientrare automaticamente (dopo il kick)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10376,8 +10381,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"ritardo (in secondi) dopo l'esecuzione del comando (esempio: fornire il "
"tempo per l'autenticazione)"
@@ -15310,14 +15315,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%sErrore: creazione della barra \"%s\" fallita"
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "Barra \"%s\" creata"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%sErrore: creazione della barra \"%s\" fallita"
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%sTasto \"%s\" non trovato"
diff --git a/po/ja.po b/po/ja.po
index 9173ff626..7a0a608c3 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -10692,6 +10692,11 @@ msgstr ""
"xxx} はサーバオプション、${server} はサーバ名を意味します)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr "自動再参加前の遅延時間 (秒単位) (キック後)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10706,9 +10711,14 @@ msgstr ""
"は評価されます、/help eval を参照してください; ここで ${irc_server.xxx} は"
"サーバオプション、${server} はサーバ名を意味します)"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"コマンドを実行して、チャンネルに自動参加するまでの遅延時間 (秒単位) (例: 認証"
"に時間がかかる場合にチャンネル参加前に少し時間を空ける)"
@@ -15745,14 +15755,14 @@ msgstr ""
"プションで上書きを有効化してください)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: トリガ \"%s\" の作成に失敗しました"
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "トリガ \"%s\" が作成されました"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: トリガ \"%s\" の作成に失敗しました"
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: トリガ \"%s\" が見つかりません"
diff --git a/po/pl.po b/po/pl.po
index 26a4ac2a2..92b1a8fd9 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2024-01-31 21:16+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10671,6 +10671,11 @@ msgstr ""
"jest przetwarzana, zobacz /help eval; opcje serwera mogą zostać użytego w "
"postaci ${irc_server.xxx} oraz ${server} jest zastępowany nazwą serwera)"
+#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr "opóźnienie (w sekundach) przed wejściem na kanał (po wykopaniu)"
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10686,9 +10691,14 @@ msgstr ""
"help eval; opcje serwera mogą zostać użytego w postaci ${irc_server.xxx} "
"oraz ${server} jest zastępowany nazwą serwera)"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"odstęp (w sekundach) po wykonaniu komendy i przed automatycznym wejściem na "
"kanały (na przykład: daj trochę czasu na uwierzytelnienie przed wejściem na "
@@ -15699,14 +15709,14 @@ msgstr ""
"\"addreplace\" żeby nadpisać istniejący)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: nie udało się utworzyć triggera \"%s\""
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "Utworzono trigger \"%s\""
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: nie udało się utworzyć triggera \"%s\""
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: trigger \"%s\" nie został znaleziony"
diff --git a/po/pt.po b/po/pt.po
index 63a4f0e54..512c6672f 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -10661,6 +10661,13 @@ msgstr ""
"conteúdo é avaliado, ver /help eval)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"atraso (em segundos) antes de se voltar a juntar (depois de ser expulso "
+"(kick))"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10675,9 +10682,14 @@ msgstr ""
"$server são substituídas pelos respetivos valores) (nota: o conteúdo é "
"avaliado, ver /help eval)"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"atraso (em segundos) depois de executar os comandos e antes de se juntar "
"automaticamente aos canais (exemplo: dar algum tempo à autenticação antes de "
@@ -15683,14 +15695,14 @@ msgstr ""
"\"addreplace\" para o substituir)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: falha ao criar o acionador \"%s\""
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "Acionador \"%s\" criado"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: falha ao criar o acionador \"%s\""
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: acionador \"%s\" não encontrado"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index a913da41a..3c83ec2e4 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-10-20 13:11+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10049,6 +10049,12 @@ msgstr ""
"são substituídas por seus valores)"
#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"tempo de espera (em segundos) antes de auto-re-entrar (depois de ser chutado)"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10064,8 +10070,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"tempo de espera (em segundos) depois que um comando for executado (exemplo: "
"espere algum tempo para a autenticação)"
@@ -14790,14 +14796,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%sErro: falha ao criar a barra \"%s\""
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "Barra \"%s\" criada"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%sErro: falha ao criar a barra \"%s\""
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%sTecla \"%s\" não encontrada"
diff --git a/po/ru.po b/po/ru.po
index 1ee9966b5..8b2fb87d3 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9789,6 +9789,10 @@ msgstr ""
"соответствующие значения)"
#, fuzzy
+msgid "delay (in seconds) before execution of command"
+msgstr "задержка (в секундах) перед повторным соединением с сервером"
+
+#, fuzzy
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -9804,8 +9808,8 @@ msgstr ""
#, fuzzy
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"задержка (в секундах) перед выполнением команды (например, нужно время для "
"аутентификации)"
@@ -14412,14 +14416,14 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s не могу сохранить конфигурационный файл pluginов\n"
-
-#, fuzzy, c-format
msgid "Trigger \"%s\" created"
msgstr "Сокращение \"%s\" => \"%s\" создано\n"
#, fuzzy, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s не могу сохранить конфигурационный файл pluginов\n"
+
+#, fuzzy, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s сервер \"%s\" не найден\n"
diff --git a/po/sr.po b/po/sr.po
index 2a98002b5..813bdc350 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2024-01-15 10:23+0400\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10647,6 +10647,13 @@ msgstr ""
"израчунава, погледајте /help eval; опције сервера се израчунавају са "
"${irc_server.xxx} и ${server} се замењује са именом сервера)"
+#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"време (у секундама) пре него што се обави аутоматско поновно приступање "
+"каналу (након избацивања)"
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10662,9 +10669,14 @@ msgstr ""
"eval; опције сервера се израчунавају са ${irc_server.xxx} и ${server} се "
"замењује са именом сервера)"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"време (у секундама) након извршавања команде и пре ауто-приступа каналима "
"(пример: давање мало времена за аутентификацију пре него што се приступи "
@@ -15664,14 +15676,14 @@ msgstr ""
"опцију „addreplace” да га препишете)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: није успело креирање окидача „%s”"
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "Окидач „%s” је креиран"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: није успело креирање окидача „%s”"
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: није пронађен окидач „%s”"
diff --git a/po/tr.po b/po/tr.po
index 414c50aa7..493a6d949 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+0100\n"
"PO-Revision-Date: 2023-11-29 09:59+0100\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10823,6 +10823,12 @@ msgstr ""
"değerlendirilir, bkz. /help eval; sunucu seçenekleri ${irc_server.xxx} ile "
"değerlendirilir ve ${server} sunucu adı ile değiştirilir"
+#, fuzzy
+#| msgid "delay (in seconds) before autorejoin (after kick)"
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+"kendiliğinden yeniden katılma öncesi gecikme (saniye) (kovulma sonrası)"
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -10838,9 +10844,14 @@ msgstr ""
"eval; sunucu seçenekleri ${irc_server.xxx} ile değerlendirilir ve ${server} "
"sunucu adı ile değiştirilir"
+#, fuzzy
+#| msgid ""
+#| "delay (in seconds) after execution of command and before auto-join of "
+#| "channels (example: give some time for authentication before joining "
+#| "channels)"
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
"komut yürütüldükten sonra ve kanallara kendiliğinden katılma sonrası gecikme "
"(örnek: kanallara katılma öncesi kimlik doğrulama için zaman ver)"
@@ -15942,14 +15953,14 @@ msgstr ""
"yazmak için \"addreplace\" seçeneğini kullanın)"
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
-msgstr "%s%s: \"%s\" tetiği oluşturulamadı"
-
-#, c-format
msgid "Trigger \"%s\" created"
msgstr "\"%s\" tetiği oluşturuldu"
#, c-format
+msgid "%s%s: failed to create trigger \"%s\""
+msgstr "%s%s: \"%s\" tetiği oluşturulamadı"
+
+#, c-format
msgid "%s%s: trigger \"%s\" not found"
msgstr "%s%s: \"%s\" tetiği bulunamadı"
diff --git a/po/weechat.pot b/po/weechat.pot
index d4d9b5be2..b95b574eb 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: 2024-02-01 21:36+0100\n"
+"POT-Creation-Date: 2024-02-11 08:54+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"
@@ -8863,6 +8863,9 @@ msgid ""
"name)"
msgstr ""
+msgid "delay (in seconds) before execution of command"
+msgstr ""
+
msgid ""
"command(s) to run after connection to server and before auto-join of "
"channels (many commands can be separated by \";\", use \"\\;\" for a "
@@ -8873,8 +8876,8 @@ msgid ""
msgstr ""
msgid ""
-"delay (in seconds) after execution of command and before auto-join of "
-"channels (example: give some time for authentication before joining channels)"
+"delay (in seconds) before auto-join of channels (example: give some time for "
+"authentication before joining channels)"
msgstr ""
msgid ""
@@ -13139,11 +13142,11 @@ msgid ""
msgstr ""
#, c-format
-msgid "%s%s: failed to create trigger \"%s\""
+msgid "Trigger \"%s\" created"
msgstr ""
#, c-format
-msgid "Trigger \"%s\" created"
+msgid "%s%s: failed to create trigger \"%s\""
msgstr ""
#, c-format
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index e9112facc..52531047a 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -5421,6 +5421,16 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
weechat_printf (NULL, " usermode . . . . . . : %s'%s'",
IRC_COLOR_CHAT_VALUE,
weechat_config_string (server->options[IRC_SERVER_OPTION_USERMODE]));
+ /* command_delay */
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]))
+ weechat_printf (NULL, " command_delay. . . . : (%d %s)",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY),
+ NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY)));
+ else
+ weechat_printf (NULL, " command_delay. . . . : %s%d %s",
+ IRC_COLOR_CHAT_VALUE,
+ weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]),
+ NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY])));
/* command */
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND]))
{
@@ -5443,16 +5453,16 @@ irc_command_display_server (struct t_irc_server *server, int with_detail)
if (cmd_pwd_hidden)
free (cmd_pwd_hidden);
}
- /* command_delay */
- if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]))
- weechat_printf (NULL, " command_delay. . . . : (%d %s)",
- IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY),
- NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY)));
+ /* autojoin_delay */
+ if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOJOIN_DELAY]))
+ weechat_printf (NULL, " autojoin_delay . . . : (%d %s)",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOJOIN_DELAY),
+ NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOJOIN_DELAY)));
else
- weechat_printf (NULL, " command_delay. . . . : %s%d %s",
+ weechat_printf (NULL, " autojoin_delay . . . : %s%d %s",
IRC_COLOR_CHAT_VALUE,
- weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]),
- NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY])));
+ weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTOJOIN_DELAY]),
+ NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTOJOIN_DELAY])));
/* autojoin */
if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOJOIN]))
weechat_printf (NULL, " autojoin . . . . . . : ('%s')",
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 5de3e51b0..7a8db7b10 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -2376,6 +2376,22 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
+ case IRC_SERVER_OPTION_COMMAND_DELAY:
+ new_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "integer",
+ N_("delay (in seconds) before execution of command"),
+ NULL, 0, 3600,
+ default_value, value,
+ null_value_allowed,
+ callback_check_value,
+ callback_check_value_pointer,
+ callback_check_value_data,
+ callback_change,
+ callback_change_pointer,
+ callback_change_data,
+ NULL, NULL, NULL);
+ break;
case IRC_SERVER_OPTION_COMMAND:
new_option = weechat_config_new_option (
config_file, section,
@@ -2398,13 +2414,13 @@ irc_config_server_new_option (struct t_config_file *config_file,
callback_change_data,
NULL, NULL, NULL);
break;
- case IRC_SERVER_OPTION_COMMAND_DELAY:
+ case IRC_SERVER_OPTION_AUTOJOIN_DELAY:
new_option = weechat_config_new_option (
config_file, section,
option_name, "integer",
- N_("delay (in seconds) after execution of command and before "
- "auto-join of channels (example: give some time for "
- "authentication before joining channels)"),
+ N_("delay (in seconds) before auto-join of channels "
+ "(example: give some time for authentication before joining "
+ "channels)"),
NULL, 0, 3600,
default_value, value,
null_value_allowed,
@@ -2880,8 +2896,9 @@ irc_config_update_cb (const void *pointer, void *data,
struct t_hashtable *data_read)
{
const char *ptr_section, *ptr_option, *ptr_value;
+ const char *option_autojoin_delay = "autojoin_delay";
char *new_option, *pos_option, *new_value;
- int changes;
+ int changes, length;
/* make C compiler happy */
(void) pointer;
@@ -2987,6 +3004,57 @@ irc_config_update_cb (const void *pointer, void *data,
}
}
+ if (version_read < 4)
+ {
+ /*
+ * changes in v4 (WeeChat 4.3.0):
+ * - server option "command_delay" is renamed to "autojoin_delay"
+ * ("command_delay" is a new option that sets the delay before
+ * the command, while "autojoin_delay" sets the delay before the
+ * autojoin)
+ */
+ ptr_section = weechat_hashtable_get (data_read, "section");
+ ptr_option = weechat_hashtable_get (data_read, "option");
+ if (ptr_section
+ && ptr_option
+ && (strcmp (ptr_section, "server_default") == 0)
+ && (strcmp (ptr_option, "command_delay") == 0))
+ {
+ weechat_printf (
+ NULL,
+ _("IRC option renamed: \"irc.%s.%s\" => \"irc.%s.%s\""),
+ ptr_section, ptr_option,
+ ptr_section, option_autojoin_delay);
+ weechat_hashtable_set (data_read, "option", option_autojoin_delay);
+ changes++;
+ }
+ else if (ptr_section
+ && ptr_option
+ && (strcmp (ptr_section, "server") == 0))
+ {
+ pos_option = strrchr (ptr_option, '.');
+ if (pos_option && (strcmp (pos_option + 1, "command_delay") == 0))
+ {
+ length = (pos_option - ptr_option + 1) + strlen (option_autojoin_delay) + 1;
+ new_option = malloc (length);
+ if (new_option)
+ {
+ memcpy (new_option, ptr_option, pos_option - ptr_option + 1);
+ new_option[pos_option - ptr_option + 1] = '\0';
+ strcat (new_option, option_autojoin_delay);
+ weechat_printf (
+ NULL,
+ _("IRC option renamed: \"irc.%s.%s\" => \"irc.%s.%s\""),
+ ptr_section, ptr_option,
+ ptr_section, new_option);
+ weechat_hashtable_set (data_read, "option", new_option);
+ changes++;
+ free (new_option);
+ }
+ }
+ }
+ }
+
return (changes) ? data_read : NULL;
}
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 7164df9e3..eb905becd 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -23,7 +23,7 @@
#define IRC_CONFIG_NAME "irc"
#define IRC_CONFIG_PRIO_NAME (TO_STR(IRC_PLUGIN_PRIORITY) "|" IRC_CONFIG_NAME)
-#define IRC_CONFIG_VERSION 3
+#define IRC_CONFIG_VERSION 4
enum t_irc_config_look_server_buffer
{
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 2d286d144..cde4c4d6a 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -4004,10 +4004,7 @@ IRC_PROTOCOL_CALLBACK(warn)
IRC_PROTOCOL_CALLBACK(001)
{
- char **commands, **ptr_command, *command2, *command3, *slash_command;
char *away_msg, *usermode;
- const char *ptr_server_command;
- int length;
IRC_PROTOCOL_MIN_PARAMS(1);
@@ -4061,57 +4058,16 @@ IRC_PROTOCOL_CALLBACK(001)
free (usermode);
/* execute command when connected */
- ptr_server_command = IRC_SERVER_OPTION_STRING(ctxt->server,
- IRC_SERVER_OPTION_COMMAND);
- if (ptr_server_command && ptr_server_command[0])
- {
- /* split command on ';' which can be escaped with '\;' */
- commands = weechat_string_split_command (ptr_server_command, ';');
- if (commands)
- {
- for (ptr_command = commands; *ptr_command; ptr_command++)
- {
- command2 = irc_server_eval_expression (ctxt->server, *ptr_command);
- if (command2)
- {
- command3 = irc_message_replace_vars (ctxt->server, NULL,
- command2);
- if (command3)
- {
- if (weechat_string_is_command_char (command3))
- {
- weechat_command (ctxt->server->buffer, command3);
- }
- else
- {
- length = 1 + strlen (command3) + 1;
- slash_command = malloc (length);
- if (slash_command)
- {
- snprintf (slash_command, length,
- "/%s", command3);
- weechat_command (ctxt->server->buffer,
- slash_command);
- free (slash_command);
- }
- }
- free (command3);
- }
- free (command2);
- }
- }
- weechat_string_free_split_command (commands);
- }
+ if (IRC_SERVER_OPTION_INTEGER(ctxt->server, IRC_SERVER_OPTION_COMMAND_DELAY) > 0)
+ ctxt->server->command_time = time (NULL) + 1;
+ else
+ irc_server_execute_command (ctxt->server);
- if (IRC_SERVER_OPTION_INTEGER(ctxt->server, IRC_SERVER_OPTION_COMMAND_DELAY) > 0)
- ctxt->server->command_time = time (NULL) + 1;
- else
- irc_server_autojoin_channels (ctxt->server);
- }
+ /* auto-join of channels */
+ if (IRC_SERVER_OPTION_INTEGER(ctxt->server, IRC_SERVER_OPTION_AUTOJOIN_DELAY) > 0)
+ ctxt->server->autojoin_time = time (NULL) + 1;
else
- {
irc_server_autojoin_channels (ctxt->server);
- }
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index cbd20a431..b25e5a945 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -109,8 +109,9 @@ char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] =
{ "realname", "" },
{ "local_hostname", "" },
{ "usermode", "" },
- { "command", "" },
{ "command_delay", "0" },
+ { "command", "" },
+ { "autojoin_delay", "0" },
{ "autojoin", "" },
{ "autojoin_dynamic", "off" },
{ "autorejoin", "off" },
@@ -1755,6 +1756,7 @@ irc_server_alloc (const char *name)
new_server->reconnect_delay = 0;
new_server->reconnect_start = 0;
new_server->command_time = 0;
+ new_server->autojoin_time = 0;
new_server->autojoin_done = 0;
new_server->disable_autojoin = 0;
new_server->is_away = 0;
@@ -4067,15 +4069,24 @@ irc_server_timer_cb (const void *pointer, void *data, int remaining_calls)
}
}
- /* check if it's time to autojoin channels (after command delay) */
+ /* check if it's time to execute command (after command_delay) */
if ((ptr_server->command_time != 0)
&& (current_time >= ptr_server->command_time +
IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_COMMAND_DELAY)))
{
- irc_server_autojoin_channels (ptr_server);
+ irc_server_execute_command (ptr_server);
ptr_server->command_time = 0;
}
+ /* check if it's time to auto-join channels (after autojoin_delay) */
+ if ((ptr_server->autojoin_time != 0)
+ && (current_time >= ptr_server->autojoin_time +
+ IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AUTOJOIN_DELAY)))
+ {
+ irc_server_autojoin_channels (ptr_server);
+ ptr_server->autojoin_time = 0;
+ }
+
/* check if it's time to send MONITOR command */
if ((ptr_server->monitor_time != 0)
&& (current_time >= ptr_server->monitor_time))
@@ -5898,6 +5909,58 @@ irc_server_disconnect_all ()
}
/*
+ * Executes command on server (using server option ".command").
+ */
+
+void
+irc_server_execute_command (struct t_irc_server *server)
+{
+ char **commands, **ptr_command, *command2, *command3, *slash_command;
+ const char *ptr_server_command;
+ int length;
+
+ ptr_server_command = IRC_SERVER_OPTION_STRING(server,
+ IRC_SERVER_OPTION_COMMAND);
+ if (!ptr_server_command || !ptr_server_command[0])
+ return;
+
+ /* split command on ';' which can be escaped with '\;' */
+ commands = weechat_string_split_command (ptr_server_command, ';');
+ if (!commands)
+ return;
+
+ for (ptr_command = commands; *ptr_command; ptr_command++)
+ {
+ command2 = irc_server_eval_expression (server, *ptr_command);
+ if (command2)
+ {
+ command3 = irc_message_replace_vars (server, NULL, command2);
+ if (command3)
+ {
+ if (weechat_string_is_command_char (command3))
+ {
+ weechat_command (server->buffer, command3);
+ }
+ else
+ {
+ length = 1 + strlen (command3) + 1;
+ slash_command = malloc (length);
+ if (slash_command)
+ {
+ snprintf (slash_command, length, "/%s", command3);
+ weechat_command (server->buffer, slash_command);
+ free (slash_command);
+ }
+ }
+ free (command3);
+ }
+ free (command2);
+ }
+ }
+ weechat_string_free_split_command (commands);
+}
+
+/*
* Creates buffers for auto-joined channels on a server.
*/
@@ -6567,6 +6630,7 @@ irc_server_hdata_server_cb (const void *pointer, void *data,
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_server, autojoin_time, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, autojoin_done, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, disable_autojoin, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_server, is_away, INTEGER, 0, NULL, NULL);
@@ -6726,11 +6790,14 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
if (!weechat_infolist_new_var_string (ptr_item, "usermode",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERMODE)))
return 0;
+ if (!weechat_infolist_new_var_integer (ptr_item, "command_delay",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY)))
+ return 0;
if (!weechat_infolist_new_var_string (ptr_item, "command",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND)))
return 0;
- if (!weechat_infolist_new_var_integer (ptr_item, "command_delay",
- IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY)))
+ if (!weechat_infolist_new_var_integer (ptr_item, "autojoin_delay",
+ IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOJOIN_DELAY)))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "autojoin",
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN)))
@@ -6949,6 +7016,8 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_time (ptr_item, "command_time", server->command_time))
return 0;
+ if (!weechat_infolist_new_var_time (ptr_item, "autojoin_time", server->autojoin_time))
+ return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "autojoin_done", server->autojoin_done))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "disable_autojoin", server->disable_autojoin))
@@ -7165,11 +7234,6 @@ irc_server_print_log ()
else
weechat_log_printf (" usermode. . . . . . . . . : '%s'",
weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_USERMODE]));
- /* command */
- if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_COMMAND]))
- weechat_log_printf (" command . . . . . . . . . : null");
- else
- weechat_log_printf (" command . . . . . . . . . : (hidden)");
/* command_delay */
if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_COMMAND_DELAY]))
weechat_log_printf (" command_delay . . . . . . : null (%d)",
@@ -7177,6 +7241,18 @@ irc_server_print_log ()
else
weechat_log_printf (" command_delay . . . . . . : %d",
weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_COMMAND_DELAY]));
+ /* command */
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_COMMAND]))
+ weechat_log_printf (" command . . . . . . . . . : null");
+ else
+ weechat_log_printf (" command . . . . . . . . . : (hidden)");
+ /* autojoin_delay */
+ if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN_DELAY]))
+ weechat_log_printf (" autojoin_delay. . . . . . : null (%d)",
+ IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AUTOJOIN_DELAY));
+ else
+ weechat_log_printf (" autojoin_delay. . . . . . : %d",
+ weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN_DELAY]));
/* autojoin */
if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN]))
weechat_log_printf (" autojoin. . . . . . . . . : null ('%s')",
@@ -7336,6 +7412,7 @@ irc_server_print_log ()
weechat_log_printf (" reconnect_delay . . . . . : %d", ptr_server->reconnect_delay);
weechat_log_printf (" reconnect_start . . . . . : %lld", (long long)ptr_server->reconnect_start);
weechat_log_printf (" command_time. . . . . . . : %lld", (long long)ptr_server->command_time);
+ weechat_log_printf (" autojoin_time . . . . . . : %lld", (long long)ptr_server->autojoin_time);
weechat_log_printf (" autojoin_done . . . . . . : %d", ptr_server->autojoin_done);
weechat_log_printf (" disable_autojoin. . . . . : %d", ptr_server->disable_autojoin);
weechat_log_printf (" is_away . . . . . . . . . : %d", ptr_server->is_away);
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 12a3b53d9..90be6b292 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -76,9 +76,10 @@ enum t_irc_server_option
IRC_SERVER_OPTION_REALNAME, /* real name */
IRC_SERVER_OPTION_LOCAL_HOSTNAME,/* custom local hostname */
IRC_SERVER_OPTION_USERMODE, /* usermode to set once connected */
+ IRC_SERVER_OPTION_COMMAND_DELAY, /* delay before execution of command */
IRC_SERVER_OPTION_COMMAND, /* command to run once connected */
- IRC_SERVER_OPTION_COMMAND_DELAY, /* delay after execution of command */
- IRC_SERVER_OPTION_AUTOJOIN, /* channels to automatically join */
+ IRC_SERVER_OPTION_AUTOJOIN_DELAY, /* delay before autojoin */
+ IRC_SERVER_OPTION_AUTOJOIN, /* channels to automatically join */
IRC_SERVER_OPTION_AUTOJOIN_DYNAMIC, /* auto set autojoin option */
IRC_SERVER_OPTION_AUTOREJOIN, /* auto rejoin channels when kicked */
IRC_SERVER_OPTION_AUTOREJOIN_DELAY, /* delay before auto rejoin */
@@ -269,7 +270,9 @@ struct t_irc_server
int reconnect_delay; /* current reconnect delay (growing) */
time_t reconnect_start; /* this time + delay = reconnect time */
time_t command_time; /* this time + command_delay = time to */
- /* autojoin channels */
+ /* execute command */
+ time_t autojoin_time; /* this time + autojoin_delay = time to */
+ /* auto-join channels */
int autojoin_done; /* 1 if autojoin has been done */
int disable_autojoin; /* 1 if user asked to not autojoin chans */
int is_away; /* 1 is user is marked as away */
@@ -445,6 +448,7 @@ extern void irc_server_switch_address (struct t_irc_server *server,
extern void irc_server_disconnect (struct t_irc_server *server,
int switch_address, int reconnect);
extern void irc_server_disconnect_all ();
+extern void irc_server_execute_command (struct t_irc_server *server);
extern void irc_server_free_sasl_data (struct t_irc_server *server);
extern void irc_server_free (struct t_irc_server *server);
extern int irc_server_xfer_send_ready_cb (const void *pointer, void *data,
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index b500a5a7d..402a225e4 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -649,6 +649,7 @@ irc_upgrade_read_cb (const void *pointer, void *data,
irc_upgrade_current_server->reconnect_delay = weechat_infolist_integer (infolist, "reconnect_delay");
irc_upgrade_current_server->reconnect_start = weechat_infolist_time (infolist, "reconnect_start");
irc_upgrade_current_server->command_time = weechat_infolist_time (infolist, "command_time");
+ irc_upgrade_current_server->autojoin_time = weechat_infolist_time (infolist, "autojoin_time");
irc_upgrade_current_server->autojoin_done = weechat_infolist_integer (infolist, "autojoin_done");
irc_upgrade_current_server->disable_autojoin = weechat_infolist_integer (infolist, "disable_autojoin");
irc_upgrade_current_server->is_away = weechat_infolist_integer (infolist, "is_away");
diff --git a/tests/unit/plugins/irc/test-irc-server.cpp b/tests/unit/plugins/irc/test-irc-server.cpp
index f951bc6ac..99ff5538e 100644
--- a/tests/unit/plugins/irc/test-irc-server.cpp
+++ b/tests/unit/plugins/irc/test-irc-server.cpp
@@ -1480,6 +1480,16 @@ TEST(IrcServer, DisconnectAll)
/*
* Tests functions:
+ * irc_server_execute_command
+ */
+
+TEST(IrcServer, ExecuteCommand)
+{
+ /* TODO: write tests */
+}
+
+/*
+ * Tests functions:
* irc_server_autojoin_create_buffers
*/