From 9017a230136f8daa1d227dd8a20a5ecfa839920b Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 5 Apr 2010 13:03:11 +0200 Subject: [PATCH] Add option "-open" for IRC command /connect --- ChangeLog | 3 ++- doc/en/autogen/user/irc_commands.txt | 5 ++-- doc/fr/autogen/user/irc_commands.txt | 5 ++-- doc/it/autogen/user/irc_commands.txt | 21 +++++++-------- po/cs.po | 11 +++++--- po/de.po | 11 +++++--- po/es.po | 11 +++++--- po/fr.po | 19 ++++++++------ po/hu.po | 9 ++++--- po/it.po | 11 +++++--- po/pl.po | 11 +++++--- po/ru.po | 9 ++++--- po/weechat.pot | 9 ++++--- src/plugins/irc/irc-command.c | 38 +++++++++++++++++++++------- 14 files changed, 109 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a339aba7..8a2d1febe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ WeeChat ChangeLog ================= FlashCode -v0.3.2-dev, 2010-03-31 +v0.3.2-dev, 2010-04-05 Version 0.3.2 (under dev!) @@ -74,6 +74,7 @@ Version 0.3.2 (under dev!) * irc: bug with prefix "!" for mode "a" (channel admin) (bug #29109) * irc: do not send signals "irc_in" and "irc_in2" when messages are ignored, add new signals "irc_raw_in" and "irc_raw_in2" +* irc: add option "-open" for command /connect * irc: add option irc.network.connection_timeout (timeout between TCP connection to server and reception of message 001) * irc: add options irc.look.smart_filter_join and irc.look.smart_filter_quit diff --git a/doc/en/autogen/user/irc_commands.txt b/doc/en/autogen/user/irc_commands.txt index 134c1b425..6a982fc51 100644 --- a/doc/en/autogen/user/irc_commands.txt +++ b/doc/en/autogen/user/irc_commands.txt @@ -50,12 +50,13 @@ nickname: user or host to ban ........................................ -• *`/connect`* `[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-option[=value]] [-nooption]]`:: +• *`/connect`* `[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-option[=value]] [-nooption]]`:: ........................................ connect to IRC server(s) - -all: connect to all servers + -all: connect to all servers defined in configuration + -open: connect to all opened servers that are not currently connected servername: internal server name to connect (server must have been created by /server add) -nojoin: do not join any channel (even if autojoin is enabled on server) hostname: hostname (or IP) of a server diff --git a/doc/fr/autogen/user/irc_commands.txt b/doc/fr/autogen/user/irc_commands.txt index f0e1d994f..d5a89ddca 100644 --- a/doc/fr/autogen/user/irc_commands.txt +++ b/doc/fr/autogen/user/irc_commands.txt @@ -50,12 +50,13 @@ pseudo: pseudo ou hôte pour le bannissement ........................................ -• *`/connect`* `[-all [-nojoin] | nom_serveur [nom_serveur ...] [-nojoin] | nom[/port] [-option[=valeur]] [-nooption]]`:: +• *`/connect`* `[-all [-nojoin] | -open [-nojoin] | nom_serveur [nom_serveur ...] [-nojoin] | nom[/port] [-option[=valeur]] [-nooption]]`:: ........................................ se connecter à un/plusieurs serveur(s) IRC - -all: se reconnecter à tous les serveurs + -all: se connecter à tous les serveurs définis dans la configuration + -open: se connecter à tous les serveurs ouverts qui ne sont pas actuellement connectés nom_serveur: nom du serveur interne pour se connecter (le serveur doit avoir été créé par /server add) -nojoin: ne rejoindre aucun canal (même si l'autojoin est activé pour le serveur) nom: nom (ou adresse IP) d'un serveur diff --git a/doc/it/autogen/user/irc_commands.txt b/doc/it/autogen/user/irc_commands.txt index be518618f..25462c200 100644 --- a/doc/it/autogen/user/irc_commands.txt +++ b/doc/it/autogen/user/irc_commands.txt @@ -50,25 +50,26 @@ nick: utente o host da bannare ........................................ -• *`/connect`* `[-all [-nojoin] | nome_server [nome_server ...] [-nojoin] | nome_host[/porta] [-opzione[=valore]] [-nooption]`:: +• *`/connect`* `[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-option[=value]] [-nooption]]`:: ........................................ connette ad uno o più server IRC - -all: connette a tutti i server - nome_server: nome interno del server a cui connettersi (il server deve essere stato creato con /server add) - -nojoin: non entrare in nessun canale (anche se l'ingresso automatico è attivo sul server) - nome_host: nome host (oppure IP) del server - porta: porta per il server (6667 è la predefinita) - opzione: imposta opzione per il server (per le opzioni bool, il valore può essere omesso) - nooption: imposta il valore bool dell'opzione su off (per esempio: -nossl) + -all: connect to all servers defined in configuration + -open: connect to all opened servers that are not currently connected + servername: internal server name to connect (server must have been created by /server add) + -nojoin: do not join any channel (even if autojoin is enabled on server) + hostname: hostname (or IP) of a server + port: port for server (6667 by default) + option: set option for server (for boolean option, value can be omitted) + nooption: set boolean option to 'off' (for example: -nossl) - Esempi: + Examples: /connect freenode /connect irc.oftc.net/6667 /connect irc6.oftc.net/6667 -ipv6 /connect irc6.oftc.net/6697 -ipv6 -ssl - /connect mio.server.org/6697 -ssl -password=test + /connect my.server.org/6697 -ssl -password=test ........................................ • *`/ctcp`* `destinatario tipo [argomenti]`:: diff --git a/po/cs.po b/po/cs.po index 1dd618b0a..533203342 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-23 10:19+0100\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -3239,15 +3239,18 @@ msgstr "" msgid "connect to IRC server(s)" msgstr "připojit se k IRC serveru/serverům" +#, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | jméno_serveru [jméno_serveru ...] [-nojoin] | jméno_hosta[/" "port] [-volba[=hodnota]] [-novolba]]" +#, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/de.po b/po/de.po index f526a88e8..273f303e4 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 19:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-04-04 12:20+0100\n" "Last-Translator: Nils G \n" "Language-Team: weechat-dev \n" @@ -3412,15 +3412,18 @@ msgstr "" msgid "connect to IRC server(s)" msgstr "Mit IRC-Server(n) verbinden" +#, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | Servername [Servername ...] [-nojoin] | Hostname[/port] [-" "option[=value]] [-nooption]]" +#, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/es.po b/po/es.po index d21679213..6f460227f 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3267,15 +3267,18 @@ msgstr "" msgid "connect to IRC server(s)" msgstr "conectar a un servidor IRC" +#, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | servidor [servidor ...] [-nojoin] | hostname[/puerto] [-" "opción=[=valor]] [-noopción]]" +#, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/fr.po b/po/fr.po index 8f80dcc17..63d17ad57 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" -"PO-Revision-Date: 2010-04-03 12:51+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" +"PO-Revision-Date: 2010-04-05 12:45+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -3362,14 +3362,15 @@ msgid "connect to IRC server(s)" msgstr "se connecter à un/plusieurs serveur(s) IRC" msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" -"[-all [-nojoin] | nom_serveur [nom_serveur ...] [-nojoin] | nom[/port] [-" -"option[=valeur]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | nom_serveur [nom_serveur ...] [-nojoin] " +"| nom[/port] [-option[=valeur]] [-nooption]]" msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" @@ -3386,7 +3387,9 @@ msgid "" " /connect irc6.oftc.net/6697 -ipv6 -ssl\n" " /connect my.server.org/6697 -ssl -password=test" msgstr "" -" -all: se reconnecter à tous les serveurs\n" +" -all: se connecter à tous les serveurs définis dans la configuration\n" +" -open: se connecter à tous les serveurs ouverts qui ne sont pas " +"actuellement connectés\n" "nom_serveur: nom du serveur interne pour se connecter (le serveur doit avoir " "été créé par /server add)\n" " -nojoin: ne rejoindre aucun canal (même si l'autojoin est activé pour le " diff --git a/po/hu.po b/po/hu.po index 22f62baab..75817af96 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3108,15 +3108,16 @@ msgstr "csatlakozás a szerver(ek)hez" #, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | szervernév [szervernév ...] [-nojoin] | gépnév [-port " "port] [-ipv6] [-ssl]]" #, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/it.po b/po/it.po index 001c433d3..40cabf91a 100644 --- a/po/it.po +++ b/po/it.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Weechat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-24 14:20+0100\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -3327,15 +3327,18 @@ msgstr "" msgid "connect to IRC server(s)" msgstr "connette ad uno o più server IRC" +#, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | nome_server [nome_server ...] [-nojoin] | nome_host[/" "porta] [-opzione[=valore]] [-nooption]" +#, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/pl.po b/po/pl.po index 86c98ac02..d77ef3697 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.0-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Krzysztof Koroscik \n" "Language-Team: Polish\n" @@ -3273,15 +3273,18 @@ msgstr "" msgid "connect to IRC server(s)" msgstr "łączy się z serwerem(ami) IRC" +#, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | nazwa_serwera [nazwa_serwera ...] [-nojoin] | nazwa_hosta[/" "port] [-opcja[=wartość]] [-noopcja]]" +#, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/ru.po b/po/ru.po index 2c7c026c1..40c2caae2 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.2-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: 2010-03-23 10:20+0100\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -3120,15 +3120,16 @@ msgstr "подключиться к серверу(-ам)" #, fuzzy msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" "[-all [-nojoin] | сервер [servername ...] [-nojoin] | адрес [-port порт] [-" "ipv6] [-ssl]]" #, fuzzy msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/po/weechat.pot b/po/weechat.pot index b6888a4d1..8fc431fee 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-04-03 12:50+0200\n" +"POT-Creation-Date: 2010-04-05 12:44+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2724,12 +2724,13 @@ msgid "connect to IRC server(s)" msgstr "" msgid "" -"[-all [-nojoin] | servername [servername ...] [-nojoin] | hostname[/port] [-" -"option[=value]] [-nooption]]" +"[-all [-nojoin] | -open [-nojoin] | servername [servername ...] [-nojoin] | " +"hostname[/port] [-option[=value]] [-nooption]]" msgstr "" msgid "" -" -all: connect to all servers\n" +" -all: connect to all servers defined in configuration\n" +" -open: connect to all opened servers that are not currently connected\n" "servername: internal server name to connect (server must have been created " "by /server add)\n" " -nojoin: do not join any channel (even if autojoin is enabled on server)\n" diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 4f5fa1ea2..936ba22e7 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -698,7 +698,7 @@ int irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - int i, nb_connect, connect_ok, all_servers, no_join; + int i, nb_connect, connect_ok, all_servers, all_opened, no_join; char *name; IRC_BUFFER_GET_SERVER(buffer); @@ -711,27 +711,44 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, connect_ok = 1; all_servers = 0; + all_opened = 0; no_join = 0; for (i = 1; i < argc; i++) { if (weechat_strcasecmp (argv[i], "-all") == 0) all_servers = 1; - if (weechat_strcasecmp (argv[i], "-nojoin") == 0) + else if (weechat_strcasecmp (argv[i], "-open") == 0) + all_opened = 1; + else if (weechat_strcasecmp (argv[i], "-nojoin") == 0) no_join = 1; } - if (all_servers) + if (all_opened) + { + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + if (ptr_server->buffer + && !ptr_server->is_connected && (!ptr_server->hook_connect)) + { + if (!irc_command_connect_one_server (ptr_server, no_join)) + connect_ok = 0; + } + } + return (connect_ok) ? WEECHAT_RC_OK : WEECHAT_RC_ERROR; + } + else if (all_servers) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - nb_connect++; if (!ptr_server->is_connected && (!ptr_server->hook_connect)) { if (!irc_command_connect_one_server (ptr_server, no_join)) connect_ok = 0; } } + return (connect_ok) ? WEECHAT_RC_OK : WEECHAT_RC_ERROR; } else { @@ -4226,10 +4243,13 @@ irc_command_init () "%(irc_channel_nicks_hosts)", &irc_command_ban, NULL); weechat_hook_command ("connect", N_("connect to IRC server(s)"), - N_("[-all [-nojoin] | servername [servername ...] " - "[-nojoin] | hostname[/port] [-option[=value]] " - "[-nooption]]"), - N_(" -all: connect to all servers\n" + N_("[-all [-nojoin] | -open [-nojoin] | servername " + "[servername ...] [-nojoin] | hostname[/port] " + "[-option[=value]] [-nooption]]"), + N_(" -all: connect to all servers defined in " + "configuration\n" + " -open: connect to all opened servers that " + "are not currently connected\n" "servername: internal server name to connect " "(server must have been created by /server add)\n" " -nojoin: do not join any channel (even if " @@ -4246,7 +4266,7 @@ irc_command_init () " /connect irc6.oftc.net/6667 -ipv6\n" " /connect irc6.oftc.net/6697 -ipv6 -ssl\n" " /connect my.server.org/6697 -ssl -password=test"), - "-all -nojoin" + "-all|-open -nojoin" " || %(irc_servers)|%*", &irc_command_connect, NULL); weechat_hook_command ("ctcp",