diff --git a/CMakeLists.txt b/CMakeLists.txt index 757e9f7c3..f2dabef10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ OPTION(DISABLE_FIFO "Disable FIFO plugin") OPTION(DISABLE_IRC "Disable IRC plugin") OPTION(DISABLE_LOGGER "Disable Logger plugin") OPTION(DISABLE_NOTIFY "Disable Notify plugin") +OPTION(DISABLE_RELAY "Disable Relay plugin") OPTION(DISABLE_SCRIPTS "Disable script plugins") OPTION(DISABLE_PERL "Disable Perl scripting language") OPTION(DISABLE_PYTHON "Disable Python scripting language") diff --git a/ChangeLog b/ChangeLog index f11c19ab5..fbb13ab73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2008-11-23 +ChangeLog - 2008-12-10 Version 0.2.7 (under dev!): + * new relay plugin (network communication between WeeChat and remote + application) * add support for more than one proxy, with proxy selection for each IRC server (task #6859) * add smart join/part/quit message filter in IRC plugin (task #8503) @@ -48,7 +50,7 @@ Version 0.2.7 (under dev!): * add /reload command to reload WeeChat and plugins config files (signal SIGHUP is catched to reload config files) * new plugins: alias, debug, demo, fifo, irc, logger, notify, tcl, trigger, - xfer + xfer, relay * add hooks: command, timer, file descriptor, connection, print, signal, config, completion, modifier, info, infolist * new plugin API with many new functions: hooks, buffer management, bars, diff --git a/configure.in b/configure.in index cdd63bf8c..28e3d2883 100644 --- a/configure.in +++ b/configure.in @@ -101,6 +101,7 @@ AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO]) AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC]) AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER]) AH_VERBATIM([PLUGIN_NOTIFY], [#undef PLUGIN_NOTIFY]) +AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY]) AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL]) AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON]) AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY]) @@ -126,6 +127,7 @@ AC_ARG_ENABLE(fifo, [ --disable-fifo turn off Fifo plugin (def AC_ARG_ENABLE(irc, [ --disable-irc turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes) AC_ARG_ENABLE(logger, [ --disable-logger turn off Logger plugin (default=compiled)],enable_logger=$enableval,enable_logger=yes) AC_ARG_ENABLE(notify, [ --disable-notify turn off Notify plugin (default=compiled)],enable_notify=$enableval,enable_notify=yes) +AC_ARG_ENABLE(relay, [ --disable-relay turn off Relay plugin (default=compiled)],enable_relay=$enableval,enable_relay=yes) AC_ARG_ENABLE(scripts, [ --disable-scripts turn off script plugins (default=compiled if found)],enable_scripts=$enableval,enable_scripts=yes) AC_ARG_ENABLE(perl, [ --disable-perl turn off Perl script plugin (default=compiled if found)],enable_perl=$enableval,enable_perl=yes) AC_ARG_ENABLE(python, [ --disable-python turn off Python script plugin (default=compiled if found)],enable_python=$enableval,enable_python=yes) @@ -396,6 +398,18 @@ else not_asked="$not_asked notify" fi +# --------------------------------- relay -------------------------------------- + +if test "x$enable_relay" = "xyes" ; then + RELAY_CFLAGS="" + RELAY_LFLAGS="" + AC_SUBST(RELAY_CFLAGS) + AC_SUBST(RELAY_LFLAGS) + AC_DEFINE(PLUGIN_RELAY) +else + not_asked="$not_asked relay" +fi + # ---------------------------------- perl -------------------------------------- PERL_VERSION= @@ -961,6 +975,7 @@ AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes") AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes") AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes") AM_CONDITIONAL(PLUGIN_NOTIFY, test "$enable_notify" = "yes") +AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes") AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes") AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes") AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes") @@ -991,6 +1006,7 @@ AC_OUTPUT([Makefile src/plugins/irc/Makefile src/plugins/logger/Makefile src/plugins/notify/Makefile + src/plugins/relay/Makefile src/plugins/scripts/Makefile src/plugins/scripts/perl/Makefile src/plugins/scripts/python/Makefile @@ -1056,6 +1072,9 @@ fi if test "x$enable_notify" = "xyes"; then listplugins="$listplugins notify" fi +if test "x$enable_relay" = "xyes"; then + listplugins="$listplugins relay" +fi if test "x$enable_perl" = "xyes"; then listplugins="$listplugins perl($PERL_VERSION)" fi diff --git a/debian/control b/debian/control index 243f40b07..98e96ba16 100644 --- a/debian/control +++ b/debian/control @@ -54,7 +54,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends}, weechat-curses (= ${binary:Version} Suggests: weechat-scripts Description: Plugins for WeeChat This package provides some plugins to enhance WeeChat. It currently ships - the following plugins: Perl, Python, Ruby, Lua, Tcl, Aspell and Fifo. + the following plugins: Perl, Python, Ruby, Lua, Tcl, Aspell, Relay and Fifo. Package: weechat-doc Section: doc diff --git a/debian/weechat-plugins.install b/debian/weechat-plugins.install index a5ed3eeb0..0f47f431d 100644 --- a/debian/weechat-plugins.install +++ b/debian/weechat-plugins.install @@ -1,7 +1,8 @@ +usr/lib/weechat/plugins/aspell.so usr/lib/weechat/plugins/fifo.so +usr/lib/weechat/plugins/relay.so usr/lib/weechat/plugins/perl.so usr/lib/weechat/plugins/python.so usr/lib/weechat/plugins/ruby.so usr/lib/weechat/plugins/lua.so -usr/lib/weechat/plugins/aspell.so usr/lib/weechat/plugins/tcl.so diff --git a/doc/de/autogen/relay_commands.xml b/doc/de/autogen/relay_commands.xml new file mode 100644 index 000000000..6ba15b874 --- /dev/null +++ b/doc/de/autogen/relay_commands.xml @@ -0,0 +1,15 @@ + + + +/relay + +relay control + +Open buffer with relay clients list + + diff --git a/doc/de/autogen/relay_infos.xml b/doc/de/autogen/relay_infos.xml new file mode 100644 index 000000000..eb979c513 --- /dev/null +++ b/doc/de/autogen/relay_infos.xml @@ -0,0 +1,13 @@ + + + + + infolist + relay + list of relay clients + diff --git a/doc/de/autogen/relay_options.xml b/doc/de/autogen/relay_options.xml new file mode 100644 index 000000000..48337494d --- /dev/null +++ b/doc/de/autogen/relay_options.xml @@ -0,0 +1,118 @@ + + + +relay.color.status_active: text color for "connected" status + + + type: color + + + values: a color name (default value: lightblue) + + + +relay.color.status_auth_failed: text color for "authentication failed" status + + + type: color + + + values: a color name (default value: lightred) + + + +relay.color.status_connecting: text color for "connecting" status + + + type: color + + + values: a color name (default value: yellow) + + + +relay.color.status_disconnected: text color for "disconnected" status + + + type: color + + + values: a color name (default value: lightred) + + + +relay.color.status_waiting_auth: text color for "waiting authentication" status + + + type: color + + + values: a color name (default value: brown) + + + +relay.color.text: text color + + + type: color + + + values: a color name (default value: default) + + + +relay.color.text_bg: background color + + + type: color + + + values: a color name (default value: default) + + + +relay.color.text_selected: text color of selected client line + + + type: color + + + values: a color name (default value: white) + + + +relay.look.auto_open_buffer: auto open relay buffer when a new client is connecting + + + type: boolean + + + values: on, off (default value: on) + + + +relay.network.listen_port_range: port number (or range of ports) that relay plugin listens on (syntax: a single port, ie. 5000 or a port range, ie. 5000-5015) + + + type: string + + + values: any string (default value: '22373-22400') + + + +relay.network.timeout: timeout for relay request (in seconds) + + + type: integer + + + values: 5 .. 2147483647 (default value: 300) + + + diff --git a/doc/docgen.pl b/doc/docgen.pl index 060c67e06..4151a5b20 100644 --- a/doc/docgen.pl +++ b/doc/docgen.pl @@ -66,10 +66,10 @@ my %plugin_list = ("weechat" => "co", "alias" => "", "aspell" => "o", "charset" => "co", "demo" => "co", "fifo" => "co", "irc" => "co", "logger" => "co", - "notify" => "co", "perl" => "", - "python" => "", "ruby" => "", - "lua" => "", "tcl" => "", - "xfer" => "co"); + "notify" => "co", "relay" => "co", + "perl" => "", "python" => "", + "ruby" => "", "lua" => "", + "tcl" => "", "xfer" => "co"); # options to ignore my @ignore_options = ("aspell\\.dict\\..*", diff --git a/doc/en/autogen/relay_commands.xml b/doc/en/autogen/relay_commands.xml new file mode 100644 index 000000000..6ba15b874 --- /dev/null +++ b/doc/en/autogen/relay_commands.xml @@ -0,0 +1,15 @@ + + + +/relay + +relay control + +Open buffer with relay clients list + + diff --git a/doc/en/autogen/relay_infos.xml b/doc/en/autogen/relay_infos.xml new file mode 100644 index 000000000..eb979c513 --- /dev/null +++ b/doc/en/autogen/relay_infos.xml @@ -0,0 +1,13 @@ + + + + + infolist + relay + list of relay clients + diff --git a/doc/en/autogen/relay_options.xml b/doc/en/autogen/relay_options.xml new file mode 100644 index 000000000..48337494d --- /dev/null +++ b/doc/en/autogen/relay_options.xml @@ -0,0 +1,118 @@ + + + +relay.color.status_active: text color for "connected" status + + + type: color + + + values: a color name (default value: lightblue) + + + +relay.color.status_auth_failed: text color for "authentication failed" status + + + type: color + + + values: a color name (default value: lightred) + + + +relay.color.status_connecting: text color for "connecting" status + + + type: color + + + values: a color name (default value: yellow) + + + +relay.color.status_disconnected: text color for "disconnected" status + + + type: color + + + values: a color name (default value: lightred) + + + +relay.color.status_waiting_auth: text color for "waiting authentication" status + + + type: color + + + values: a color name (default value: brown) + + + +relay.color.text: text color + + + type: color + + + values: a color name (default value: default) + + + +relay.color.text_bg: background color + + + type: color + + + values: a color name (default value: default) + + + +relay.color.text_selected: text color of selected client line + + + type: color + + + values: a color name (default value: white) + + + +relay.look.auto_open_buffer: auto open relay buffer when a new client is connecting + + + type: boolean + + + values: on, off (default value: on) + + + +relay.network.listen_port_range: port number (or range of ports) that relay plugin listens on (syntax: a single port, ie. 5000 or a port range, ie. 5000-5015) + + + type: string + + + values: any string (default value: '22373-22400') + + + +relay.network.timeout: timeout for relay request (in seconds) + + + type: integer + + + values: 5 .. 2147483647 (default value: 300) + + + diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 097e8d80c..58eabed6f 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -722,7 +722,9 @@ char *weechat_string_strip ( Example: - char *str = weechat_strip (string, " ", 0, 1); /* remove spaces at end of string */ + +char *str = weechat_string_strip (string, " ", 0, 1); /* remove spaces at end of string */ + @@ -857,7 +859,7 @@ char **weechat_string_explode ( Examples: - + char **argv; int argc; argv = weechat_string_explode ("abc de fghi", " ", 0, 0, &argc); @@ -877,7 +879,7 @@ argv = weechat_string_explode ("abc de fghi", " ", 1, 0, &argc); argc == 3 */ weechat_string_free_exploded (argv); - + @@ -909,13 +911,13 @@ void weechat_string_free_exploded (char **exploded_string); Example: - + char *argv; int argc; argv = weechat_string_explode (string, " ", 0, 0, &argc); ... weechat_string_free_exploded (, argv); - + @@ -959,13 +961,13 @@ char *weechat_string_build_with_exploded ( Example: - + char **argv; int argc; argv = weechat_string_explode ("abc def ghi", " ", 0, 0, &argc); char *string = weechat_string_build_with_exploded (argv, ";"); /* string == "abc;def;ghi" */ - + @@ -1040,11 +1042,60 @@ void weechat_string_free_splitted_command (char **splitted_command); Example: - + char **argv = weechat_string_split_command ("/command1;/command2", ';'); ... weechat_string_free_splitted_command (argv); - + + + + +
+ weechat_string_format_size + + + Prototype: + +char *weechat_string_format_size (unsigned long size); + + + + Build a string with formated size and translated unit. + + + Arguments: + + + + : size + + + + + + Return value: string with formated size and translated unit. + + + + Result has to be free by a call to "free" after use. + + + + Example: + +char *str = weechat_string_format_size (0); /* str == "0 byte" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (200); /* str == "200 bytes" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (1536); /* str == "1.5 KB" (english locale) */ +if (str) + free (str); +char *str = weechat_string_format_size (2097152); /* str == "2 MB" (english locale) */ +if (str) + free (str); +
@@ -1123,10 +1174,10 @@ int weechat_utf8_is_valid (const char *string, char **error); Example: - + char *error; if (weechat_utf8_is_valid (string, &error)) ... - + diff --git a/doc/fr/autogen/relay_commands.xml b/doc/fr/autogen/relay_commands.xml new file mode 100644 index 000000000..e7e644f71 --- /dev/null +++ b/doc/fr/autogen/relay_commands.xml @@ -0,0 +1,15 @@ + + + +/relay + +contrôle du relai + +Ouverture du tampon avec la liste des clients pour le relai + + diff --git a/doc/fr/autogen/relay_infos.xml b/doc/fr/autogen/relay_infos.xml new file mode 100644 index 000000000..9e9834a12 --- /dev/null +++ b/doc/fr/autogen/relay_infos.xml @@ -0,0 +1,13 @@ + + + + + infolist + relay + liste des clients pour le relai + diff --git a/doc/fr/autogen/relay_options.xml b/doc/fr/autogen/relay_options.xml new file mode 100644 index 000000000..77bfc3e09 --- /dev/null +++ b/doc/fr/autogen/relay_options.xml @@ -0,0 +1,118 @@ + + + +relay.color.status_active: couleur du texte pour le statut "connecté" + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: lightblue) + + + +relay.color.status_auth_failed: couleur du texte pour le statut "échec auth" + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: lightred) + + + +relay.color.status_connecting: couleur du texte pour le statut "connexion" + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: yellow) + + + +relay.color.status_disconnected: couleur du texte pour le statut "déconnecté" + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: lightred) + + + +relay.color.status_waiting_auth: couleur du texte pour le statut "attente auth" + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: brown) + + + +relay.color.text: couleur du texte + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: default) + + + +relay.color.text_bg: couleur du fond + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: default) + + + +relay.color.text_selected: couleur du texte pour la ligne client sélectionnée + + + type: couleur + + + valeurs: un nom de couleur (valeur par défaut: white) + + + +relay.look.auto_open_buffer: ouvrir automatiquement le tampon des clients lorsqu'un nouveau client est ajouté à la liste + + + type: booléen + + + valeurs: on, off (valeur par défaut: on) + + + +relay.network.listen_port_range: numéro de port (ou intervalle de ports) sur lesquels écoute l'extension relay (syntaxe: un port simple, par exemple 5000, un intervalle de ports, par exemple 5000-5015) + + + type: chaîne + + + valeurs: toute chaîne (valeur par défaut: '22373-22400') + + + +relay.network.timeout: délai d'attente pour la requête relai (en secondes) + + + type: entier + + + valeurs: 5 .. 2147483647 (valeur par défaut: 300) + + + diff --git a/doc/include_autogen.xml b/doc/include_autogen.xml index e7dafb9dc..b4098dc8b 100644 --- a/doc/include_autogen.xml +++ b/doc/include_autogen.xml @@ -10,6 +10,7 @@ + @@ -21,6 +22,7 @@ + @@ -30,5 +32,6 @@ + diff --git a/po/POTFILES.in b/po/POTFILES.in index c0f4d92bb..b4e0587f1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -148,6 +148,22 @@ ./src/plugins/plugin-config.c ./src/plugins/plugin-config.h ./src/plugins/plugin.h +./src/plugins/relay/relay-buffer.c +./src/plugins/relay/relay-buffer.h +./src/plugins/relay/relay.c +./src/plugins/relay/relay-client.c +./src/plugins/relay/relay-client.h +./src/plugins/relay/relay-command.c +./src/plugins/relay/relay-command.h +./src/plugins/relay/relay-config.c +./src/plugins/relay/relay-config.h +./src/plugins/relay/relay.h +./src/plugins/relay/relay-info.c +./src/plugins/relay/relay-info.h +./src/plugins/relay/relay-network.c +./src/plugins/relay/relay-network.h +./src/plugins/relay/relay-upgrade.c +./src/plugins/relay/relay-upgrade.h ./src/plugins/scripts/lua/weechat-lua-api.c ./src/plugins/scripts/lua/weechat-lua-api.h ./src/plugins/scripts/lua/weechat-lua.c diff --git a/po/cs.po b/po/cs.po index 901ff682a..ff2d454be 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: 2008-09-17 16:19+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1827,6 +1827,22 @@ msgstr "uživatelské jméno pro proxy server" msgid "password for proxy server" msgstr "heslo pro proxy server" +msgid "bytes" +msgstr "bajtů" + +msgid "KB" +msgstr "KB" + +msgid "MB" +msgstr "MB" + +msgid "GB" +msgstr "GB" + +#, fuzzy +msgid "byte" +msgstr "bajtů" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%s nemohu vytvořit soubor \"%s\"\n" @@ -4367,6 +4383,161 @@ msgstr "Plugin \"%s\" odebrán.\n" msgid "%sError: plugin \"%s\" not found" msgstr "%s plugin \"%s\" nenalezen\n" +msgid "Actions (letter+enter):" +msgstr "Akce (písmeno+enter):" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr " [R] Odebrat" + +#, fuzzy +msgid " [P] Purge finished" +msgstr " [P] Pročistit staré DCC" + +#, fuzzy +msgid " [Q] Close this buffer" +msgstr " [Q] Zavřít DCC pohled" + +#, fuzzy, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s%s je pryč: %s\n" + +#, fuzzy, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "DCC: soubor %s%s%s" + +msgid "List of clients for relay" +msgstr "" + +#, fuzzy +msgid "connecting" +msgstr "Připojuji" + +#, fuzzy +msgid "waiting auth" +msgstr "Čekám" + +#, fuzzy +msgid "auth failed" +msgstr "Selhal" + +#, fuzzy +msgid "disconnected" +msgstr "připojen" + +#, fuzzy, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s chyba při zasílání dat na IRC server\n" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s nedostatek paměti pro nové DCC\n" + +#, fuzzy, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "Nemůžu zapsat log soubor \"%s\"\n" + +#, fuzzy, c-format +msgid "%s: disconnected from client @ %s" +msgstr "Odpojen od serveru!\n" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +#, fuzzy +msgid "relay control" +msgstr "ovládání xfer" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +#, fuzzy +msgid "auto open relay buffer when a new client is connecting" +msgstr "" +"automaticky otevřít xfer buffer, když je přidána nová položka do xfer seznamu" + +#, fuzzy +msgid "text color" +msgstr "barva pro text rozhovoru" + +#, fuzzy +msgid "background color" +msgstr "pozadí přezdívek" + +#, fuzzy +msgid "text color of selected client line" +msgstr "barva pro jeméno serveru" + +#, fuzzy +msgid "text color for \"connecting\" status" +msgstr "barva pro \"connecting\" status dcc" + +#, fuzzy +msgid "text color for \"waiting authentication\" status" +msgstr "barva pro \"waiting\" status dcc" + +#, fuzzy +msgid "text color for \"connected\" status" +msgstr "barva pro \"connecting\" status dcc" + +#, fuzzy +msgid "text color for \"authentication failed\" status" +msgstr "barva pro \"failed\" status dcc" + +#, fuzzy +msgid "text color for \"disconnected\" status" +msgstr "barva pro \"connecting\" status dcc" + +#, fuzzy +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"omezit odchozí dcc pro používaní portů pouze v zadaném rozsahu (užitečné pro " +"NAT) (syntaxe: samostatný port, např. 5000 nebo rozsah portů např. 5000-" +"5015, prázdná hodnota znamená jakýkoliv port)" + +#, fuzzy +msgid "list of relay clients" +msgstr "Seznam pro aliasy:\n" + +#, fuzzy, c-format +msgid "%s%s: cannot accept client" +msgstr "%s nemohu vytvořit soket\n" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s nemůžu najít dostupný port pro DCC\n" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4605,38 +4776,12 @@ msgstr "%s nemohu vytvořit server\n" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "Nemůžu zapsat log soubor \"%s\"\n" -msgid "bytes" -msgstr "bajtů" - -msgid "KB" -msgstr "KB" - -msgid "MB" -msgstr "MB" - -msgid "GB" -msgstr "GB" - -msgid "Actions (letter+enter):" -msgstr "Akce (písmeno+enter):" - msgid " [A] Accept" msgstr " [A] Akceptovat" msgid " [C] Cancel" msgstr " [C] Storno" -msgid " [R] Remove" -msgstr " [R] Odebrat" - -#, fuzzy -msgid " [P] Purge finished" -msgstr " [P] Pročistit staré DCC" - -#, fuzzy -msgid " [Q] Close xfer list" -msgstr " [Q] Zavřít DCC pohled" - msgid "xfer chat" msgstr "xfer chat" @@ -4651,10 +4796,6 @@ msgstr "vyčisti hotlist" msgid "waiting" msgstr "Čekám" -#, fuzzy -msgid "connecting" -msgstr "Připojuji" - #, fuzzy msgid "active" msgstr "Aktivní" @@ -4827,8 +4968,12 @@ msgstr "Žádný xfer" msgid "xfer control" msgstr "ovládání xfer" -msgid "Open buffer with xfer list" -msgstr "Otevřené buffery s xfer seznamem" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4837,14 +4982,6 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "velikost ukazatele průběhu ve znacích (0 pro vypnutí ukazatele)" -#, fuzzy -msgid "text color" -msgstr "barva pro text rozhovoru" - -#, fuzzy -msgid "background color" -msgstr "pozadí přezdívek" - #, fuzzy msgid "text color of selected xfer line" msgstr "barva pro jeméno serveru" @@ -4853,10 +4990,6 @@ msgstr "barva pro jeméno serveru" msgid "text color for \"waiting\" status" msgstr "barva pro \"waiting\" status dcc" -#, fuzzy -msgid "text color for \"connecting\" status" -msgstr "barva pro \"connecting\" status dcc" - #, fuzzy msgid "text color for \"active\" status" msgstr "barva pro \"active\" status dcc" @@ -4991,6 +5124,29 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s chybí argument pro volbu \"%s\"\n" +#, fuzzy +#~ msgid "timeout for relay request (in seconds)" +#~ msgstr "časový limit pro dcc požadavek (v sekundách)" + +#, fuzzy +#~ msgid "Open buffer with relay clients list" +#~ msgstr "Otevřené buffery s xfer seznamem" + +#~ msgid "Open buffer with xfer list" +#~ msgstr "Otevřené buffery s xfer seznamem" + +#, fuzzy +#~ msgid "%s%s: disconnecting client @ %s" +#~ msgstr "%s: Navazuji nové spojení se serverem za %d sekund\n" + +#, fuzzy +#~ msgid "%s%s: cannot bind socket" +#~ msgstr "%s nemohu vytvořit soket\n" + +#, fuzzy +#~ msgid " [Q] Close client list" +#~ msgstr " [Q] Zavřít DCC pohled" + #, fuzzy #~ msgid "use a proxy server" #~ msgstr "uživatelské jméno pro proxy server" @@ -5153,10 +5309,6 @@ msgstr "%s chybí argument pro volbu \"%s\"\n" #~ msgid "Saved buffers layout:" #~ msgstr "Seznam bufferů:" -#, fuzzy -#~ msgid "%s: disconnected from server" -#~ msgstr "Odpojen od serveru!\n" - #, fuzzy #~ msgid "%s: connecting to server %s/%d%s%s..." #~ msgstr "%s: připojuji se k serveru %s:%d%s%s...\n" diff --git a/po/de.po b/po/de.po index 2c79be8f0..ca9c8b912 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -1846,6 +1846,22 @@ msgstr "Benutzername für die Proxyverbindung" msgid "password for proxy server" msgstr "Passwort für die Proxyverbindung" +msgid "bytes" +msgstr "Bytes" + +msgid "KB" +msgstr "KB" + +msgid "MB" +msgstr "MB" + +msgid "GB" +msgstr "GB" + +#, fuzzy +msgid "byte" +msgstr "Bytes" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "Aktualisiere WeeChat...\n" @@ -4343,6 +4359,159 @@ msgstr "Plugin \"%s\" entladen.\n" msgid "%sError: plugin \"%s\" not found" msgstr "%s Plugin \"%s\" nicht gefunden\n" +msgid "Actions (letter+enter):" +msgstr "" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr " [R] entfernen" + +#, fuzzy +msgid " [P] Purge finished" +msgstr " [P] alte DCCs entfernen" + +#, fuzzy +msgid " [Q] Close this buffer" +msgstr " [Q] DCC-Ansicht schließen" + +#, fuzzy, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s%s ist abwesend: %s\n" + +#, fuzzy, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "DCC: Datei %s%s%s" + +msgid "List of clients for relay" +msgstr "" + +#, fuzzy +msgid "connecting" +msgstr "verbinden" + +#, fuzzy +msgid "waiting auth" +msgstr "warten" + +#, fuzzy +msgid "auth failed" +msgstr "fehlg." + +#, fuzzy +msgid "disconnected" +msgstr "verbunden" + +#, fuzzy, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s Fehler beim Senden von Daten an den IRC-Server\n" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s nicht genug Speicher für neuen DCC\n" + +#, fuzzy, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "Kann das Logfile nicht schreiben\n" + +#, fuzzy, c-format +msgid "%s: disconnected from client @ %s" +msgstr "Vom Server getrennt!\n" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +msgid "relay control" +msgstr "" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" + +#, fuzzy +msgid "text color" +msgstr "Farbe vom Chat-Text" + +#, fuzzy +msgid "background color" +msgstr "Hintergrundfarbe der Nicknames" + +#, fuzzy +msgid "text color of selected client line" +msgstr "Farbe des Servernamens" + +#, fuzzy +msgid "text color for \"connecting\" status" +msgstr "Farbe des DCC-Status 'verbinden'" + +#, fuzzy +msgid "text color for \"waiting authentication\" status" +msgstr "Farbe des DCC-Status 'warten'" + +#, fuzzy +msgid "text color for \"connected\" status" +msgstr "Farbe des DCC-Status 'verbinden'" + +#, fuzzy +msgid "text color for \"authentication failed\" status" +msgstr "Farbe des DCC-Status 'fehlgeschlagen'" + +#, fuzzy +msgid "text color for \"disconnected\" status" +msgstr "Farbe des DCC-Status 'verbinden'" + +#, fuzzy +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"beschränkt ausgehenden DCC auf die ausschließliche Benutzung von Ports in " +"einem vorgegebenen Bereich (hilfreich bei NAT) (Syntax: ein einzelner Port, " +"z.B. 5000, oder eine Port-Bereich, z.B. 5000-5015,wenn kein Bereich " +"angegeben ist, ist jeder Port möglich)" + +#, fuzzy +msgid "list of relay clients" +msgstr "Liste der Aliases:\n" + +#, fuzzy, c-format +msgid "%s%s: cannot accept client" +msgstr "%s Socket konnte nicht angelegt werden\n" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s kann keinen freien Port für DCC ermitteln\n" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4573,38 +4742,12 @@ msgstr "%s kann den Server nicht anlegen\n" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "Kann das Logfile nicht schreiben\n" -msgid "bytes" -msgstr "Bytes" - -msgid "KB" -msgstr "KB" - -msgid "MB" -msgstr "MB" - -msgid "GB" -msgstr "GB" - -msgid "Actions (letter+enter):" -msgstr "" - msgid " [A] Accept" msgstr " [A] annehmen" msgid " [C] Cancel" msgstr " [C] abbrechen" -msgid " [R] Remove" -msgstr " [R] entfernen" - -#, fuzzy -msgid " [P] Purge finished" -msgstr " [P] alte DCCs entfernen" - -#, fuzzy -msgid " [Q] Close xfer list" -msgstr " [Q] DCC-Ansicht schließen" - msgid "xfer chat" msgstr "" @@ -4619,10 +4762,6 @@ msgstr "Hotlist leeren" msgid "waiting" msgstr "warten" -#, fuzzy -msgid "connecting" -msgstr "verbinden" - #, fuzzy msgid "active" msgstr "aktiv" @@ -4793,9 +4932,12 @@ msgstr "Kein Server.\n" msgid "xfer control" msgstr "" -#, fuzzy -msgid "Open buffer with xfer list" -msgstr "Offene Puffer:\n" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4803,14 +4945,6 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "" -#, fuzzy -msgid "text color" -msgstr "Farbe vom Chat-Text" - -#, fuzzy -msgid "background color" -msgstr "Hintergrundfarbe der Nicknames" - #, fuzzy msgid "text color of selected xfer line" msgstr "Farbe des Servernamens" @@ -4819,10 +4953,6 @@ msgstr "Farbe des Servernamens" msgid "text color for \"waiting\" status" msgstr "Farbe des DCC-Status 'warten'" -#, fuzzy -msgid "text color for \"connecting\" status" -msgstr "Farbe des DCC-Status 'verbinden'" - #, fuzzy msgid "text color for \"active\" status" msgstr "Farbe des DCC-Status 'aktiv'" @@ -4957,6 +5087,30 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" +#, fuzzy +#~ msgid "timeout for relay request (in seconds)" +#~ msgstr "DCC-Timeout in Sekunden" + +#, fuzzy +#~ msgid "Open buffer with relay clients list" +#~ msgstr "Offene Puffer:\n" + +#, fuzzy +#~ msgid "Open buffer with xfer list" +#~ msgstr "Offene Puffer:\n" + +#, fuzzy +#~ msgid "%s%s: disconnecting client @ %s" +#~ msgstr "%s: Neuverbinden in %d Sekunden\n" + +#, fuzzy +#~ msgid "%s%s: cannot bind socket" +#~ msgstr "%s Socket konnte nicht angelegt werden\n" + +#, fuzzy +#~ msgid " [Q] Close client list" +#~ msgstr " [Q] DCC-Ansicht schließen" + #, fuzzy #~ msgid "use a proxy server" #~ msgstr "Benutzername für die Proxyverbindung" @@ -5109,10 +5263,6 @@ msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #~ msgid "-MORE-" #~ msgstr "-MEHR-" -#, fuzzy -#~ msgid "%s: disconnected from server" -#~ msgstr "Vom Server getrennt!\n" - #, fuzzy #~ msgid "%s: connecting to server %s/%d%s%s..." #~ msgstr "%s: verbinden zu Server %s:%d%s%s...\n" diff --git a/po/es.po b/po/es.po index ca036e932..a4e3bfcab 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -1827,6 +1827,22 @@ msgstr "nombre de usuario para el servidor proxy" msgid "password for proxy server" msgstr "contraseña para el servidor proxy" +msgid "bytes" +msgstr "bytes" + +msgid "KB" +msgstr "" + +msgid "MB" +msgstr "" + +msgid "GB" +msgstr "" + +#, fuzzy +msgid "byte" +msgstr "bytes" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "Actualizando Weechat...\n" @@ -4344,6 +4360,158 @@ msgstr "Plugin \"%s\" descargado.\n" msgid "%sError: plugin \"%s\" not found" msgstr "%s plugin \"%s\" no encontrado\n" +msgid "Actions (letter+enter):" +msgstr "" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr " [R] Eliminar" + +#, fuzzy +msgid " [P] Purge finished" +msgstr " [P] Purgar los viejos DCC" + +#, fuzzy +msgid " [Q] Close this buffer" +msgstr " [Q] Cerrar la vista DCC" + +#, fuzzy, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s%s está ausente: %s\n" + +#, fuzzy, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "DCC: fichero %s%s%s" + +msgid "List of clients for relay" +msgstr "" + +#, fuzzy +msgid "connecting" +msgstr "Conectando" + +#, fuzzy +msgid "waiting auth" +msgstr "Esperando" + +#, fuzzy +msgid "auth failed" +msgstr "Falló" + +#, fuzzy +msgid "disconnected" +msgstr "conectado" + +#, fuzzy, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s error enviando datos al servidor IRC\n" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s no hay memoria suficiente para un nuevo DCC\n" + +#, fuzzy, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "No es posible escribir un fichero de log para un búfer\n" + +#, fuzzy, c-format +msgid "%s: disconnected from client @ %s" +msgstr "¡Desconectado del servidor!\n" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +msgid "relay control" +msgstr "" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" + +#, fuzzy +msgid "text color" +msgstr "color para el texto de conversación" + +#, fuzzy +msgid "background color" +msgstr "color de fondo para los nombres de usuario" + +#, fuzzy +msgid "text color of selected client line" +msgstr "color para el nombre del servidor" + +#, fuzzy +msgid "text color for \"connecting\" status" +msgstr "color para el estado dcc \"conectando\"" + +#, fuzzy +msgid "text color for \"waiting authentication\" status" +msgstr "color para el estado dcc \"esperando\"" + +#, fuzzy +msgid "text color for \"connected\" status" +msgstr "color para el estado dcc \"conectando\"" + +#, fuzzy +msgid "text color for \"authentication failed\" status" +msgstr "color para el estado dcc \"fallo\"" + +#, fuzzy +msgid "text color for \"disconnected\" status" +msgstr "color para el estado dcc \"conectando\"" + +#, fuzzy +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"restringe el dcc de salida a utilizar únicamente los puertos del rango " +"especificado (útil para NAT) (sintaxis: un puerto simple, e.g. 5000, o un " +"rango de puertos, e.g. 5000-5015, un valor vacío significa cualquier puerto)" + +#, fuzzy +msgid "list of relay clients" +msgstr "Lista de alias:\n" + +#, fuzzy, c-format +msgid "%s%s: cannot accept client" +msgstr "%s no ha sido posible crear el socket\n" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s no puede encontrar un puerto disponible para el DCC\n" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4573,38 +4741,12 @@ msgstr "%s no es posible crear el servidor\n" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "No es posible escribir un fichero de log para un búfer\n" -msgid "bytes" -msgstr "bytes" - -msgid "KB" -msgstr "" - -msgid "MB" -msgstr "" - -msgid "GB" -msgstr "" - -msgid "Actions (letter+enter):" -msgstr "" - msgid " [A] Accept" msgstr " [A] Aceptar" msgid " [C] Cancel" msgstr " [C] Cancelar" -msgid " [R] Remove" -msgstr " [R] Eliminar" - -#, fuzzy -msgid " [P] Purge finished" -msgstr " [P] Purgar los viejos DCC" - -#, fuzzy -msgid " [Q] Close xfer list" -msgstr " [Q] Cerrar la vista DCC" - msgid "xfer chat" msgstr "" @@ -4619,10 +4761,6 @@ msgstr "limpiar hotlist" msgid "waiting" msgstr "Esperando" -#, fuzzy -msgid "connecting" -msgstr "Conectando" - #, fuzzy msgid "active" msgstr "Activo" @@ -4795,9 +4933,12 @@ msgstr "Ningún servidor.\n" msgid "xfer control" msgstr "" -#, fuzzy -msgid "Open buffer with xfer list" -msgstr "Búfers abiertos:\n" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4805,14 +4946,6 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "" -#, fuzzy -msgid "text color" -msgstr "color para el texto de conversación" - -#, fuzzy -msgid "background color" -msgstr "color de fondo para los nombres de usuario" - #, fuzzy msgid "text color of selected xfer line" msgstr "color para el nombre del servidor" @@ -4821,10 +4954,6 @@ msgstr "color para el nombre del servidor" msgid "text color for \"waiting\" status" msgstr "color para el estado dcc \"esperando\"" -#, fuzzy -msgid "text color for \"connecting\" status" -msgstr "color para el estado dcc \"conectando\"" - #, fuzzy msgid "text color for \"active\" status" msgstr "color para el estado dcc \"activo\"" @@ -4962,6 +5091,30 @@ msgstr "%s no es posible crear el servidor\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s falta un argumento para la opción --dir\n" +#, fuzzy +#~ msgid "timeout for relay request (in seconds)" +#~ msgstr "tiempo de espera para la petición dcc (en segundos)" + +#, fuzzy +#~ msgid "Open buffer with relay clients list" +#~ msgstr "Búfers abiertos:\n" + +#, fuzzy +#~ msgid "Open buffer with xfer list" +#~ msgstr "Búfers abiertos:\n" + +#, fuzzy +#~ msgid "%s%s: disconnecting client @ %s" +#~ msgstr "%s: Reconexión al servidor en %d segundos\n" + +#, fuzzy +#~ msgid "%s%s: cannot bind socket" +#~ msgstr "%s no ha sido posible crear el socket\n" + +#, fuzzy +#~ msgid " [Q] Close client list" +#~ msgstr " [Q] Cerrar la vista DCC" + #, fuzzy #~ msgid "use a proxy server" #~ msgstr "nombre de usuario para el servidor proxy" @@ -5110,10 +5263,6 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgid "-MORE-" #~ msgstr "-MÁS-" -#, fuzzy -#~ msgid "%s: disconnected from server" -#~ msgstr "¡Desconectado del servidor!\n" - #, fuzzy #~ msgid "%s: connecting to server %s/%d%s%s..." #~ msgstr "%s: conectando al servidor %s:%d%s%s...\n" diff --git a/po/fr.po b/po/fr.po index 10ba29a55..c7699115e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" -"PO-Revision-Date: 2008-11-23 22:46+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" +"PO-Revision-Date: 2008-12-10 17:02+0100\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -1910,6 +1910,21 @@ msgstr "nom d'utilisateur pour le serveur proxy" msgid "password for proxy server" msgstr "mot de passe pour le serveur proxy" +msgid "bytes" +msgstr "octets" + +msgid "KB" +msgstr "Ko" + +msgid "MB" +msgstr "Mo" + +msgid "GB" +msgstr "Go" + +msgid "byte" +msgstr "octet" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "%sErreur de mise à jour de WeeChat avec le fichier \"%s\":" @@ -4506,6 +4521,151 @@ msgstr "Extension \"%s\" déchargée" msgid "%sError: plugin \"%s\" not found" msgstr "%sErreur: extension \"%s\" non trouvée" +msgid "Actions (letter+enter):" +msgstr "Actions (lettre+entrée):" + +msgid " [D] Disconnect" +msgstr " [D] Déconnecter" + +msgid " [R] Remove" +msgstr " [R] Retirer" + +msgid " [P] Purge finished" +msgstr " [P] Purger terminés" + +msgid " [Q] Close this buffer" +msgstr " [Q] Fermer ce tampon" + +#, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s[%s%s%s%s] %s (démarré le: %s)" + +#, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "%s%-26s reçu: %s, envoyé: %s" + +msgid "List of clients for relay" +msgstr "Liste des clients pour le relai" + +msgid "connecting" +msgstr "connexion" + +msgid "waiting auth" +msgstr "attente auth" + +msgid "auth failed" +msgstr "échec auth" + +msgid "disconnected" +msgstr "déconnecté" + +#, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s%s: erreur d'envoi de données au client %s" + +#, c-format +msgid "%s: new client @ %s" +msgstr "%s: nouveau client @ %s" + +#, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s%s: pas assez de mémoire pour un nouveau client" + +#, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "%s%s: l'authentification a échoué avec le client @ %s" + +#, c-format +msgid "%s: disconnected from client @ %s" +msgstr "%s: déconnecté du client @ %s" + +msgid "Clients for relay:" +msgstr "Clients pour le relai:" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" +"%3d. %s, démarré le: %s, dernière activité: %s, octets: %lu reçus, %lu " +"envoyés" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "%3d. %s, démarré le: %s" + +msgid "No client for relay" +msgstr "Pas de client pour le relai" + +msgid "relay control" +msgstr "contrôle du relai" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" +" list: liste les clients pour le relai\n" +"listfull: liste les clients pour le relai (verbeux)\n" +"\n" +"Sans paramètre, cette commande ouvre le tampon avec la liste des clients " +"pour le relai." + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" +"ouvrir automatiquement le tampon des clients pour le relai lorsqu'un nouveau " +"client est ajouté à la liste" + +msgid "text color" +msgstr "couleur du texte" + +msgid "background color" +msgstr "couleur du fond" + +msgid "text color of selected client line" +msgstr "couleur du texte pour la ligne client sélectionnée" + +msgid "text color for \"connecting\" status" +msgstr "couleur du texte pour le statut \"connexion\"" + +msgid "text color for \"waiting authentication\" status" +msgstr "couleur du texte pour le statut \"attente auth\"" + +msgid "text color for \"connected\" status" +msgstr "couleur du texte pour le statut \"connecté\"" + +msgid "text color for \"authentication failed\" status" +msgstr "couleur du texte pour le statut \"échec auth\"" + +msgid "text color for \"disconnected\" status" +msgstr "couleur du texte pour le statut \"déconnecté\"" + +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"numéro de port (ou intervalle de ports) sur lesquels écoute l'extension " +"relay (syntaxe: un port simple, par exemple 5000, un intervalle de ports, " +"par exemple 5000-5015)" + +msgid "list of relay clients" +msgstr "liste des clients pour le relai" + +#, c-format +msgid "%s%s: cannot accept client" +msgstr "%s%s: impossible d'accepter le client" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "%s%s: l'option \"listen_port_range\" n'est pas définie" + +#, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s%s: impossible de trouver un port disponible pour écouter" + +#, c-format +msgid "%s: listening on port %d" +msgstr "%s: écoute sur le port %d" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4746,36 +4906,12 @@ msgstr "%s%s: impossible de créer l'interpréteur" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "%s%s: erreur d'analyse du fichier \"%s\": %s" -msgid "bytes" -msgstr "octets" - -msgid "KB" -msgstr "Ko" - -msgid "MB" -msgstr "Mo" - -msgid "GB" -msgstr "Go" - -msgid "Actions (letter+enter):" -msgstr "Actions (lettre+entrée):" - msgid " [A] Accept" msgstr " [A] Accepter" msgid " [C] Cancel" msgstr " [C] Annuler" -msgid " [R] Remove" -msgstr " [R] Retirer" - -msgid " [P] Purge finished" -msgstr " [P] Purger terminés" - -msgid " [Q] Close xfer list" -msgstr " [Q] Fermer la liste xfer" - msgid "xfer chat" msgstr "discussion xfer" @@ -4788,9 +4924,6 @@ msgstr "Liste Xfer" msgid "waiting" msgstr "attente" -msgid "connecting" -msgstr "connexion" - msgid "active" msgstr "actif" @@ -4953,8 +5086,16 @@ msgstr "Pas de xfer" msgid "xfer control" msgstr "contrôle xfer" -msgid "Open buffer with xfer list" -msgstr "Ouverture du tampon avec la liste des xfers" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" +" list: liste les xfer\n" +"listfull: liste les xfer (verbeux)\n" +"\n" +"Sans paramètre, cette commande ouvre le tampon avec la liste des xfer." msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4966,21 +5107,12 @@ msgstr "" "taille de la barre de progression, en caractères (si 0, la barre de " "progression est désactivée)" -msgid "text color" -msgstr "couleur du texte" - -msgid "background color" -msgstr "couleur du fond" - msgid "text color of selected xfer line" msgstr "couleur du texte pour la ligne xfer sélectionnée" msgid "text color for \"waiting\" status" msgstr "couleur du texte pour le statut \"en attente\"" -msgid "text color for \"connecting\" status" -msgstr "couleur du texte pour le statut \"connexion\"" - msgid "text color for \"active\" status" msgstr "couleur du texte pour le statut \"actif\"" @@ -5107,42 +5239,3 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket" #, c-format msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s" - -#~ msgid "use a proxy server" -#~ msgstr "utiliser un serveur proxy" - -#~ msgid "text color for title bar" -#~ msgstr "create a socks5 proxy with username/password:" - -#~ msgid "background color for title bar" -#~ msgstr "couleur du fond pour la barre de titre" - -#~ msgid "text color for status bar" -#~ msgstr "couleur du texte pour la barre de statut" - -#~ msgid "background color for status bar" -#~ msgstr "couleur du fond pour la barre de statut" - -#~ msgid "text color for status bar delimiters" -#~ msgstr "couleur du texte pour les délimiteurs de la barre de statut" - -#~ msgid "text color for input line" -#~ msgstr "couleur du texte pour la ligne de saisie" - -#~ msgid "background color for input line" -#~ msgstr "couleur du fond pour la ligne de saisie" - -#~ msgid "text color for server name in input line" -#~ msgstr "couleur du texte pour le nom du serveur dans la ligne de saisie" - -#~ msgid "text color for channel name in input line" -#~ msgstr "couleur du texte pour le canal dans la ligne de saisie" - -#~ msgid "text color for delimiters in input line" -#~ msgstr "couleur du texte pour les délimiteurs dans la ligne de saisie" - -#~ msgid "text color for nicklist" -#~ msgstr "couleur du texte pour la liste des pseudos" - -#~ msgid "background color for nicklist" -#~ msgstr "couleur du fond pour la liste des pseudos" diff --git a/po/hu.po b/po/hu.po index 71928a75e..cfaf56785 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1855,6 +1855,22 @@ msgstr "felhasználónév a proxy szerverhez" msgid "password for proxy server" msgstr "jelszó a proxy szerverhez" +msgid "bytes" +msgstr "byte" + +msgid "KB" +msgstr "KB" + +msgid "MB" +msgstr "MB" + +msgid "GB" +msgstr "GB" + +#, fuzzy +msgid "byte" +msgstr "byte" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "WeeChat frissítése...\n" @@ -4369,6 +4385,158 @@ msgstr "A \"%s\" modul eltávolítva.\n" msgid "%sError: plugin \"%s\" not found" msgstr "%s a \"%s\" modul nem található\n" +msgid "Actions (letter+enter):" +msgstr "" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr " [R] Eltávolítás" + +#, fuzzy +msgid " [P] Purge finished" +msgstr " [P] Régi DCC törlése" + +#, fuzzy +msgid " [Q] Close this buffer" +msgstr " [Q] DCC nézet bezárása" + +#, fuzzy, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s%s távol: %s\n" + +#, fuzzy, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "DCC: fájl %s%s%s" + +msgid "List of clients for relay" +msgstr "" + +#, fuzzy +msgid "connecting" +msgstr "Kapcsolódás" + +#, fuzzy +msgid "waiting auth" +msgstr "Várakozás" + +#, fuzzy +msgid "auth failed" +msgstr "Sikertelen" + +#, fuzzy +msgid "disconnected" +msgstr "csatlakozva" + +#, fuzzy, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s adatküldési hiba az IRC szerveren\n" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s nincs elegendő memória új DCC számára\n" + +#, fuzzy, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" + +#, fuzzy, c-format +msgid "%s: disconnected from client @ %s" +msgstr "Lekapcsolódott a szerverről!\n" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +msgid "relay control" +msgstr "" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" + +#, fuzzy +msgid "text color" +msgstr "üzenetek színe" + +#, fuzzy +msgid "background color" +msgstr "nevek háttere" + +#, fuzzy +msgid "text color of selected client line" +msgstr "szerver nevének színe" + +#, fuzzy +msgid "text color for \"connecting\" status" +msgstr "\"connecting\" dcc státusz színe" + +#, fuzzy +msgid "text color for \"waiting authentication\" status" +msgstr "\"waiting\" dcc státusz színe" + +#, fuzzy +msgid "text color for \"connected\" status" +msgstr "\"connecting\" dcc státusz színe" + +#, fuzzy +msgid "text color for \"authentication failed\" status" +msgstr "\"failed\" dcc státusz színe" + +#, fuzzy +msgid "text color for \"disconnected\" status" +msgstr "\"connecting\" dcc státusz színe" + +#, fuzzy +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"korlátozza a dcc-t, hogy csak egy bizonyos tartományban lévő portokat " +"használja (NAT esetén hasznos) (szintaxis: egyetlen port, pl. 5000 vagy egy " +"port intervallum, pl. 5000-5015, üresen hagyva tetszőleges port)" + +#, fuzzy +msgid "list of relay clients" +msgstr "Aliaszok listája:\n" + +#, fuzzy, c-format +msgid "%s%s: cannot accept client" +msgstr "%s nem sikerült a csatornát létrehozni\n" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s nem sikerült elérhető portot találni a DCC-hez\n" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4599,38 +4767,12 @@ msgstr "%s nem sikerült a szervert létrehozni\n" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" -msgid "bytes" -msgstr "byte" - -msgid "KB" -msgstr "KB" - -msgid "MB" -msgstr "MB" - -msgid "GB" -msgstr "GB" - -msgid "Actions (letter+enter):" -msgstr "" - msgid " [A] Accept" msgstr " [A] Elfogadás" msgid " [C] Cancel" msgstr " [C] Mégsem" -msgid " [R] Remove" -msgstr " [R] Eltávolítás" - -#, fuzzy -msgid " [P] Purge finished" -msgstr " [P] Régi DCC törlése" - -#, fuzzy -msgid " [Q] Close xfer list" -msgstr " [Q] DCC nézet bezárása" - msgid "xfer chat" msgstr "" @@ -4645,10 +4787,6 @@ msgstr "hotlist törlése" msgid "waiting" msgstr "Várakozás" -#, fuzzy -msgid "connecting" -msgstr "Kapcsolódás" - #, fuzzy msgid "active" msgstr "Aktív" @@ -4821,9 +4959,12 @@ msgstr "Nincs szerver.\n" msgid "xfer control" msgstr "" -#, fuzzy -msgid "Open buffer with xfer list" -msgstr "Nyitott pufferek:\n" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4831,14 +4972,6 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "" -#, fuzzy -msgid "text color" -msgstr "üzenetek színe" - -#, fuzzy -msgid "background color" -msgstr "nevek háttere" - #, fuzzy msgid "text color of selected xfer line" msgstr "szerver nevének színe" @@ -4847,10 +4980,6 @@ msgstr "szerver nevének színe" msgid "text color for \"waiting\" status" msgstr "\"waiting\" dcc státusz színe" -#, fuzzy -msgid "text color for \"connecting\" status" -msgstr "\"connecting\" dcc státusz színe" - #, fuzzy msgid "text color for \"active\" status" msgstr "\"active\" dcc státusz színe" @@ -4980,6 +5109,30 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +#, fuzzy +#~ msgid "timeout for relay request (in seconds)" +#~ msgstr "dcc kérések időkorlátja (másodpercben)" + +#, fuzzy +#~ msgid "Open buffer with relay clients list" +#~ msgstr "Nyitott pufferek:\n" + +#, fuzzy +#~ msgid "Open buffer with xfer list" +#~ msgstr "Nyitott pufferek:\n" + +#, fuzzy +#~ msgid "%s%s: disconnecting client @ %s" +#~ msgstr "%s: Újracsatlakozás a szerverhez %d másodperc múlva\n" + +#, fuzzy +#~ msgid "%s%s: cannot bind socket" +#~ msgstr "%s nem sikerült a csatornát létrehozni\n" + +#, fuzzy +#~ msgid " [Q] Close client list" +#~ msgstr " [Q] DCC nézet bezárása" + #, fuzzy #~ msgid "use a proxy server" #~ msgstr "felhasználónév a proxy szerverhez" @@ -5135,10 +5288,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #~ msgid "-MORE-" #~ msgstr "-TOVÁBB-" -#, fuzzy -#~ msgid "%s: disconnected from server" -#~ msgstr "Lekapcsolódott a szerverről!\n" - #, fuzzy #~ msgid "%s: connecting to server %s/%d%s%s..." #~ msgstr "%s: csatlakozás a(z) %s:%d%s%s szerverhez...\n" diff --git a/po/ru.po b/po/ru.po index 9614a49b0..8a4e1049d 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -1858,6 +1858,22 @@ msgstr "имя пользователя, используемое при под msgid "password for proxy server" msgstr "пароль к proxy серверу" +msgid "bytes" +msgstr "байтов" + +msgid "KB" +msgstr "КБ" + +msgid "MB" +msgstr "МБ" + +msgid "GB" +msgstr "ГБ" + +#, fuzzy +msgid "byte" +msgstr "байтов" + #, fuzzy, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "Обновляю WeeChat...\n" @@ -4356,6 +4372,158 @@ msgstr "Plugin \"%s\" выгружен.\n" msgid "%sError: plugin \"%s\" not found" msgstr "%s plugin \"%s\" не найден\n" +msgid "Actions (letter+enter):" +msgstr "" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr " [R] Удалить" + +#, fuzzy +msgid " [P] Purge finished" +msgstr " [P] Очистить список" + +#, fuzzy +msgid " [Q] Close this buffer" +msgstr " [Q] Закрыть окно" + +#, fuzzy, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "%s%s%s отсутствует: %s\n" + +#, fuzzy, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "DCC: файл %s%s%s" + +msgid "List of clients for relay" +msgstr "" + +#, fuzzy +msgid "connecting" +msgstr "Подключение" + +#, fuzzy +msgid "waiting auth" +msgstr "Ожидание" + +#, fuzzy +msgid "auth failed" +msgstr "Неудача" + +#, fuzzy +msgid "disconnected" +msgstr "подключен" + +#, fuzzy, c-format +msgid "%s%s: error sending data to client %s" +msgstr "%s ошибка при отправке данных IRC серверу\n" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: not enough memory for new client" +msgstr "%s недостаточно памяти для нового DCC\n" + +#, fuzzy, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "Не могу записать лог-файл \"%s\"\n" + +#, fuzzy, c-format +msgid "%s: disconnected from client @ %s" +msgstr "Отключен от сервера!\n" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +msgid "relay control" +msgstr "" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" + +#, fuzzy +msgid "text color" +msgstr "цвет чата" + +#, fuzzy +msgid "background color" +msgstr "фон ников" + +#, fuzzy +msgid "text color of selected client line" +msgstr "цвет названия сервера" + +#, fuzzy +msgid "text color for \"connecting\" status" +msgstr "цвет \"соединения\" в окне DCC" + +#, fuzzy +msgid "text color for \"waiting authentication\" status" +msgstr "цвет \"ожидания\" в окне DCC" + +#, fuzzy +msgid "text color for \"connected\" status" +msgstr "цвет \"соединения\" в окне DCC" + +#, fuzzy +msgid "text color for \"authentication failed\" status" +msgstr "цвет \"неудачных\" в окне DCC" + +#, fuzzy +msgid "text color for \"disconnected\" status" +msgstr "цвет \"соединения\" в окне DCC" + +#, fuzzy +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" +"привязывает исходящие DCС соединения к определённому интервалу портов " +"(полезно для NAT) (синтаксис: определённый порт, например 5000, или интервал " +"портов, например 5000-5015, пустое значение означает любой порт)" + +#, fuzzy +msgid "list of relay clients" +msgstr "Список сокращений:\n" + +#, fuzzy, c-format +msgid "%s%s: cannot accept client" +msgstr "%s невозможно создать сокет\n" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, fuzzy, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "%s не могу найти свободный порт для DCC\n" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4586,38 +4754,12 @@ msgstr "%s не могу создать сервер\n" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "Не могу записать лог-файл \"%s\"\n" -msgid "bytes" -msgstr "байтов" - -msgid "KB" -msgstr "КБ" - -msgid "MB" -msgstr "МБ" - -msgid "GB" -msgstr "ГБ" - -msgid "Actions (letter+enter):" -msgstr "" - msgid " [A] Accept" msgstr " [A] Принять" msgid " [C] Cancel" msgstr " [C] Отменить" -msgid " [R] Remove" -msgstr " [R] Удалить" - -#, fuzzy -msgid " [P] Purge finished" -msgstr " [P] Очистить список" - -#, fuzzy -msgid " [Q] Close xfer list" -msgstr " [Q] Закрыть окно" - msgid "xfer chat" msgstr "" @@ -4632,10 +4774,6 @@ msgstr "очистить хотлист" msgid "waiting" msgstr "Ожидание" -#, fuzzy -msgid "connecting" -msgstr "Подключение" - #, fuzzy msgid "active" msgstr "Активно" @@ -4801,9 +4939,12 @@ msgstr "Нет сервера.\n" msgid "xfer control" msgstr "" -#, fuzzy -msgid "Open buffer with xfer list" -msgstr "Открытые буферы:\n" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." +msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" msgstr "" @@ -4811,14 +4952,6 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "" -#, fuzzy -msgid "text color" -msgstr "цвет чата" - -#, fuzzy -msgid "background color" -msgstr "фон ников" - #, fuzzy msgid "text color of selected xfer line" msgstr "цвет названия сервера" @@ -4827,10 +4960,6 @@ msgstr "цвет названия сервера" msgid "text color for \"waiting\" status" msgstr "цвет \"ожидания\" в окне DCC" -#, fuzzy -msgid "text color for \"connecting\" status" -msgstr "цвет \"соединения\" в окне DCC" - #, fuzzy msgid "text color for \"active\" status" msgstr "цвет \"активности\" в окне DCC" @@ -4962,6 +5091,30 @@ msgstr "%s DCC: не могу установить неблокирующий р msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s нет аргумента для параметра \"%s\"\n" +#, fuzzy +#~ msgid "timeout for relay request (in seconds)" +#~ msgstr "таймаут запросов dcc-соединений (в секундах)" + +#, fuzzy +#~ msgid "Open buffer with relay clients list" +#~ msgstr "Открытые буферы:\n" + +#, fuzzy +#~ msgid "Open buffer with xfer list" +#~ msgstr "Открытые буферы:\n" + +#, fuzzy +#~ msgid "%s%s: disconnecting client @ %s" +#~ msgstr "%s: Повторное подключение к серверу через %d секунд\n" + +#, fuzzy +#~ msgid "%s%s: cannot bind socket" +#~ msgstr "%s невозможно создать сокет\n" + +#, fuzzy +#~ msgid " [Q] Close client list" +#~ msgstr " [Q] Закрыть окно" + #, fuzzy #~ msgid "use a proxy server" #~ msgstr "имя пользователя, используемое при подключения к proxy-серверу" @@ -5117,10 +5270,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #~ msgid "-MORE-" #~ msgstr "-ДАЛЬШЕ-" -#, fuzzy -#~ msgid "%s: disconnected from server" -#~ msgstr "Отключен от сервера!\n" - #, fuzzy #~ msgid "%s: connecting to server %s/%d%s%s..." #~ msgstr "%s: поключаюсь к серверу %s:%d%s%s...\n" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index 3ea49cf37..55d082d04 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -149,6 +149,22 @@ SET(WEECHAT_SOURCES ./src/plugins/plugin-config.c ./src/plugins/plugin-config.h ./src/plugins/plugin.h +./src/plugins/relay/relay-buffer.c +./src/plugins/relay/relay-buffer.h +./src/plugins/relay/relay.c +./src/plugins/relay/relay-client.c +./src/plugins/relay/relay-client.h +./src/plugins/relay/relay-command.c +./src/plugins/relay/relay-command.h +./src/plugins/relay/relay-config.c +./src/plugins/relay/relay-config.h +./src/plugins/relay/relay.h +./src/plugins/relay/relay-info.c +./src/plugins/relay/relay-info.h +./src/plugins/relay/relay-network.c +./src/plugins/relay/relay-network.h +./src/plugins/relay/relay-upgrade.c +./src/plugins/relay/relay-upgrade.h ./src/plugins/scripts/lua/weechat-lua-api.c ./src/plugins/scripts/lua/weechat-lua-api.h ./src/plugins/scripts/lua/weechat-lua.c diff --git a/po/weechat.pot b/po/weechat.pot index 0055eaf90..d6fcb3409 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: 2008-11-23 22:44+0100\n" +"POT-Creation-Date: 2008-12-10 17:02+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1561,6 +1561,21 @@ msgstr "" msgid "password for proxy server" msgstr "" +msgid "bytes" +msgstr "" + +msgid "KB" +msgstr "" + +msgid "MB" +msgstr "" + +msgid "GB" +msgstr "" + +msgid "byte" +msgstr "" + #, c-format msgid "%sError upgrading WeeChat with file \"%s\":" msgstr "" @@ -3781,6 +3796,139 @@ msgstr "" msgid "%sError: plugin \"%s\" not found" msgstr "" +msgid "Actions (letter+enter):" +msgstr "" + +msgid " [D] Disconnect" +msgstr "" + +msgid " [R] Remove" +msgstr "" + +msgid " [P] Purge finished" +msgstr "" + +msgid " [Q] Close this buffer" +msgstr "" + +#, c-format +msgid "%s%s[%s%s%s%s] %s (started on: %s)" +msgstr "" + +#, c-format +msgid "%s%-26s received: %s, sent: %s" +msgstr "" + +msgid "List of clients for relay" +msgstr "" + +msgid "connecting" +msgstr "" + +msgid "waiting auth" +msgstr "" + +msgid "auth failed" +msgstr "" + +msgid "disconnected" +msgstr "" + +#, c-format +msgid "%s%s: error sending data to client %s" +msgstr "" + +#, c-format +msgid "%s: new client @ %s" +msgstr "" + +#, c-format +msgid "%s%s: not enough memory for new client" +msgstr "" + +#, c-format +msgid "%s%s: authentication failed with client @ %s" +msgstr "" + +#, c-format +msgid "%s: disconnected from client @ %s" +msgstr "" + +msgid "Clients for relay:" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s, last activity: %s, bytes: %lu recv, %lu sent" +msgstr "" + +#, c-format +msgid "%3d. %s, started on: %s" +msgstr "" + +msgid "No client for relay" +msgstr "" + +msgid "relay control" +msgstr "" + +msgid "" +" list: list relay clients\n" +"listfull: list relay clients (verbose)\n" +"\n" +"Without argument, this command opens buffer with list of relay clients." +msgstr "" + +msgid "auto open relay buffer when a new client is connecting" +msgstr "" + +msgid "text color" +msgstr "" + +msgid "background color" +msgstr "" + +msgid "text color of selected client line" +msgstr "" + +msgid "text color for \"connecting\" status" +msgstr "" + +msgid "text color for \"waiting authentication\" status" +msgstr "" + +msgid "text color for \"connected\" status" +msgstr "" + +msgid "text color for \"authentication failed\" status" +msgstr "" + +msgid "text color for \"disconnected\" status" +msgstr "" + +msgid "" +"port number (or range of ports) that relay plugin listens on (syntax: a " +"single port, ie. 5000 or a port range, ie. 5000-5015)" +msgstr "" + +msgid "list of relay clients" +msgstr "" + +#, c-format +msgid "%s%s: cannot accept client" +msgstr "" + +#, c-format +msgid "%s%s: option \"listen_port_range\" is not defined" +msgstr "" + +#, c-format +msgid "%s%s: cannot find available port for listening" +msgstr "" + +#, c-format +msgid "%s: listening on port %d" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -4004,36 +4152,12 @@ msgstr "" msgid "%s%s: error occured while parsing file \"%s\": %s" msgstr "" -msgid "bytes" -msgstr "" - -msgid "KB" -msgstr "" - -msgid "MB" -msgstr "" - -msgid "GB" -msgstr "" - -msgid "Actions (letter+enter):" -msgstr "" - msgid " [A] Accept" msgstr "" msgid " [C] Cancel" msgstr "" -msgid " [R] Remove" -msgstr "" - -msgid " [P] Purge finished" -msgstr "" - -msgid " [Q] Close xfer list" -msgstr "" - msgid "xfer chat" msgstr "" @@ -4046,9 +4170,6 @@ msgstr "" msgid "waiting" msgstr "" -msgid "connecting" -msgstr "" - msgid "active" msgstr "" @@ -4200,7 +4321,11 @@ msgstr "" msgid "xfer control" msgstr "" -msgid "Open buffer with xfer list" +msgid "" +" list: list xfer\n" +"listfull: list xfer (verbose)\n" +"\n" +"Without argument, this command opens buffer with xfer list." msgstr "" msgid "auto open xfer buffer when a new xfer is added to list" @@ -4209,21 +4334,12 @@ msgstr "" msgid "size of progress bar, in chars (if 0, progress bar is disabled)" msgstr "" -msgid "text color" -msgstr "" - -msgid "background color" -msgstr "" - msgid "text color of selected xfer line" msgstr "" msgid "text color for \"waiting\" status" msgstr "" -msgid "text color for \"connecting\" status" -msgstr "" - msgid "text color for \"active\" status" msgstr "" diff --git a/src/core/wee-string.c b/src/core/wee-string.c index cf9a0b8c4..2988b67b6 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -1244,3 +1244,39 @@ string_iconv_fprintf (FILE *file, const char *data, ...) if (buf2) free (buf2); } + +/* + * string_format_size: format a string with size and unit name (bytes, KB, MB, GB) + * note: returned value has to be free() after use + */ + +char * +string_format_size (unsigned long size) +{ + char *unit_name[] = { N_("bytes"), N_("KB"), N_("MB"), N_("GB") }; + char *unit_format[] = { "%.0f", "%.1f", "%.02f", "%.02f" }; + float unit_divide[] = { 1, 1024, 1024*1024, 1024*1024*1024 }; + char format_size[128], str_size[128]; + int num_unit; + + str_size[0] = '\0'; + + if (size < 1024*10) + num_unit = 0; + else if (size < 1024*1024) + num_unit = 1; + else if (size < 1024*1024*1024) + num_unit = 2; + else + num_unit = 3; + + snprintf (format_size, sizeof (format_size), + "%s %%s", + unit_format[num_unit]); + snprintf (str_size, sizeof (str_size), + format_size, + ((float)size) / ((float)(unit_divide[num_unit])), + (size <= 1) ? _("byte") : _(unit_name[num_unit])); + + return strdup (str_size); +} diff --git a/src/core/wee-string.h b/src/core/wee-string.h index d5042aaf8..16f3a2598 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -55,5 +55,6 @@ extern char *string_iconv_to_internal (const char *charset, const char *string); extern char *string_iconv_from_internal (const char *charset, const char *string); extern void string_iconv_fprintf (FILE *file, const char *data, ...); +extern char *string_format_size (unsigned long size); #endif /* wee-string.h */ diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index ba6c807b8..70079814c 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1156,9 +1156,6 @@ gui_buffer_clear (struct t_gui_buffer *buffer) if (!buffer) return; - /* remove buffer from hotlist */ - gui_hotlist_remove_buffer (buffer); - /* remove all lines */ gui_chat_line_free_all (buffer); diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index fabe7700f..8a98324b5 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -66,6 +66,10 @@ IF(NOT DISABLE_NOTIFY) ADD_SUBDIRECTORY( notify ) ENDIF(NOT DISABLE_NOTIFY) +IF(NOT DISABLE_RELAY) + ADD_SUBDIRECTORY( relay ) +ENDIF(NOT DISABLE_RELAY) + IF(NOT DISABLE_SCRIPTS AND NOT DISABLE_PERL AND NOT DISABLE_PYTHON AND NOT DISABLE_RUBY AND NOT DISABLE_LUA AND NOT DISABLE_TCL) ADD_SUBDIRECTORY( scripts ) ENDIF(NOT DISABLE_SCRIPTS AND NOT DISABLE_PERL AND NOT DISABLE_PYTHON AND NOT DISABLE_RUBY AND NOT DISABLE_LUA AND NOT DISABLE_TCL) diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index ffc1a20f9..e93fbb99a 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -58,6 +58,10 @@ if PLUGIN_NOTIFY notify_dir = notify endif +if PLUGIN_RELAY +relay_dir = relay +endif + if PLUGIN_PERL script_dir = scripts endif @@ -87,5 +91,5 @@ xfer_dir = xfer endif SUBDIRS = . $(alias_dir) $(aspell_dir) $(charset_dir) $(demo_dir) $(fifo_dir) \ - $(irc_dir) $(logger_dir) $(notify_dir) $(script_dir) \ + $(irc_dir) $(logger_dir) $(notify_dir) $(relay_dir) $(script_dir) \ $(trigger_dir) $(xfer_dir) diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index d023719a6..4b1c9fe7b 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -346,6 +346,7 @@ plugin_load (const char *filename) new_plugin->string_build_with_exploded = &string_build_with_exploded; new_plugin->string_split_command = &string_split_command; new_plugin->string_free_splitted_command = &string_free_splitted_command; + new_plugin->string_format_size = &string_format_size; new_plugin->utf8_has_8bits = &utf8_has_8bits; new_plugin->utf8_is_valid = &utf8_is_valid; @@ -829,9 +830,6 @@ plugin_reload_name (const char *name) if (filename) { plugin_unload (ptr_plugin); - gui_chat_printf (NULL, - _("Plugin \"%s\" unloaded"), - name); plugin_load (filename); free (filename); } diff --git a/src/plugins/relay/CMakeLists.txt b/src/plugins/relay/CMakeLists.txt new file mode 100644 index 000000000..4ad5fbce6 --- /dev/null +++ b/src/plugins/relay/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (c) 2003-2008 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +ADD_LIBRARY(relay MODULE +relay.c relay.h +relay-buffer.c relay-buffer.h +relay-client.c relay-client.h +relay-command.c relay-command.h +relay-config.c relay-config.h +relay-info.c relay-info.h +relay-network.c relay-network.h +relay-upgrade.c relay-upgrade.h) +SET_TARGET_PROPERTIES(relay PROPERTIES PREFIX "") + +TARGET_LINK_LIBRARIES(relay) + +INSTALL(TARGETS relay LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins) diff --git a/src/plugins/relay/Makefile.am b/src/plugins/relay/Makefile.am new file mode 100644 index 000000000..c2cf6e165 --- /dev/null +++ b/src/plugins/relay/Makefile.am @@ -0,0 +1,41 @@ +# Copyright (c) 2003-2008 FlashCode +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" + +libdir = ${weechat_libdir}/plugins + +lib_LTLIBRARIES = relay.la + +relay_la_SOURCES = relay.c \ + relay.h \ + relay-buffer.c \ + relay-buffer.h \ + relay-client.c \ + relay-client.h \ + relay-command.c \ + relay-command.h \ + relay-config.c \ + relay-config.h \ + relay-info.c \ + relay-info.h \ + relay-network.c \ + relay-network.h \ + relay-upgrade.c \ + relay-upgrade.h + +relau_la_LDFLAGS = -module +relay_la_LIBADD = $(RELAY_LFLAGS) diff --git a/src/plugins/relay/relay-buffer.c b/src/plugins/relay/relay-buffer.c new file mode 100644 index 000000000..36b30bc1f --- /dev/null +++ b/src/plugins/relay/relay-buffer.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-buffer.c: display clients list on relay buffer */ + + +#include +#include +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-client.h" +#include "relay-config.h" + + +struct t_gui_buffer *relay_buffer = NULL; +int relay_buffer_selected_line = 0; + + +/* + * relay_buffer_refresh: update a client in buffer and update hotlist for + * relay buffer + */ + +void +relay_buffer_refresh (const char *hotlist) +{ + struct t_relay_client *ptr_client, *client_selected; + char str_color[256], status[64], date_start[128]; + char *str_recv, *str_sent; + int i, length, line; + struct tm *date_tmp; + + if (relay_buffer) + { + weechat_buffer_clear (relay_buffer); + line = 0; + client_selected = relay_client_search_by_number (relay_buffer_selected_line); + if (client_selected) + { + weechat_printf_y (relay_buffer, 0, + "%s%s%s%s%s%s%s", + weechat_color("green"), + _("Actions (letter+enter):"), + weechat_color("lightgreen"), + /* disconnect */ + (RELAY_CLIENT_HAS_ENDED(client_selected->status)) ? + "" : _(" [D] Disconnect"), + /* remove */ + (RELAY_CLIENT_HAS_ENDED(client_selected->status)) ? + _(" [R] Remove") : "", + /* purge old */ + _(" [P] Purge finished"), + /* quit */ + _(" [Q] Close this buffer")); + } + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + snprintf (str_color, sizeof (str_color), + "%s,%s", + (line == relay_buffer_selected_line) ? + weechat_config_string (relay_config_color_text_selected) : + weechat_config_string (relay_config_color_text), + weechat_config_string (relay_config_color_text_bg)); + + snprintf (status, sizeof (status), + "%s", _(relay_client_status_string[ptr_client->status])); + length = weechat_utf8_strlen_screen (status); + if (length < 20) + { + for (i = 0; i < 20 - length; i++) + { + strcat (status, " "); + } + } + + date_tmp = localtime (&(ptr_client->start_time)); + strftime (date_start, sizeof (date_start), + "%a, %d %b %Y %H:%M:%S", date_tmp); + + /* first line with status and start time */ + weechat_printf_y (relay_buffer, (line * 2) + 2, + _("%s%s[%s%s%s%s] %s (started on: %s)"), + weechat_color(str_color), + (line == relay_buffer_selected_line) ? + "*** " : " ", + weechat_color(weechat_config_string (relay_config_color_status[ptr_client->status])), + status, + weechat_color ("reset"), + weechat_color (str_color), + ptr_client->address, + date_start); + + /* second line with bytes recv/sent */ + str_recv = weechat_string_format_size (ptr_client->bytes_recv); + str_sent = weechat_string_format_size (ptr_client->bytes_sent); + weechat_printf_y (relay_buffer, (line * 2) + 3, + _("%s%-26s received: %s, sent: %s"), + weechat_color(str_color), + " ", + (str_recv) ? str_recv : "?", + (str_sent) ? str_sent : "?"); + if (str_recv) + free (str_recv); + if (str_sent) + free (str_sent); + + line++; + } + if (hotlist) + weechat_buffer_set (relay_buffer, "hotlist", hotlist); + } +} + +/* + * relay_buffer_input_cb: callback called when user send data to client list + * buffer + */ + +int +relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer, + const char *input_data) +{ + struct t_relay_client *client, *ptr_client, *next_client; + + /* make C compiler happy */ + (void) data; + + client = relay_client_search_by_number (relay_buffer_selected_line); + + /* disconnect client */ + if (weechat_strcasecmp (input_data, "d") == 0) + { + if (client && !RELAY_CLIENT_HAS_ENDED(client->status)) + { + relay_client_disconnect (client); + relay_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + } + } + /* purge old clients */ + else if (weechat_strcasecmp (input_data, "p") == 0) + { + ptr_client = relay_clients; + while (ptr_client) + { + next_client = ptr_client->next_client; + if (RELAY_CLIENT_HAS_ENDED(ptr_client->status)) + relay_client_free (ptr_client); + ptr_client = next_client; + } + relay_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + } + /* quit relay buffer (close it) */ + else if (weechat_strcasecmp (input_data, "q") == 0) + { + weechat_buffer_close (buffer); + } + /* remove client */ + else if (weechat_strcasecmp (input_data, "r") == 0) + { + if (client && RELAY_CLIENT_HAS_ENDED(client->status)) + { + relay_client_free (client); + relay_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); + } + } + + return WEECHAT_RC_OK; +} + +/* + * relay_buffer_close_cb: callback called when relay buffer is closed + */ + +int +relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer) +{ + /* make C compiler happy */ + (void) data; + (void) buffer; + + relay_buffer = NULL; + + return WEECHAT_RC_OK; +} + +/* + * relay_buffer_open: open relay buffer (to display list of clients) + */ + +void +relay_buffer_open () +{ + if (!relay_buffer) + { + relay_buffer = weechat_buffer_new ("relay.list", + &relay_buffer_input_cb, NULL, + &relay_buffer_close_cb, NULL); + + /* failed to create buffer ? then exit */ + if (!relay_buffer) + return; + + weechat_buffer_set (relay_buffer, "type", "free"); + weechat_buffer_set (relay_buffer, "title", _("List of clients for relay")); + weechat_buffer_set (relay_buffer, "key_bind_meta2-A", "/relay up"); + weechat_buffer_set (relay_buffer, "key_bind_meta2-B", "/relay down"); + } +} diff --git a/src/plugins/relay/relay-buffer.h b/src/plugins/relay/relay-buffer.h new file mode 100644 index 000000000..1702e0b91 --- /dev/null +++ b/src/plugins/relay/relay-buffer.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_DISPLAY_H +#define __WEECHAT_RELAY_DISPLAY_H 1 + +extern struct t_gui_buffer *relay_buffer; +extern int relay_buffer_selected_line; + +extern void relay_buffer_refresh (const char *hotlist); +extern int relay_buffer_input_cb (void *data, struct t_gui_buffer *buffer, + const char *input_data); +extern int relay_buffer_close_cb (void *data, struct t_gui_buffer *buffer); +extern void relay_buffer_open (); + +#endif /* relay-buffer.h */ diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c new file mode 100644 index 000000000..02a7e53fd --- /dev/null +++ b/src/plugins/relay/relay-client.c @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-client.c: client functions for relay plugin */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-client.h" +#include "relay-config.h" +#include "relay-buffer.h" + + +char *relay_client_status_string[] = /* strings for status */ +{ N_("connecting"), N_("waiting auth"), + N_("connected"), N_("auth failed"), N_("disconnected") +}; + +struct t_relay_client *relay_clients = NULL; +struct t_relay_client *last_relay_client = NULL; +int relay_client_count = 0; /* number of clients */ + + +/* + * relay_client_valid: check if a client pointer exists + * return 1 if client exists + * 0 if client is not found + */ + +int +relay_client_valid (struct t_relay_client *client) +{ + struct t_relay_client *ptr_client; + + if (!client) + return 0; + + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + if (ptr_client == client) + return 1; + } + + /* client not found */ + return 0; +} + +/* + * relay_client_search_by_number: search a client by number (first client is 0) + */ + +struct t_relay_client * +relay_client_search_by_number (int number) +{ + struct t_relay_client *ptr_client; + int i; + + i = 0; + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + if (i == number) + return ptr_client; + i++; + } + + /* client not found */ + return NULL; +} + +/* + * relay_client_sendf: send formatted data to client + */ + +int +relay_client_sendf (struct t_relay_client *client, const char *format, ...) +{ + va_list args; + static char buffer[4096]; + char str_length[8]; + int length, num_sent; + + if (!client) + return 0; + + va_start (args, format); + vsnprintf (buffer + 7, sizeof (buffer) - 7 - 1, format, args); + va_end (args); + + length = strlen (buffer + 7); + snprintf (str_length, sizeof (str_length), "%07d", length); + memcpy (buffer, str_length, 7); + + num_sent = send (client->sock, buffer, length + 7, 0); + + client->bytes_sent += length + 7; + + if (num_sent < 0) + { + weechat_printf (NULL, + _("%s%s: error sending data to client %s"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + strerror (errno)); + } + + return num_sent; +} + +/* + * relay_client_send_infolist: send infolist to client + */ + +void +relay_client_send_infolist (struct t_relay_client *client, + const char *name, + struct t_infolist *infolist) +{ + const char *fields; + char **argv; + int i, argc, size; + + relay_client_sendf (client, "name %s", name); + + while (weechat_infolist_next (infolist)) + { + fields = weechat_infolist_fields (infolist); + if (fields) + { + argv = weechat_string_explode (fields, ",", 0, 0, &argc); + if (argv && (argc > 0)) + { + for (i = 0; i < argc; i++) + { + switch (argv[i][0]) + { + case 'i': + relay_client_sendf (client, "%s %c %d", + argv[i] + 2, argv[i][0], + weechat_infolist_integer (infolist, + argv[i] + 2)); + break; + case 's': + relay_client_sendf (client, "%s %c %s", + argv[i] + 2, argv[i][0], + weechat_infolist_string (infolist, + argv[i] + 2)); + break; + case 'p': + relay_client_sendf (client, "%s %c %lx", + argv[i] + 2, argv[i][0], + (long unsigned int)weechat_infolist_pointer (infolist, + argv[i] + 2)); + break; + case 'b': + relay_client_sendf (client, "%s %c %lx", + argv[i] + 2, argv[i][0], + (long unsigned int)weechat_infolist_buffer (infolist, + argv[i] + 2, + &size)); + break; + case 't': + relay_client_sendf (client, "%s %c %ld", + argv[i] + 2, argv[i][0], + weechat_infolist_time (infolist, argv[i] + 2)); + break; + } + } + } + if (argv) + weechat_string_free_exploded (argv); + } + } +} + +/* + * relay_client_recv_cb: read data from a client + */ + +int +relay_client_recv_cb (void *arg_client) +{ + struct t_relay_client *client; + static char buffer[4096 + 2]; + struct t_infolist *infolist; + int num_read; + + client = (struct t_relay_client *)arg_client; + + num_read = recv (client->sock, buffer, sizeof (buffer) - 1, 0); + if (num_read > 0) + { + client->bytes_recv += num_read; + buffer[num_read] = '\0'; + if (buffer[num_read - 1] == '\n') + buffer[--num_read] = '\0'; + if (buffer[num_read - 1] == '\r') + buffer[--num_read] = '\0'; + if (weechat_relay_plugin->debug) + { + weechat_printf (NULL, "%s: data received from %s: \"%s\"", + RELAY_PLUGIN_NAME, client->address, buffer); + } + if (weechat_strcasecmp (buffer, "quit") == 0) + relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); + else + { + infolist = weechat_infolist_get (buffer, NULL, NULL); + if (infolist) + { + relay_client_send_infolist (client, buffer, infolist); + weechat_infolist_free (infolist); + } + } + relay_buffer_refresh (NULL); + } + else + { + relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); + } + + return WEECHAT_RC_OK; +} + +/* + * relay_client_new: create a new client + */ + +struct t_relay_client * +relay_client_new (int sock, char *address) +{ + struct t_relay_client *new_client; + + new_client = malloc (sizeof (*new_client)); + if (new_client) + { + new_client->sock = sock; + new_client->address = strdup ((address) ? address : "?"); + new_client->status = RELAY_STATUS_CONNECTED; + new_client->start_time = time (NULL); + new_client->hook_fd = NULL; + new_client->hook_timer = NULL; + new_client->last_activity = new_client->start_time; + new_client->bytes_recv = 0; + new_client->bytes_sent = 0; + + new_client->prev_client = NULL; + new_client->next_client = relay_clients; + if (relay_clients) + relay_clients->prev_client = new_client; + else + last_relay_client = new_client; + relay_clients = new_client; + + weechat_printf (NULL, + _("%s: new client @ %s"), + RELAY_PLUGIN_NAME, + new_client->address); + + new_client->hook_fd = weechat_hook_fd (new_client->sock, + 1, 0, 0, + &relay_client_recv_cb, + new_client); + + relay_client_count++; + + if (!relay_buffer + && weechat_config_boolean (relay_config_look_auto_open_buffer)) + { + relay_buffer_open (); + } + + relay_buffer_refresh (WEECHAT_HOTLIST_PRIVATE); + } + else + { + weechat_printf (NULL, + _("%s%s: not enough memory for new client"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + } + + return new_client; +} + +/* + * relay_client_set_status: set status for a client + */ + +void +relay_client_set_status (struct t_relay_client *client, + enum t_relay_status status) +{ + client->status = status; + + if (RELAY_CLIENT_HAS_ENDED(client->status)) + { + if (client->hook_fd) + { + weechat_unhook (client->hook_fd); + client->hook_fd = NULL; + } + if (client->hook_timer) + { + weechat_unhook (client->hook_timer); + client->hook_timer = NULL; + } + switch (client->status) + { + case RELAY_STATUS_AUTH_FAILED: + weechat_printf (NULL, + _("%s%s: authentication failed with client @ %s"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME, + client->address); + break; + case RELAY_STATUS_DISCONNECTED: + weechat_printf (NULL, + _("%s: disconnected from client @ %s"), + RELAY_PLUGIN_NAME, client->address); + break; + default: + break; + } + + if (client->sock >= 0) + { + close (client->sock); + client->sock = -1; + } + } + + relay_buffer_refresh (WEECHAT_HOTLIST_MESSAGE); +} + +/* + * relay_client_free: remove a client + */ + +void +relay_client_free (struct t_relay_client *client) +{ + struct t_relay_client *new_relay_clients; + + if (!client) + return; + + /* remove client from list */ + if (last_relay_client == client) + last_relay_client = client->prev_client; + if (client->prev_client) + { + (client->prev_client)->next_client = client->next_client; + new_relay_clients = relay_clients; + } + else + new_relay_clients = client->next_client; + if (client->next_client) + (client->next_client)->prev_client = client->prev_client; + + /* free data */ + if (client->address) + free (client->address); + if (client->hook_fd) + weechat_unhook (client->hook_fd); + if (client->hook_timer) + weechat_unhook (client->hook_timer); + + free (client); + + relay_clients = new_relay_clients; + + relay_client_count--; + if (relay_buffer_selected_line >= relay_client_count) + { + relay_buffer_selected_line = (relay_client_count == 0) ? + 0 : relay_client_count - 1; + } +} + +/* + * relay_client_disconnect: disconnect one client + */ + +void +relay_client_disconnect (struct t_relay_client *client) +{ + if (client->sock >= 0) + { + relay_client_set_status (client, RELAY_STATUS_DISCONNECTED); + } +} + +/* + * relay_client_disconnect_all: disconnect from all clients + */ + +void +relay_client_disconnect_all () +{ + struct t_relay_client *ptr_client; + + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + relay_client_disconnect (ptr_client); + } +} + +/* + * relay_client_add_to_infolist: add a client in an infolist + * return 1 if ok, 0 if error + */ + +int +relay_client_add_to_infolist (struct t_infolist *infolist, + struct t_relay_client *client) +{ + struct t_infolist_item *ptr_item; + char value[128]; + + if (!infolist || !client) + return 0; + + ptr_item = weechat_infolist_new_item (infolist); + if (!ptr_item) + return 0; + + if (!weechat_infolist_new_var_integer (ptr_item, "sock", client->sock)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "address", client->address)) + return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "status", client->status)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "status_string", relay_client_status_string[client->status])) + return 0; + if (!weechat_infolist_new_var_time (ptr_item, "start_time", client->start_time)) + return 0; + if (!weechat_infolist_new_var_pointer (ptr_item, "hook_fd", client->hook_fd)) + return 0; + if (!weechat_infolist_new_var_pointer (ptr_item, "hook_timer", client->hook_timer)) + return 0; + if (!weechat_infolist_new_var_time (ptr_item, "last_activity", client->last_activity)) + return 0; + snprintf (value, sizeof (value), "%lu", client->bytes_recv); + if (!weechat_infolist_new_var_string (ptr_item, "bytes_recv", value)) + return 0; + snprintf (value, sizeof (value), "%lu", client->bytes_sent); + if (!weechat_infolist_new_var_string (ptr_item, "bytes_sent", value)) + return 0; + + return 1; +} + +/* + * relay_client_print_log: print client infos in log (usually for crash dump) + */ + +void +relay_client_print_log () +{ + struct t_relay_client *ptr_client; + + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + weechat_log_printf (""); + weechat_log_printf ("[relay client (addr:0x%lx)]", ptr_client); + weechat_log_printf (" sock. . . . . . . . : %d", ptr_client->sock); + weechat_log_printf (" address . . . . . . : '%s'", ptr_client->address); + weechat_log_printf (" status. . . . . . . : %d (%s)", + ptr_client->status, + relay_client_status_string[ptr_client->status]); + weechat_log_printf (" start_time. . . . . : %ld", ptr_client->start_time); + weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_client->hook_fd); + weechat_log_printf (" hook_timer. . . . . : 0x%lx", ptr_client->hook_timer); + weechat_log_printf (" last_activity . . . : %ld", ptr_client->last_activity); + weechat_log_printf (" bytes_recv. . . . . : %lu", ptr_client->bytes_recv); + weechat_log_printf (" bytes_sent. . . . . : %lu", ptr_client->bytes_sent); + weechat_log_printf (" prev_client . . . . : 0x%lx", ptr_client->prev_client); + weechat_log_printf (" next_client . . . . : 0x%lx", ptr_client->next_client); + } +} diff --git a/src/plugins/relay/relay-client.h b/src/plugins/relay/relay-client.h new file mode 100644 index 000000000..4f06e6c0e --- /dev/null +++ b/src/plugins/relay/relay-client.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_CLIENT_H +#define __WEECHAT_RELAY_CLIENT_H 1 + +/* relay status */ + +enum t_relay_status +{ + RELAY_STATUS_CONNECTING = 0, /* connecting to client */ + RELAY_STATUS_WAITING_AUTH, /* waiting AUTH from client */ + RELAY_STATUS_CONNECTED, /* connected to client */ + RELAY_STATUS_AUTH_FAILED, /* AUTH failed with client */ + RELAY_STATUS_DISCONNECTED, /* disconnected from client */ + /* number of relay status */ + RELAY_NUM_STATUS, +}; + +/* macros for status */ + +#define RELAY_CLIENT_HAS_ENDED(status) ((status == RELAY_STATUS_AUTH_FAILED) || \ + (status == RELAY_STATUS_DISCONNECTED)) + +/* relay client */ + +struct t_relay_client +{ + int sock; /* socket for connection */ + char *address; /* string with IP address */ + enum t_relay_status status; /* status (connecting, active,..) */ + time_t start_time; /* time of client connection */ + struct t_hook *hook_fd; /* hook for socket or child pipe */ + struct t_hook *hook_timer; /* timeout for recever accept */ + time_t last_activity; /* time of last byte received/sent */ + unsigned long bytes_recv; /* bytes received from client */ + unsigned long bytes_sent; /* bytes sent to client */ + struct t_relay_client *prev_client;/* link to previous client */ + struct t_relay_client *next_client;/* link to next client */ +}; + +extern char *relay_client_status_string[]; +extern struct t_relay_client *relay_clients; +extern struct t_relay_client *last_relay_client; +extern int relay_client_count; + +extern int relay_client_valid (struct t_relay_client *client); +extern struct t_relay_client *relay_client_search_by_number (int number); +extern struct t_relay_client *relay_client_new (int sock, char *address); +extern void relay_client_set_status (struct t_relay_client *client, + enum t_relay_status status); +extern void relay_client_free (struct t_relay_client *client); +extern void relay_client_disconnect (struct t_relay_client *client); +extern void relay_client_disconnect_all (); +extern int relay_client_add_to_infolist (struct t_infolist *infolist, + struct t_relay_client *client); +extern void relay_client_print_log (); + +#endif /* relay-client.h */ diff --git a/src/plugins/relay/relay-command.c b/src/plugins/relay/relay-command.c new file mode 100644 index 000000000..839a02286 --- /dev/null +++ b/src/plugins/relay/relay-command.c @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-command.c: relay command */ + + +#include +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-buffer.h" +#include "relay-client.h" +#include "relay-config.h" + + +/* + * relay_command_client_list: list clients + */ + +void +relay_command_client_list (int full) +{ + struct t_relay_client *ptr_client; + int i; + char date_start[128], date_activity[128]; + struct tm *date_tmp; + + if (relay_clients) + { + weechat_printf (NULL, ""); + weechat_printf (NULL, _("Clients for relay:")); + i = 1; + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + date_tmp = localtime (&(ptr_client->start_time)); + strftime (date_start, sizeof (date_start), + "%a, %d %b %Y %H:%M:%S", date_tmp); + + date_tmp = localtime (&(ptr_client->last_activity)); + strftime (date_activity, sizeof (date_activity), + "%a, %d %b %Y %H:%M:%S", date_tmp); + + if (full) + { + weechat_printf (NULL, + _("%3d. %s, started on: %s, last activity: %s, " + "bytes: %lu recv, %lu sent"), + i, + ptr_client->address, + date_start, + date_activity, + ptr_client->bytes_recv, + ptr_client->bytes_sent); + } + else + { + weechat_printf (NULL, + _("%3d. %s, started on: %s"), + i, + ptr_client->address); + } + i++; + } + } + else + weechat_printf (NULL, _("No client for relay")); +} + +/* + * relay_command_relay: command /relay + */ + +int +relay_command_relay (void *data, struct t_gui_buffer *buffer, int argc, + char **argv, char **argv_eol) +{ + /* make C compiler happy */ + (void) data; + (void) buffer; + (void) argv_eol; + + if ((argc > 1) && (weechat_strcasecmp (argv[1], "list") == 0)) + { + relay_command_client_list (0); + return WEECHAT_RC_OK; + } + + if ((argc > 1) && (weechat_strcasecmp (argv[1], "listfull") == 0)) + { + relay_command_client_list (1); + return WEECHAT_RC_OK; + } + + if (!relay_buffer) + relay_buffer_open (); + + if (relay_buffer) + { + weechat_buffer_set (relay_buffer, "display", "1"); + + if (argc > 1) + { + if (strcmp (argv[1], "up") == 0) + { + if (relay_buffer_selected_line > 0) + relay_buffer_selected_line--; + } + else if (strcmp (argv[1], "down") == 0) + { + if (relay_buffer_selected_line < relay_client_count - 1) + relay_buffer_selected_line++; + } + } + } + + relay_buffer_refresh (NULL); + + return WEECHAT_RC_OK; +} + +/* + * relay_command_init: add /relay command + */ + +void +relay_command_init () +{ + weechat_hook_command ("relay", + N_("relay control"), + "[list | listfull]", + N_(" list: list relay clients\n" + "listfull: list relay clients (verbose)\n\n" + "Without argument, this command opens buffer " + "with list of relay clients."), + "list|listfull", &relay_command_relay, NULL); +} diff --git a/src/plugins/relay/relay-command.h b/src/plugins/relay/relay-command.h new file mode 100644 index 000000000..8236768f5 --- /dev/null +++ b/src/plugins/relay/relay-command.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_COMMAND_H +#define __WEECHAT_RELAY_COMMAND_H 1 + +extern void relay_command_init (); + +#endif /* relay-command.h */ diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c new file mode 100644 index 000000000..a8cd965a6 --- /dev/null +++ b/src/plugins/relay/relay-config.c @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-config.c: relay configuration options */ + + +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-config.h" +#include "relay-client.h" +#include "relay-buffer.h" + + +struct t_config_file *relay_config_file = NULL; + +/* relay config, look section */ + +struct t_config_option *relay_config_look_auto_open_buffer; + +/* relay config, color section */ + +struct t_config_option *relay_config_color_text; +struct t_config_option *relay_config_color_text_bg; +struct t_config_option *relay_config_color_text_selected; +struct t_config_option *relay_config_color_status[RELAY_NUM_STATUS]; + +/* relay config, network section */ + +struct t_config_option *relay_config_network_listen_port_range; + + +/* + * relay_config_refresh_cb: callback called when user changes relay option that + * needs a refresh of relay list + */ + +void +relay_config_refresh_cb (void *data, struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + (void) option; + + if (relay_buffer) + relay_buffer_refresh (NULL); +} + +/* + * relay_config_reload: reload relay configuration file + */ + +int +relay_config_reload (void *data, struct t_config_file *config_file) +{ + /* make C compiler happy */ + (void) data; + + return weechat_config_reload (config_file); +} + +/* + * relay_config_init: init relay configuration file + * return: 1 if ok, 0 if error + */ + +int +relay_config_init () +{ + struct t_config_section *ptr_section; + + relay_config_file = weechat_config_new (RELAY_CONFIG_NAME, + &relay_config_reload, NULL); + if (!relay_config_file) + return 0; + + ptr_section = weechat_config_new_section (relay_config_file, "look", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (relay_config_file); + return 0; + } + + relay_config_look_auto_open_buffer = weechat_config_new_option ( + relay_config_file, ptr_section, + "auto_open_buffer", "boolean", + N_("auto open relay buffer when a new client is connecting"), + NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + ptr_section = weechat_config_new_section (relay_config_file, "color", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (relay_config_file); + return 0; + } + + relay_config_color_text = weechat_config_new_option ( + relay_config_file, ptr_section, + "text", "color", + N_("text color"), + NULL, 0, 0, "default", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_text_bg = weechat_config_new_option ( + relay_config_file, ptr_section, + "text_bg", "color", + N_("background color"), + NULL, 0, 0, "default", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_text_selected = weechat_config_new_option ( + relay_config_file, ptr_section, + "text_selected", "color", + N_("text color of selected client line"), + NULL, 0, 0, "white", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option ( + relay_config_file, ptr_section, + "status_connecting", "color", + N_("text color for \"connecting\" status"), + NULL, 0, 0, "yellow", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option ( + relay_config_file, ptr_section, + "status_waiting_auth", "color", + N_("text color for \"waiting authentication\" status"), + NULL, 0, 0, "brown", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option ( + relay_config_file, ptr_section, + "status_active", "color", + N_("text color for \"connected\" status"), + NULL, 0, 0, "lightblue", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option ( + relay_config_file, ptr_section, + "status_auth_failed", "color", + N_("text color for \"authentication failed\" status"), + NULL, 0, 0, "lightred", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option ( + relay_config_file, ptr_section, + "status_disconnected", "color", + N_("text color for \"disconnected\" status"), + NULL, 0, 0, "lightred", NULL, + NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); + + ptr_section = weechat_config_new_section (relay_config_file, "network", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (relay_config_file); + return 0; + } + + relay_config_network_listen_port_range = weechat_config_new_option ( + relay_config_file, ptr_section, + "listen_port_range", "string", + N_("port number (or range of ports) that relay plugin listens on " + "(syntax: a single port, ie. 5000 or a port " + "range, ie. 5000-5015)"), + NULL, 0, 0, "22373-22400", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + return 1; +} + +/* + * relay_config_read: read relay configuration file + */ + +int +relay_config_read () +{ + return weechat_config_read (relay_config_file); +} + +/* + * relay_config_write: write relay configuration file + */ + +int +relay_config_write () +{ + return weechat_config_write (relay_config_file); +} diff --git a/src/plugins/relay/relay-config.h b/src/plugins/relay/relay-config.h new file mode 100644 index 000000000..0c35f2ff1 --- /dev/null +++ b/src/plugins/relay/relay-config.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_CONFIG_H +#define __WEECHAT_RELAY_CONFIG_H 1 + +#define RELAY_CONFIG_NAME "relay" + +extern struct t_config_file *relay_config; + +extern struct t_config_option *relay_config_look_auto_open_buffer; + +extern struct t_config_option *relay_config_color_text; +extern struct t_config_option *relay_config_color_text_bg; +extern struct t_config_option *relay_config_color_text_selected; +extern struct t_config_option *relay_config_color_status[]; + +extern struct t_config_option *relay_config_network_listen_port_range; + +extern int relay_config_init (); +extern int relay_config_read (); +extern int relay_config_write (); + +#endif /* relay-config.h */ diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c new file mode 100644 index 000000000..100e366cb --- /dev/null +++ b/src/plugins/relay/relay-info.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-info.c: info and infolist hooks for relay plugin */ + + +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-client.h" + + +/* + * relay_info_get_infolist_cb: callback called when relay infolist is asked + */ + +struct t_infolist * +relay_info_get_infolist_cb (void *data, const char *infolist_name, + void *pointer, const char *arguments) +{ + struct t_infolist *ptr_infolist; + struct t_relay_client *ptr_client; + + /* make C compiler happy */ + (void) data; + (void) arguments; + + if (!infolist_name || !infolist_name[0]) + return NULL; + + if (weechat_strcasecmp (infolist_name, "relay") == 0) + { + if (pointer && !relay_client_valid (pointer)) + return NULL; + + ptr_infolist = weechat_infolist_new (); + if (ptr_infolist) + { + if (pointer) + { + /* build list with only one relay */ + if (!relay_client_add_to_infolist (ptr_infolist, pointer)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; + } + else + { + /* build list with all relays */ + for (ptr_client = relay_clients; ptr_client; + ptr_client = ptr_client->next_client) + { + if (!relay_client_add_to_infolist (ptr_infolist, ptr_client)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + } + return ptr_infolist; + } + } + } + + return NULL; +} + +/* + * relay_info_init: initialize info and infolist hooks for relay plugin + */ + +void +relay_info_init () +{ + /* relay infolist hooks */ + weechat_hook_infolist ("relay", N_("list of relay clients"), + &relay_info_get_infolist_cb, NULL); +} diff --git a/src/plugins/relay/relay-info.h b/src/plugins/relay/relay-info.h new file mode 100644 index 000000000..87aaabf96 --- /dev/null +++ b/src/plugins/relay/relay-info.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_INFO_H +#define __WEECHAT_RELAY_INFO_H 1 + +extern void relay_info_init (); + +#endif /* relay-info.h */ diff --git a/src/plugins/relay/relay-network.c b/src/plugins/relay/relay-network.c new file mode 100644 index 000000000..d93ac4387 --- /dev/null +++ b/src/plugins/relay/relay-network.c @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-network.c: network functions for relay plugin */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-buffer.h" +#include "relay-client.h" +#include "relay-config.h" + + +int relay_network_sock = -1; /* socket used for listening and */ + /* waiting for clients */ +struct t_hook *relay_network_hook_fd = NULL; +int relay_network_listen_port = -1; /* listening port */ + + +/* + * relay_network_close_socket: close socket + */ + +void +relay_network_close_socket () +{ + if (relay_network_hook_fd) + { + weechat_unhook (relay_network_hook_fd); + relay_network_hook_fd = NULL; + } + if (relay_network_sock >= 0) + { + close (relay_network_sock); + relay_network_sock = -1; + } +} + +/* + * relay_network_sock_cb: read data from a client which is connecting on socket + */ + +int +relay_network_sock_cb (void *data) +{ + struct sockaddr_in client_addr; + unsigned int client_length; + int client_fd; + char ipv4_address[INET_ADDRSTRLEN + 1], *ptr_address; + + /* make C compiler happy */ + (void) data; + + client_length = sizeof (client_addr); + memset (&client_addr, 0, client_length); + + client_fd = accept (relay_network_sock, (struct sockaddr *) &client_addr, + &client_length); + if (client_fd < 0) + { + weechat_printf (NULL, + _("%s%s: cannot accept client"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + return WEECHAT_RC_OK; + } + + ptr_address = NULL; + if (inet_ntop (AF_INET, + &(client_addr.sin_addr), + ipv4_address, + INET_ADDRSTRLEN)) + { + ptr_address = ipv4_address; + } + + relay_client_new (client_fd, ptr_address); + + return WEECHAT_RC_OK; +} + +/* + * relay_network_init: init socket and listen on port + * return 1 if ok, 0 if error + */ + +int +relay_network_init () +{ + int set, args, port, port_start, port_end; + struct sockaddr_in server_addr; + const char *port_range; + + relay_network_close_socket (); + + port_range = weechat_config_string (relay_config_network_listen_port_range); + if (!port_range || !port_range[0]) + { + weechat_printf (NULL, + _("%s%s: option \"listen_port_range\" is not defined"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + return 0; + } + + relay_network_sock = socket (AF_INET, SOCK_STREAM, 0); + if (relay_network_sock < 0) + { + weechat_printf (NULL, + _("%s%s: cannot create socket"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + return 0; + } + + set = 1; + if (setsockopt (relay_network_sock, SOL_SOCKET, SO_REUSEADDR, + (void *) &set, sizeof (set)) < 0) + { + weechat_printf (NULL, + _("%s%s: cannot set socket option " + "\"SO_REUSEADDR\""), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + close (relay_network_sock); + relay_network_sock = -1; + return 0; + } + + set = 1; + if (setsockopt (relay_network_sock, SOL_SOCKET, SO_KEEPALIVE, + (void *) &set, sizeof (set)) < 0) + { + weechat_printf (NULL, + _("%s%s: cannot set socket option " + "\"SO_KEEPALIVE\""), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + close (relay_network_sock); + relay_network_sock = -1; + return 0; + } + + memset(&server_addr, 0, sizeof(struct sockaddr_in)); + server_addr.sin_family = AF_INET; + server_addr.sin_addr.s_addr = INADDR_ANY; + + port = -1; + + /* find a free port in the specified range */ + args = sscanf (weechat_config_string (relay_config_network_listen_port_range), + "%d-%d", &port_start, &port_end); + if (args > 0) + { + port = port_start; + if (args == 1) + port_end = port_start; + + /* loop through the entire allowed port range */ + while (port <= port_end) + { + /* attempt to bind to the free port */ + server_addr.sin_port = htons (port); + if (bind (relay_network_sock, (struct sockaddr *) &server_addr, + sizeof (server_addr)) == 0) + break; + port++; + } + + if (port > port_end) + port = -1; + } + + if (port < 0) + { + weechat_printf (NULL, + _("%s%s: cannot find available port for listening"), + weechat_prefix ("error"), RELAY_PLUGIN_NAME); + close (relay_network_sock); + relay_network_sock = -1; + return 0; + } + + relay_network_listen_port = port; + + listen (relay_network_sock, 5); + + weechat_printf (NULL, + _("%s: listening on port %d"), + RELAY_PLUGIN_NAME, relay_network_listen_port); + + relay_network_hook_fd = weechat_hook_fd (relay_network_sock, + 1, 0, 0, + &relay_network_sock_cb, + NULL); + + return 1; +} + +/* + * relay_network_end: close main socket + */ + +void +relay_network_end () +{ + relay_network_close_socket (); +} diff --git a/src/plugins/relay/relay-network.h b/src/plugins/relay/relay-network.h new file mode 100644 index 000000000..a090276d3 --- /dev/null +++ b/src/plugins/relay/relay-network.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_NETWORK_H +#define __WEECHAT_RELAY_NETWORK_H 1 + +extern int relay_network_init (); +extern void relay_network_end (); + +#endif /* relay-network.h */ diff --git a/src/plugins/relay/relay-upgrade.c b/src/plugins/relay/relay-upgrade.c new file mode 100644 index 000000000..907122583 --- /dev/null +++ b/src/plugins/relay/relay-upgrade.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay-upgrade.c: save/restore relay plugin data */ + + +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-upgrade.h" +#include "relay-buffer.h" + + +/* + * relay_upgrade_save_clients: save clients info to upgrade file + */ + +int +relay_upgrade_save_clients (struct t_upgrade_file *upgrade_file) +{ + /* TODO: save relay data */ + (void) upgrade_file; + return 1; +} + +/* + * relay_upgrade_save: save upgrade file + * return 1 if ok, 0 if error + */ + +int +relay_upgrade_save () +{ + int rc; + struct t_upgrade_file *upgrade_file; + + upgrade_file = weechat_upgrade_create (RELAY_UPGRADE_FILENAME, 1); + if (!upgrade_file) + return 0; + + rc = relay_upgrade_save_clients (upgrade_file); + + weechat_upgrade_close (upgrade_file); + + return rc; +} + +/* + * relay_upgrade_set_buffer_callbacks: restore buffers callbacks (input and + * close) for buffers created by relay plugin + */ + +void +relay_upgrade_set_buffer_callbacks () +{ + struct t_infolist *infolist; + struct t_gui_buffer *ptr_buffer; + + infolist = weechat_infolist_get ("buffer", NULL, NULL); + if (infolist) + { + while (weechat_infolist_next (infolist)) + { + if (weechat_infolist_pointer (infolist, "plugin") == weechat_relay_plugin) + { + ptr_buffer = weechat_infolist_pointer (infolist, "pointer"); + weechat_buffer_set_pointer (ptr_buffer, "close_callback", &relay_buffer_close_cb); + weechat_buffer_set_pointer (ptr_buffer, "input_callback", &relay_buffer_input_cb); + } + } + } +} + +/* + * relay_upgrade_read_cb: read callback for relay upgrade file + */ + +int +relay_upgrade_read_cb (int object_id, + struct t_infolist *infolist) +{ + /* TODO: write relay read cb */ + (void) object_id; + (void) infolist; + return WEECHAT_RC_OK; +} + +/* + * relay_upgrade_load: load upgrade file + * return 1 if ok, 0 if error + */ + +int +relay_upgrade_load () +{ + int rc; + struct t_upgrade_file *upgrade_file; + + relay_upgrade_set_buffer_callbacks (); + + upgrade_file = weechat_upgrade_create (RELAY_UPGRADE_FILENAME, 0); + rc = weechat_upgrade_read (upgrade_file, &relay_upgrade_read_cb); + + return rc; +} diff --git a/src/plugins/relay/relay-upgrade.h b/src/plugins/relay/relay-upgrade.h new file mode 100644 index 000000000..855c1026e --- /dev/null +++ b/src/plugins/relay/relay-upgrade.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_UPGRADE_H +#define __WEECHAT_RELAY_UPGRADE_H 1 + +#define RELAY_UPGRADE_FILENAME "relay" + +/* For developers: please add new values ONLY AT THE END of enums */ + +enum t_relay_upgrade_type +{ + RELAY_UPGRADE_TYPE_RELAY = 0, +}; + +extern int relay_upgrade_save (); +extern int relay_upgrade_load (); + +#endif /* relay-upgrade.h */ diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c new file mode 100644 index 000000000..252d91590 --- /dev/null +++ b/src/plugins/relay/relay.c @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* relay.c: network communication between WeeChat and remote application */ + + +#include + +#include "../weechat-plugin.h" +#include "relay.h" +#include "relay-client.h" +#include "relay-command.h" +#include "relay-config.h" +#include "relay-info.h" +#include "relay-network.h" +#include "relay-upgrade.h" + + +WEECHAT_PLUGIN_NAME(RELAY_PLUGIN_NAME); +WEECHAT_PLUGIN_DESCRIPTION("Network communication between WeeChat and " + "remote application"); +WEECHAT_PLUGIN_AUTHOR("FlashCode "); +WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_LICENSE("GPL3"); + +struct t_weechat_plugin *weechat_relay_plugin = NULL; + +int relay_signal_upgrade_received = 0; /* signal "upgrade" received ? */ + + +/* + * relay_signal_upgrade_cb: callback for "upgrade" signal + */ + +int +relay_signal_upgrade_cb (void *data, const char *signal, const char *type_data, + void *signal_data) +{ + /* make C compiler happy */ + (void) data; + (void) signal; + (void) type_data; + (void) signal_data; + + relay_signal_upgrade_received = 1; + + return WEECHAT_RC_OK; +} + +/* + * relay_debug_dump_cb: callback for "debug_dump" signal + */ + +int +relay_debug_dump_cb (void *data, const char *signal, const char *type_data, + void *signal_data) +{ + /* make C compiler happy */ + (void) data; + (void) signal; + (void) type_data; + (void) signal_data; + + weechat_log_printf (""); + weechat_log_printf ("***** \"%s\" plugin dump *****", + weechat_plugin->name); + + relay_client_print_log (); + + weechat_log_printf (""); + weechat_log_printf ("***** End of \"%s\" plugin dump *****", + weechat_plugin->name); + + return WEECHAT_RC_OK; +} + +/* + * weechat_plugin_init: initialize relay plugin + */ + +int +weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) +{ + /* make C compiler happy */ + (void) argc; + (void) argv; + + weechat_plugin = plugin; + + if (!relay_config_init ()) + return WEECHAT_RC_ERROR; + + if (relay_config_read () < 0) + return WEECHAT_RC_ERROR; + + relay_command_init (); + + weechat_hook_signal ("upgrade", &relay_signal_upgrade_cb, NULL); + weechat_hook_signal ("debug_dump", &relay_debug_dump_cb, NULL); + + relay_info_init (); + + relay_network_init (); + + return WEECHAT_RC_OK; +} + +/* + * weechat_plugin_end: end relay plugin + */ + +int +weechat_plugin_end (struct t_weechat_plugin *plugin) +{ + /* make C compiler happy */ + (void) plugin; + + relay_config_write (); + + relay_network_end (); + + if (relay_signal_upgrade_received) + relay_upgrade_save (); + else + relay_client_disconnect_all (); + + return WEECHAT_RC_OK; +} diff --git a/src/plugins/relay/relay.h b/src/plugins/relay/relay.h new file mode 100644 index 000000000..18e81c471 --- /dev/null +++ b/src/plugins/relay/relay.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2003-2008 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef __WEECHAT_RELAY_H +#define __WEECHAT_RELAY_H 1 + +#define weechat_plugin weechat_relay_plugin +#define RELAY_PLUGIN_NAME "relay" + +extern struct t_weechat_plugin *weechat_relay_plugin; + +#endif /* relay.h */ diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 837462c68..6a1ad8970 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -155,6 +155,7 @@ struct t_weechat_plugin const char *separator); char **(*string_split_command) (const char *command, char separator); void (*string_free_splitted_command) (char **splitted_command); + char *(*string_format_size) (unsigned long size); /* UTF-8 strings */ int (*utf8_has_8bits) (const char *string); @@ -651,6 +652,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->string_split_command(__command, __separator) #define weechat_string_free_splitted_command(__splitted_command) \ weechat_plugin->string_free_splitted_command(__splitted_command) +#define weechat_string_format_size(__size) \ + weechat_plugin->string_format_size(__size) /* UTF-8 strings */ #define weechat_utf8_has_8bits(__string) \ diff --git a/src/plugins/xfer/xfer-buffer.c b/src/plugins/xfer/xfer-buffer.c index 6a3ba6db1..0d319453c 100644 --- a/src/plugins/xfer/xfer-buffer.c +++ b/src/plugins/xfer/xfer-buffer.c @@ -42,14 +42,10 @@ void xfer_buffer_refresh (const char *hotlist) { struct t_xfer *ptr_xfer, *xfer_selected; - char str_color[256], suffix[32], status[64], date[128], *progress_bar; - char format[128], format_per_sec[128], bytes_per_sec[256], eta[128]; - int i, length, line, progress_bar_size, num_bars, num_unit; - int num_unit_per_sec; + char str_color[256], suffix[32], status[64], date[128], eta[128]; + char *progress_bar, *str_pos, *str_total, *str_bytes_per_sec; + int i, length, line, progress_bar_size, num_bars; unsigned long pct_complete; - char *unit_name[] = { N_("bytes"), N_("KB"), N_("MB"), N_("GB") }; - char *unit_format[] = { "%.0f", "%.1f", "%.02f", "%.02f" }; - float unit_divide[] = { 1, 1024, 1024*1024, 1024*1024*1024 }; struct tm *date_tmp; if (xfer_buffer) @@ -77,7 +73,7 @@ xfer_buffer_refresh (const char *hotlist) /* purge old */ _(" [P] Purge finished"), /* quit */ - _(" [Q] Close xfer list")); + _(" [Q] Close this buffer")); } for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer) { @@ -170,14 +166,6 @@ xfer_buffer_refresh (const char *hotlist) } /* computes percentage */ - if (ptr_xfer->size < 1024*10) - num_unit = 0; - else if (ptr_xfer->size < 1024*1024) - num_unit = 1; - else if (ptr_xfer->size < 1024*1024*1024) - num_unit = 2; - else - num_unit = 3; if (ptr_xfer->size == 0) { if (ptr_xfer->status == XFER_STATUS_DONE) @@ -188,28 +176,10 @@ xfer_buffer_refresh (const char *hotlist) else pct_complete = (unsigned long)(((float)(ptr_xfer->pos)/(float)(ptr_xfer->size)) * 100); - snprintf (format, sizeof (format), - "%%s%%s%%s %%s%%s%%s%%s%%3lu%%%% %s %%s / %s %%s (%%s%%s)", - unit_format[num_unit], - unit_format[num_unit]); - - /* bytes per second */ - bytes_per_sec[0] = '\0'; - if (ptr_xfer->bytes_per_sec < 1024*10) - num_unit_per_sec = 0; - else if (ptr_xfer->bytes_per_sec < 1024*1024) - num_unit_per_sec = 1; - else if (ptr_xfer->bytes_per_sec < 1024*1024*1024) - num_unit_per_sec = 2; - else - num_unit_per_sec = 3; - snprintf (format_per_sec, sizeof (format_per_sec), - "%s %%s/s", - unit_format[num_unit_per_sec]); - snprintf (bytes_per_sec, sizeof (bytes_per_sec), - format_per_sec, - ((float)ptr_xfer->bytes_per_sec) / ((float)(unit_divide[num_unit_per_sec])), - _(unit_name[num_unit_per_sec])); + /* position, total and bytes per second */ + str_pos = weechat_string_format_size (ptr_xfer->pos); + str_total = weechat_string_format_size (ptr_xfer->size); + str_bytes_per_sec = weechat_string_format_size (ptr_xfer->bytes_per_sec); /* ETA */ eta[0] = '\0'; @@ -225,23 +195,25 @@ xfer_buffer_refresh (const char *hotlist) /* display second line for file with status, progress bar and estimated time */ weechat_printf_y (xfer_buffer, (line * 2) + 3, - format, + "%s%s%s %s%s%s%s%3lu%% %s / %s (%s%s/s)", weechat_color(str_color), - (line == xfer_buffer_selected_line) ? - "*** " : " ", - (XFER_IS_SEND(ptr_xfer->type)) ? - "<<--" : "-->>", + (line == xfer_buffer_selected_line) ? "*** " : " ", + (XFER_IS_SEND(ptr_xfer->type)) ? "<<--" : "-->>", weechat_color(weechat_config_string (xfer_config_color_status[ptr_xfer->status])), status, weechat_color (str_color), (progress_bar) ? progress_bar : "", pct_complete, - ((float)(ptr_xfer->pos)) / unit_divide[num_unit], - _(unit_name[num_unit]), - ((float)(ptr_xfer->size)) / unit_divide[num_unit], - _(unit_name[num_unit]), + (str_pos) ? str_pos : "?", + (str_total) ? str_total : "?", eta, - bytes_per_sec); + str_bytes_per_sec); + if (str_pos) + free (str_pos); + if (str_total) + free (str_total); + if (str_bytes_per_sec) + free (str_bytes_per_sec); } line++; } diff --git a/src/plugins/xfer/xfer-command.c b/src/plugins/xfer/xfer-command.c index 23f630a22..777766351 100644 --- a/src/plugins/xfer/xfer-command.c +++ b/src/plugins/xfer/xfer-command.c @@ -189,7 +189,7 @@ xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc, } /* - * xfer_command: xfer command + * xfer_command_init: add /xfer command */ void @@ -197,7 +197,10 @@ xfer_command_init () { weechat_hook_command ("xfer", N_("xfer control"), - "", - N_("Open buffer with xfer list"), + "[list | listfull]", + N_(" list: list xfer\n" + "listfull: list xfer (verbose)\n\n" + "Without argument, this command opens buffer " + "with xfer list."), "list|listfull", &xfer_command_xfer, NULL); } diff --git a/src/plugins/xfer/xfer-network.c b/src/plugins/xfer/xfer-network.c index f6848e61a..c760ebaf0 100644 --- a/src/plugins/xfer/xfer-network.c +++ b/src/plugins/xfer/xfer-network.c @@ -213,7 +213,7 @@ xfer_network_send_file_fork (struct t_xfer *xfer) xfer->child_pid = pid; xfer->hook_fd = weechat_hook_fd (xfer->child_read, 1, 0, 0, - xfer_network_child_read_cb, + &xfer_network_child_read_cb, xfer); } @@ -268,7 +268,7 @@ xfer_network_recv_file_fork (struct t_xfer *xfer) xfer->child_pid = pid; xfer->hook_fd = weechat_hook_fd (xfer->child_read, 1, 0, 0, - xfer_network_child_read_cb, + &xfer_network_child_read_cb, xfer); } diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 0c9e69694..c04d0d113 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -1277,7 +1277,7 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer) } /* - * xfer_print_log: print DCC infos in log (usually for crash dump) + * xfer_print_log: print xfer infos in log (usually for crash dump) */ void @@ -1294,6 +1294,9 @@ xfer_print_log () weechat_log_printf (" type. . . . . . . . : %d (%s)", ptr_xfer->type, xfer_type_string[ptr_xfer->type]); + weechat_log_printf (" protocol. . . . . . : %d (%s)", + ptr_xfer->protocol, + xfer_protocol_string[ptr_xfer->protocol]); weechat_log_printf (" remote_nick . . . . : '%s'", ptr_xfer->remote_nick); weechat_log_printf (" local_nick. . . . . : '%s'", ptr_xfer->local_nick); weechat_log_printf (" filename. . . . . . : '%s'", ptr_xfer->filename); @@ -1314,6 +1317,8 @@ xfer_print_log () weechat_log_printf (" child_pid . . . . . : %d", ptr_xfer->child_pid); weechat_log_printf (" child_read. . . . . : %d", ptr_xfer->child_read); weechat_log_printf (" child_write . . . . : %d", ptr_xfer->child_write); + weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_xfer->hook_fd); + weechat_log_printf (" hook_timer. . . . . : 0x%lx", ptr_xfer->hook_timer); weechat_log_printf (" unterminated_message: '%s'", ptr_xfer->unterminated_message); weechat_log_printf (" file. . . . . . . . : %d", ptr_xfer->file); weechat_log_printf (" local_filename. . . : '%s'", ptr_xfer->local_filename); @@ -1380,7 +1385,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) xfer_create_directories (); xfer_command_init (); - + + weechat_hook_signal ("upgrade", &xfer_signal_upgrade_cb, NULL); weechat_hook_signal ("xfer_add", &xfer_add_cb, NULL); weechat_hook_signal ("xfer_start_resume", &xfer_start_resume_cb, NULL); weechat_hook_signal ("xfer_accept_resume", &xfer_accept_resume_cb, NULL);