From d59d099e82378669a2bea5aac5c9d9862438f51e Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Wed, 11 Aug 2010 15:43:20 +0200 Subject: [PATCH] Add new plugin "rmodifier": alter modifier strings with regular expressions (bug #26964) --- CMakeLists.txt | 1 + ChangeLog | 5 +- configure.in | 99 ++-- doc/de/autogen/plugin_api/completions.txt | 2 + doc/de/autogen/plugin_api/infolists.txt | 2 + doc/de/autogen/user/rmodifier_commands.txt | 25 + doc/de/autogen/user/rmodifier_options.txt | 5 + doc/de/weechat_user.de.txt | 93 ++- doc/docgen.pl | 17 +- doc/en/autogen/plugin_api/completions.txt | 2 + doc/en/autogen/plugin_api/infolists.txt | 2 + doc/en/autogen/user/rmodifier_commands.txt | 25 + doc/en/autogen/user/rmodifier_options.txt | 5 + doc/en/weechat_user.en.txt | 91 ++- doc/fr/autogen/plugin_api/completions.txt | 2 + doc/fr/autogen/plugin_api/infolists.txt | 2 + doc/fr/autogen/user/rmodifier_commands.txt | 25 + doc/fr/autogen/user/rmodifier_options.txt | 5 + doc/fr/weechat_user.fr.txt | 70 ++- doc/it/autogen/plugin_api/completions.txt | 2 + doc/it/autogen/plugin_api/infolists.txt | 2 + doc/it/autogen/user/rmodifier_commands.txt | 25 + doc/it/autogen/user/rmodifier_options.txt | 5 + doc/it/weechat_user.it.txt | 93 ++- po/POTFILES.in | 12 + po/cs.po | 113 +++- po/de.po | 113 +++- po/es.po | 111 +++- po/fr.po | 140 ++++- po/hu.po | 107 +++- po/it.po | 113 +++- po/pl.po | 111 +++- po/ru.po | 106 +++- po/srcfiles.cmake | 12 + po/weechat.pot | 90 ++- src/plugins/CMakeLists.txt | 4 + src/plugins/Makefile.am | 7 +- src/plugins/rmodifier/CMakeLists.txt | 31 + src/plugins/rmodifier/Makefile.am | 41 ++ src/plugins/rmodifier/rmodifier-command.c | 265 +++++++++ src/plugins/rmodifier/rmodifier-command.h | 25 + src/plugins/rmodifier/rmodifier-completion.c | 66 +++ src/plugins/rmodifier/rmodifier-completion.h | 25 + src/plugins/rmodifier/rmodifier-config.c | 291 ++++++++++ src/plugins/rmodifier/rmodifier-config.h | 40 ++ src/plugins/rmodifier/rmodifier-debug.c | 68 +++ src/plugins/rmodifier/rmodifier-debug.h | 25 + src/plugins/rmodifier/rmodifier-info.c | 105 ++++ src/plugins/rmodifier/rmodifier-info.h | 25 + src/plugins/rmodifier/rmodifier.c | 573 +++++++++++++++++++ src/plugins/rmodifier/rmodifier.h | 62 ++ 51 files changed, 3155 insertions(+), 131 deletions(-) create mode 100644 doc/de/autogen/user/rmodifier_commands.txt create mode 100644 doc/de/autogen/user/rmodifier_options.txt create mode 100644 doc/en/autogen/user/rmodifier_commands.txt create mode 100644 doc/en/autogen/user/rmodifier_options.txt create mode 100644 doc/fr/autogen/user/rmodifier_commands.txt create mode 100644 doc/fr/autogen/user/rmodifier_options.txt create mode 100644 doc/it/autogen/user/rmodifier_commands.txt create mode 100644 doc/it/autogen/user/rmodifier_options.txt create mode 100644 src/plugins/rmodifier/CMakeLists.txt create mode 100644 src/plugins/rmodifier/Makefile.am create mode 100644 src/plugins/rmodifier/rmodifier-command.c create mode 100644 src/plugins/rmodifier/rmodifier-command.h create mode 100644 src/plugins/rmodifier/rmodifier-completion.c create mode 100644 src/plugins/rmodifier/rmodifier-completion.h create mode 100644 src/plugins/rmodifier/rmodifier-config.c create mode 100644 src/plugins/rmodifier/rmodifier-config.h create mode 100644 src/plugins/rmodifier/rmodifier-debug.c create mode 100644 src/plugins/rmodifier/rmodifier-debug.h create mode 100644 src/plugins/rmodifier/rmodifier-info.c create mode 100644 src/plugins/rmodifier/rmodifier-info.h create mode 100644 src/plugins/rmodifier/rmodifier.c create mode 100644 src/plugins/rmodifier/rmodifier.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d79185f5..29e5d97d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ OPTION(DISABLE_FIFO "Disable FIFO plugin") OPTION(DISABLE_IRC "Disable IRC plugin") OPTION(DISABLE_LOGGER "Disable Logger plugin") OPTION(ENABLE_RELAY "Enable Relay plugin") +OPTION(DISABLE_RMODIFIER "Disable Rmodifier 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 10be0cc28..40c2ae07d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,15 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.3.4-dev, 2010-08-07 +v0.3.4-dev, 2010-08-11 Version 0.3.4 (under dev!) -------------------------- +* rmodifier: new plugin "rmodifier": alter modifier strings with regular + expressions (bug #26964) + Version 0.3.3 (2010-08-07) -------------------------- diff --git a/configure.in b/configure.in index feae986aa..bde5a4255 100644 --- a/configure.in +++ b/configure.in @@ -100,27 +100,28 @@ AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa mem # Variables in config.h -AH_VERBATIM([PREFIX], [#undef PREFIX]) -AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR]) +AH_VERBATIM([PREFIX], [#undef PREFIX]) +AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR]) AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR]) -AH_VERBATIM([HAVE_GCRYPT], [#undef HAVE_GCRYPT]) -AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS]) -AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK]) -AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS]) -AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL]) -AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET]) -AH_VERBATIM([PLUGIN_DEMO], [#undef PLUGIN_DEMO]) -AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO]) -AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC]) -AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER]) -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]) -AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA]) -AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL]) -AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER]) -AH_VERBATIM([DOC], [#undef DOC]) +AH_VERBATIM([HAVE_GCRYPT], [#undef HAVE_GCRYPT]) +AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS]) +AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK]) +AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS]) +AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL]) +AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET]) +AH_VERBATIM([PLUGIN_DEMO], [#undef PLUGIN_DEMO]) +AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO]) +AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC]) +AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER]) +AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY]) +AH_VERBATIM([PLUGIN_RMODIFIER], [#undef PLUGIN_RMODIFIER]) +AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL]) +AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON]) +AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY]) +AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA]) +AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL]) +AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER]) +AH_VERBATIM([DOC], [#undef DOC]) # Arguments for ./configure @@ -139,6 +140,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(relay, [ --enable-relay turn on Relay plugin (default=off)],enable_relay=$enableval,enable_relay=no) +AC_ARG_ENABLE(rmodifier, [ --disable-rmodifier turn off Rmodifier plugin (default=compiled)],enable_rmodifier=$enableval,enable_rmodifier=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) @@ -408,6 +410,14 @@ else not_asked="$not_asked relay" fi +# ------------------------------- rmodifier ------------------------------------ + +if test "x$enable_rmodifier" = "xyes" ; then + AC_DEFINE(PLUGIN_RMODIFIER) +else + not_asked="$not_asked rmodifier" +fi + # ---------------------------------- perl -------------------------------------- PERL_VERSION= @@ -971,28 +981,29 @@ CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENS # output Makefiles # ------------------------------------------------------------------------------ -AM_CONDITIONAL(HAVE_GCRYPT, test "$enable_gcrypt" = "yes") -AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") -AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes") -AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes") -AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes") -AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes") -AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes") -AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes") -AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes") -AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes") -AM_CONDITIONAL(PLUGIN_DEMO, test "$enable_demo" = "yes") -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_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") -AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes") -AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes") -AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes") -AM_CONDITIONAL(DOC, test "$enable_doc" = "yes") +AM_CONDITIONAL(HAVE_GCRYPT, test "$enable_gcrypt" = "yes") +AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") +AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes") +AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes") +AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes") +AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes") +AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes") +AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes") +AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes") +AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes") +AM_CONDITIONAL(PLUGIN_DEMO, test "$enable_demo" = "yes") +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_RELAY, test "$enable_relay" = "yes") +AM_CONDITIONAL(PLUGIN_RMODIFIER, test "$enable_rmodifier" = "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") +AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes") +AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes") +AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes") +AM_CONDITIONAL(DOC, test "$enable_doc" = "yes") AC_OUTPUT([Makefile doc/Makefile @@ -1014,6 +1025,7 @@ AC_OUTPUT([Makefile src/plugins/irc/Makefile src/plugins/logger/Makefile src/plugins/relay/Makefile + src/plugins/rmodifier/Makefile src/plugins/scripts/Makefile src/plugins/scripts/perl/Makefile src/plugins/scripts/python/Makefile @@ -1078,6 +1090,9 @@ fi if test "x$enable_relay" = "xyes"; then listplugins="$listplugins relay" fi +if test "x$enable_rmodifier" = "xyes"; then + listplugins="$listplugins rmodifier" +fi if test "x$enable_perl" = "xyes"; then listplugins="$listplugins perl($PERL_VERSION)" fi diff --git a/doc/de/autogen/plugin_api/completions.txt b/doc/de/autogen/plugin_api/completions.txt index fdacbab69..1ac42ba2e 100644 --- a/doc/de/autogen/plugin_api/completions.txt +++ b/doc/de/autogen/plugin_api/completions.txt @@ -46,6 +46,8 @@ | relay | relay_relays | Protokoll.Name des aktuellen Relays von der Relay-Erweiterung +| rmodifier | rmodifier | list of rmodifiers + | ruby | ruby_script | Liste der Skripten: | tcl | tcl_script | Liste der Skripten: diff --git a/doc/de/autogen/plugin_api/infolists.txt b/doc/de/autogen/plugin_api/infolists.txt index 2300074d2..92acac5f1 100644 --- a/doc/de/autogen/plugin_api/infolists.txt +++ b/doc/de/autogen/plugin_api/infolists.txt @@ -22,6 +22,8 @@ | relay | relay | Liste der Relay-Clients | Relay Pointer (optional) | - +| rmodifier | rmodifier | list of rmodifiers | rmodifier pointer (optional) | rmodifier name (can start or end with "*" as joker) (optional) + | ruby | ruby_script | Liste der Skripten: | Skript Pointer (optional) | Name des Skripts (darf mit einem "*" als Platzhalter beginnen oder enden) (optional) | tcl | tcl_script | Liste der Skripten: | Skript Pointer (optional) | Name des Skripts (darf mit einem "*" als Platzhalter beginnen oder enden) (optional) diff --git a/doc/de/autogen/user/rmodifier_commands.txt b/doc/de/autogen/user/rmodifier_commands.txt new file mode 100644 index 000000000..42ef6b896 --- /dev/null +++ b/doc/de/autogen/user/rmodifier_commands.txt @@ -0,0 +1,25 @@ +• *`/rmodifier`* `[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all [name...]] | [default -yes]`:: + +........................................ + alter modifier strings with regular expressions + + list: list all rmodifiers + listdefault: list default rmodifiers + add: add a rmodifier + name: name of rmodifier + modifiers: comma separated list of modifiers + groups: action on groups found: comma separated list of groups (from 1 to 9) with optional "*" after number to hide group + regex: regular expression + del: delete a rmodifier + -all: delete all rmodifiers + default: restore default rmodifiers + + Examples: + hide everything typed after a command /password: + /rmodifier add password input_text_display 1,2* ^(/password +)(.*) + delete rmodifier "password": + /rmodifier del password + delete all rmodifiers: + /rmodifier del -all +........................................ + diff --git a/doc/de/autogen/user/rmodifier_options.txt b/doc/de/autogen/user/rmodifier_options.txt new file mode 100644 index 000000000..43222b7f4 --- /dev/null +++ b/doc/de/autogen/user/rmodifier_options.txt @@ -0,0 +1,5 @@ +* *rmodifier.look.hide_char* +** Beschreibung: char used to hide part of a string +** Typ: Zeichenkette +** Werte: beliebige Zeichenkette (Standardwert: "*") + diff --git a/doc/de/weechat_user.de.txt b/doc/de/weechat_user.de.txt index 75d7d8f39..6d2f360a1 100644 --- a/doc/de/weechat_user.de.txt +++ b/doc/de/weechat_user.de.txt @@ -22,7 +22,7 @@ Funktionen wesentliche Merkmale: -* Multi-Protokoll fähig (IRC, andere Protokolle folgen) +* Multi-Protokoll fähig (IRC, Jabber) * Multi-Server Verbindungen (mittels SSL, IPv6, proxy) * verschiedene GUIs: Curses (wxWidgets, Gtk und Qt sind in der Entwicklung) * klein, schnell und schlank @@ -923,20 +923,22 @@ Standarderweiterungen: [width="50%",cols="^1,5",options="header"] |======================================== -| Erweit. | Beschreibung -| alias | definiert Alias für Befehle -| aspell | Rechtschreibprüfung für Befehlszeile -| charset | Zeichensatz (de)-kodierung in Buffern -| demo | Demo Erweiterung (nicht standardmäßig kompiliert) -| fifo | FIFO Pipe die zur Fernsteuerung von WeeChat genutzt werden kann -| irc | IRC Chat-Protokoll -| logger | erstellt Protokolldateien von Buffern -| perl | Perl-Skript API -| python | Python-Skript API -| ruby | Ruby-Skript API -| lua | Lua-Skript API -| tcl | Tcl-Skript API -| xfer | Datentransfer und Direktchat +| Erweit. | Beschreibung +| alias | definiert Alias für Befehle +| aspell | Rechtschreibprüfung für Befehlszeile +| charset | Zeichensatz (de)-kodierung in Buffern +| demo | Demo Erweiterung (nicht standardmäßig kompiliert) +| fifo | FIFO Pipe die zur Fernsteuerung von WeeChat genutzt werden kann +| irc | IRC Chat-Protokoll +| logger | erstellt Protokolldateien von Buffern +// TRANSLATION MISSING +| rmodifier | Alter modifier strings with regular expressions +| perl | Perl-Skript API +| python | Python-Skript API +| ruby | Ruby-Skript API +| lua | Lua-Skript API +| tcl | Tcl-Skript API +| xfer | Datentransfer und Direktchat |======================================== [[alias_plugin]] @@ -1564,6 +1566,67 @@ In einer Baumstruktur sieht es dann wie folgt aus: | #chan2.weechatlog ........................................ +// TRANSLATION MISSING +[[rmodifier_plugin]] +Rmodifier plugin +~~~~~~~~~~~~~~~~ + +The Rmodifier plugin lets you alter modifier strings using regular expressions. +Typical use is to hide password when you type them, or when WeeChat saves +them in command history. For example, it is possible to replace each char in +these passwords by "*". + +[[rmodifier_options]] +Options (rmodifier.conf) +^^^^^^^^^^^^^^^^^^^^^^^^ + +include::autogen/user/rmodifier_options.txt[] + +[[rmodifier_commands]] +Commands +^^^^^^^^ + +include::autogen/user/rmodifier_commands.txt[] + +[[rmodifier_creation]] +Rmodifier creation +^^^^^^^^^^^^^^^^^^ + +A rmodifier consists of three elements: + +. one or more "modifiers" +. a regular expression, to capture "groups" +. a string that describes output using number of "groups" captured in regular + expression + +For list of modifiers used by WeeChat or plugins, see +''WeeChat Plugin API Reference', function 'weechat_hook_modifier'. + +For each captured group, following actions are possible: + +* keep group as-is (by using group number) +* replace all chars in group to hide content (group number + "*") +* remove group (if group is not used in string) + +Example of default rmodifier for command `/oper`: + +* modifiers: `history_add,input_text_display` +** `history_add`: called when WeeChat stores command in history +** `input_text_display`: called when command line has changed + (applies only on display, not content of command line) +* regular expression: `^(/oper +\S+ +)(.*)` +* groupes: `1,2*` + +Each time modifiers "history_add" or "input_text_display" are called, regular +expression is checked. If string matches, then it is replaced by captured groups, +as defined in string with groups. + +In this example, we keep number 1 as-is, and we replace all chars of group 2 by +replacement char defined in configuration (option 'rmodifier.look.hide_char'). + +If command line contains: `/oper nick password` then display becomes: +`/oper nick ********`. + [[scripts_plugins]] Skripten Erweiterungen ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/docgen.pl b/doc/docgen.pl index 9ef30bc88..e8409c2af 100644 --- a/doc/docgen.pl +++ b/doc/docgen.pl @@ -63,14 +63,14 @@ my @all_locale_list = qw(en_US fr_FR it_IT de_DE); # if plugin is listed without "c", that means plugin has only one command # /name (where "name" # is name of plugin) # Note: we consider core is a plugin called "weechat" -my %plugin_list = ("weechat" => "co", "alias" => "", - "aspell" => "o", "charset" => "co", - "demo" => "co", "fifo" => "co", - "irc" => "co", "logger" => "co", - "relay" => "co", "perl" => "", - "python" => "", "ruby" => "", - "lua" => "", "tcl" => "", - "xfer" => "co"); +my %plugin_list = ("weechat" => "co", "alias" => "", + "aspell" => "o", "charset" => "co", + "demo" => "co", "fifo" => "co", + "irc" => "co", "logger" => "co", + "relay" => "co", "rmodifier" => "co", + "perl" => "", "python" => "", + "ruby" => "", "lua" => "", + "tcl" => "", "xfer" => "co"); # options to ignore my @ignore_options = ("aspell\\.dict\\..*", @@ -84,6 +84,7 @@ my @ignore_options = ("aspell\\.dict\\..*", "logger\\.level\\..*", "logger\\.mask\\..*", "relay\\.port\\..*", + "rmodifier\\.modifier\\..*", "weechat\\.proxy\\..*", "weechat\\.bar\\..*", "weechat\\.debug\\..*", diff --git a/doc/en/autogen/plugin_api/completions.txt b/doc/en/autogen/plugin_api/completions.txt index d3409e6b6..85dc06699 100644 --- a/doc/en/autogen/plugin_api/completions.txt +++ b/doc/en/autogen/plugin_api/completions.txt @@ -46,6 +46,8 @@ | relay | relay_relays | protocol.name of current relays for relay plugin +| rmodifier | rmodifier | list of rmodifiers + | ruby | ruby_script | list of scripts | tcl | tcl_script | list of scripts diff --git a/doc/en/autogen/plugin_api/infolists.txt b/doc/en/autogen/plugin_api/infolists.txt index c734fc2a4..9eee2fec8 100644 --- a/doc/en/autogen/plugin_api/infolists.txt +++ b/doc/en/autogen/plugin_api/infolists.txt @@ -22,6 +22,8 @@ | relay | relay | list of relay clients | relay pointer (optional) | - +| rmodifier | rmodifier | list of rmodifiers | rmodifier pointer (optional) | rmodifier name (can start or end with "*" as joker) (optional) + | ruby | ruby_script | list of scripts | script pointer (optional) | script name (can start or end with "*" as wildcard) (optional) | tcl | tcl_script | list of scripts | script pointer (optional) | script name (can start or end with "*" as wildcard) (optional) diff --git a/doc/en/autogen/user/rmodifier_commands.txt b/doc/en/autogen/user/rmodifier_commands.txt new file mode 100644 index 000000000..42ef6b896 --- /dev/null +++ b/doc/en/autogen/user/rmodifier_commands.txt @@ -0,0 +1,25 @@ +• *`/rmodifier`* `[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all [name...]] | [default -yes]`:: + +........................................ + alter modifier strings with regular expressions + + list: list all rmodifiers + listdefault: list default rmodifiers + add: add a rmodifier + name: name of rmodifier + modifiers: comma separated list of modifiers + groups: action on groups found: comma separated list of groups (from 1 to 9) with optional "*" after number to hide group + regex: regular expression + del: delete a rmodifier + -all: delete all rmodifiers + default: restore default rmodifiers + + Examples: + hide everything typed after a command /password: + /rmodifier add password input_text_display 1,2* ^(/password +)(.*) + delete rmodifier "password": + /rmodifier del password + delete all rmodifiers: + /rmodifier del -all +........................................ + diff --git a/doc/en/autogen/user/rmodifier_options.txt b/doc/en/autogen/user/rmodifier_options.txt new file mode 100644 index 000000000..358ae2769 --- /dev/null +++ b/doc/en/autogen/user/rmodifier_options.txt @@ -0,0 +1,5 @@ +* *rmodifier.look.hide_char* +** description: char used to hide part of a string +** type: string +** values: any string (default value: "*") + diff --git a/doc/en/weechat_user.en.txt b/doc/en/weechat_user.en.txt index 854657c9b..88c589e6f 100644 --- a/doc/en/weechat_user.en.txt +++ b/doc/en/weechat_user.en.txt @@ -22,7 +22,7 @@ Features Main features are: -* multi-protocols (IRC and other soon) +* multi-protocols (IRC, Jabber) * multi-servers connection (with SSL, IPv6, proxy) * many GUI: Curses (wxWidgets, Gtk and Qt under development) * small, fast and light @@ -923,20 +923,21 @@ Default plugins are: [width="50%",cols="^1,5",options="header"] |======================================== -| Plugin | Description -| alias | Define alias for commands -| aspell | Spell checking for command line -| charset | Charset decoding/encoding for buffers -| demo | Demo plugin (not compiled by default) -| fifo | FIFO pipe used to remotely send commands to WeeChat -| irc | IRC chat protocol -| logger | Log buffers to files -| perl | Perl scripting API -| python | Python scripting API -| ruby | Ruby scripting API -| lua | Lua scripting API -| tcl | Tcl scripting API -| xfer | File transfer and direct chat +| Plugin | Description +| alias | Define alias for commands +| aspell | Spell checking for command line +| charset | Charset decoding/encoding for buffers +| demo | Demo plugin (not compiled by default) +| fifo | FIFO pipe used to remotely send commands to WeeChat +| irc | IRC chat protocol +| logger | Log buffers to files +| rmodifier | Alter modifier strings with regular expressions +| perl | Perl scripting API +| python | Python scripting API +| ruby | Ruby scripting API +| lua | Lua scripting API +| tcl | Tcl scripting API +| xfer | File transfer and direct chat |======================================== [[alias_plugin]] @@ -1549,6 +1550,66 @@ You'll have following files: | #chan2.weechatlog ........................................ +[[rmodifier_plugin]] +Rmodifier plugin +~~~~~~~~~~~~~~~~ + +The Rmodifier plugin lets you alter modifier strings using regular expressions. +Typical use is to hide password when you type them, or when WeeChat saves +them in command history. For example, it is possible to replace each char in +these passwords by "*". + +[[rmodifier_options]] +Options (rmodifier.conf) +^^^^^^^^^^^^^^^^^^^^^^^^ + +include::autogen/user/rmodifier_options.txt[] + +[[rmodifier_commands]] +Commands +^^^^^^^^ + +include::autogen/user/rmodifier_commands.txt[] + +[[rmodifier_creation]] +Rmodifier creation +^^^^^^^^^^^^^^^^^^ + +A rmodifier consists of three elements: + +. one or more "modifiers" +. a regular expression, to capture "groups" +. a string that describes output using number of "groups" captured in regular + expression + +For list of modifiers used by WeeChat or plugins, see +''WeeChat Plugin API Reference', function 'weechat_hook_modifier'. + +For each captured group, following actions are possible: + +* keep group as-is (by using group number) +* replace all chars in group to hide content (group number + "*") +* remove group (if group is not used in string) + +Example of default rmodifier for command `/oper`: + +* modifiers: `history_add,input_text_display` +** `history_add`: called when WeeChat stores command in history +** `input_text_display`: called when command line has changed + (applies only on display, not content of command line) +* regular expression: `^(/oper +\S+ +)(.*)` +* groupes: `1,2*` + +Each time modifiers "history_add" or "input_text_display" are called, regular +expression is checked. If string matches, then it is replaced by captured groups, +as defined in string with groups. + +In this example, we keep number 1 as-is, and we replace all chars of group 2 by +replacement char defined in configuration (option 'rmodifier.look.hide_char'). + +If command line contains: `/oper nick password` then display becomes: +`/oper nick ********`. + [[scripts_plugins]] Scripts plugins ~~~~~~~~~~~~~~~ diff --git a/doc/fr/autogen/plugin_api/completions.txt b/doc/fr/autogen/plugin_api/completions.txt index 60cae5969..e84b1614f 100644 --- a/doc/fr/autogen/plugin_api/completions.txt +++ b/doc/fr/autogen/plugin_api/completions.txt @@ -46,6 +46,8 @@ | relay | relay_relays | protocole.nom des relais courants pour l'extension relay +| rmodifier | rmodifier | liste des rmodifiers + | ruby | ruby_script | liste des scripts | tcl | tcl_script | liste des scripts diff --git a/doc/fr/autogen/plugin_api/infolists.txt b/doc/fr/autogen/plugin_api/infolists.txt index 9e18f46e3..616d0e2ff 100644 --- a/doc/fr/autogen/plugin_api/infolists.txt +++ b/doc/fr/autogen/plugin_api/infolists.txt @@ -22,6 +22,8 @@ | relay | relay | liste des clients pour le relai | pointeur vers le relay (optionnel) | - +| rmodifier | rmodifier | liste des rmodifiers | pointeur vers le rmodifieur (optionnel) | nom du rmodifier (peut démarrer ou se terminer par "*" comme caractère joker) (optionnel) + | ruby | ruby_script | liste des scripts | pointeur vers le script (optionnel) | nom de script (peut démarrer ou se terminer par "*" comme joker) (optionnel) | tcl | tcl_script | liste des scripts | pointeur vers le script (optionnel) | nom de script (peut démarrer ou se terminer par "*" comme joker) (optionnel) diff --git a/doc/fr/autogen/user/rmodifier_commands.txt b/doc/fr/autogen/user/rmodifier_commands.txt new file mode 100644 index 000000000..6bd1a47aa --- /dev/null +++ b/doc/fr/autogen/user/rmodifier_commands.txt @@ -0,0 +1,25 @@ +• *`/rmodifier`* `[list] | [listdefault] | [add nom modifiers groupes regex] | [del nom|-all [nom...]] | [default -yes]`:: + +........................................ + modifie des chaînes de "modifier" avec des expressions régulières + + list: liste les rmodifiers + listdefault: liste les rmodifiers par défaut + add: ajoute un rmodifier + name: nom du rmodifier + modifiers: liste de modifiers (séparés par une virgule) + groupes: action sur les groupes trouvés: liste de groupes (séparés par une virgule) (de 1 à 9) avec en option "*" après le nombre pour cacher le groupe + regex: expression régulière + del: supprime un rmodifier + -all: supprime tous les rmodifiers + default: restaure les rmodifiers par défaut + + Exemples: + cacher tout ce qui est tapé après la commande /password: + /rmodifier add password input_text_display 1,2* ^(/password +)(.*) + supprimer le rmodifier "password": + /rmodifier del password + supprimer tous les rmodifiers: + /rmodifier del -all +........................................ + diff --git a/doc/fr/autogen/user/rmodifier_options.txt b/doc/fr/autogen/user/rmodifier_options.txt new file mode 100644 index 000000000..5cebb0483 --- /dev/null +++ b/doc/fr/autogen/user/rmodifier_options.txt @@ -0,0 +1,5 @@ +* *rmodifier.look.hide_char* +** description: caractère utilisé pour cacher une partie de la chaîne +** type: chaîne +** valeurs: toute chaîne (valeur par défaut: "*") + diff --git a/doc/fr/weechat_user.fr.txt b/doc/fr/weechat_user.fr.txt index b2317cad9..2dd951186 100644 --- a/doc/fr/weechat_user.fr.txt +++ b/doc/fr/weechat_user.fr.txt @@ -23,7 +23,7 @@ Fonctionnalités Ses principales fonctionnalités sont les suivantes : -* multi-protocoles (IRC et bientôt d'autres) +* multi-protocoles (IRC, Jabber) * connexion multi-serveurs (avec SSL, IPv6, proxy) * plusieurs interfaces : Curses (wxWidgets, Gtk et Qt en développement) * petit, rapide et léger @@ -954,6 +954,7 @@ Les extensions par défaut sont : | fifo | Tube FIFO pour envoyer des commandes à distance vers WeeChat | irc | Discussion avec le protocole IRC | logger | Enregistrement des tampons dans des fichiers +| rmodifier | Modification des chaînes de "modifier" avec des expressions régulières | perl | Interface (API) pour scripts Perl | python | Interface (API) pour scripts Python | ruby | Interface (API) pour scripts Ruby @@ -1594,6 +1595,71 @@ Vous obtiendrez les fichiers suivants : | #chan2.weechatlog ........................................ +[[rmodifier_plugin]] +Extension Rmodifier +~~~~~~~~~~~~~~~~~~~ + +L'extension Rmodifier vous permet de modifier les chaînes de "modifier" avec +des expressions régulières. + +L'utilisation typique est pour cacher les mots de passe lorsque vous les tapez, +ou lorsque WeeChat les sauvegarde dans l'historique des commandes. Il est +possible par exemple de remplacer chaque lettre de ces mots de passe par "*". + +[[rmodifier_options]] +Options (rmodifier.conf) +^^^^^^^^^^^^^^^^^^^^^^^^ + +include::autogen/user/rmodifier_options.txt[] + +[[rmodifier_commands]] +Commandes +^^^^^^^^^ + +include::autogen/user/rmodifier_commands.txt[] + +[[rmodifier_creation]] +Création d'un rmodifier +^^^^^^^^^^^^^^^^^^^^^^^ + +Un rmodifier se compose de trois éléments : + +. un ou plusieurs "modifiers" +. une expression régulière, permettant de capturer des "groupes" +. une chaîne décrivant la sortie en utilisant les numéros de "groupes" capturés + dans l'expression régulière + +Pour la liste des modifiers utilisés par WeeChat ou des extensions, voir la +'Référence API Extension WeeChat', fonction 'weechat_hook_modifier'. + +Pour chaque groupe capturé, les actions suivantes sont possibles : + +* garder le groupe tel quel (en utilisant son numéro) +* remplacer tous les caractères du groupe pour cacher le contenu + (numéro du groupe + "*") +* supprimer le groupe (si le groupe n'est pas utilisé dans la chaîne) + +Exemple du rmodifier par défaut pour la commande `/oper` : + +* modifiers : `history_add,input_text_display` +** `history_add` : appelé lorsque WeeChat stocke la commande dans l'historique +** `input_text_display` : appelé lorsque la ligne de commande a changé + (agit uniquement sur l'affichage, pas le contenu de la ligne de commande) +* expression régulière : `^(/oper +\S+ +)(.*)` +* groupes : `1,2*` + +A chaque fois que les modifiers "history_add" ou "input_text_display" sont +appelés, l'expression régulière est vérifiée. Si la chaîne correspont, alors +elle est remplacée par les groupes capturés, tels que définis dans la chaîne +des groupes. + +Dans cet exemple, on garde le groupe numéro 1 tel quel, et on remplace tous les +caractères du groupe 2 par le caractère de remplacement défini dans la +configuration (option 'rmodifier.look.hide_char'). + +Si la ligne de commande contient : `/oper nick password` alors l'affichage +sera : `/oper nick ********`. + [[scripts_plugins]] Extensions Scripts ~~~~~~~~~~~~~~~~~~ @@ -1650,7 +1716,7 @@ L'extension Xfer permet : [[xfer_options]] Options (xfer.conf) -^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^ include::autogen/user/xfer_options.txt[] diff --git a/doc/it/autogen/plugin_api/completions.txt b/doc/it/autogen/plugin_api/completions.txt index 012e2bdcd..69a019619 100644 --- a/doc/it/autogen/plugin_api/completions.txt +++ b/doc/it/autogen/plugin_api/completions.txt @@ -46,6 +46,8 @@ | relay | relay_relays | protocollo.nome dei relay correnti per il plugin relay +| rmodifier | rmodifier | list of rmodifiers + | ruby | ruby_script | elenco degli script | tcl | tcl_script | elenco degli script diff --git a/doc/it/autogen/plugin_api/infolists.txt b/doc/it/autogen/plugin_api/infolists.txt index ee5ae7d9d..f960d8b4c 100644 --- a/doc/it/autogen/plugin_api/infolists.txt +++ b/doc/it/autogen/plugin_api/infolists.txt @@ -22,6 +22,8 @@ | relay | relay | elenco di client relay | puntatore al relay (opzionale) | - +| rmodifier | rmodifier | list of rmodifiers | rmodifier pointer (optional) | rmodifier name (can start or end with "*" as joker) (optional) + | ruby | ruby_script | elenco degli script | puntatore allo script (opzionale) | nome script (può iniziare o terminare con "*" come carattere jolly) (opzionale) | tcl | tcl_script | elenco degli script | puntatore allo script (opzionale) | nome script (può iniziare o terminare con "*" come carattere jolly) (opzionale) diff --git a/doc/it/autogen/user/rmodifier_commands.txt b/doc/it/autogen/user/rmodifier_commands.txt new file mode 100644 index 000000000..42ef6b896 --- /dev/null +++ b/doc/it/autogen/user/rmodifier_commands.txt @@ -0,0 +1,25 @@ +• *`/rmodifier`* `[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all [name...]] | [default -yes]`:: + +........................................ + alter modifier strings with regular expressions + + list: list all rmodifiers + listdefault: list default rmodifiers + add: add a rmodifier + name: name of rmodifier + modifiers: comma separated list of modifiers + groups: action on groups found: comma separated list of groups (from 1 to 9) with optional "*" after number to hide group + regex: regular expression + del: delete a rmodifier + -all: delete all rmodifiers + default: restore default rmodifiers + + Examples: + hide everything typed after a command /password: + /rmodifier add password input_text_display 1,2* ^(/password +)(.*) + delete rmodifier "password": + /rmodifier del password + delete all rmodifiers: + /rmodifier del -all +........................................ + diff --git a/doc/it/autogen/user/rmodifier_options.txt b/doc/it/autogen/user/rmodifier_options.txt new file mode 100644 index 000000000..3206809d7 --- /dev/null +++ b/doc/it/autogen/user/rmodifier_options.txt @@ -0,0 +1,5 @@ +* *rmodifier.look.hide_char* +** descrizione: char used to hide part of a string +** tipo: stringa +** valori: qualsiasi stringa (valore predefinito: "*") + diff --git a/doc/it/weechat_user.it.txt b/doc/it/weechat_user.it.txt index 6c56392b4..1d4ea739d 100644 --- a/doc/it/weechat_user.it.txt +++ b/doc/it/weechat_user.it.txt @@ -23,7 +23,7 @@ Caratteristiche Le caratteristiche principali: -* multi-protocollo (IRC ed altri presto in arrivo) +* multi-protocollo (IRC, Jabber) * connessione a server multipli (con SSL, IPv6, proxy) * molte interfacce: Curses (wxWidgets, Gtk e Qt in fase di sviluppo) * piccolo, veloce e leggero @@ -940,20 +940,22 @@ I plugin predefiniti sono: [width="50%",cols="^1,5",options="header"] |======================================= -| Plugin | Descrizione -| alias | Definisce gli alias per i comandi -| aspell | Controllo ortografico per la riga di comando -| charset | Set di caratteri per la codifica/decodifica nei buffer -| demo | Plugin Demo (non viene compilato per default) -| fifo | pipe FIFO utilizzata per inviare comandi da remoto su WeeChat -| irc | protocollo chat per IRC -| logger | Registra i buffer su file -| perl | API per lo scripting in Perl -| python | API per lo scripting in Python -| ruby | API per lo scripting in Ruby -| lua | API per lo scripting in Lua -| tcl | API per lo scripting in TCL -| xfer | Trasferimento file e chat diretta +| Plugin | Descrizione +| alias | Definisce gli alias per i comandi +| aspell | Controllo ortografico per la riga di comando +| charset | Set di caratteri per la codifica/decodifica nei buffer +| demo | Plugin Demo (non viene compilato per default) +| fifo | pipe FIFO utilizzata per inviare comandi da remoto su WeeChat +| irc | protocollo chat per IRC +| logger | Registra i buffer su file +// TRANSLATION MISSING +| rmodifier | Alter modifier strings with regular expressions +| perl | API per lo scripting in Perl +| python | API per lo scripting in Python +| ruby | API per lo scripting in Ruby +| lua | API per lo scripting in Lua +| tcl | API per lo scripting in TCL +| xfer | Trasferimento file e chat diretta |======================================= [[alias_plugin]] @@ -1585,6 +1587,67 @@ Si avranno i seguenti file: | #canale2.weechatlog ........................................ +// TRANSLATION MISSING +[[rmodifier_plugin]] +Rmodifier plugin +~~~~~~~~~~~~~~~~ + +The Rmodifier plugin lets you alter modifier strings using regular expressions. +Typical use is to hide password when you type them, or when WeeChat saves +them in command history. For example, it is possible to replace each char in +these passwords by "*". + +[[rmodifier_options]] +Options (rmodifier.conf) +^^^^^^^^^^^^^^^^^^^^^^^^ + +include::autogen/user/rmodifier_options.txt[] + +[[rmodifier_commands]] +Commands +^^^^^^^^ + +include::autogen/user/rmodifier_commands.txt[] + +[[rmodifier_creation]] +Rmodifier creation +^^^^^^^^^^^^^^^^^^ + +A rmodifier consists of three elements: + +. one or more "modifiers" +. a regular expression, to capture "groups" +. a string that describes output using number of "groups" captured in regular + expression + +For list of modifiers used by WeeChat or plugins, see +''WeeChat Plugin API Reference', function 'weechat_hook_modifier'. + +For each captured group, following actions are possible: + +* keep group as-is (by using group number) +* replace all chars in group to hide content (group number + "*") +* remove group (if group is not used in string) + +Example of default rmodifier for command `/oper`: + +* modifiers: `history_add,input_text_display` +** `history_add`: called when WeeChat stores command in history +** `input_text_display`: called when command line has changed + (applies only on display, not content of command line) +* regular expression: `^(/oper +\S+ +)(.*)` +* groupes: `1,2*` + +Each time modifiers "history_add" or "input_text_display" are called, regular +expression is checked. If string matches, then it is replaced by captured groups, +as defined in string with groups. + +In this example, we keep number 1 as-is, and we replace all chars of group 2 by +replacement char defined in configuration (option 'rmodifier.look.hide_char'). + +If command line contains: `/oper nick password` then display becomes: +`/oper nick ********`. + [[scripts_plugins]] Plugin per gli script ~~~~~~~~~~~~~~~~~~~~~ diff --git a/po/POTFILES.in b/po/POTFILES.in index 244ec9498..c02c99305 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -183,6 +183,18 @@ ./src/plugins/relay/relay-server.h ./src/plugins/relay/relay-upgrade.c ./src/plugins/relay/relay-upgrade.h +./src/plugins/rmodifier/rmodifier.c +./src/plugins/rmodifier/rmodifier-command.c +./src/plugins/rmodifier/rmodifier-command.h +./src/plugins/rmodifier/rmodifier-completion.c +./src/plugins/rmodifier/rmodifier-completion.h +./src/plugins/rmodifier/rmodifier-config.c +./src/plugins/rmodifier/rmodifier-config.h +./src/plugins/rmodifier/rmodifier-debug.c +./src/plugins/rmodifier/rmodifier-debug.h +./src/plugins/rmodifier/rmodifier.h +./src/plugins/rmodifier/rmodifier-info.c +./src/plugins/rmodifier/rmodifier-info.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 00baea2df..7db98f718 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -6062,6 +6062,109 @@ msgstr "%s: poslouchám na portu %d (přesměrování %s.%s, maximálně %d klie msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: nedostatek paměti pro poslouchání na portu" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: chyba při vytváření volby serveru \"%s\"" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Žádné filtry zpráv nejsou definovány" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "seznam filtrů" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Výchozí klávesové zkratky obnoveny" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: chyba při vytváření serveru \"%s\"" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Pole \"%s\" vytvořeno" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " napojené modifikátory:" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Alias \"%s\" odebrán" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sChyba: filtr \"%s\" nenalezen" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Výchozí klávesové zkratky obnoveny" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%sChyba: \"-yes\" argument je požadován pro reset kaláves (bezpečnostní " +"opatření)" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s%s: chyba při vytváření volby serveru \"%s\"" + +#, fuzzy +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [enable|disable|toggle [name]] | [add jméno plugin.buffer tags " +"regex] | [del name|-all]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "seznam filtrů" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: chyba vytváření \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "ukazatel xfer (volitelné)" + +#, fuzzy +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" +"jméno filtru (může začínat nebo končit \"*\" jako zástupným znakem) " +"(volitelné)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6673,3 +6776,11 @@ msgstr "Argumenty" msgid "Pointer" msgstr "Ukazatel" + +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "seznam xfer" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Seznam proxy:" diff --git a/po/de.po b/po/de.po index fcb2af22f..b95a86b33 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Nils G. \n" "Language-Team: weechat-dev \n" @@ -6287,6 +6287,109 @@ msgstr "%s: Lausche am Port %d (Relay: %s.%s, Max. %d Clients)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: Nicht genug Speicher um an dem neuen Port zu lauschen" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: Fehler bei der Erstellung der Server-Option \"%s\"" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Kein Nachrichtenfilter definiert" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "Liste der Filter" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Standardtastenbelegungen wiederhergestellt" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: Fehler bei der Erstellung des Servers \"%s\"" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Infobar \"%s\" erstellt" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " modifiers ge-hooked:" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Alias \"%s\" entfernt" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sFehler: Filter \"%s\" nicht gefunden" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Standardtastenbelegungen wiederhergestellt" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%sFehler: \"-yes\" Argument ist aus Sicherheitsgründen für den Reset der " +"Tastenbelegung notwendig" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s%s: Fehler bei der Erstellung der Server-Option \"%s\"" + +#, fuzzy +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [enable|disable|toggle [name]] | [add name plugin.buffer tags " +"regex] | [del name|-all]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "Liste der Filter" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: Fehler beim Erstellen von \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "xfer Pointer (optional)" + +#, fuzzy +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" +"Name des Filters (darf mit einem \"*\" als Platzhalter beginnen oder enden) " +"(optional)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6913,3 +7016,11 @@ msgstr "Argumente" msgid "Pointer" msgstr "Pointer" + +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "Transfer-Liste" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Liste der Proxys:" diff --git a/po/es.po b/po/es.po index c4e7f2cbd..e61fed9d8 100644 --- a/po/es.po +++ b/po/es.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -6143,6 +6143,107 @@ msgstr "%s: escuchando en el puerto %d (repetidor: %s.%s, max %d clientes)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: no hay memoria suficiente para escuchar en un nuevo puerto" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: error al crear la opción \"%s\" del servidor" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Ningún filtro definido" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "lista de filtros" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Atajos predefinidos restaurados" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: error al crear el servidor \"%s\"" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Barra \"%s\" creada" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " modificadores enganchados:" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Alias \"%s\" eliminado" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sError: filtro \"%s\" no encontrado" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Atajos predefinidos restaurados" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "%sError: se requiere el argumento \"-yes\" para restaurar los atajos" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s%s: error al crear la opción \"%s\" del servidor" + +#, fuzzy +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [enable|disable|toggle [nombre]] | [add nombre plugin.buffer " +"etiquetas regex] | [del nombre|-all]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "lista de filtros" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: error al crear \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "puntero del xfer (optional)" + +#, fuzzy +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" +"nombre del filtro (puede empezar o terminar con \"*\" como comodín) " +"(opcional)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6767,6 +6868,14 @@ msgstr "Argumentos" msgid "Pointer" msgstr "Puntero" +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "lista de transferencias" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Lista de proxies:" + #~ msgid "text color for prefix #1 in nicklist" #~ msgstr "color para el prefijo #1 en la lista de apodos" diff --git a/po/fr.po b/po/fr.po index 66bb0c4fb..b0799ac5e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" -"PO-Revision-Date: 2010-08-07 10:46+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" +"PO-Revision-Date: 2010-08-11 13:16+0200\n" "Last-Translator: Sebastien Helleu \n" "Language-Team: weechat-dev \n" "Language: French\n" @@ -6178,6 +6178,120 @@ msgstr "%s: écoute sur le port %d (relai: %s.%s, max %d clients)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: pas assez de mémoire pour écouter sur le nouveau port" +#, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: erreur de compilation de l'expression régulière \"%s\"" + +msgid "No rmodifier defined" +msgstr "Pas de rmodifier défini" + +msgid "List of rmodifiers:" +msgstr "Liste des rmodifiers:" + +msgid "Default rmodifiers:" +msgstr "Rmodifiers par défaut:" + +#, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: erreur de création du rmodifier \"%s\"" + +#, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Rmodifier \"%s\" créé" + +#, c-format +msgid "%d rmodifiers removed" +msgstr "%d rmodifiers supprimés" + +#, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Rmodifier \"%s\" supprimé" + +#, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sRmodifier \"%s\" non trouvé" + +msgid "Default rmodifiers restored:" +msgstr "Rmodifiers par défaut restaurés:" + +#, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%sErreur: le paramètre \"-yes\" est requis pour la restauration des " +"rmodifiers par défaut (raison de sécurité)" + +msgid "alter modifier strings with regular expressions" +msgstr "modifie des chaînes de \"modifier\" avec des expressions régulières" + +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [listdefault] | [add nom modifiers groupes regex] | [del nom|-all " +"[nom...]] | [default -yes]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" +" list: liste les rmodifiers\n" +"listdefault: liste les rmodifiers par défaut\n" +" add: ajoute un rmodifier\n" +" name: nom du rmodifier\n" +" modifiers: liste de modifiers (séparés par une virgule)\n" +" groupes: action sur les groupes trouvés: liste de groupes (séparés par " +"une virgule) (de 1 à 9) avec en option \"*\" après le nombre pour cacher le " +"groupe\n" +" regex: expression régulière\n" +" del: supprime un rmodifier\n" +" -all: supprime tous les rmodifiers\n" +" default: restaure les rmodifiers par défaut\n" +"\n" +"Exemples:\n" +" cacher tout ce qui est tapé après la commande /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" supprimer le rmodifier \"password\":\n" +" /rmodifier del password\n" +" supprimer tous les rmodifiers:\n" +" /rmodifier del -all" + +msgid "list of rmodifiers" +msgstr "liste des rmodifiers" + +#, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: erreur de création du rmodifier \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "caractère utilisé pour cacher une partie de la chaîne" + +msgid "rmodifier pointer (optional)" +msgstr "pointeur vers le rmodifieur (optionnel)" + +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" +"nom du rmodifier (peut démarrer ou se terminer par \"*\" comme caractère " +"joker) (optionnel)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6802,25 +6916,3 @@ msgstr "Paramètres" msgid "Pointer" msgstr "Pointeur" - -#~ msgid "text color for prefix #1 in nicklist" -#~ msgstr "couleur du texte pour le préfixe n°1 de la liste des pseudos" - -#~ msgid "text color for prefix #2 in nicklist" -#~ msgstr "couleur du texte pour le préfixe n°2 de la liste des pseudos" - -#~ msgid "text color for prefix #3 in nicklist" -#~ msgstr "couleur du texte pour le préfixe n°3 de la liste des pseudos" - -#~ msgid "text color for prefix #4 in nicklist" -#~ msgstr "couleur du texte pour le préfixe n°4 de la liste des pseudos" - -#~ msgid "text color for prefix #5 in nicklist" -#~ msgstr "couleur du texte pour le préfixe n°5 de la liste des pseudos" - -#~ msgid "" -#~ "channel: channel name to join\n" -#~ " key: key to join the channel" -#~ msgstr "" -#~ "canal: nom du canal à rejoindre\n" -#~ " clé: clé pour rejoindre le canal" diff --git a/po/hu.po b/po/hu.po index 6bd4a41eb..c5d3bf8d0 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -5807,6 +5807,103 @@ msgstr "" msgid "%s%s: not enough memory for listening on new port" msgstr "%s nincs elegendő memória új DCC számára\n" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Nincs aliasz definiálva.\n" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "Aliaszok listája:\n" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Alapértelmezett billentyűparancsok visszaállítva\n" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "A \"%s\" => \"%s\" aliasz elkészült\n" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " időkezelők:\n" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "A \"%s\" aliasz eltávolítva\n" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%s a \"%s\" modul nem található\n" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Alapértelmezett billentyűparancsok visszaállítva\n" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%s \"-yes\" paraméter megadása kötelező a billentyűparancsok " +"visszaállításához (biztonsági okokból)\n" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "Aliaszok listája:\n" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "Beállítások mentése a lemezre\n" + +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6432,6 +6529,14 @@ msgstr "fogadó típusa [paraméterek]" msgid "Pointer" msgstr "perc" +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "Aliaszok listája:\n" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Aliaszok listája:\n" + #, fuzzy #~ msgid "text color for prefix #1 in nicklist" #~ msgstr "név színe" diff --git a/po/it.po b/po/it.po index 7c7d96ed2..770d47531 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Marco Paolone \n" "Language-Team: weechat-dev \n" @@ -6143,6 +6143,109 @@ msgstr "%s: in ascolto sulla porta %d (relay: %s,%s, massimo %d client)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: memoria non sufficiente per l'ascolto su una nuova porta" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: errore durante la creazione dell'opzione del server \"%s\"" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Nessun filtro per messaggio definito" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "elenco dei filtri" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Associazione tasti predefinita ripristinata" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: errore durante la creazione del server \"%s\"" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Barra \"%s\" creata" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " hook sui modificatori:" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Alias \"%s\" eliminato" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sErrore: filtro \"%s\" non trovato" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Associazione tasti predefinita ripristinata" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%sErrore: l'argomento \"-yes\" è richiesto per il reset dei tasti (motivi di " +"sicurezza)" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s%s: errore durante la creazione dell'opzione del server \"%s\"" + +#, fuzzy +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [enable|disable|toggle [nome]] | [add nome plugin.buffer tag regex] " +"| [del nome|-all]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "elenco dei filtri" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: errore nella creazione \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "puntatore a xfer (opzionale)" + +#, fuzzy +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" +"nome filtro (può iniziare o terminare con \"*\" come carattere jolly) " +"(opzionale)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6755,6 +6858,14 @@ msgstr "Argomenti" msgid "Pointer" msgstr "Puntatore" +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "lista di xfer" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Elenco di proxy:" + #~ msgid "text color for prefix #1 in nicklist" #~ msgstr "colore del testo per il prefisso #1 nella nicklist" diff --git a/po/pl.po b/po/pl.po index 1d8572e9a..55944f13a 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Krzysztof Koroscik \n" "Language-Team: weechat-dev \n" @@ -6086,6 +6086,107 @@ msgstr "%s: nasłuchuję na porcie %d (relay:%s.%s, max %d klientów)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: za mało pamięci do nasłuchu na nowym porcie" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s%s: błąd podczas tworzenia opcji dla serwera \"%s\"" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Nie zdefiniowano żadnych filtrow wiadomości" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "lista filtrów" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Przywrócono domyślne przypisania klawiszy" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s%s: błąd podczas tworzenia serwera \"%s\"" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Utworzono pasek \"%s\"" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " powiązane modyfikatory:" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Alias \"%s\" został usunięty" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%sBłąd: nie odnaleziono filtru \"%s\"" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Przywrócono domyślne przypisania klawiszy" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%sBłąd: argument \"-yes\" wymagany do zresetowania ustawień klawiszy " +"(względy bezpieczeństwa) " + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s%s: błąd podczas tworzenia opcji dla serwera \"%s\"" + +#, fuzzy +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" +"[list] | [enable|disable|toggle [nazwa]] | [add nazwa wtyczka.bufor tagi " +"regex] | [del nazwa|-all]" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "lista filtrów" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s%s: błąd podczas tworzenia \"%s\" => \"%s\"" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "wskaźnik xfer (opcjonalny)" + +#, fuzzy +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "nazwa filtru (może się zaczynać lub kończyć \"*\") (opcjonalne)" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6693,3 +6794,11 @@ msgstr "Argumenty" msgid "Pointer" msgstr "Wskaźnik" + +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "lista xfer" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Lista proxy:" diff --git a/po/ru.po b/po/ru.po index fc1bbf2f9..580a2df5b 100644 --- a/po/ru.po +++ b/po/ru.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.3.4-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: 2010-08-07 10:46+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -5816,6 +5816,102 @@ msgstr "" msgid "%s%s: not enough memory for listening on new port" msgstr "%s недостаточно памяти для нового DCC\n" +#, fuzzy, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +#, fuzzy +msgid "No rmodifier defined" +msgstr "Сокращения не заданы.\n" + +#, fuzzy +msgid "List of rmodifiers:" +msgstr "Список сокращений:\n" + +#, fuzzy +msgid "Default rmodifiers:" +msgstr "Комбинации клавиш по умолчанию восстановлены\n" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" created" +msgstr "Сокращение \"%s\" => \"%s\" создано\n" + +#, fuzzy, c-format +msgid "%d rmodifiers removed" +msgstr " обработчики таймера:\n" + +#, fuzzy, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "Сокращение \"%s\" удалено\n" + +#, fuzzy, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "%s plugin \"%s\" не найден\n" + +#, fuzzy +msgid "Default rmodifiers restored:" +msgstr "Комбинации клавиш по умолчанию восстановлены\n" + +#, fuzzy, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" +"%s аргумент \"-yes\" необходим для сброса ключей (в целях безопасности)\n" + +#, fuzzy +msgid "alter modifier strings with regular expressions" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +#, fuzzy +msgid "list of rmodifiers" +msgstr "Список сокращений:\n" + +#, fuzzy, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +msgid "char used to hide part of a string" +msgstr "" + +#, fuzzy +msgid "rmodifier pointer (optional)" +msgstr "Сохраняю конфигурацию\n" + +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " @@ -6436,6 +6532,14 @@ msgstr "адресат тип [аргументы]" msgid "Pointer" msgstr "минута" +#, fuzzy +#~ msgid "list of regex modifiers" +#~ msgstr "Список сокращений:\n" + +#, fuzzy +#~ msgid "List of regex modifiers:" +#~ msgstr "Список сокращений:\n" + #, fuzzy #~ msgid "text color for prefix #1 in nicklist" #~ msgstr "цвет ника" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index 913913a67..4a4d3d0ef 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -184,6 +184,18 @@ SET(WEECHAT_SOURCES ./src/plugins/relay/relay-server.h ./src/plugins/relay/relay-upgrade.c ./src/plugins/relay/relay-upgrade.h +./src/plugins/rmodifier/rmodifier.c +./src/plugins/rmodifier/rmodifier-command.c +./src/plugins/rmodifier/rmodifier-command.h +./src/plugins/rmodifier/rmodifier-completion.c +./src/plugins/rmodifier/rmodifier-completion.h +./src/plugins/rmodifier/rmodifier-config.c +./src/plugins/rmodifier/rmodifier-config.h +./src/plugins/rmodifier/rmodifier-debug.c +./src/plugins/rmodifier/rmodifier-debug.h +./src/plugins/rmodifier/rmodifier.h +./src/plugins/rmodifier/rmodifier-info.c +./src/plugins/rmodifier/rmodifier-info.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 d6d2933c7..e7d5e1cd1 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2010-08-06 20:08+0200\n" +"POT-Creation-Date: 2010-08-11 14:49+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -5058,6 +5058,94 @@ msgstr "" msgid "%s%s: not enough memory for listening on new port" msgstr "" +#, c-format +msgid "%s%s: error compiling regular expression \"%s\"" +msgstr "" + +msgid "No rmodifier defined" +msgstr "" + +msgid "List of rmodifiers:" +msgstr "" + +msgid "Default rmodifiers:" +msgstr "" + +#, c-format +msgid "%s%s: error creating rmodifier \"%s\"" +msgstr "" + +#, c-format +msgid "Rmodifier \"%s\" created" +msgstr "" + +#, c-format +msgid "%d rmodifiers removed" +msgstr "" + +#, c-format +msgid "Rmodifier \"%s\" removed" +msgstr "" + +#, c-format +msgid "%sRmodifier \"%s\" not found" +msgstr "" + +msgid "Default rmodifiers restored:" +msgstr "" + +#, c-format +msgid "" +"%sError: \"-yes\" argument is required for restoring default rmodifiers " +"(security reason)" +msgstr "" + +msgid "alter modifier strings with regular expressions" +msgstr "" + +msgid "" +"[list] | [listdefault] | [add name modifiers groups regex] | [del name|-all " +"[name...]] | [default -yes]" +msgstr "" + +msgid "" +" list: list all rmodifiers\n" +"listdefault: list default rmodifiers\n" +" add: add a rmodifier\n" +" name: name of rmodifier\n" +" modifiers: comma separated list of modifiers\n" +" groups: action on groups found: comma separated list of groups (from 1 " +"to 9) with optional \"*\" after number to hide group\n" +" regex: regular expression\n" +" del: delete a rmodifier\n" +" -all: delete all rmodifiers\n" +" default: restore default rmodifiers\n" +"\n" +"Examples:\n" +" hide everything typed after a command /password:\n" +" /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" +" delete rmodifier \"password\":\n" +" /rmodifier del password\n" +" delete all rmodifiers:\n" +" /rmodifier del -all" +msgstr "" + +msgid "list of rmodifiers" +msgstr "" + +#, c-format +msgid "%s%s: error creating rmodifier \"%s\" => \"%s\"" +msgstr "" + +msgid "char used to hide part of a string" +msgstr "" + +msgid "rmodifier pointer (optional)" +msgstr "" + +msgid "rmodifier name (can start or end with \"*\" as joker) (optional)" +msgstr "" + #, c-format msgid "" "%s%s: unable to register script \"%s\" (another script already exists with " diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 80bcbad08..349aa4c22 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -70,6 +70,10 @@ IF(ENABLE_RELAY) ADD_SUBDIRECTORY( relay ) ENDIF(ENABLE_RELAY) +IF(NOT DISABLE_RMODIFIER) + ADD_SUBDIRECTORY( rmodifier ) +ENDIF(NOT DISABLE_RMODIFIER) + IF(NOT DISABLE_SCRIPTS OR NOT DISABLE_PERL OR NOT DISABLE_PYTHON OR NOT DISABLE_RUBY OR NOT DISABLE_LUA OR NOT DISABLE_TCL) ADD_SUBDIRECTORY( scripts ) ENDIF(NOT DISABLE_SCRIPTS OR NOT DISABLE_PERL OR NOT DISABLE_PYTHON OR NOT DISABLE_RUBY OR NOT DISABLE_LUA OR NOT DISABLE_TCL) diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 0c2c4d671..4fd76e836 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -62,6 +62,10 @@ if PLUGIN_RELAY relay_dir = relay endif +if PLUGIN_RMODIFIER +rmodifier_dir = rmodifier +endif + if PLUGIN_PERL script_dir = scripts endif @@ -87,7 +91,8 @@ xfer_dir = xfer endif SUBDIRS = . $(alias_dir) $(aspell_dir) $(charset_dir) $(demo_dir) $(fifo_dir) \ - $(irc_dir) $(logger_dir) $(relay_dir) $(script_dir) $(xfer_dir) + $(irc_dir) $(logger_dir) $(relay_dir) $(rmodifier_dir) \ + $(script_dir) $(xfer_dir) EXTRA_DIST = CMakeLists.txt diff --git a/src/plugins/rmodifier/CMakeLists.txt b/src/plugins/rmodifier/CMakeLists.txt new file mode 100644 index 000000000..81790ee2b --- /dev/null +++ b/src/plugins/rmodifier/CMakeLists.txt @@ -0,0 +1,31 @@ +# +# Copyright (C) 2010 Sebastien Helleu +# +# This file is part of WeeChat, the extensible chat client. +# +# WeeChat 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. +# +# WeeChat 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 WeeChat. If not, see . +# + +ADD_LIBRARY(rmodifier MODULE +rmodifier.c rmodifier.h +rmodifier-command.c rmodifier-command.h +rmodifier-completion.c rmodifier-completion.h +rmodifier-config.c rmodifier-config.h +rmodifier-debug.c rmodifier-debug.h +rmodifier-info.c rmodifier-info.h) +SET_TARGET_PROPERTIES(rmodifier PROPERTIES PREFIX "") + +TARGET_LINK_LIBRARIES(rmodifier) + +INSTALL(TARGETS rmodifier LIBRARY DESTINATION ${LIBDIR}/plugins) diff --git a/src/plugins/rmodifier/Makefile.am b/src/plugins/rmodifier/Makefile.am new file mode 100644 index 000000000..74d533134 --- /dev/null +++ b/src/plugins/rmodifier/Makefile.am @@ -0,0 +1,41 @@ +# +# Copyright (C) 2010 Sebastien Helleu +# +# This file is part of WeeChat, the extensible chat client. +# +# WeeChat 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. +# +# WeeChat 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 WeeChat. If not, see . +# + +INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(RMODIFIER_CFLAGS) + +libdir = ${weechat_libdir}/plugins + +lib_LTLIBRARIES = rmodifier.la + +rmodifier_la_SOURCES = rmodifier.c \ + rmodifier.h \ + rmodifier-command.c \ + rmodifier-command.h \ + rmodifier-completion.c \ + rmodifier-completion.h \ + rmodifier-config.c \ + rmodifier-config.h \ + rmodifier-debug.c \ + rmodifier-debug.h \ + rmodifier-info.c \ + rmodifier-info.h +rmodifier_la_LDFLAGS = -module +rmodifier_la_LIBADD = $(RMODIFIER_LFLAGS) + +EXTRA_DIST = CMakeLists.txt diff --git a/src/plugins/rmodifier/rmodifier-command.c b/src/plugins/rmodifier/rmodifier-command.c new file mode 100644 index 000000000..20c00805b --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-command.c @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier-command.c: rmodifier command + */ + +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-command.h" +#include "rmodifier-config.h" + + +/* + * rmodifier_command_print: print a rmodifier + */ + +void +rmodifier_command_print (const char *name, const char *modifiers, + const char *str_regex, const char *groups) +{ + weechat_printf (NULL, + " %s[%s%s%s]%s %s%s: \"%s%s%s\" [%s%s%s]", + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + name, + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + modifiers, + weechat_color ("chat_delimiters"), + weechat_color ("chat_host"), + str_regex, + weechat_color ("chat_delimiters"), + weechat_color ("chat"), + groups, + weechat_color ("chat_delimiters")); +} + +/* + * rmodifier_command_list: list rmodifiers + */ + +void +rmodifier_command_list (const char *message) +{ + struct t_rmodifier *ptr_rmodifier; + + if (rmodifier_list) + { + weechat_printf (NULL, ""); + weechat_printf (NULL, message); + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + rmodifier_command_print (ptr_rmodifier->name, + ptr_rmodifier->modifiers, + ptr_rmodifier->str_regex, + ptr_rmodifier->groups); + } + } + else + weechat_printf (NULL, _("No rmodifier defined")); +} + +/* + * rmodifier_command_cb: manage rmodifiers + */ + +int +rmodifier_command_cb (void *data, struct t_gui_buffer *buffer, int argc, + char **argv, char **argv_eol) +{ + struct t_rmodifier *ptr_rmodifier; + struct t_config_option *ptr_option; + int i, count; + + /* make C compiler happy */ + (void) data; + (void) buffer; + + if ((argc == 1) + || ((argc == 2) && (weechat_strcasecmp (argv[1], "list") == 0))) + { + /* list all rmodifiers */ + rmodifier_command_list (_("List of rmodifiers:")); + return WEECHAT_RC_OK; + } + + if (weechat_strcasecmp (argv[1], "listdefault") == 0) + { + /* list default rmodifiers */ + weechat_printf (NULL, ""); + weechat_printf (NULL, _("Default rmodifiers:")); + for (i = 0; rmodifier_config_default_list[i][0]; i++) + { + rmodifier_command_print (rmodifier_config_default_list[i][0], + rmodifier_config_default_list[i][1], + rmodifier_config_default_list[i][2], + rmodifier_config_default_list[i][3]); + } + return WEECHAT_RC_OK; + } + + if (weechat_strcasecmp (argv[1], "add") == 0) + { + /* add a rmodifier */ + if (argc < 6) + { + weechat_printf (NULL, + _("%sError: missing arguments for \"%s\" " + "command"), + weechat_prefix ("error"), "rmodifier"); + return WEECHAT_RC_ERROR; + } + ptr_rmodifier = rmodifier_new (argv[2], argv[3], argv_eol[5], argv[4]); + if (!ptr_rmodifier) + { + weechat_printf (NULL, + _("%s%s: error creating rmodifier \"%s\""), + weechat_prefix ("error"), RMODIFIER_PLUGIN_NAME, + argv[2]); + return WEECHAT_RC_ERROR; + } + /* create config option */ + ptr_option = weechat_config_search_option (rmodifier_config_file, + rmodifier_config_section_modifier, + argv[2]); + if (ptr_option) + weechat_config_option_free (ptr_option); + rmodifier_config_modifier_new_option (ptr_rmodifier->name, + ptr_rmodifier->modifiers, + ptr_rmodifier->str_regex, + ptr_rmodifier->groups); + + /* display message */ + weechat_printf (NULL, _("Rmodifier \"%s\" created"), + ptr_rmodifier->name); + return WEECHAT_RC_OK; + } + + if (weechat_strcasecmp (argv[1], "del") == 0) + { + /* add a rmodifier */ + if (argc < 3) + { + weechat_printf (NULL, + _("%sError: missing arguments for \"%s\" " + "command"), + weechat_prefix ("error"), "rmodifier"); + return WEECHAT_RC_ERROR; + } + if (weechat_strcasecmp (argv[2], "-all") == 0) + { + count = rmodifier_count; + rmodifier_free_all (); + weechat_config_section_free_options (rmodifier_config_section_modifier); + if (count > 0) + weechat_printf (NULL, _("%d rmodifiers removed"), count); + } + else + { + for (i = 2; i < argc; i++) + { + ptr_rmodifier = rmodifier_search (argv[i]); + if (ptr_rmodifier) + { + ptr_option = weechat_config_search_option (rmodifier_config_file, + rmodifier_config_section_modifier, + argv[i]); + if (ptr_option) + weechat_config_option_free (ptr_option); + rmodifier_free (ptr_rmodifier); + weechat_printf (NULL, _("Rmodifier \"%s\" removed"), + argv[i]); + } + else + { + weechat_printf (NULL, _("%sRmodifier \"%s\" not found"), + weechat_prefix ("error"), argv[i]); + } + } + } + return WEECHAT_RC_OK; + } + + /* restore default rmodifiers (only with "-yes", for security reason) */ + if (weechat_strcasecmp (argv[1], "default") == 0) + { + if ((argc >= 3) && (weechat_strcasecmp (argv[2], "-yes") == 0)) + { + rmodifier_free_all (); + weechat_config_section_free_options (rmodifier_config_section_modifier); + rmodifier_create_default (); + rmodifier_command_list (_("Default rmodifiers restored:")); + } + else + { + weechat_printf (NULL, + _("%sError: \"-yes\" argument is required for " + "restoring default rmodifiers (security reason)"), + weechat_prefix ("error")); + return WEECHAT_RC_ERROR; + } + return WEECHAT_RC_OK; + } + + return WEECHAT_RC_OK; +} + +/* + * rmodifier_command_init: add /rmodifier command + */ + +void +rmodifier_command_init () +{ + weechat_hook_command ("rmodifier", + N_("alter modifier strings with regular expressions"), + N_("[list] | [listdefault] | " + "[add name modifiers groups regex] | " + "[del name|-all [name...]] | [default -yes]"), + N_(" list: list all rmodifiers\n" + "listdefault: list default rmodifiers\n" + " add: add a rmodifier\n" + " name: name of rmodifier\n" + " modifiers: comma separated list of modifiers\n" + " groups: action on groups found: comma separated " + "list of groups (from 1 to 9) with optional \"*\" " + "after number to hide group\n" + " regex: regular expression\n" + " del: delete a rmodifier\n" + " -all: delete all rmodifiers\n" + " default: restore default rmodifiers\n\n" + "Examples:\n" + " hide everything typed after a command /password:\n" + " /rmodifier add password input_text_display 1,2* ^(/password +)(.*)\n" + " delete rmodifier \"password\":\n" + " /rmodifier del password\n" + " delete all rmodifiers:\n" + " /rmodifier del -all"), + "list" + " || listdefault" + " || add %(rmodifier)" + " || del %(rmodifier)|-all %(rmodifier)|%*" + " || default", + &rmodifier_command_cb, NULL); +} diff --git a/src/plugins/rmodifier/rmodifier-command.h b/src/plugins/rmodifier/rmodifier-command.h new file mode 100644 index 000000000..d83fb67e4 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-command.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_COMMAND_H +#define __WEECHAT_RMODIFIER_COMMAND_H 1 + +extern void rmodifier_command_init (); + +#endif /* __WEECHAT_RMODIFIER_COMMAND_H */ diff --git a/src/plugins/rmodifier/rmodifier-completion.c b/src/plugins/rmodifier/rmodifier-completion.c new file mode 100644 index 000000000..e85cdf7b6 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-completion.c @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier-completion.c: completion for rmodifier command + */ + +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-completion.h" + + +/* + * rmodifier_completion_cb: callback for completion with list of rmodifiers + */ + +int +rmodifier_completion_cb (void *data, const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_rmodifier *ptr_rmodifier; + + /* make C compiler happy */ + (void) data; + (void) completion_item; + (void) buffer; + + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + weechat_hook_completion_list_add (completion, ptr_rmodifier->name, + 0, WEECHAT_LIST_POS_SORT); + } + + return WEECHAT_RC_OK; +} + +/* + * rmodifier_completion_init: initialize rmodifier plugin + */ + +void +rmodifier_completion_init () +{ + weechat_hook_completion ("rmodifier", N_("list of rmodifiers"), + &rmodifier_completion_cb, NULL); +} diff --git a/src/plugins/rmodifier/rmodifier-completion.h b/src/plugins/rmodifier/rmodifier-completion.h new file mode 100644 index 000000000..09e7fe1a7 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-completion.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_COMPLETION_H +#define __WEECHAT_RMODIFIER_COMPLETION_H 1 + +extern void rmodifier_completion_init (); + +#endif /* __WEECHAT_RMODIFIER_COMPLETION_H */ diff --git a/src/plugins/rmodifier/rmodifier-config.c b/src/plugins/rmodifier/rmodifier-config.c new file mode 100644 index 000000000..d6d6e16c4 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-config.c @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier-config.c: rmodifier configuration options (file rmodifier.conf) + */ + +#include +#include +#include +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-config.h" + + +struct t_config_file *rmodifier_config_file = NULL; +struct t_config_section *rmodifier_config_section_modifier = NULL; + +struct t_config_option *rmodifier_config_look_hide_char; + +char *rmodifier_config_default_list[][4] = +{ + { "nickserv", "history_add,input_text_display", + "^(/(msg|quote) +nickserv +(identify|ghost \\S+) +)(.*)", "1,4*" + }, + { "oper", "history_add,input_text_display", + "^(/oper +\\S+ +)(.*)", "1,2*" + }, + { "set_pass", "history_add", + "^(/set +\\S*password\\S* +)(.*)", "1,2*" + }, + { NULL, NULL, NULL, NULL }, +}; + + +/* + * rmodifier_config_reload: reload rmodifier configuration file + */ + +int +rmodifier_config_reload (void *data, struct t_config_file *config_file) +{ + /* make C compiler happy */ + (void) data; + + rmodifier_free_all (); + + return weechat_config_reload (config_file); +} + +/* + * rmodifier_config_modifier_change_cb: callback called when a rmodifier is + * modified in section "modifier" + */ + +void +rmodifier_config_modifier_change_cb (void *data, struct t_config_option *option) +{ + /* make C compiler happy */ + (void) data; + + rmodifier_new_with_string (weechat_config_option_get_pointer (option, "name"), + weechat_config_option_get_pointer (option, "value")); +} + +/* + * rmodifier_config_modifier_delete_cb: callback called when rmodifier option + * is deleted in section "modifier" + */ + +void +rmodifier_config_modifier_delete_cb (void *data, struct t_config_option *option) +{ + struct t_rmodifier *ptr_rmodifier; + + /* make C compiler happy */ + (void) data; + + ptr_rmodifier = rmodifier_search (weechat_config_option_get_pointer (option, + "name")); + if (ptr_rmodifier) + rmodifier_free (ptr_rmodifier); +} + +/* + * rmodifier_config_modifier_write_default_cb: write default rmodifiers in + * configuration file in section + * "modifier" + */ + +int +rmodifier_config_modifier_write_default_cb (void *data, + struct t_config_file *config_file, + const char *section_name) +{ + int i; + + /* make C compiler happy */ + (void) data; + + if (!weechat_config_write_line (config_file, section_name, NULL)) + return WEECHAT_CONFIG_WRITE_ERROR; + + for (i = 0; rmodifier_config_default_list[i][0]; i++) + { + if (!weechat_config_write_line (config_file, + rmodifier_config_default_list[i][0], + "\"%s;%s;%s\"", + rmodifier_config_default_list[i][1], + rmodifier_config_default_list[i][2], + rmodifier_config_default_list[i][3])) + return WEECHAT_CONFIG_WRITE_ERROR; + } + + return WEECHAT_CONFIG_WRITE_OK; +} + +/* + * rmodifier_config_modifier_new_option: create new option in section "modifier" + */ + +void +rmodifier_config_modifier_new_option (const char *name, const char *modifiers, + const char *regex, const char *groups) +{ + int length; + char *value; + + length = strlen (modifiers) + 1 + strlen (regex) + 1 + + ((groups) ? strlen (groups) : 0) + 1; + value = malloc (length); + if (value) + { + snprintf (value, length, "%s;%s;%s", + modifiers, regex, + (groups) ? groups : ""); + weechat_config_new_option (rmodifier_config_file, + rmodifier_config_section_modifier, + name, "string", NULL, + NULL, 0, 0, "", value, 0, + NULL, NULL, + &rmodifier_config_modifier_change_cb, NULL, + &rmodifier_config_modifier_delete_cb, NULL); + free (value); + } +} + +/* + * rmodifier_config_modifier_create_option_cb: callback to create option in + * "modifier" section + */ + +int +rmodifier_config_modifier_create_option_cb (void *data, + struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, + const char *value) +{ + struct t_rmodifier *ptr_rmodifier; + int rc; + + /* make C compiler happy */ + (void) data; + (void) config_file; + (void) section; + + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; + + /* create rmodifier */ + ptr_rmodifier = rmodifier_search (option_name); + if (ptr_rmodifier) + rmodifier_free (ptr_rmodifier); + if (value && value[0]) + { + ptr_rmodifier = rmodifier_new_with_string (option_name, value); + if (ptr_rmodifier) + { + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + /* create option */ + rmodifier_config_modifier_new_option (ptr_rmodifier->name, + ptr_rmodifier->modifiers, + ptr_rmodifier->str_regex, + ptr_rmodifier->groups); + } + else + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; + } + else + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + + if (rc == WEECHAT_CONFIG_OPTION_SET_ERROR) + { + weechat_printf (NULL, + _("%s%s: error creating rmodifier " + "\"%s\" => \"%s\""), + weechat_prefix ("error"), RMODIFIER_PLUGIN_NAME, + option_name, value); + } + + return rc; +} + +/* + * rmodifier_config_init: init rmodifier configuration file + * return: 1 if ok, 0 if error + */ + +int +rmodifier_config_init () +{ + struct t_config_section *ptr_section; + + rmodifier_config_file = weechat_config_new (RMODIFIER_CONFIG_NAME, + &rmodifier_config_reload, NULL); + if (!rmodifier_config_file) + return 0; + + /* look */ + ptr_section = weechat_config_new_section (rmodifier_config_file, "look", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (rmodifier_config_file); + return 0; + } + + rmodifier_config_look_hide_char = weechat_config_new_option ( + rmodifier_config_file, ptr_section, + "hide_char", "string", + N_("char used to hide part of a string"), + NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); + + /* modifier */ + ptr_section = weechat_config_new_section (rmodifier_config_file, "modifier", + 0, 0, + NULL, NULL, + NULL, NULL, + &rmodifier_config_modifier_write_default_cb, NULL, + &rmodifier_config_modifier_create_option_cb, NULL, + NULL, NULL); + if (!ptr_section) + { + weechat_config_free (rmodifier_config_file); + return 0; + } + rmodifier_config_section_modifier = ptr_section; + + return 1; +} + +/* + * rmodifier_config_read: read rmodifier configuration file + */ + +int +rmodifier_config_read () +{ + return weechat_config_read (rmodifier_config_file); +} + +/* + * rmodifier_config_write: write rmodifier configuration file + */ + +int +rmodifier_config_write () +{ + return weechat_config_write (rmodifier_config_file); +} diff --git a/src/plugins/rmodifier/rmodifier-config.h b/src/plugins/rmodifier/rmodifier-config.h new file mode 100644 index 000000000..cc16c736b --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-config.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_CONFIG_H +#define __WEECHAT_RMODIFIER_CONFIG_H 1 + +#define RMODIFIER_CONFIG_NAME "rmodifier" + +extern struct t_config_file *rmodifier_config_file; +extern struct t_config_section *rmodifier_config_section_modifier; + +struct t_config_option *rmodifier_config_look_hide_char; + +extern char *rmodifier_config_default_list[][4]; + +extern void rmodifier_config_modifier_new_option (const char *name, + const char *modifiers, + const char *regex, + const char *groups); +extern int rmodifier_config_init (); +extern int rmodifier_config_read (); +extern int rmodifier_config_write (); + +#endif /* __WEECHAT_RMODIFIER_CONFIG_H */ diff --git a/src/plugins/rmodifier/rmodifier-debug.c b/src/plugins/rmodifier/rmodifier-debug.c new file mode 100644 index 000000000..3820edaa6 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-debug.c @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier-debug.c: debug functions for rmodifier plugin + */ + +#include +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-debug.h" + + +/* + * rmodifier_debug_signal_debug_dump_cb: dump rmodifier data in WeeChat log file + */ + +int +rmodifier_debug_signal_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); + + rmodifier_print_log (); + + weechat_log_printf (""); + weechat_log_printf ("***** End of \"%s\" plugin dump *****", + weechat_plugin->name); + + return WEECHAT_RC_OK; +} + +/* + * rmodifier_debug_init: initialize debug for rmodifier plugin + */ + +void +rmodifier_debug_init () +{ + weechat_hook_signal ("debug_dump", + &rmodifier_debug_signal_debug_dump_cb, NULL); +} diff --git a/src/plugins/rmodifier/rmodifier-debug.h b/src/plugins/rmodifier/rmodifier-debug.h new file mode 100644 index 000000000..9e81ba8f8 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-debug.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_DEBUG_H +#define __WEECHAT_RMODIFIER_DEBUG_H 1 + +extern void rmodifier_debug_init (); + +#endif /* __WEECHAT_RMODIFIER_DEBUG_H */ diff --git a/src/plugins/rmodifier/rmodifier-info.c b/src/plugins/rmodifier/rmodifier-info.c new file mode 100644 index 000000000..076e782b7 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-info.c @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier-info.c: info and infolist hooks for rmodifier plugin + */ + +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-info.h" + + +/* + * rmodifier_info_get_infolist_cb: callback called when rmodifier infolist is + * asked + */ + +struct t_infolist * +rmodifier_info_get_infolist_cb (void *data, const char *infolist_name, + void *pointer, const char *arguments) +{ + struct t_infolist *ptr_infolist; + struct t_rmodifier *ptr_rmodifier; + + /* make C compiler happy */ + (void) data; + (void) arguments; + + if (!infolist_name || !infolist_name[0]) + return NULL; + + if (weechat_strcasecmp (infolist_name, RMODIFIER_PLUGIN_NAME) == 0) + { + if (pointer && !rmodifier_valid (pointer)) + return NULL; + + ptr_infolist = weechat_infolist_new (); + if (ptr_infolist) + { + if (pointer) + { + /* build list with only one rmodifier */ + if (!rmodifier_add_to_infolist (ptr_infolist, pointer)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; + } + else + { + /* build list with all rmodifiers matching arguments */ + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + if (!arguments || !arguments[0] + || weechat_string_match (ptr_rmodifier->name, arguments, 0)) + { + if (!rmodifier_add_to_infolist (ptr_infolist, ptr_rmodifier)) + { + weechat_infolist_free (ptr_infolist); + return NULL; + } + } + } + return ptr_infolist; + } + } + } + + return NULL; +} + +/* + * rmodifier_info_init: initialize info and infolist hooks for rmodifier plugin + */ + +void +rmodifier_info_init () +{ + /* rmodifier infolist hooks */ + weechat_hook_infolist ("rmodifier", N_("list of rmodifiers"), + N_("rmodifier pointer (optional)"), + N_("rmodifier name (can start or end with \"*\" as " + "joker) (optional)"), + &rmodifier_info_get_infolist_cb, NULL); +} diff --git a/src/plugins/rmodifier/rmodifier-info.h b/src/plugins/rmodifier/rmodifier-info.h new file mode 100644 index 000000000..eeffbd285 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier-info.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_INFO_H +#define __WEECHAT_RMODIFIER_INFO_H 1 + +extern void rmodifier_info_init (); + +#endif /* __WEECHAT_RMODIFIER_INFO_H */ diff --git a/src/plugins/rmodifier/rmodifier.c b/src/plugins/rmodifier/rmodifier.c new file mode 100644 index 000000000..e6fe6ec38 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier.c @@ -0,0 +1,573 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +/* + * rmodifier.c: alter modifier strings with regular expressions + * (useful for hiding passwords in input or command history) + */ + +#include +#include +#include + +#include "../weechat-plugin.h" +#include "rmodifier.h" +#include "rmodifier-command.h" +#include "rmodifier-completion.h" +#include "rmodifier-config.h" +#include "rmodifier-debug.h" +#include "rmodifier-info.h" + + +WEECHAT_PLUGIN_NAME(RMODIFIER_PLUGIN_NAME); +WEECHAT_PLUGIN_DESCRIPTION("Regex modifier plugin for WeeChat"); +WEECHAT_PLUGIN_AUTHOR("Sebastien Helleu "); +WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION); +WEECHAT_PLUGIN_LICENSE(WEECHAT_LICENSE); + +struct t_weechat_plugin *weechat_rmodifier_plugin = NULL; + +struct t_rmodifier *rmodifier_list = NULL; +struct t_rmodifier *last_rmodifier = NULL; +int rmodifier_count = 0; +struct t_weelist *rmodifier_hook_list = NULL; + + +/* + * rmodifier_valid: check if a rmodifier pointer exists + * return 1 if rmodifier exists + * 0 if rmodifier is not found + */ + +int +rmodifier_valid (struct t_rmodifier *rmodifier) +{ + struct t_rmodifier *ptr_rmodifier; + + if (!rmodifier) + return 0; + + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + if (ptr_rmodifier == rmodifier) + return 1; + } + + /* rmodifier not found */ + return 0; +} + +/* + * rmodifier_search: search a rmodifier + */ + +struct t_rmodifier * +rmodifier_search (const char *name) +{ + struct t_rmodifier *ptr_rmodifier; + + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + if (strcmp (name, ptr_rmodifier->name) == 0) + return ptr_rmodifier; + } + return NULL; +} + +/* + * rmodifier_hide_string: hide a string (using char defined in option + * "rmodifier.look.hide_char") + */ + +char * +rmodifier_hide_string (const char *string) +{ + int length, i; + char *result; + + if (!string || !string[0]) + return NULL; + + length = weechat_utf8_strlen (string); + result = malloc ((length * strlen (weechat_config_string (rmodifier_config_look_hide_char))) + 1); + if (!result) + return NULL; + + result[0] = '\0'; + for (i = 0; i < length; i++) + { + strcat (result, weechat_config_string (rmodifier_config_look_hide_char)); + } + + return result; +} + +/* + * rmodifier_replace_groups: replace groups in a string, using regex_match + * found by call to regexec() + */ + +char * +rmodifier_replace_groups (const char *string, regmatch_t regex_match[], + const char *groups) +{ + char *result, *str_group, *string_to_add; + const char *ptr_groups; + int length, num_group; + + length = 1; + result = malloc (length); + if (!result) + return NULL; + + result[0] = '\0'; + ptr_groups = groups; + while (ptr_groups && ptr_groups[0]) + { + if ((ptr_groups[0] >= '1') && (ptr_groups[0] <= '9')) + { + num_group = ptr_groups[0] - '0'; + if (regex_match[num_group].rm_so >= 0) + { + str_group = weechat_strndup (string + regex_match[num_group].rm_so, + regex_match[num_group].rm_eo -regex_match[num_group].rm_so); + if (str_group) + { + string_to_add = NULL; + if (ptr_groups[1] == '*') + string_to_add = rmodifier_hide_string (str_group); + else + string_to_add = strdup (str_group); + + if (string_to_add) + { + length += strlen (string_to_add); + result = realloc (result, length); + if (!result) + return NULL; + strcat (result, string_to_add); + free (string_to_add); + } + free (str_group); + } + } + } + ptr_groups = weechat_utf8_next_char (ptr_groups); + } + + return result; +} + +/* + * rmodifier_modifier_cb: callback for a modifier + */ + +char * +rmodifier_modifier_cb (void *data, const char *modifier, + const char *modifier_data, const char *string) +{ + struct t_rmodifier *rmodifier; + regmatch_t regex_match[9]; + int i; + + /* make C compiler happy */ + (void) modifier; + (void) modifier_data; + + rmodifier = (struct t_rmodifier *)data; + + /* reset matching groups */ + for (i = 0; i < 9; i++) + { + regex_match[i].rm_so = -1; + } + + /* execute regex and return modified string if matching */ + if (regexec (rmodifier->regex, string, 9, regex_match, 0) == 0) + { + return rmodifier_replace_groups (string, regex_match, + rmodifier->groups); + } + + /* regex not matching */ + return NULL; +} + +/* + * rmodifier_create_regex: create regex for a rmodifier + */ + +void +rmodifier_create_regex (struct t_rmodifier *rmodifier) +{ + if (rmodifier->regex) + { + regfree (rmodifier->regex); + free (rmodifier->regex); + } + + rmodifier->regex = malloc (sizeof (*rmodifier->regex)); + if (!rmodifier->regex) + return; + + if (regcomp (rmodifier->regex, rmodifier->str_regex, + REG_EXTENDED | REG_ICASE) != 0) + { + weechat_printf (NULL, + _("%s%s: error compiling regular expression \"%s\""), + weechat_prefix ("error"), RMODIFIER_PLUGIN_NAME, + rmodifier->str_regex); + free (rmodifier->regex); + return; + } +} + +/* + * rmodifier_hook_modifiers: hook modifiers for a rmodifier + */ + +void +rmodifier_hook_modifiers (struct t_rmodifier *rmodifier) +{ + char **argv; + int argc, i; + + argv = weechat_string_split (rmodifier->modifiers, ",", 0, 0, &argc); + + if (argv) + { + rmodifier->hooks = malloc (sizeof (*rmodifier->hooks) * argc); + if (rmodifier->hooks) + { + for (i = 0; i < argc; i++) + { + rmodifier->hooks[i] = weechat_hook_modifier (argv[i], + &rmodifier_modifier_cb, + rmodifier); + } + rmodifier->hooks_count = argc; + } + weechat_string_free_split (argv); + } +} + +/* + * rmodifier_new: create new rmodifier and add it to rmodifier list + */ + +struct t_rmodifier * +rmodifier_new (const char *name, const char *modifiers, const char *str_regex, + const char *groups) +{ + struct t_rmodifier *new_rmodifier, *ptr_rmodifier; + + if (!name || !name[0] || !modifiers || !modifiers[0] + || !str_regex || !str_regex[0]) + return NULL; + + ptr_rmodifier = rmodifier_search (name); + if (ptr_rmodifier) + rmodifier_free (ptr_rmodifier); + + new_rmodifier = malloc (sizeof (*new_rmodifier)); + if (new_rmodifier) + { + new_rmodifier->name = strdup (name); + new_rmodifier->hooks = NULL; + new_rmodifier->modifiers = strdup (modifiers); + new_rmodifier->str_regex = strdup (str_regex); + new_rmodifier->regex = NULL; + new_rmodifier->groups = strdup ((groups) ? groups : ""); + + /* create regex and modifiers */ + rmodifier_create_regex (new_rmodifier); + rmodifier_hook_modifiers (new_rmodifier); + + if (rmodifier_list) + { + /* add rmodifier to end of list */ + new_rmodifier->prev_rmodifier = last_rmodifier; + new_rmodifier->next_rmodifier = NULL; + last_rmodifier->next_rmodifier = new_rmodifier; + last_rmodifier = new_rmodifier; + } + else + { + new_rmodifier->prev_rmodifier = NULL; + new_rmodifier->next_rmodifier = NULL; + rmodifier_list = new_rmodifier; + last_rmodifier = new_rmodifier; + } + + rmodifier_count++; + } + + return new_rmodifier; +} + +/* + * rmodifier_new_with_string: create a rmodifier with a single string, which + * contains: "modifiers;regex;groups" + */ + +struct t_rmodifier * +rmodifier_new_with_string (const char *name, const char *value) +{ + struct t_rmodifier *new_rmodifier; + char *pos1, *pos2, *modifiers, *str_regex; + + new_rmodifier = NULL; + + pos1 = strchr (value, ';'); + pos2 = rindex (value, ';'); + if (pos1 && pos2 && (pos2 > pos1)) + { + modifiers = weechat_strndup (value, pos1 - value); + str_regex = weechat_strndup (pos1 + 1, pos2 - (pos1 + 1)); + if (modifiers && str_regex) + { + new_rmodifier = rmodifier_new (name, + modifiers, str_regex, pos2 + 1); + } + if (modifiers) + free (modifiers); + if (str_regex) + free (str_regex); + } + + return new_rmodifier; +} + +/* + * rmodifer_create_default: create default rmodifiers + */ + +void +rmodifier_create_default () +{ + int i; + + for (i = 0; rmodifier_config_default_list[i][0]; i++) + { + if (rmodifier_new (rmodifier_config_default_list[i][0], + rmodifier_config_default_list[i][1], + rmodifier_config_default_list[i][2], + rmodifier_config_default_list[i][3])) + { + rmodifier_config_modifier_new_option (rmodifier_config_default_list[i][0], + rmodifier_config_default_list[i][1], + rmodifier_config_default_list[i][2], + rmodifier_config_default_list[i][3]); + } + } +} + +/* + * rmodifier_free: free a rmodifier and remove it from list + */ + +void +rmodifier_free (struct t_rmodifier *rmodifier) +{ + struct t_rmodifier *new_rmodifier_list; + int i; + + /* remove rmodifier from list */ + if (last_rmodifier == rmodifier) + last_rmodifier = rmodifier->prev_rmodifier; + if (rmodifier->prev_rmodifier) + { + (rmodifier->prev_rmodifier)->next_rmodifier = rmodifier->next_rmodifier; + new_rmodifier_list = rmodifier_list; + } + else + new_rmodifier_list = rmodifier->next_rmodifier; + if (rmodifier->next_rmodifier) + (rmodifier->next_rmodifier)->prev_rmodifier = rmodifier->prev_rmodifier; + + /* free data */ + if (rmodifier->name) + free (rmodifier->name); + if (rmodifier->modifiers) + free (rmodifier->modifiers); + if (rmodifier->hooks) + { + for (i = 0; i < rmodifier->hooks_count; i++) + { + weechat_unhook (rmodifier->hooks[i]); + } + free (rmodifier->hooks); + } + if (rmodifier->str_regex) + free (rmodifier->str_regex); + if (rmodifier->regex) + { + regfree (rmodifier->regex); + free (rmodifier->regex); + } + if (rmodifier->groups) + free (rmodifier->groups); + free (rmodifier); + + rmodifier_count--; + + rmodifier_list = new_rmodifier_list; +} + +/* + * rmodifier_free_all: free all rmodifier + */ + +void +rmodifier_free_all () +{ + while (rmodifier_list) + { + rmodifier_free (rmodifier_list); + } +} + +/* + * rmodifier_add_to_infolist: add a rmodifier in an infolist + * return 1 if ok, 0 if error + */ + +int +rmodifier_add_to_infolist (struct t_infolist *infolist, + struct t_rmodifier *rmodifier) +{ + struct t_infolist_item *ptr_item; + char option_name[64]; + int i; + + if (!infolist || !rmodifier) + return 0; + + ptr_item = weechat_infolist_new_item (infolist); + if (!ptr_item) + return 0; + + if (!weechat_infolist_new_var_string (ptr_item, "name", rmodifier->name)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "modifiers", rmodifier->modifiers)) + return 0; + for (i = 0; i < rmodifier->hooks_count; i++) + { + snprintf (option_name, sizeof (option_name), "hook_%05d", i + 1); + if (!weechat_infolist_new_var_pointer (ptr_item, option_name, + rmodifier->hooks[i])) + return 0; + } + if (!weechat_infolist_new_var_integer (ptr_item, "hooks_count", rmodifier->hooks_count)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "str_regex", rmodifier->str_regex)) + return 0; + if (!weechat_infolist_new_var_pointer (ptr_item, "regex", rmodifier->regex)) + return 0; + if (!weechat_infolist_new_var_string (ptr_item, "groups", rmodifier->groups)) + return 0; + + return 1; +} + +/* + * rmodifier_print_log: print rmodifiers in log (usually for crash dump) + */ + +void +rmodifier_print_log () +{ + struct t_rmodifier *ptr_rmodifier; + int i; + + for (ptr_rmodifier = rmodifier_list; ptr_rmodifier; + ptr_rmodifier = ptr_rmodifier->next_rmodifier) + { + weechat_log_printf (""); + weechat_log_printf ("[rmodifier %s (addr:0x%lx)]", ptr_rmodifier->name, ptr_rmodifier); + weechat_log_printf (" modifiers. . . . . . : '%s'", ptr_rmodifier->modifiers); + weechat_log_printf (" hooks. . . . . . . . : 0x%lx", ptr_rmodifier->hooks); + for (i = 0; i < ptr_rmodifier->hooks_count; i++) + { + weechat_log_printf (" hooks[%03d] . . . . : 0x%lx", i, ptr_rmodifier->hooks[i]); + } + weechat_log_printf (" hooks_count. . . . . : %d", ptr_rmodifier->hooks_count); + weechat_log_printf (" str_regex. . . . . . : '%s'", ptr_rmodifier->str_regex); + weechat_log_printf (" regex. . . . . . . . : 0x%lx", ptr_rmodifier->regex); + weechat_log_printf (" groups . . . . . . . : '%s'", ptr_rmodifier->groups); + weechat_log_printf (" prev_rmodifier . . . : 0x%lx", ptr_rmodifier->prev_rmodifier); + weechat_log_printf (" next_rmodifier . . . : 0x%lx", ptr_rmodifier->next_rmodifier); + } +} + +/* + * weechat_plugin_init: initialize rmodifier 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; + + rmodifier_count = 0; + + rmodifier_hook_list = weechat_list_new (); + + if (!rmodifier_config_init ()) + { + weechat_printf (NULL, + _("%s%s: error creating configuration file"), + weechat_prefix("error"), RMODIFIER_PLUGIN_NAME); + return WEECHAT_RC_ERROR; + } + rmodifier_config_read (); + + rmodifier_command_init (); + rmodifier_completion_init (); + + rmodifier_info_init (); + + rmodifier_debug_init (); + + return WEECHAT_RC_OK; +} + +/* + * weechat_plugin_end: end rmodifier plugin + */ + +int +weechat_plugin_end (struct t_weechat_plugin *plugin) +{ + /* make C compiler happy */ + (void) plugin; + + rmodifier_config_write (); + rmodifier_free_all (); + weechat_list_free (rmodifier_hook_list); + weechat_config_free (rmodifier_config_file); + + return WEECHAT_RC_OK; +} diff --git a/src/plugins/rmodifier/rmodifier.h b/src/plugins/rmodifier/rmodifier.h new file mode 100644 index 000000000..bfd086708 --- /dev/null +++ b/src/plugins/rmodifier/rmodifier.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Sebastien Helleu + * + * This file is part of WeeChat, the extensible chat client. + * + * WeeChat 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. + * + * WeeChat 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 WeeChat. If not, see . + */ + +#ifndef __WEECHAT_RMODIFIER_H +#define __WEECHAT_RMODIFIER_H 1 + +#include + +#define weechat_plugin weechat_rmodifier_plugin +#define RMODIFIER_PLUGIN_NAME "rmodifier" + +struct t_rmodifier +{ + char *name; /* name of rmodifier */ + char *modifiers; /* modifiers */ + struct t_hook **hooks; /* hooks for modifiers */ + int hooks_count; /* number of hooks */ + char *str_regex; /* string with regex */ + regex_t *regex; /* regex */ + char *groups; /* actions on groups in regex */ + /* (keep, delete, hide) */ + struct t_rmodifier *prev_rmodifier; /* link to previous rmodifier */ + struct t_rmodifier *next_rmodifier; /* link to next rmodifier */ +}; + +extern struct t_rmodifier *rmodifier_list; +extern int rmodifier_count; + +extern struct t_weechat_plugin *weechat_rmodifier_plugin; + +extern int rmodifier_valid (struct t_rmodifier *rmodifier); +extern struct t_rmodifier *rmodifier_search (const char *name); +struct t_rmodifier *rmodifier_new (const char *name, + const char *modifiers, + const char *str_regex, + const char *groups); +extern struct t_rmodifier *rmodifier_new_with_string (const char *name, + const char *value); +extern void rmodifier_create_default (); +extern void rmodifier_free (struct t_rmodifier *rmodifier); +extern void rmodifier_free_all (); +extern int rmodifier_add_to_infolist (struct t_infolist *infolist, + struct t_rmodifier *rmodifier); +extern void rmodifier_print_log (); + +#endif /* __WEECHAT_RMODIFIER_H */