From 43cc44abca0768ce2ad1e804a0daa62b4ce81dfc Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 18 Sep 2010 09:25:59 +0200 Subject: [PATCH] Fix problem when removing relay server (socket was closed, but option relay.port.xxx not removed) --- po/cs.po | 14 ++++++++++- po/de.po | 14 ++++++++++- po/es.po | 14 ++++++++++- po/fr.po | 16 +++++++++++-- po/hu.po | 14 ++++++++++- po/it.po | 14 ++++++++++- po/pl.po | 14 ++++++++++- po/ru.po | 14 ++++++++++- po/weechat.pot | 14 ++++++++++- src/plugins/relay/relay-command.c | 39 ++++++++++++++++++++++--------- src/plugins/relay/relay-config.c | 15 +++++++++--- 11 files changed, 158 insertions(+), 24 deletions(-) diff --git a/po/cs.po b/po/cs.po index d10d17344..71f09c0b3 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -5997,6 +5997,14 @@ msgstr "%3d. port %s%d%s, přesměrování: %s%s.%s%s, spuštěno v: %s" msgid "No server for relay" msgstr "Žádný server pro přesměrování" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s%s: přesměrování \"%s\" nenalezeno" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s%s: přesměrování \"%s\" nenalezeno" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: přesměrování \"%s\" nenalezeno" @@ -6051,6 +6059,10 @@ msgstr "%s%s: chyba: port \"%d\" je již používán" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: chyba: neznámý protokol \"%s\"" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%sChyba: filtr \"%s\" již existuje" + msgid "auto open relay buffer when a new client is connecting" msgstr "automaticky otevřít buffer přesměrování, když připojuje nový klient" diff --git a/po/de.po b/po/de.po index 47b4ff6c9..d45e750b2 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.3-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-09-08 22:15+0200\n" "Last-Translator: Nils G.\n" "Language-Team: weechat-dev \n" @@ -6230,6 +6230,14 @@ msgstr "%3d. Port %s%d%s, Relay: %s%s.%s%s, gestartet am: %s" msgid "No server for relay" msgstr "Keinen Server für Relay" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s%s: Relay \"%s\" nicht gefunden" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s%s: Relay \"%s\" nicht gefunden" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: Relay \"%s\" nicht gefunden" @@ -6284,6 +6292,10 @@ msgstr "%s%s: Fehler: Der Port \"%d\" ist schon im Gebrauch" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: Unbekanntes Protokoll \"%s\"" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%sFehler: Filter \"%s\" existiert bereits" + msgid "auto open relay buffer when a new client is connecting" msgstr "" "Öffnet automatisch einen Relay-Buffer, falls eine Verbindung zu einem neuen " diff --git a/po/es.po b/po/es.po index 779c0e89a..8eb8f36d6 100644 --- a/po/es.po +++ b/po/es.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -6075,6 +6075,14 @@ msgstr "%3d. puerto %s%d%s, repetidor: %s%s.%s%s, iniciado en: %s" msgid "No server for relay" msgstr "Ningún servidor para retransmitir" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s%s: repetidor \"%s\" no encontrado" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s%s: repetidor \"%s\" no encontrado" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: repetidor \"%s\" no encontrado" @@ -6130,6 +6138,10 @@ msgstr "%s%s: error: puerto \"%d\" ya está en uso" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: error: protocolo desconocido \"%s\"" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%sError: el filtro \"%s\" ya existe" + msgid "auto open relay buffer when a new client is connecting" msgstr "" "abrir automáticamente el buffer de retransmisiones cuando un cliente nuevo " diff --git a/po/fr.po b/po/fr.po index 349fafa97..6f74c4cc9 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" -"PO-Revision-Date: 2010-09-17 20:13+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" +"PO-Revision-Date: 2010-09-18 09:21+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -6118,6 +6118,14 @@ msgstr " port %s%d%s, relai: %s%s.%s%s, démarré le: %s" msgid "No server for relay" msgstr "Pas de serveur pour le relai" +#, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s: relai \"%s\" (port %s) ajouté" + +#, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s: relai \"%s\" (port %d) supprimé" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: relai \"%s\" non trouvé" @@ -6171,6 +6179,10 @@ msgstr "%s%s: erreur: le port \"%d\" est déjà utilisé" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: erreur: protocole \"%s\" inconnu" +#, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%s%s: erreur: le relai pour \"%s\" existe déjà" + msgid "auto open relay buffer when a new client is connecting" msgstr "" "ouvrir automatiquement le tampon des clients pour le relai lorsqu'un nouveau " diff --git a/po/hu.po b/po/hu.po index 23984242d..30dc320fd 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -5741,6 +5741,14 @@ msgstr "%s%s%s távol: %s\n" msgid "No server for relay" msgstr "Nincs szerver.\n" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s a \"%s\" szerver nem található\n" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s a \"%s\" szerver nem található\n" + #, fuzzy, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s a \"%s\" szerver nem található\n" @@ -5783,6 +5791,10 @@ msgstr "%s az ignore már létezik\n" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s ismeretlen billentyűparancs \"%s\"\n" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%s az ignore már létezik\n" + msgid "auto open relay buffer when a new client is connecting" msgstr "" diff --git a/po/it.po b/po/it.po index fcfc1e16b..6442dd540 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -6078,6 +6078,14 @@ msgstr "%3d, porta %s%d%s, relay: %s%s,%s%s, avviato il: %s" msgid "No server for relay" msgstr "Nessun server per relay" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s%s: relay \"%s\" non trovato" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s%s: relay \"%s\" non trovato" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: relay \"%s\" non trovato" @@ -6131,6 +6139,10 @@ msgstr "%s%s: errore: la porta \"%d\" è già utilizzata" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: errore: protocollo \"%s\" sconosciuto" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%sErrore: il filtro \"%s\" esiste già" + msgid "auto open relay buffer when a new client is connecting" msgstr "" "apre automaticamente il buffer relay alla connessione di un nuovo client" diff --git a/po/pl.po b/po/pl.po index c565aa922..704d7a352 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Krzysztof Koroscik \n" "Language-Team: weechat-dev \n" @@ -6022,6 +6022,14 @@ msgstr "%3d. port %s%d%s, relay: %s%s.%s%s, rozpoczęte: %s" msgid "No server for relay" msgstr "Brak serwera dla relay" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s%s: relay \"%s\" nie został znaleziony" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s%s: relay \"%s\" nie został znaleziony" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s%s: relay \"%s\" nie został znaleziony" @@ -6075,6 +6083,10 @@ msgstr "%s%s: błąd: port \"%d\" jest już w użyciu" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s%s: błąd: nieznany protokół \"%s\"" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%sBłąd: filtr \"%s\" już istnieje" + msgid "auto open relay buffer when a new client is connecting" msgstr "automatycznie otwiera bufor kiedy podłącza się nowy klient" diff --git a/po/ru.po b/po/ru.po index cdee49071..3c341335d 100644 --- a/po/ru.po +++ b/po/ru.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -5750,6 +5750,14 @@ msgstr "%s%s%s отсутствует: %s\n" msgid "No server for relay" msgstr "Нет сервера.\n" +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "%s сервер \"%s\" не найден\n" + +#, fuzzy, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "%s сервер \"%s\" не найден\n" + #, fuzzy, c-format msgid "%s%s: relay \"%s\" not found" msgstr "%s сервер \"%s\" не найден\n" @@ -5792,6 +5800,10 @@ msgstr "%s игнорирование уже существует\n" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "%s неизвестная функция клавиши \"%s\"\n" +#, fuzzy, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "%s игнорирование уже существует\n" + msgid "auto open relay buffer when a new client is connecting" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 37daffb48..273754ac2 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-09-17 20:12+0200\n" +"POT-Creation-Date: 2010-09-18 09:24+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4996,6 +4996,14 @@ msgstr "" msgid "No server for relay" msgstr "" +#, c-format +msgid "%s: relay \"%s\" (port %s) added" +msgstr "" + +#, c-format +msgid "%s: relay \"%s\" (port %d) removed" +msgstr "" + #, c-format msgid "%s%s: relay \"%s\" not found" msgstr "" @@ -5037,6 +5045,10 @@ msgstr "" msgid "%s%s: error: unknown protocol \"%s\"" msgstr "" +#, c-format +msgid "%s%s: error: relay for \"%s\" already exists" +msgstr "" + msgid "auto open relay buffer when a new client is connecting" msgstr "" diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c index 33b315bf3..94a006f7b 100644 --- a/src/plugins/relay/relay-command.c +++ b/src/plugins/relay/relay-command.c @@ -151,12 +151,13 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { struct t_relay_server *ptr_server; + struct t_config_option *ptr_option; + int port; /* make C compiler happy */ (void) data; (void) buffer; - (void) argv_eol; - + if (argc > 1) { if (weechat_strcasecmp (argv[1], "list") == 0) @@ -180,19 +181,25 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, { if (argc >= 4) { - relay_config_create_option_port (NULL, - relay_config_file, - relay_config_section_port, - argv[2], - argv_eol[3]); + if (relay_config_create_option_port (NULL, + relay_config_file, + relay_config_section_port, + argv[2], + argv_eol[3]) != WEECHAT_CONFIG_OPTION_SET_ERROR) + { + weechat_printf (NULL, + _("%s: relay \"%s\" (port %s) added"), + RELAY_PLUGIN_NAME, + argv[2], argv_eol[3]); + } } else { weechat_printf (NULL, - _("%s%s: missing arguments for \"%s\" " - "command"), - weechat_prefix ("error"), RELAY_PLUGIN_NAME, - "relay add"); + _("%s%s: missing arguments for \"%s\" " + "command"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + "relay add"); } return WEECHAT_RC_OK; } @@ -203,7 +210,17 @@ relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, ptr_server = relay_server_search (argv_eol[2]); if (ptr_server) { + port = ptr_server->port; relay_server_free (ptr_server); + ptr_option = weechat_config_search_option (relay_config_file, + relay_config_section_port, + argv_eol[2]); + if (ptr_option) + weechat_config_option_free (ptr_option); + weechat_printf (NULL, + _("%s: relay \"%s\" (port %d) removed"), + RELAY_PLUGIN_NAME, + argv[2], port); } else { diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index 3dce1bae5..53b0d7e85 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -200,6 +200,14 @@ relay_config_create_option_port (void *data, RELAY_PLUGIN_NAME, protocol); rc = WEECHAT_CONFIG_OPTION_SET_ERROR; } + + if (weechat_config_search_option (config_file, section, option_name)) + { + weechat_printf (NULL, _("%s%s: error: relay for \"%s\" already exists"), + weechat_prefix ("error"), + RELAY_PLUGIN_NAME, option_name); + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; + } if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) { @@ -226,9 +234,10 @@ relay_config_create_option_port (void *data, &relay_config_change_port_cb, NULL, &relay_config_delete_port_cb, NULL); - relay_server_new (protocol_number, protocol_string, port); - - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + if (relay_server_new (protocol_number, protocol_string, port)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; } if (protocol)