summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--configure.in2
-rw-r--r--po/POTFILES.in4
-rw-r--r--po/cs.po122
-rw-r--r--po/de.po120
-rw-r--r--po/es.po123
-rw-r--r--po/fr.po150
-rw-r--r--po/hu.po120
-rw-r--r--po/ru.po120
-rw-r--r--po/srcfiles.cmake4
-rw-r--r--po/weechat.pot104
-rw-r--r--src/core/wee-command.c11
-rw-r--r--src/core/wee-config-file.c12
-rw-r--r--src/core/wee-hook.c4
-rw-r--r--src/core/wee-upgrade-file.c2
-rw-r--r--src/gui/gui-bar-item.c17
-rw-r--r--src/gui/gui-buffer.c11
-rw-r--r--src/gui/gui-buffer.h1
-rw-r--r--src/gui/gui-chat.c4
-rw-r--r--src/gui/gui-completion.c4
-rw-r--r--src/gui/gui-filter.c4
-rw-r--r--src/gui/gui-input.c65
-rw-r--r--src/gui/gui-input.h1
-rw-r--r--src/gui/gui-layout.c4
-rw-r--r--src/gui/gui-nicklist.c34
-rw-r--r--src/gui/gui-window.c4
-rw-r--r--src/plugins/CMakeLists.txt4
-rw-r--r--src/plugins/aspell/CMakeLists.txt5
-rw-r--r--src/plugins/aspell/Makefile.am7
-rw-r--r--src/plugins/aspell/aspell-config.c338
-rw-r--r--src/plugins/aspell/aspell-config.h43
-rw-r--r--src/plugins/aspell/aspell-speller.c237
-rw-r--r--src/plugins/aspell/aspell-speller.h41
-rw-r--r--src/plugins/aspell/aspell.c1942
-rw-r--r--src/plugins/aspell/aspell.h170
-rw-r--r--src/plugins/charset/charset.c12
-rw-r--r--src/plugins/demo/demo.c6
-rw-r--r--src/plugins/irc/irc-command.c2
-rw-r--r--src/plugins/irc/irc-ignore.c4
-rw-r--r--src/plugins/logger/logger-config.h2
-rw-r--r--src/plugins/scripts/script.c2
41 files changed, 2283 insertions, 1581 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2710f0d08..9099d8e71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ OPTION(DISABLE_NLS "Disable Native Language Support")
OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support")
OPTION(DISABLE_LARGEFILE "Disable Large File Support")
OPTION(DISABLE_ALIAS "Disable Alias plugin")
-OPTION(ENABLE_ASPELL "Enable Aspell plugin")
+OPTION(DISABLE_ASPELL "Disable Aspell plugin")
OPTION(DISABLE_CHARSET "Disable Charset plugin")
OPTION(DISABLE_DEBUG "Disable Debug plugin")
OPTION(ENABLE_DEMO "Enable Demo plugin")
diff --git a/configure.in b/configure.in
index de4c60131..f52e3a78e 100644
--- a/configure.in
+++ b/configure.in
@@ -120,7 +120,7 @@ AC_ARG_ENABLE(qt, [ --enable-qt turn on Qt interface (def
AC_ARG_ENABLE(gnutls, [ --disable-gnutls turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
AC_ARG_ENABLE(largefile, [ --disable-largefile turn off Large File Support (default=on)],enable_largefile=$enableval,enable_largefile=yes)
AC_ARG_ENABLE(alias, [ --disable-alias turn off Alias plugin (default=compiled)],enable_alias=$enableval,enable_alias=yes)
-AC_ARG_ENABLE(aspell, [ --enable-aspell turn on Aspell plugin (default=off)],enable_aspell=$enableval,enable_aspell=no)
+AC_ARG_ENABLE(aspell, [ --disable-aspell turn off Aspell plugin (default=compiled)],enable_aspell=$enableval,enable_aspell=yes)
AC_ARG_ENABLE(charset, [ --disable-charset turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes)
AC_ARG_ENABLE(debug, [ --enable-debug turn on Debug plugin (default=on)],enable_debug=$enableval,enable_debug=yes)
AC_ARG_ENABLE(demo, [ --enable-demo turn on Demo plugin (default=off)],enable_demo=$enableval,enable_demo=no)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index bfc32c2ae..5d3e7d699 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -85,6 +85,10 @@
./src/plugins/alias/alias-info.h
./src/plugins/aspell/aspell.c
./src/plugins/aspell/aspell.h
+./src/plugins/aspell/aspell-config.c
+./src/plugins/aspell/aspell-config.h
+./src/plugins/aspell/aspell-speller.c
+./src/plugins/aspell/aspell-speller.h
./src/plugins/charset/charset.c
./src/plugins/debug/debug.c
./src/plugins/demo/demo.c
diff --git a/po/cs.po b/po/cs.po
index 5bd6abe89..5a7e35332 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -396,7 +396,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%s nemohu napojit kalávesu \"%s\"\n"
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1718,11 +1718,12 @@ msgstr "Ukládám konfiguraci na disk\n"
msgid " . type: boolean\n"
msgstr " . typ: boolean\n"
-msgid " . values: 'on' or 'off'\n"
+#, fuzzy
+msgid " . values: \"on\" or \"off\"\n"
msgstr " . hodnoty: 'on' or 'off'\n"
-#, c-format
-msgid " . default value: '%s'\n"
+#, fuzzy, c-format
+msgid " . default value: \"%s\"\n"
msgstr " . výchozí hodnota: '%s'\n"
msgid " . type: string\n"
@@ -1789,7 +1790,7 @@ msgstr ""
"s jiným domovským adresářem pomocí \"--dir\" volby příkazové řádky.\n"
#, fuzzy, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr "%s nemohu vytvořit soubor \"%s\"\n"
#, fuzzy, c-format
@@ -2082,6 +2083,91 @@ msgid "%s: debug disabled"
msgstr "%s: ladění vypnuto"
#, fuzzy, c-format
+msgid "%s: %s: removed"
+msgstr "Alias \"%s\" odebrán\n"
+
+#. TRANSLATORS: %s is "aspell"
+#, fuzzy, c-format
+msgid "%s dictionnaries list:"
+msgstr "konec /who seznamu"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+#, fuzzy
+msgid "aspell plugin configuration"
+msgstr "Ukládám konfiguraci na disk\n"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr "%s nedostatek paměti pro infobar zprávu\n"
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s nedostatek paměti pro nové DCC\n"
+
+#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s nedostatek paměti pro infobar zprávu\n"
@@ -2092,11 +2178,7 @@ msgid "global encoding charset"
msgstr "globální znaková sada pro kódování"
#, fuzzy, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "Alias \"%s\" => \"%s\" vytvořen\n"
-
-#, fuzzy, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr "Alias \"%s\" odebrán\n"
#, fuzzy, c-format
@@ -2175,8 +2257,8 @@ msgstr ""
msgid "Available infolists:"
msgstr ""
-#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+#, fuzzy, c-format
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr "ukázkový_signál: signál: %s, typ_dat: %s, data_signálu: '%s'"
#, c-format
@@ -2439,7 +2521,7 @@ msgid "No server"
msgstr "žádný server.\n"
#, fuzzy, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr "Server s '%s':\n"
#, fuzzy, c-format
@@ -4816,6 +4898,18 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s chybí argument pro volbu \"%s\"\n"
+#, fuzzy
+#~ msgid "%s: creating new speller for lang \"%s\""
+#~ msgstr "%s nedostatek paměti pro infobar zprávu\n"
+
+#, fuzzy
+#~ msgid "%s: removing speller for lang \"%s\""
+#~ msgstr "%s nedostatek paměti pro infobar zprávu\n"
+
+#, fuzzy
+#~ msgid "Charset: %s, %s => %s"
+#~ msgstr "Alias \"%s\" => \"%s\" vytvořen\n"
+
#~ msgid " Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
#~ msgstr " Vložit %d řádků ? [ctrl-Y] Ano [ctrl-N] Ne"
diff --git a/po/de.po b/po/de.po
index d20f4f211..5a31b6f75 100644
--- a/po/de.po
+++ b/po/de.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -402,7 +402,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%s kann die Taste \"%s\" nicht zuordnen\n"
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1667,11 +1667,12 @@ msgstr "Konfiguration wird gespeichert\n"
msgid " . type: boolean\n"
msgstr " . Typ: Boolean\n"
-msgid " . values: 'on' or 'off'\n"
+#, fuzzy
+msgid " . values: \"on\" or \"off\"\n"
msgstr " . Werte ('on' oder 'off')\n"
-#, c-format
-msgid " . default value: '%s'\n"
+#, fuzzy, c-format
+msgid " . default value: \"%s\"\n"
msgstr " . Standardwert: '%s'\n"
msgid " . type: string\n"
@@ -1742,7 +1743,7 @@ msgstr ""
"Verzeichnis zu starten.\n"
#, fuzzy, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr "Aktualisiere WeeChat...\n"
#, fuzzy, c-format
@@ -2030,6 +2031,91 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
+msgid "%s: %s: removed"
+msgstr "Alias \"%s\" entfernt\n"
+
+#. TRANSLATORS: %s is "aspell"
+#, fuzzy, c-format
+msgid "%s dictionnaries list:"
+msgstr "Ende der /who-Liste"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+#, fuzzy
+msgid "aspell plugin configuration"
+msgstr "Konfiguration wird gespeichert\n"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s nicht genug Speicher für neuen DCC\n"
+
+#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
@@ -2040,11 +2126,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "Alias \"%s\" => \"%s\" angelegt\n"
-
-#, fuzzy, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr "Alias \"%s\" entfernt\n"
#, fuzzy, c-format
@@ -2118,7 +2200,7 @@ msgid "Available infolists:"
msgstr ""
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr ""
#, c-format
@@ -2382,7 +2464,7 @@ msgid "No server"
msgstr "Kein Server.\n"
#, fuzzy, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr "Server '%s' nicht gefunden.\n"
#, fuzzy, c-format
@@ -4716,6 +4798,18 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s fehlende Argumente für die \"--dir\"-Option\n"
+#, fuzzy
+#~ msgid "%s: creating new speller for lang \"%s\""
+#~ msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
+
+#, fuzzy
+#~ msgid "%s: removing speller for lang \"%s\""
+#~ msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n"
+
+#, fuzzy
+#~ msgid "Charset: %s, %s => %s"
+#~ msgstr "Alias \"%s\" => \"%s\" angelegt\n"
+
#~ msgid "-MORE-"
#~ msgstr "-MEHR-"
diff --git a/po/es.po b/po/es.po
index 08ece5a7b..9999aa484 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -397,7 +397,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%s No ha sido posible atar la clave \"%s\"\n"
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1654,11 +1654,12 @@ msgstr "Guardar configuración a disco\n"
msgid " . type: boolean\n"
msgstr " . tipo: booleano\n"
-msgid " . values: 'on' or 'off'\n"
+#, fuzzy
+msgid " . values: \"on\" or \"off\"\n"
msgstr " . valores: 'on' u 'off'\n"
-#, c-format
-msgid " . default value: '%s'\n"
+#, fuzzy, c-format
+msgid " . default value: \"%s\"\n"
msgstr " . valor por defecto: '%s'\n"
msgid " . type: string\n"
@@ -1723,7 +1724,7 @@ msgid ""
msgstr ""
#, fuzzy, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr "Actualizando Weechat...\n"
#, fuzzy, c-format
@@ -2004,6 +2005,92 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
+msgid "%s: %s: removed"
+msgstr "Alias \"%s\" eliminado\n"
+
+#. TRANSLATORS: %s is "aspell"
+#, fuzzy, c-format
+msgid "%s dictionnaries list:"
+msgstr "fin de la lista /who"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+#, fuzzy
+msgid "aspell plugin configuration"
+msgstr "Guardar configuración a disco\n"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr ""
+"No hay suficiente memoria para el mensaje de la barra de información\n"
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s no hay memoria suficiente para un nuevo DCC\n"
+
+#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr ""
"No hay suficiente memoria para el mensaje de la barra de información\n"
@@ -2015,11 +2102,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "Alias \"%s\" => \"%s\" creado\n"
-
-#, fuzzy, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr "Alias \"%s\" eliminado\n"
#, fuzzy, c-format
@@ -2093,7 +2176,7 @@ msgid "Available infolists:"
msgstr ""
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr ""
#, c-format
@@ -2357,7 +2440,7 @@ msgid "No server"
msgstr "Ningún servidor.\n"
#, fuzzy, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr "Servidor '%s' no encontrado.\n"
#, fuzzy, c-format
@@ -4720,6 +4803,20 @@ msgstr "%s no es posible crear el servidor\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s falta un argumento para la opción --dir\n"
+#, fuzzy
+#~ msgid "%s: creating new speller for lang \"%s\""
+#~ msgstr ""
+#~ "No hay suficiente memoria para el mensaje de la barra de información\n"
+
+#, fuzzy
+#~ msgid "%s: removing speller for lang \"%s\""
+#~ msgstr ""
+#~ "No hay suficiente memoria para el mensaje de la barra de información\n"
+
+#, fuzzy
+#~ msgid "Charset: %s, %s => %s"
+#~ msgstr "Alias \"%s\" => \"%s\" creado\n"
+
#~ msgid "-MORE-"
#~ msgstr "-MÁS-"
diff --git a/po/fr.po b/po/fr.po
index f18e47759..41bd24e61 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
-"PO-Revision-Date: 2008-10-10 15:52+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
+"PO-Revision-Date: 2008-10-18 15:35+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@@ -368,8 +368,8 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%sErreur: impossible de créer la touche \"%s\""
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
-msgstr "feuille: id: %d, parent: %d, extension: '%s', tampon: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
+msgstr "feuille: id: %d, parent: %d, extension: \"%s\", tampon: \"%s\""
#, c-format
msgid "node: id: %d, parent: %d, child1: %d, child2: %d, size: %d%% (%s)"
@@ -1674,12 +1674,12 @@ msgstr "Rechargement du fichier de configuration %s"
msgid " . type: boolean\n"
msgstr " . type: booléen\n"
-msgid " . values: 'on' or 'off'\n"
-msgstr " . valeurs: 'on' ou 'off'\n"
+msgid " . values: \"on\" or \"off\"\n"
+msgstr " . valeurs: \"on\" ou \"off\"\n"
#, c-format
-msgid " . default value: '%s'\n"
-msgstr " . valeur par défaut: '%s'\n"
+msgid " . default value: \"%s\"\n"
+msgstr " . valeur par défaut: \"%s\"\n"
msgid " . type: string\n"
msgstr " . type: chaîne\n"
@@ -1745,8 +1745,8 @@ msgstr ""
"dir\".\n"
#, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
-msgstr "%sErreur de mise à jour de WeeChat avec le fichier '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
+msgstr "%sErreur de mise à jour de WeeChat avec le fichier \"%s\":"
#, c-format
msgid "%s error: %s%s%s%s"
@@ -2021,6 +2021,114 @@ msgid "%s: debug disabled"
msgstr "%s: debug désactivé"
#, c-format
+msgid "%s: %s: removed"
+msgstr "%s: %s: supprimé"
+
+#. TRANSLATORS: %s is "aspell"
+#, c-format
+msgid "%s dictionnaries list:"
+msgstr "Liste des dictionnaires %s:"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+"%s: erreur: le dictionnaire \"%s\" n'est pas disponible sur votre système"
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr "%s: mot \"%s\" ajouté dans le dictionnaire personnel"
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr "%s%s: impossible d'ajouter le mot dans le dictionnaire personnel"
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr "%s%s: pas de dictionnaire sur ce tampon pour ajouter le mot"
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+"%s%s: plusieurs dictionnaires sont définis pour ce tampon, merci de préciser "
+"le dictionnaire"
+
+msgid "aspell plugin configuration"
+msgstr "configuration de l'extension aspell"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr "[list | enable lang | disable | addword [lang] word]"
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+" list: affichier les dictionnaires installés\n"
+" enable: active aspell sur le tampon courant\n"
+"disable: désactive aspell sur le tampon courant\n"
+"addword: ajoute un mot dans le dictionnaire personnel aspell\n"
+"\n"
+"Les lignes d'entrée commençant par '/' ne sont pas vérifiées, excepté pour "
+"certaines commandes."
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+"liste de dictionnaires (séparés par des virgules) à utiliser sur ce tampon"
+
+#, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr "%s%s: erreur en création du dictionnaire aspell \"%s\" => \"%s\""
+
+msgid "color used for mispelled words"
+msgstr "couleur utilisée pour les mots mal orthographiés"
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+"liste de commandes (séparées par des virgules) pour lesquelles la "
+"vérification orthographique est activée (la vérification est désactivée pour "
+"toutes les autres commandes)"
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+"dictionnaire par défaut (ou liste de dictionnaires séparés par une virgule) "
+"à utiliser quand le tampon courant n'a pas de dictionnaire défini (laissez "
+"blanc pour désactiver aspell sur les tampons pour lesquels vous ne l'avez "
+"pas explicitement activé)"
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+"longueur minimum d'un mot pour que l'otrhographe soit vérifiée (utilisez 0 "
+"pour vérifier tous les mots)"
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+"vérification orthographique des mots en temps réel (plus lent, désactivé par "
+"défaut: les mots sont vérifiés seulement s'il y a un délimiteur après)"
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+"%s: attention: le dictionnaire \\\"%s\\\" n'est pas disponible sur votre "
+"système"
+
+#, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s%s: pas assez de mémoire pour créer un nouveau speller"
+
+#, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s%s: erreur en création du charset \"%s\" => \"%s\""
@@ -2031,12 +2139,8 @@ msgid "global encoding charset"
msgstr "charset d'encodage global"
#, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "Charset %s, %s => %s"
-
-#, c-format
-msgid "Charset: %s, %s: removed"
-msgstr "Charset: %s, %s: supprimé"
+msgid "%s: %s, %s: removed"
+msgstr "%s: %s, %s: supprimé"
#, c-format
msgid "%s%s: missing parameters"
@@ -2113,8 +2217,8 @@ msgid "Available infolists:"
msgstr "Infolists disponibles:"
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
-msgstr "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
+msgstr "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
#, c-format
msgid "demo_signal: signal: %s, type_data: %s, signal_data: %d"
@@ -2377,8 +2481,8 @@ msgid "No server"
msgstr "Pas de serveur"
#, c-format
-msgid "Servers with '%s':"
-msgstr "Serveurs avec '%s':"
+msgid "Servers with \"%s\":"
+msgstr "Serveurs avec \"%s\":"
#, c-format
msgid "No server found with \"%s\""
@@ -4741,9 +4845,3 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket"
#, c-format
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s"
-
-#~ msgid " Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
-#~ msgstr " Coller %d lignes ? [ctrl-Y] Oui [ctrl-N] Non"
-
-#~ msgid "-MORE-"
-#~ msgstr "-PLUS-"
diff --git a/po/hu.po b/po/hu.po
index 1ff54150b..145ecdebb 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -403,7 +403,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%s nem sikerült a(z) \"%s\" billentyűt hozzárendelni\n"
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1679,11 +1679,12 @@ msgstr "Beállítások mentése a lemezre\n"
msgid " . type: boolean\n"
msgstr " . típus: logikai\n"
-msgid " . values: 'on' or 'off'\n"
+#, fuzzy
+msgid " . values: \"on\" or \"off\"\n"
msgstr " . értékek: 'on' vagy 'off'\n"
-#, c-format
-msgid " . default value: '%s'\n"
+#, fuzzy, c-format
+msgid " . default value: \"%s\"\n"
msgstr " . alapérték: '%s'\n"
msgid " . type: string\n"
@@ -1750,7 +1751,7 @@ msgstr ""
"saját könyvtárral futtatni a WeeChat-et a \"--dir\" opció segítségével!\n"
#, fuzzy, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr "WeeChat frissítése...\n"
#, fuzzy, c-format
@@ -2036,6 +2037,91 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
+msgid "%s: %s: removed"
+msgstr "A \"%s\" aliasz eltávolítva\n"
+
+#. TRANSLATORS: %s is "aspell"
+#, fuzzy, c-format
+msgid "%s dictionnaries list:"
+msgstr "a /who lista vége"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+#, fuzzy
+msgid "aspell plugin configuration"
+msgstr "Beállítások mentése a lemezre\n"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr "%s nincs elég memória az információs pult üzenethez\n"
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s nincs elegendő memória új DCC számára\n"
+
+#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s nincs elég memória az információs pult üzenethez\n"
@@ -2046,11 +2132,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "A \"%s\" => \"%s\" aliasz elkészült\n"
-
-#, fuzzy, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr "A \"%s\" aliasz eltávolítva\n"
#, fuzzy, c-format
@@ -2125,7 +2207,7 @@ msgid "Available infolists:"
msgstr ""
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr ""
#, c-format
@@ -2385,7 +2467,7 @@ msgid "No server"
msgstr "Nincs szerver.\n"
#, fuzzy, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr "A(z) '%s' szerverek listája:\n"
#, fuzzy, c-format
@@ -4739,6 +4821,18 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n"
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
+#, fuzzy
+#~ msgid "%s: creating new speller for lang \"%s\""
+#~ msgstr "%s nincs elég memória az információs pult üzenethez\n"
+
+#, fuzzy
+#~ msgid "%s: removing speller for lang \"%s\""
+#~ msgstr "%s nincs elég memória az információs pult üzenethez\n"
+
+#, fuzzy
+#~ msgid "Charset: %s, %s => %s"
+#~ msgstr "A \"%s\" => \"%s\" aliasz elkészült\n"
+
#~ msgid " Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
#~ msgstr " Beszúrható %d sor? [ctrl-Y] Igen [ctrl-N] Nem"
diff --git a/po/ru.po b/po/ru.po
index e5e842b8e..ca44fb288 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -398,7 +398,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr "%s не могу установить клавишу \"%s\"\n"
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1680,11 +1680,12 @@ msgstr "Сохраняю конфигурацию\n"
msgid " . type: boolean\n"
msgstr " . тип: булевый\n"
-msgid " . values: 'on' or 'off'\n"
+#, fuzzy
+msgid " . values: \"on\" or \"off\"\n"
msgstr " . значения: 'on' или 'off'\n"
-#, c-format
-msgid " . default value: '%s'\n"
+#, fuzzy, c-format
+msgid " . default value: \"%s\"\n"
msgstr " . значение по умолчанию: '%s'\n"
msgid " . type: string\n"
@@ -1752,7 +1753,7 @@ msgstr ""
"с другой домашней директорией используя параметр \"--dir\".\n"
#, fuzzy, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr "Обновляю WeeChat...\n"
#, fuzzy, c-format
@@ -2040,6 +2041,91 @@ msgid "%s: debug disabled"
msgstr ""
#, fuzzy, c-format
+msgid "%s: %s: removed"
+msgstr "Сокращение \"%s\" удалено\n"
+
+#. TRANSLATORS: %s is "aspell"
+#, fuzzy, c-format
+msgid "%s dictionnaries list:"
+msgstr "конец списка /who"
+
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+#, fuzzy
+msgid "aspell plugin configuration"
+msgstr "Сохраняю конфигурацию\n"
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr "%s недостаточно памяти для сообщения в строке информации\n"
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, fuzzy, c-format
+msgid "%s%s: not enough memory to create new speller"
+msgstr "%s недостаточно памяти для нового DCC\n"
+
+#, fuzzy, c-format
msgid "%s%s: error creating charset \"%s\" => \"%s\""
msgstr "%s недостаточно памяти для сообщения в строке информации\n"
@@ -2050,11 +2136,7 @@ msgid "global encoding charset"
msgstr ""
#, fuzzy, c-format
-msgid "Charset: %s, %s => %s"
-msgstr "Сокращение \"%s\" => \"%s\" создано\n"
-
-#, fuzzy, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr "Сокращение \"%s\" удалено\n"
#, fuzzy, c-format
@@ -2130,7 +2212,7 @@ msgid "Available infolists:"
msgstr ""
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr ""
#, c-format
@@ -2391,7 +2473,7 @@ msgid "No server"
msgstr "Нет сервера.\n"
#, fuzzy, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr "Серверы с '%s':\n"
#, fuzzy, c-format
@@ -4721,6 +4803,18 @@ msgstr "%s DCC: не могу установить неблокирующий р
msgid "%s%s: timeout for \"%s\" with %s"
msgstr "%s нет аргумента для параметра \"%s\"\n"
+#, fuzzy
+#~ msgid "%s: creating new speller for lang \"%s\""
+#~ msgstr "%s недостаточно памяти для сообщения в строке информации\n"
+
+#, fuzzy
+#~ msgid "%s: removing speller for lang \"%s\""
+#~ msgstr "%s недостаточно памяти для сообщения в строке информации\n"
+
+#, fuzzy
+#~ msgid "Charset: %s, %s => %s"
+#~ msgstr "Сокращение \"%s\" => \"%s\" создано\n"
+
#~ msgid " Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"
#~ msgstr " Вставить %d строк ? [ctrl-Y] Да [ctrl-N] Нет"
diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake
index 7d4693298..05140d3ac 100644
--- a/po/srcfiles.cmake
+++ b/po/srcfiles.cmake
@@ -86,6 +86,10 @@ SET(WEECHAT_SOURCES
./src/plugins/alias/alias-info.h
./src/plugins/aspell/aspell.c
./src/plugins/aspell/aspell.h
+./src/plugins/aspell/aspell-config.c
+./src/plugins/aspell/aspell-config.h
+./src/plugins/aspell/aspell-speller.c
+./src/plugins/aspell/aspell-speller.h
./src/plugins/charset/charset.c
./src/plugins/debug/debug.c
./src/plugins/demo/demo.c
diff --git a/po/weechat.pot b/po/weechat.pot
index 07a9090d0..f19e792ce 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-12 11:42+0200\n"
+"POT-Creation-Date: 2008-10-18 15:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -345,7 +345,7 @@ msgid "%sError: unable to bind key \"%s\""
msgstr ""
#, c-format
-msgid "leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"
+msgid "leaf: id: %d, parent: %d, plugin: \"%s\", buffer: \"%s\""
msgstr ""
#, c-format
@@ -1386,11 +1386,11 @@ msgstr ""
msgid " . type: boolean\n"
msgstr ""
-msgid " . values: 'on' or 'off'\n"
+msgid " . values: \"on\" or \"off\"\n"
msgstr ""
#, c-format
-msgid " . default value: '%s'\n"
+msgid " . default value: \"%s\"\n"
msgstr ""
msgid " . type: string\n"
@@ -1452,7 +1452,7 @@ msgid ""
msgstr ""
#, c-format
-msgid "%sError upgrading WeeChat with file '%s':"
+msgid "%sError upgrading WeeChat with file \"%s\":"
msgstr ""
#, c-format
@@ -1704,21 +1704,101 @@ msgid "%s: debug disabled"
msgstr ""
#, c-format
-msgid "%s%s: error creating charset \"%s\" => \"%s\""
+msgid "%s: %s: removed"
msgstr ""
-msgid "global decoding charset"
+#. TRANSLATORS: %s is "aspell"
+#, c-format
+msgid "%s dictionnaries list:"
msgstr ""
-msgid "global encoding charset"
+#, c-format
+msgid "%s: error: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s: word \"%s\" added to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: failed to add word to personal dictionary"
+msgstr ""
+
+#, c-format
+msgid "%s%s: no dictionary on this buffer for adding word"
+msgstr ""
+
+#, c-format
+msgid ""
+"%s%s: many dictionaries are defined for this buffer, please specify "
+"dictionary"
+msgstr ""
+
+msgid "aspell plugin configuration"
+msgstr ""
+
+msgid "[list | enable lang | disable | addword [lang] word]"
+msgstr ""
+
+msgid ""
+" list: show installed dictionnaries\n"
+" enable: enable aspell on current buffer\n"
+"disable: disable aspell on current buffer\n"
+"addword: add a word in your personnal aspell dictionary\n"
+"\n"
+"Input line beginning with a '/' is not checked, except for some commands."
+msgstr ""
+
+msgid "comma separated list of dictionaries to use on this buffer"
+msgstr ""
+
+#, c-format
+msgid "%s%s: error creating aspell dictionary \"%s\" => \"%s\""
+msgstr ""
+
+msgid "color used for mispelled words"
+msgstr ""
+
+msgid ""
+"comma separated list of commands for which spell checking is enabled (spell "
+"checking is disabled for all other commands)"
+msgstr ""
+
+msgid ""
+"default dictionary (or comma separated list of dictionaries) to use when "
+"buffer has no dictionary defined (leave blank to disable aspell on buffers "
+"for which you didn't explicitely enabled it)"
+msgstr ""
+
+msgid ""
+"minimum length for a word to be spell checked (use 0 to check all words)"
+msgstr ""
+
+msgid ""
+"real-time spell checking of words (slower, disabled by default: words are "
+"checked only if there's delimiter after)"
+msgstr ""
+
+#, c-format
+msgid "%s: warning: dictionary \"%s\" is not available on your system"
+msgstr ""
+
+#, c-format
+msgid "%s%s: not enough memory to create new speller"
msgstr ""
#, c-format
-msgid "Charset: %s, %s => %s"
+msgid "%s%s: error creating charset \"%s\" => \"%s\""
+msgstr ""
+
+msgid "global decoding charset"
+msgstr ""
+
+msgid "global encoding charset"
msgstr ""
#, c-format
-msgid "Charset: %s, %s: removed"
+msgid "%s: %s, %s: removed"
msgstr ""
#, c-format
@@ -1786,7 +1866,7 @@ msgid "Available infolists:"
msgstr ""
#, c-format
-msgid "demo_signal: signal: %s, type_data: %s, signal_data: '%s'"
+msgid "demo_signal: signal: %s, type_data: %s, signal_data: \"%s\""
msgstr ""
#, c-format
@@ -2035,7 +2115,7 @@ msgid "No server"
msgstr ""
#, c-format
-msgid "Servers with '%s':"
+msgid "Servers with \"%s\":"
msgstr ""
#, c-format
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index 3fdc1a836..a36fdacf5 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1126,11 +1126,11 @@ command_help (void *data, struct t_gui_buffer *buffer,
_("type"), _("string"));
gui_chat_printf (NULL, " %s: %s",
_("values"), string);
- gui_chat_printf (NULL, " %s: '%s'",
+ gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
gui_chat_printf (NULL,
- " %s: '%s%s%s'",
+ " %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
ptr_option->string_values[CONFIG_INTEGER(ptr_option)],
@@ -1178,10 +1178,10 @@ command_help (void *data, struct t_gui_buffer *buffer,
ptr_option->max);
break;
}
- gui_chat_printf (NULL, " %s: '%s'",
+ gui_chat_printf (NULL, " %s: \"%s\"",
_("default value"),
CONFIG_STRING_DEFAULT(ptr_option));
- gui_chat_printf (NULL, " %s: '%s%s%s'",
+ gui_chat_printf (NULL, " %s: \"%s%s%s\"",
_("current value"),
GUI_COLOR(GUI_COLOR_CHAT_HOST),
CONFIG_STRING(ptr_option),
@@ -1516,7 +1516,8 @@ command_layout_display_tree (struct t_gui_layout_window *layout_window,
/* leaf */
snprintf (format, sizeof (format), "%%-%ds%s",
indent * 2,
- _("leaf: id: %d, parent: %d, plugin: '%s', buffer: '%s'"));
+ _("leaf: id: %d, parent: %d, plugin: \"%s\", "
+ "buffer: \"%s\""));
gui_chat_printf (NULL, format,
" ",
layout_window->internal_id,
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 67524806f..637f20150 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -2393,8 +2393,8 @@ config_file_print_stdout (struct t_config_file *config_file)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
string_iconv_fprintf (stdout, _(" . type: boolean\n"));
- string_iconv_fprintf (stdout, _(" . values: 'on' or 'off'\n"));
- string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
+ string_iconv_fprintf (stdout, _(" . values: \"on\" or \"off\"\n"));
+ string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
(CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ?
"on" : "off");
break;
@@ -2406,14 +2406,14 @@ config_file_print_stdout (struct t_config_file *config_file)
i = 0;
while (ptr_option->string_values[i])
{
- string_iconv_fprintf (stdout, "'%s'",
+ string_iconv_fprintf (stdout, "\"%s\"",
ptr_option->string_values[i]);
if (ptr_option->string_values[i + 1])
string_iconv_fprintf (stdout, ", ");
i++;
}
string_iconv_fprintf (stdout, "\n");
- string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
+ string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]);
}
else
@@ -2443,14 +2443,14 @@ config_file_print_stdout (struct t_config_file *config_file)
ptr_option->max);
break;
}
- string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
+ string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
CONFIG_STRING_DEFAULT(ptr_option));
break;
case CONFIG_OPTION_TYPE_COLOR:
color_name = gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option));
string_iconv_fprintf (stdout, _(" . type: color\n"));
string_iconv_fprintf (stdout, _(" . values: color (depends on GUI used)\n"));
- string_iconv_fprintf (stdout, _(" . default value: '%s'\n"),
+ string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"),
color_name);
break;
case CONFIG_NUM_OPTION_TYPES:
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 56861714f..0de375a52 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -176,14 +176,14 @@ hook_remove_from_list (struct t_hook *hook)
last_weechat_hook[hook->type] = hook->prev_hook;
if (hook->prev_hook)
{
- hook->prev_hook->next_hook = hook->next_hook;
+ (hook->prev_hook)->next_hook = hook->next_hook;
new_hooks = weechat_hooks[hook->type];
}
else
new_hooks = hook->next_hook;
if (hook->next_hook)
- hook->next_hook->prev_hook = hook->prev_hook;
+ (hook->next_hook)->prev_hook = hook->prev_hook;
free (hook);
diff --git a/src/core/wee-upgrade-file.c b/src/core/wee-upgrade-file.c
index e8f5fa13a..a8ee02d42 100644
--- a/src/core/wee-upgrade-file.c
+++ b/src/core/wee-upgrade-file.c
@@ -54,7 +54,7 @@ upgrade_file_error (struct t_upgrade_file *upgrade_file, char *message1,
char *message2, char *file, int line)
{
gui_chat_printf (NULL,
- _("%sError upgrading WeeChat with file '%s':"),
+ _("%sError upgrading WeeChat with file \"%s\":"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
upgrade_file->filename);
gui_chat_printf (NULL,
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 12d35fb5b..e2820a6fb 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -570,9 +570,9 @@ gui_bar_item_free (struct t_gui_bar_item *item)
{
/* remove bar item from bar items list */
if (item->prev_item)
- item->prev_item->next_item = item->next_item;
+ (item->prev_item)->next_item = item->next_item;
if (item->next_item)
- item->next_item->prev_item = item->prev_item;
+ (item->next_item)->prev_item = item->prev_item;
if (gui_bar_items == item)
gui_bar_items = item->next_item;
if (last_gui_bar_item == item)
@@ -751,6 +751,8 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
struct t_gui_window *window,
int max_width, int max_height)
{
+ char *new_input, str_buffer[128];
+
/* make C compiler happy */
(void) data;
(void) item;
@@ -759,6 +761,17 @@ gui_bar_item_default_input_text (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
+
+ snprintf (str_buffer, sizeof (str_buffer),
+ "0x%x", (unsigned int)(window->buffer));
+
+ new_input = hook_modifier_exec (NULL,
+ "weechat_input_text_display",
+ str_buffer,
+ (window->buffer->input_buffer) ?
+ window->buffer->input_buffer : "");
+ if (new_input)
+ return new_input;
return (window->buffer->input_buffer) ?
strdup (window->buffer->input_buffer) : NULL;
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 1df8fca4c..b5298d004 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -118,12 +118,12 @@ gui_buffer_insert (struct t_gui_buffer *buffer)
/* add buffer to the end */
buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
buffer->prev_buffer = last_gui_buffer;
+ buffer->next_buffer = NULL;
if (gui_buffers)
last_gui_buffer->next_buffer = buffer;
else
gui_buffers = buffer;
last_gui_buffer = buffer;
- buffer->next_buffer = NULL;
}
}
@@ -205,9 +205,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->input_nick = NULL;
new_buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE;
new_buffer->input_buffer = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
- new_buffer->input_buffer_color_mask = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
new_buffer->input_buffer[0] = '\0';
- new_buffer->input_buffer_color_mask[0] = '\0';
new_buffer->input_buffer_size = 0;
new_buffer->input_buffer_length = 0;
new_buffer->input_buffer_pos = 0;
@@ -994,8 +992,6 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
free (buffer->name);
if (buffer->input_buffer)
free (buffer->input_buffer);
- if (buffer->input_buffer_color_mask)
- free (buffer->input_buffer_color_mask);
if (buffer->completion)
gui_completion_free (buffer->completion);
gui_history_buffer_free (buffer);
@@ -1011,9 +1007,9 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
/* remove buffer from buffers list */
if (buffer->prev_buffer)
- buffer->prev_buffer->next_buffer = buffer->next_buffer;
+ (buffer->prev_buffer)->next_buffer = buffer->next_buffer;
if (buffer->next_buffer)
- buffer->next_buffer->prev_buffer = buffer->prev_buffer;
+ (buffer->next_buffer)->prev_buffer = buffer->prev_buffer;
if (gui_buffers == buffer)
gui_buffers = buffer->next_buffer;
if (last_gui_buffer == buffer)
@@ -1449,7 +1445,6 @@ gui_buffer_print_log ()
log_printf (" input_callback_data. . : 0x%x", ptr_buffer->input_callback_data);
log_printf (" input_nick . . . . . . : '%s'", ptr_buffer->input_nick);
log_printf (" input_buffer . . . . . : '%s'", ptr_buffer->input_buffer);
- log_printf (" input_buffer_color_mask: '%s'", ptr_buffer->input_buffer_color_mask);
log_printf (" input_buffer_alloc . . : %d", ptr_buffer->input_buffer_alloc);
log_printf (" input_buffer_size. . . : %d", ptr_buffer->input_buffer_size);
log_printf (" input_buffer_length. . : %d", ptr_buffer->input_buffer_length);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 966447c9f..225f2bb5e 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -121,7 +121,6 @@ struct t_gui_buffer
/* to this buffer */
char *input_nick; /* self nick */
char *input_buffer; /* input buffer */
- char *input_buffer_color_mask; /* color mask for input buffer */
int input_buffer_alloc; /* input buffer: allocated size */
int input_buffer_size; /* buffer size in bytes */
int input_buffer_length; /* number of chars in buffer */
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index cac78bd17..48431b0ef 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -680,9 +680,9 @@ gui_chat_line_free (struct t_gui_buffer *buffer, struct t_gui_line *line)
/* remove line from lines list */
if (line->prev_line)
- line->prev_line->next_line = line->next_line;
+ (line->prev_line)->next_line = line->next_line;
if (line->next_line)
- line->next_line->prev_line = line->prev_line;
+ (line->next_line)->prev_line = line->prev_line;
if (buffer->lines == line)
buffer->lines = line->next_line;
if (buffer->last_line == line)
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index f104d6119..1e313e940 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -156,9 +156,9 @@ gui_completion_partial_list_free (struct t_gui_completion_partial *item)
{
/* remove partial completion item from list */
if (item->prev_item)
- item->prev_item->next_item = item->next_item;
+ (item->prev_item)->next_item = item->next_item;
if (item->next_item)
- item->next_item->prev_item = item->prev_item;
+ (item->next_item)->prev_item = item->prev_item;
if (gui_completion_partial_list == item)
gui_completion_partial_list = item->next_item;
if (last_gui_completion_partial == item)
diff --git a/src/gui/gui-filter.c b/src/gui/gui-filter.c
index d27343a4f..577264b68 100644
--- a/src/gui/gui-filter.c
+++ b/src/gui/gui-filter.c
@@ -381,9 +381,9 @@ gui_filter_free (struct t_gui_filter *filter)
/* remove filter from filters list */
if (filter->prev_filter)
- filter->prev_filter->next_filter = filter->next_filter;
+ (filter->prev_filter)->next_filter = filter->next_filter;
if (filter->next_filter)
- filter->next_filter->prev_filter = filter->prev_filter;
+ (filter->next_filter)->prev_filter = filter->prev_filter;
if (gui_filters == filter)
gui_filters = filter->next_filter;
if (last_gui_filter == filter)
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index 890d13c66..439cc18ac 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -114,30 +114,11 @@ gui_input_optimize_size (struct t_gui_buffer *buffer)
{
buffer->input_buffer_alloc = optimal_size;
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
- buffer->input_buffer_color_mask = realloc (buffer->input_buffer_color_mask,
- optimal_size);
}
}
}
/*
- * gui_input_init_color_mask: initialize color mask for input buffer
- */
-
-void
-gui_input_init_color_mask (struct t_gui_buffer *buffer)
-{
- int i;
-
- if (buffer->input)
- {
- for (i = 0; i < buffer->input_buffer_size; i++)
- buffer->input_buffer_color_mask[i] = ' ';
- buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
- }
-}
-
-/*
* gui_input_move: move data in input buffer
*/
@@ -151,8 +132,6 @@ gui_input_move (struct t_gui_buffer *buffer, char *target, const char *source,
pos_source = source - buffer->input_buffer;
memmove (target, source, size);
- memmove (buffer->input_buffer_color_mask + pos_target,
- buffer->input_buffer_color_mask + pos_source, size);
}
/*
@@ -166,7 +145,7 @@ int
gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
int pos)
{
- int i, pos_start, size, length;
+ int pos_start, size, length;
char *ptr_start;
char *buffer_before_insert, *string2;
@@ -187,24 +166,16 @@ gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
buffer->input_buffer_length += length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
- buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
/* move end of string to the right */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
pos_start = ptr_start - buffer->input_buffer;
memmove (ptr_start + size, ptr_start, strlen (ptr_start));
- memmove (buffer->input_buffer_color_mask + pos_start + size,
- buffer->input_buffer_color_mask + pos_start,
- strlen (buffer->input_buffer_color_mask + pos_start));
/* insert new string */
ptr_start = utf8_add_offset (buffer->input_buffer, pos);
pos_start = ptr_start - buffer->input_buffer;
strncpy (ptr_start, string, size);
- for (i = 0; i < size; i++)
- {
- buffer->input_buffer_color_mask[pos_start + i] = ' ';
- }
buffer->input_buffer_pos += length;
@@ -360,7 +331,6 @@ gui_input_return ()
else if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
command = strdup (gui_current_window->buffer->input_buffer);
if (!command)
return;
@@ -368,7 +338,6 @@ gui_input_return ()
gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer[0] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -407,15 +376,12 @@ gui_input_complete (struct t_gui_buffer *buffer)
buffer->completion->diff_length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
- buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
for (i = buffer->input_buffer_size - 1;
i >= buffer->completion->position_replace +
(int)strlen (buffer->completion->word_found); i--)
{
buffer->input_buffer[i] =
buffer->input_buffer[i - buffer->completion->diff_size];
- buffer->input_buffer_color_mask[i] =
- buffer->input_buffer_color_mask[i - buffer->completion->diff_size];
}
}
else
@@ -426,23 +392,16 @@ gui_input_complete (struct t_gui_buffer *buffer)
{
buffer->input_buffer[i] =
buffer->input_buffer[i - buffer->completion->diff_size];
- buffer->input_buffer_color_mask[i] =
- buffer->input_buffer_color_mask[i - buffer->completion->diff_size];
}
buffer->input_buffer_size += buffer->completion->diff_size;
buffer->input_buffer_length += buffer->completion->diff_length;
gui_input_optimize_size (buffer);
buffer->input_buffer[buffer->input_buffer_size] = '\0';
- buffer->input_buffer_color_mask[buffer->input_buffer_size] = '\0';
}
strncpy (buffer->input_buffer + buffer->completion->position_replace,
buffer->completion->word_found,
strlen (buffer->completion->word_found));
- for (i = 0; i < (int)strlen (buffer->completion->word_found); i++)
- {
- buffer->input_buffer_color_mask[buffer->completion->position_replace + i] = ' ';
- }
buffer->input_buffer_pos =
utf8_pos (buffer->input_buffer,
buffer->completion->position_replace) +
@@ -590,7 +549,6 @@ gui_input_delete_previous_char ()
gui_current_window->buffer->input_buffer_length--;
gui_current_window->buffer->input_buffer_pos--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -623,7 +581,6 @@ gui_input_delete_next_char ()
gui_current_window->buffer->input_buffer_size -= char_size;
gui_current_window->buffer->input_buffer_length--;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -683,7 +640,6 @@ gui_input_delete_previous_word ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_pos -= length_deleted;
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -725,7 +681,6 @@ gui_input_delete_next_word ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
@@ -762,7 +717,6 @@ gui_input_delete_beginning_of_line ()
gui_current_window->buffer->input_buffer_size -= size_deleted;
gui_current_window->buffer->input_buffer_length -= length_deleted;
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_current_window->buffer->input_buffer_pos = 0;
gui_input_optimize_size (gui_current_window->buffer);
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -795,7 +749,6 @@ gui_input_delete_end_of_line (const char *args)
length_deleted = utf8_strlen (start);
gui_input_clipboard_copy (start, size_deleted);
start[0] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[pos_start] = '\0';
gui_current_window->buffer->input_buffer_size = strlen (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer_length = utf8_strlen (gui_current_window->buffer->input_buffer);
gui_input_optimize_size (gui_current_window->buffer);
@@ -815,7 +768,6 @@ gui_input_delete_line ()
if (gui_current_window->buffer->input)
{
gui_current_window->buffer->input_buffer[0] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -859,12 +811,6 @@ gui_input_transpose_chars ()
memcpy (prev_char, start, size_start_char);
memcpy (prev_char + size_start_char, saved_char, size_prev_char);
- memcpy (saved_char, gui_current_window->buffer->input_buffer_color_mask + pos_prev_char, size_prev_char);
- memcpy (gui_current_window->buffer->input_buffer_color_mask + pos_prev_char,
- gui_current_window->buffer->input_buffer_color_mask + pos_start, size_start_char);
- memcpy (gui_current_window->buffer->input_buffer_color_mask + pos_prev_char + size_start_char,
- saved_char, size_prev_char);
-
gui_current_window->buffer->input_buffer_pos++;
gui_completion_stop (gui_current_window->buffer->completion, 1);
@@ -1072,7 +1018,6 @@ gui_input_history_previous ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_history_buffer_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
}
@@ -1082,7 +1027,6 @@ gui_input_history_previous ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
if (gui_current_window->buffer->ptr_history->prev_history->text)
free(gui_current_window->buffer->ptr_history->prev_history->text);
gui_current_window->buffer->ptr_history->prev_history->text = strdup (gui_current_window->buffer->input_buffer);
@@ -1098,7 +1042,6 @@ gui_input_history_previous ()
gui_current_window->buffer->input_buffer_1st_display = 0;
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
- gui_input_init_color_mask (gui_current_window->buffer);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
}
gui_input_text_changed_signal ();
@@ -1137,7 +1080,6 @@ gui_input_history_next ()
else
{
gui_current_window->buffer->input_buffer[0] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
}
@@ -1149,7 +1091,6 @@ gui_input_history_next ()
{
strcpy (gui_current_window->buffer->input_buffer,
gui_current_window->buffer->ptr_history->text);
- gui_input_init_color_mask (gui_current_window->buffer);
}
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
}
@@ -1159,11 +1100,9 @@ gui_input_history_next ()
if (gui_current_window->buffer->input_buffer_size > 0)
{
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[gui_current_window->buffer->input_buffer_size] = '\0';
gui_history_buffer_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
gui_history_global_add (gui_current_window->buffer->input_buffer);
gui_current_window->buffer->input_buffer[0] = '\0';
- gui_current_window->buffer->input_buffer_color_mask[0] = '\0';
gui_current_window->buffer->input_buffer_size = 0;
gui_current_window->buffer->input_buffer_length = 0;
gui_current_window->buffer->input_buffer_pos = 0;
@@ -1214,7 +1153,6 @@ gui_input_history_global_previous ()
gui_current_window->buffer->input_buffer_1st_display = 0;
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
- gui_input_init_color_mask (gui_current_window->buffer);
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
gui_input_text_changed_signal ();
}
@@ -1255,7 +1193,6 @@ gui_input_history_global_next ()
{
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
- gui_input_init_color_mask (gui_current_window->buffer);
}
gui_buffer_ask_input_refresh (gui_current_window->buffer, 1);
gui_input_text_changed_signal ();
diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h
index 601b62ce0..9cf4c11e6 100644
--- a/src/gui/gui-input.h
+++ b/src/gui/gui-input.h
@@ -33,7 +33,6 @@ extern void gui_input_prompt_changed_signal ();
extern void gui_input_text_changed_signal ();
extern void gui_input_search_signal ();
extern void gui_input_optimize_size (struct t_gui_buffer *buffer);
-extern void gui_input_init_color_mask (struct t_gui_buffer *buffer);
extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
const char *source, int size);
extern int gui_input_insert_string (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c
index ad89f1f56..db9985a23 100644
--- a/src/gui/gui-layout.c
+++ b/src/gui/gui-layout.c
@@ -61,9 +61,9 @@ gui_layout_buffer_remove (struct t_gui_layout_buffer *layout_buffer)
/* remove layout from list */
if (layout_buffer->prev_layout)
- layout_buffer->prev_layout->next_layout = layout_buffer->next_layout;
+ (layout_buffer->prev_layout)->next_layout = layout_buffer->next_layout;
if (layout_buffer->next_layout)
- layout_buffer->next_layout->prev_layout = layout_buffer->prev_layout;
+ (layout_buffer->next_layout)->prev_layout = layout_buffer->prev_layout;
if (gui_layout_buffers == layout_buffer)
gui_layout_buffers = layout_buffer->next_layout;
if (last_gui_layout_buffer == layout_buffer)
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 37cfcae18..b77fc96d6 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -276,6 +276,7 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
const char *name)
{
struct t_gui_nick *ptr_nick;
+ struct t_gui_nick_group *ptr_group;
for (ptr_nick = (from_group) ? from_group->nicks : buffer->nicklist_root->nicks;
ptr_nick; ptr_nick = ptr_nick->next_nick)
@@ -283,6 +284,15 @@ gui_nicklist_search_nick (struct t_gui_buffer *buffer,
if (strcmp (ptr_nick->name, name) == 0)
return ptr_nick;
}
+
+ /* search nick in child groups */
+ for (ptr_group = (from_group) ? from_group->childs : buffer->nicklist_root->childs;
+ ptr_group; ptr_group = ptr_group->next_group)
+ {
+ ptr_nick = gui_nicklist_search_nick (buffer, ptr_group, name);
+ if (ptr_nick)
+ return ptr_nick;
+ }
/* nick not found */
return NULL;
@@ -337,13 +347,13 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
/* remove nick from list */
if (nick->prev_nick)
- nick->prev_nick->next_nick = nick->next_nick;
+ (nick->prev_nick)->next_nick = nick->next_nick;
if (nick->next_nick)
- nick->next_nick->prev_nick = nick->prev_nick;
- if (nick->group->nicks == nick)
- nick->group->nicks = nick->next_nick;
- if (nick->group->last_nick == nick)
- nick->group->last_nick = nick->prev_nick;
+ (nick->next_nick)->prev_nick = nick->prev_nick;
+ if ((nick->group)->nicks == nick)
+ (nick->group)->nicks = nick->next_nick;
+ if ((nick->group)->last_nick == nick)
+ (nick->group)->last_nick = nick->prev_nick;
/* free data */
if (nick->name)
@@ -391,13 +401,13 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
{
/* remove group from list */
if (group->prev_group)
- group->prev_group->next_group = group->next_group;
+ (group->prev_group)->next_group = group->next_group;
if (group->next_group)
- group->next_group->prev_group = group->prev_group;
- if (group->parent->childs == group)
- group->parent->childs = group->next_group;
- if (group->parent->last_child == group)
- group->parent->last_child = group->prev_group;
+ (group->next_group)->prev_group = group->prev_group;
+ if ((group->parent)->childs == group)
+ (group->parent)->childs = group->next_group;
+ if ((group->parent)->last_child == group)
+ (group->parent)->last_child = group->prev_group;
}
else
{
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index 967333a5f..8611c61e6 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -387,9 +387,9 @@ gui_window_free (struct t_gui_window *window)
/* remove window from windows list */
if (window->prev_window)
- window->prev_window->next_window = window->next_window;
+ (window->prev_window)->next_window = window->next_window;
if (window->next_window)
- window->next_window->prev_window = window->prev_window;
+ (window->next_window)->prev_window = window->prev_window;
if (gui_windows == window)
gui_windows = window->next_window;
if (last_gui_window == window)
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index b9b9e97db..a3ef91c8d 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -31,13 +31,13 @@ IF(NOT DISABLE_ALIAS)
ADD_SUBDIRECTORY( alias )
ENDIF(NOT DISABLE_ALIAS)
-IF(ENABLE_ASPELL)
+IF(NOT DISABLE_ASPELL)
# Check for aspell libraries
FIND_PACKAGE(Aspell)
IF(ASPELL_FOUND)
ADD_SUBDIRECTORY( aspell )
ENDIF(ASPELL_FOUND)
-ENDIF(ENABLE_ASPELL)
+ENDIF(NOT DISABLE_ASPELL)
IF(NOT DISABLE_CHARSET)
# Check for iconv support.
diff --git a/src/plugins/aspell/CMakeLists.txt b/src/plugins/aspell/CMakeLists.txt
index 7104243d8..d8f31d51c 100644
--- a/src/plugins/aspell/CMakeLists.txt
+++ b/src/plugins/aspell/CMakeLists.txt
@@ -14,7 +14,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-ADD_LIBRARY(aspell MODULE aspell.c aspell.h)
+ADD_LIBRARY(aspell MODULE
+aspell.c aspell.h
+aspell-config.c aspell-config.h
+aspell-speller.c aspell-speller.h)
SET_TARGET_PROPERTIES(aspell PROPERTIES PREFIX "")
IF(ASPELL_FOUND)
diff --git a/src/plugins/aspell/Makefile.am b/src/plugins/aspell/Makefile.am
index 893632111..595cb97ac 100644
--- a/src/plugins/aspell/Makefile.am
+++ b/src/plugins/aspell/Makefile.am
@@ -20,6 +20,11 @@ libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = aspell.la
-aspell_la_SOURCES = aspell.c aspell.h
+aspell_la_SOURCES = aspell.c \
+ aspell.h \
+ aspell-config.c \
+ aspell-config.h \
+ aspell-speller.c \
+ aspell-speller.h
aspell_la_LDFLAGS = -module
aspell_la_LIBADD = $(ASPELL_LFLAGS)
diff --git a/src/plugins/aspell/aspell-config.c b/src/plugins/aspell/aspell-config.c
new file mode 100644
index 000000000..b9eee52d7
--- /dev/null
+++ b/src/plugins/aspell/aspell-config.c
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* aspell-config.c: aspell configuration options */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "../weechat-plugin.h"
+#include "aspell.h"
+#include "aspell-config.h"
+#include "aspell-speller.h"
+
+
+struct t_config_file *weechat_aspell_config_file = NULL;
+struct t_config_section *weechat_aspell_config_section_dict = NULL;
+
+/* aspell config, look section */
+
+struct t_config_option *weechat_aspell_config_look_color;
+
+/* aspell config, check section */
+
+struct t_config_option *weechat_aspell_config_check_commands;
+struct t_config_option *weechat_aspell_config_check_default_dict;
+struct t_config_option *weechat_aspell_config_check_real_time;
+struct t_config_option *weechat_aspell_config_check_word_min_length;
+
+
+char **weechat_aspell_commands_to_check = NULL;
+int weechat_aspell_count_commands_to_check = 0;
+int *weechat_aspell_length_commands_to_check = NULL;
+
+
+/*
+ * weechat_aspell_config_change_commands: called when list of commands is
+ * changed
+ */
+
+void
+weechat_aspell_config_change_commands (void *data,
+ struct t_config_option *option)
+{
+ char *value;
+ int i;
+
+ /* make C compiler happy */
+ (void) data;
+
+ if (weechat_aspell_commands_to_check)
+ {
+ weechat_string_free_exploded (weechat_aspell_commands_to_check);
+ weechat_aspell_commands_to_check = NULL;
+ weechat_aspell_count_commands_to_check = 0;
+ }
+
+ if (weechat_aspell_length_commands_to_check)
+ {
+ free (weechat_aspell_length_commands_to_check);
+ weechat_aspell_length_commands_to_check = NULL;
+ }
+
+ value = weechat_config_string (option);
+ if (value && value[0])
+ {
+ weechat_aspell_commands_to_check = weechat_string_explode (value,
+ ",", 0, 0,
+ &weechat_aspell_count_commands_to_check);
+ if (weechat_aspell_count_commands_to_check > 0)
+ {
+ weechat_aspell_length_commands_to_check = malloc (weechat_aspell_count_commands_to_check *
+ sizeof (int));
+ for (i = 0; i < weechat_aspell_count_commands_to_check; i++)
+ {
+ weechat_aspell_length_commands_to_check[i] = strlen (weechat_aspell_commands_to_check[i]);
+ }
+ }
+ }
+}
+
+/*
+ * weechat_aspell_config_change_default_dict: called when default dictionary
+ * is changed
+ */
+
+void
+weechat_aspell_config_change_default_dict (void *data,
+ struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ weechat_aspell_create_spellers (weechat_current_buffer);
+}
+
+/*
+ * weechat_aspell_config_create_option: set a dictionary for a buffer
+ */
+
+int
+weechat_aspell_config_create_option (void *data,
+ struct t_config_file *config_file,
+ struct t_config_section *section,
+ const char *option_name,
+ const char *value)
+{
+ struct t_config_option *ptr_option;
+ int rc;
+
+ /* make C compiler happy */
+ (void) data;
+
+ rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
+
+ if (value && value[0])
+ weechat_aspell_speller_check_dictionaries (value);
+
+ if (option_name)
+ {
+ ptr_option = weechat_config_search_option (config_file, section,
+ option_name);
+ if (ptr_option)
+ {
+ if (value && value[0])
+ rc = weechat_config_option_set (ptr_option, value, 1);
+ else
+ {
+ weechat_config_option_free (ptr_option);
+ rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE;
+ }
+ }
+ else
+ {
+ if (value && value[0])
+ {
+ ptr_option = weechat_config_new_option (
+ config_file, section,
+ option_name, "string",
+ _("comma separated list of dictionaries to use on this buffer"),
+ NULL, 0, 0, value, NULL, NULL, NULL, NULL, NULL, NULL);
+ rc = (ptr_option) ?
+ WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : 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 aspell dictionary \"%s\" => \"%s\""),
+ weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
+ option_name, value);
+ }
+ else
+ weechat_aspell_create_spellers (weechat_current_buffer);
+
+ return rc;
+}
+
+/*
+ * weechat_aspell_config_get_dict: get a dictionary list for a buffer
+ */
+
+struct t_config_option *
+weechat_aspell_config_get_dict (const char *name)
+{
+ return weechat_config_search_option (weechat_aspell_config_file,
+ weechat_aspell_config_section_dict,
+ name);
+}
+
+/*
+ * weechat_aspell_config_set_dict: set a dictionary list for a buffer
+ */
+
+int
+weechat_aspell_config_set_dict (const char *name, const char *value)
+{
+ return weechat_aspell_config_create_option (NULL,
+ weechat_aspell_config_file,
+ weechat_aspell_config_section_dict,
+ name,
+ value);
+}
+
+/*
+ * weechat_aspell_config_init: init aspell configuration file
+ * return: 1 if ok, 0 if error
+ */
+
+int
+weechat_aspell_config_init ()
+{
+ struct t_config_section *ptr_section;
+
+ weechat_aspell_config_file = weechat_config_new (ASPELL_CONFIG_NAME,
+ NULL, NULL);
+ if (!weechat_aspell_config_file)
+ return 0;
+
+ /* look */
+ ptr_section = weechat_config_new_section (weechat_aspell_config_file, "look",
+ 0, 0,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ if (!ptr_section)
+ {
+ weechat_config_free (weechat_aspell_config_file);
+ return 0;
+ }
+
+ weechat_aspell_config_look_color = weechat_config_new_option (
+ weechat_aspell_config_file, ptr_section,
+ "color", "color",
+ N_("color used for mispelled words"),
+ NULL, 0, 0, "lightred", NULL, NULL, NULL, NULL, NULL, NULL);
+
+ /* check */
+ ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check",
+ 0, 0,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL);
+ if (!ptr_section)
+ {
+ weechat_config_free (weechat_aspell_config_file);
+ return 0;
+ }
+
+ weechat_aspell_config_check_commands = weechat_config_new_option (
+ weechat_aspell_config_file, ptr_section,
+ "commands", "string",
+ N_("comma separated list of commands for which spell checking is "
+ "enabled (spell checking is disabled for all other commands)"),
+ NULL, 0, 0,
+ "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query,"
+ "quit,topic",
+ NULL, NULL, &weechat_aspell_config_change_commands, NULL, NULL, NULL);
+ weechat_aspell_config_check_default_dict = weechat_config_new_option (
+ weechat_aspell_config_file, ptr_section,
+ "default_dict", "string",
+ N_("default dictionary (or comma separated list of dictionaries) to "
+ "use when buffer has no dictionary defined (leave blank to disable "
+ "aspell on buffers for which you didn't explicitely enabled it)"),
+ NULL, 0, 0, "",
+ NULL, NULL, &weechat_aspell_config_change_default_dict, NULL, NULL, NULL);
+ weechat_aspell_config_check_word_min_length = weechat_config_new_option (
+ weechat_aspell_config_file, ptr_section,
+ "word_min_length", "integer",
+ N_("minimum length for a word to be spell checked (use 0 to check all "
+ "words)"),
+ NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL);
+ weechat_aspell_config_check_real_time = weechat_config_new_option (
+ weechat_aspell_config_file, ptr_section,
+ "real_time", "boolean",
+ N_("real-time spell checking of words (slower, disabled by default: "
+ "words are checked only if there's delimiter after)"),
+ NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
+
+ ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict",
+ 1, 1,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ &weechat_aspell_config_create_option, NULL);
+ if (!ptr_section)
+ {
+ weechat_config_free (weechat_aspell_config_file);
+ return 0;
+ }
+
+ weechat_aspell_config_section_dict = ptr_section;
+
+ return 1;
+}
+
+/*
+ * weechat_aspell_config_read: read aspell configuration file
+ */
+
+int
+weechat_aspell_config_read ()
+{
+ int rc;
+
+ rc = weechat_config_read (weechat_aspell_config_file);
+ if (rc == WEECHAT_CONFIG_READ_OK)
+ {
+ weechat_aspell_config_change_commands (NULL,
+ weechat_aspell_config_check_commands);
+ }
+
+ return rc;
+}
+
+/*
+ * weechat_aspell_config_write: write aspell configuration file
+ */
+
+int
+weechat_aspell_config_write ()
+{
+ return weechat_config_write (weechat_aspell_config_file);
+}
+
+/*
+ * aspell_config_free: free aspell configuration
+ */
+
+void
+weechat_aspell_config_free ()
+{
+ weechat_config_free (weechat_aspell_config_file);
+
+ if (weechat_aspell_commands_to_check)
+ weechat_string_free_exploded (weechat_aspell_commands_to_check);
+ if (weechat_aspell_length_commands_to_check)
+ free (weechat_aspell_length_commands_to_check);
+}
diff --git a/src/plugins/aspell/aspell-config.h b/src/plugins/aspell/aspell-config.h
new file mode 100644
index 000000000..f307d3ff1
--- /dev/null
+++ b/src/plugins/aspell/aspell-config.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __WEECHAT_ASPELL_CONFIG_H
+#define __WEECHAT_ASPELL_CONFIG_H 1
+
+#define ASPELL_CONFIG_NAME "aspell"
+
+
+extern struct t_config_option *weechat_aspell_config_look_color;
+
+extern struct t_config_option *weechat_aspell_config_check_default_dict;
+extern struct t_config_option *weechat_aspell_config_check_real_time;
+extern struct t_config_option *weechat_aspell_config_check_word_min_length;
+
+extern char **weechat_aspell_commands_to_check;
+extern int weechat_aspell_count_commands_to_check;
+extern int *weechat_aspell_length_commands_to_check;
+
+extern struct t_config_option *weechat_aspell_config_get_dict (const char *name);
+extern int weechat_aspell_config_set_dict (const char *name, const char *value);
+extern int weechat_aspell_config_init ();
+extern int weechat_aspell_config_read ();
+extern int weechat_aspell_config_write ();
+extern void weechat_aspell_config_free ();
+
+#endif /* aspell-config.h */
diff --git a/src/plugins/aspell/aspell-speller.c b/src/plugins/aspell/aspell-speller.c
new file mode 100644
index 000000000..f066cc64a
--- /dev/null
+++ b/src/plugins/aspell/aspell-speller.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* aspell-speller.c: speller management for aspell plugin */
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "../weechat-plugin.h"
+#include "aspell.h"
+#include "aspell-speller.h"
+
+
+struct t_aspell_speller *weechat_aspell_spellers = NULL;
+struct t_aspell_speller *last_weechat_aspell_speller = NULL;
+
+
+/*
+ * weechat_aspell_speller_exists: return 1 if an aspell dict exists for a lang,
+ * 0 otherwise
+ */
+
+int
+weechat_aspell_speller_exists (const char *lang)
+{
+ struct AspellConfig *config;
+ AspellDictInfoList *list;
+ AspellDictInfoEnumeration *el;
+ const AspellDictInfo *dict;
+ int rc;
+
+ rc = 0;
+
+ config = new_aspell_config ();
+ list = get_aspell_dict_info_list (config);
+ el = aspell_dict_info_list_elements (list);
+
+ while ((dict = aspell_dict_info_enumeration_next (el)))
+ {
+ if (strcmp (dict->name, lang) == 0)
+ {
+ rc = 1;
+ break;
+ }
+ }
+
+ delete_aspell_dict_info_enumeration (el);
+ delete_aspell_config (config);
+
+ return rc;
+}
+
+/*
+ * weechat_aspell_speller_check_dictionaries: check dictionaries (called when
+ * user creates/changes dictionaries
+ * for a buffer)
+ */
+
+void
+weechat_aspell_speller_check_dictionaries (const char *dict_list)
+{
+ char **argv;
+ int argc, i;
+
+ if (dict_list)
+ {
+ argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
+ if (argv)
+ {
+ for (i = 0; i < argc; i++)
+ {
+ if (!weechat_aspell_speller_exists (argv[i]))
+ {
+ weechat_printf (NULL,
+ _("%s: warning: dictionary \"%s\" is not "
+ "available on your system"),
+ ASPELL_PLUGIN_NAME, argv[i]);
+ }
+ }
+ weechat_string_free_exploded (argv);
+ }
+ }
+}
+
+/*
+ * weechat_aspell_speller_search: search a speller
+ */
+
+struct t_aspell_speller *
+weechat_aspell_speller_search (const char *lang)
+{
+ struct t_aspell_speller *ptr_speller;
+
+ for (ptr_speller = weechat_aspell_spellers; ptr_speller;
+ ptr_speller = ptr_speller->next_speller)
+ {
+ if (strcmp (ptr_speller->lang, lang) == 0)
+ return ptr_speller;
+ }
+
+ /* no speller found */
+ return NULL;
+}
+
+/*
+ * weechat_aspell_speller_new: create and add a new speller instance
+ */
+
+struct t_aspell_speller *
+weechat_aspell_speller_new (const char *lang)
+{
+ struct t_aspell_speller *new_speller;
+ AspellConfig *config;
+ AspellCanHaveError *ret;
+
+ if (!lang)
+ return NULL;
+
+ if (aspell_debug)
+ {
+ weechat_printf (NULL,
+ "%s: creating new speller for lang \"%s\"",
+ ASPELL_PLUGIN_NAME, lang);
+ }
+
+ /* create a speller instance for the newly created cell */
+ config = new_aspell_config();
+ aspell_config_replace (config, "lang", lang);
+
+ ret = new_aspell_speller (config);
+
+ if (aspell_error (ret) != 0)
+ {
+ weechat_printf (NULL,
+ "%s%s: error: %s",
+ weechat_prefix ("error"), ASPELL_PLUGIN_NAME,
+ aspell_error_message (ret));
+ delete_aspell_config (config);
+ delete_aspell_can_have_error (ret);
+ return NULL;
+ }
+
+ /* create and add a new speller cell */
+ new_speller = malloc (sizeof (*new_speller));
+ if (!new_speller)
+ {
+ weechat_printf (NULL,
+ _("%s%s: not enough memory to create new speller"),
+ weechat_prefix ("error"), ASPELL_PLUGIN_NAME);
+ return NULL;
+ }
+
+ new_speller->speller = to_aspell_speller (ret);
+ new_speller->lang = strdup (lang);
+
+ /* add speller to list */
+ new_speller->prev_speller = last_weechat_aspell_speller;
+ new_speller->next_speller = NULL;
+ if (weechat_aspell_spellers)
+ last_weechat_aspell_speller->next_speller = new_speller;
+ else
+ weechat_aspell_spellers = new_speller;
+ last_weechat_aspell_speller = new_speller;
+
+ /* free config */
+ delete_aspell_config (config);
+
+ return new_speller;
+}
+
+/*
+ * weechat_aspell_speller_free: remove a speller instance
+ */
+
+void
+weechat_aspell_speller_free (struct t_aspell_speller *speller)
+{
+ if (!speller)
+ return;
+
+ if (aspell_debug)
+ {
+ weechat_printf (NULL,
+ "%s: removing speller for lang \"%s\"",
+ ASPELL_PLUGIN_NAME, speller->lang);
+ }
+
+ /* free data */
+ if (speller->speller)
+ {
+ aspell_speller_save_all_word_lists (speller->speller);
+ delete_aspell_speller (speller->speller);
+ }
+ if (speller->lang)
+ free (speller->lang);
+
+ /* remove speller from list */
+ if (speller->prev_speller)
+ (speller->prev_speller)->next_speller = speller->next_speller;
+ if (speller->next_speller)
+ (speller->next_speller)->prev_speller = speller->prev_speller;
+ if (weechat_aspell_spellers == speller)
+ weechat_aspell_spellers = speller->next_speller;
+ if (last_weechat_aspell_speller == speller)
+ last_weechat_aspell_speller = speller->prev_speller;
+
+ free (speller);
+}
+
+/*
+ * weechat_aspell_speller_free_all: free all spellers
+ */
+
+void
+weechat_aspell_speller_free_all ()
+{
+ while (weechat_aspell_spellers)
+ {
+ weechat_aspell_speller_free (weechat_aspell_spellers);
+ }
+}
diff --git a/src/plugins/aspell/aspell-speller.h b/src/plugins/aspell/aspell-speller.h
new file mode 100644
index 000000000..fb6f92bcf
--- /dev/null
+++ b/src/plugins/aspell/aspell-speller.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
+ * See README for License detail, AUTHORS for developers list.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __WEECHAT_ASPELL_SPELLER_H
+#define __WEECHAT_ASPELL_SPELLER_H 1
+
+struct t_aspell_speller
+{
+ AspellSpeller *speller; /* aspell speller */
+ char *lang; /* language */
+
+ struct t_aspell_speller *prev_speller; /* pointer to next speller */
+ struct t_aspell_speller *next_speller; /* pointer to previous speller */
+};
+
+extern struct t_aspell_speller *weechat_aspell_spellers;
+
+extern int weechat_aspell_speller_exists (const char *lang);
+extern struct t_aspell_speller *weechat_aspell_speller_search (const char *lang);
+extern void weechat_aspell_speller_check_dictionaries (const char *dict_list);
+extern struct t_aspell_speller *weechat_aspell_speller_new (const char *lang);
+extern void weechat_aspell_speller_free (struct t_aspell_speller *speller);
+extern void weechat_aspell_speller_free_all ();
+
+#endif /* aspell-speller.h */
diff --git a/src/plugins/aspell/aspell.c b/src/plugins/aspell/aspell.c
index dd302895f..b44f78dea 100644
--- a/src/plugins/aspell/aspell.c
+++ b/src/plugins/aspell/aspell.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* aspell.c: Aspell plugin support for WeeChat */
+/* aspell.c: aspell plugin for WeeChat */
#include <stdio.h>
@@ -27,1432 +27,1008 @@
#include "../weechat-plugin.h"
#include "aspell.h"
+#include "aspell-config.h"
+#include "aspell-speller.h"
-WEECHAT_PLUGIN_NAME("aspell");
+WEECHAT_PLUGIN_NAME(ASPELL_PLUGIN_NAME);
WEECHAT_PLUGIN_DESCRIPTION("Aspell plugin for WeeChat");
WEECHAT_PLUGIN_AUTHOR("FlashCode <flashcode@flashtux.org>");
WEECHAT_PLUGIN_VERSION(WEECHAT_VERSION);
WEECHAT_PLUGIN_WEECHAT_VERSION(WEECHAT_VERSION);
-WEECHAT_LICENSE("GPL");
+WEECHAT_PLUGIN_LICENSE("GPL3");
struct t_weechat_plugin *weechat_aspell_plugin = NULL;
-#define weechat_plugin weechat_aspell_plugin
-aspell_speller_t *aspell_plugin_speller = NULL;
-aspell_config_t *aspell_plugin_config = NULL;
-aspell_options_t aspell_plugin_options;
+int aspell_debug = 0;
+char *aspell_last_modifier_string = NULL; /* last str. received by modifier */
+char *aspell_last_modifier_result = NULL; /* last str. built by modifier */
-/*
- * weechat_aspell_new_speller : create a new speller cell
- */
-
-aspell_speller_t *
-weechat_aspell_new_speller (void)
+/* aspell supported langs (updated on of 2008-10-17) */
+struct t_aspell_code langs_avail[] =
{
- aspell_speller_t *s;
-
- s = malloc (sizeof (*s));
- if (!s)
- {
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ERROR] : unable to alloc memory.", _PLUGIN_NAME);
- return NULL;
- }
-
- s->speller= NULL;
- s->lang = NULL;
- s->refs = 0;
- s->prev_speller = NULL;
- s->next_speller = NULL;
-
- return s;
-}
-
-/*
- * weechat_aspell_free_speller : free a speller cell
- */
-
-void
-weechat_aspell_free_speller (aspell_speller_t *s)
+ { "af", "Afrikaans" },
+ { "am", "Amharic" },
+ { "ar", "Arabic" },
+ { "az", "Azerbaijani" },
+ { "be", "Belarusian" },
+ { "bg", "Bulgarian" },
+ { "bn", "Bengali" },
+ { "br", "Breton" },
+ { "ca", "Catalan" },
+ { "cs", "Czech" },
+ { "csb", "Kashubian" },
+ { "cy", "Welsh" },
+ { "da", "Danish" },
+ { "de", "German" },
+ { "de-alt", "German - Old Spelling" },
+ { "el", "Greek" },
+ { "en", "English" },
+ { "eo", "Esperanto" },
+ { "es", "Spanish" },
+ { "et", "Estonian" },
+ { "fa", "Persian" },
+ { "fi", "Finnish" },
+ { "fo", "Faroese" },
+ { "fr", "French" },
+ { "fy", "Frisian" },
+ { "ga", "Irish" },
+ { "gd", "Scottish Gaelic" },
+ { "gl", "Galician" },
+ { "gu", "Gujarati" },
+ { "gv", "Manx Gaelic" },
+ { "he", "Hebrew" },
+ { "hi", "Hindi" },
+ { "hil", "Hiligaynon" },
+ { "hr", "Croatian" },
+ { "hsb", "Upper Sorbian" },
+ { "hu", "Hungarian" },
+ { "hy", "Armenian" },
+ { "ia", "Interlingua" },
+ { "id", "Indonesian" },
+ { "is", "Icelandic" },
+ { "it", "Italian" },
+ { "ku", "Kurdi" },
+ { "la", "Latin" },
+ { "lt", "Lithuanian" },
+ { "lv", "Latvian" },
+ { "mg", "Malagasy" },
+ { "mi", "Maori" },
+ { "mk", "Macedonian" },
+ { "ml", "Malayalam" },
+ { "mn", "Mongolian" },
+ { "mr", "Marathi" },
+ { "ms", "Malay" },
+ { "mt", "Maltese" },
+ { "nb", "Norwegian Bokmal" },
+ { "nds", "Low Saxon" },
+ { "nl", "Dutch" },
+ { "nn", "Norwegian Nynorsk" },
+ { "ny", "Chichewa" },
+ { "or", "Oriya" },
+ { "pa", "Punjabi" },
+ { "pl", "Polish" },
+ { "pt_BR", "Brazilian Portuguese" },
+ { "pt_PT", "Portuguese" },
+ { "qu", "Quechua" },
+ { "ro", "Romanian" },
+ { "ru", "Russian" },
+ { "rw", "Kinyarwanda" },
+ { "sc", "Sardinian" },
+ { "sk", "Slovak" },
+ { "sl", "Slovenian" },
+ { "sr", "Serbian" },
+ { "sv", "Swedish" },
+ { "sw", "Swahili" },
+ { "ta", "Tamil" },
+ { "te", "Telugu" },
+ { "tet", "Tetum" },
+ { "tk", "Turkmen" },
+ { "tl", "Tagalog" },
+ { "tn", "Setswana" },
+ { "tr", "Turkish" },
+ { "uk", "Ukrainian" },
+ { "uz", "Uzbek" },
+ { "vi", "Vietnamese" },
+ { "wa", "Walloon" },
+ { "yi", "Yiddish" },
+ { "zu", "Zulu" },
+ { NULL, NULL}
+};
+
+struct t_aspell_code countries_avail[] =
{
- if (s)
- {
- if (s->speller)
- {
- aspell_speller_save_all_word_lists (s->speller);
- delete_aspell_speller (s->speller);
- }
- if (s->lang)
- free(s->lang);
- free(s);
- }
-}
+ { "AT", "Austria" },
+ { "BR", "Brazil" },
+ { "CA", "Canada" },
+ { "CH", "Switzerland" },
+ { "DE", "Germany" },
+ { "FR", "France" },
+ { "GB", "Great Britain" },
+ { "PT", "Portugal" },
+ { "SK", "Slovakia" },
+ { "US", "United States of America" },
+ { NULL, NULL}
+};
+
/*
- * weechat_aspell_speller_list_search : search a speller cell
+ * weechat_aspell_debug_cb: callback for "debug" signal
*/
-aspell_speller_t *
-weechat_aspell_speller_list_search (char *lang)
+int
+weechat_aspell_debug_cb (void *data, const char *signal, const char *type_data,
+ void *signal_data)
{
- aspell_speller_t *p, *r = NULL;
+ /* make C compiler happy */
+ (void) data;
+ (void) signal;
- for(p = aspell_plugin_speller; p; p = p->next_speller)
+ if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_STRING) == 0)
{
- if (strcmp(p->lang, lang) == 0)
- {
- r = p;
- break;
- }
+ if (weechat_strcasecmp ((char *)signal_data, ASPELL_PLUGIN_NAME) == 0)
+ {
+ aspell_debug ^= 1;
+ if (aspell_debug)
+ {
+ weechat_printf (NULL, _("%s: debug enabled"),
+ ASPELL_PLUGIN_NAME);
+ }
+ else
+ {
+ weechat_printf (NULL, _("%s: debug disabled"),
+ ASPELL_PLUGIN_NAME);
+ }
+ }
}
- return r;
+ return WEECHAT_RC_OK;
}
/*
- * weechat_aspell_speller_list_add : create and add a new speller instance
+ * weechat_aspell_build_option_name: build option name with a buffer
*/
-int
-weechat_aspell_speller_list_add (char *lang)
+char *
+weechat_aspell_build_option_name (struct t_gui_buffer *buffer)
{
- aspell_speller_t *s;
- AspellConfig *config;
- AspellCanHaveError *ret;
-
- /* create a speller instance for the newly created cell */
- config = new_aspell_config();
- aspell_config_replace (config, "lang", lang);
+ char *plugin_name, *name, *option_name;
+ int length;
- ret = new_aspell_speller (config);
-
- if (aspell_error (ret) != 0)
- {
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ERROR] : %s",
- _PLUGIN_NAME, aspell_error_message (ret));
- delete_aspell_config (config);
- delete_aspell_can_have_error (ret);
- return 0;
- }
-
- /* create and add a new speller cell */
- s = weechat_aspell_new_speller();
- if (!s)
- return 0;
+ if (!buffer)
+ return NULL;
- s->next_speller = aspell_plugin_speller;
- if (aspell_plugin_speller)
- aspell_plugin_speller->prev_speller = s;
- aspell_plugin_speller = s;
+ plugin_name = weechat_buffer_get_string (buffer, "plugin");
+ name = weechat_buffer_get_string (buffer, "name");
- s->lang = strdup (lang);
- s->refs = 1;
- s->speller = to_aspell_speller (ret);
+ length = strlen (plugin_name) + 1 + strlen (name) + 1;
+ option_name = malloc (length);
+ if (!option_name)
+ return NULL;
- delete_aspell_config (config);
+ snprintf (option_name, length, "%s.%s", plugin_name, name);
- return 1;
+ return option_name;
}
/*
- * weechat_aspell_speller_list_remove : remove a speller instance
+ * weechat_aspell_get_dict: get dictionary list for a buffer
+ * we first try with all arguments, then remove one by
+ * one to find dict (from specific to general dict)
*/
-int
-weechat_aspell_speller_list_remove(char *lang)
+char *
+weechat_aspell_get_dict (struct t_gui_buffer *buffer)
{
- aspell_speller_t *p;
- int r = 0;
-
- if (!aspell_plugin_speller || !lang)
- return 0;
+ char *name, *option_name, *ptr_end;
+ struct t_config_option *ptr_option;
- if (!aspell_plugin_speller->prev_speller
- && !aspell_plugin_speller->next_speller)
- {
- weechat_aspell_free_speller (aspell_plugin_speller);
- aspell_plugin_speller = NULL;
- return 1;
- }
-
- for(p = aspell_plugin_speller; p; p = p->next_speller)
+ name = weechat_aspell_build_option_name (buffer);
+ if (!name)
+ return NULL;
+
+ option_name = strdup (name);
+ if (option_name)
{
- if (strcmp(p->lang, lang) == 0)
- {
- if (p->prev_speller)
- p->prev_speller->next_speller = p->next_speller;
- else
- aspell_plugin_speller = p->next_speller;
-
- if (p->next_speller)
- p->next_speller->prev_speller = p->prev_speller;
-
- weechat_aspell_free_speller (p);
- r = 1;
- break;
- }
+ ptr_end = option_name + strlen (option_name);
+ while (ptr_end >= option_name)
+ {
+ ptr_option = weechat_aspell_config_get_dict (option_name);
+ if (ptr_option)
+ {
+ free (option_name);
+ free (name);
+ return weechat_config_string (ptr_option);
+ }
+ ptr_end--;
+ while ((ptr_end >= option_name) && (ptr_end[0] != '.'))
+ {
+ ptr_end--;
+ }
+ if ((ptr_end >= option_name) && (ptr_end[0] == '.'))
+ ptr_end[0] = '\0';
+ }
+ ptr_option = weechat_aspell_config_get_dict (option_name);
+
+ free (option_name);
+ free (name);
+
+ if (ptr_option)
+ return weechat_config_string (ptr_option);
}
- return r;
+ /* nothing found => return default dictionary (if set) */
+ if (weechat_config_string (weechat_aspell_config_check_default_dict)
+ && weechat_config_string (weechat_aspell_config_check_default_dict)[0])
+ return weechat_config_string (weechat_aspell_config_check_default_dict);
+
+ /* no default dictionary set */
+ return NULL;
}
/*
- * weechat_aspell_new_config : create a new config cell
+ * weechat_aspell_set_dict: set a dictionary list for a buffer
*/
-aspell_config_t *
-weechat_aspell_new_config (void)
+void
+weechat_aspell_set_dict (struct t_gui_buffer *buffer, const char *value)
{
- aspell_config_t *c;
+ char *name;
+
+ name = weechat_aspell_build_option_name (buffer);
+ if (!name)
+ return;
- c = malloc (sizeof (*c));
- if (!c)
+ if (weechat_aspell_config_set_dict (name, value) > 0)
{
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ERROR] : unable to alloc memory.", _PLUGIN_NAME);
- return NULL;
+ if (value && value[0])
+ weechat_printf (NULL, "%s: %s => %s",
+ ASPELL_PLUGIN_NAME, name, value);
+ else
+ weechat_printf (NULL, _("%s: %s: removed"),
+ ASPELL_PLUGIN_NAME, name);
}
-
- c->server = NULL;
- c->channel = NULL;
- c->speller = NULL;
- c->prev_config = NULL;
- c->next_config = NULL;
- return c;
+ free (name);
}
/*
- * weechat_aspell_free_config : free a config cell
+ * weechat_aspell_spellers_already_ok: check if current spellers are already ok
+ * return 1 if already ok, 0 if spellers
+ * must be free then created again
*/
-void
-weechat_aspell_free_config (aspell_config_t *c)
+int
+weechat_aspell_spellers_already_ok (const char *dict_list)
{
- if (c)
+ char **argv;
+ int argc, rc, i;
+ struct t_aspell_speller *ptr_speller;
+
+ if (!dict_list && !weechat_aspell_spellers)
+ return 1;
+
+ if (!dict_list || !weechat_aspell_spellers)
+ return 0;
+
+ rc = 0;
+
+ argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
+ if (argv)
{
- if (c->server)
- free(c->server);
- if (c->channel)
- free(c->channel);
-
- free(c);
+ ptr_speller = weechat_aspell_spellers;
+ for (i = 0; (i < argc) && ptr_speller; i++)
+ {
+ if (strcmp (ptr_speller->lang, argv[i]) == 0)
+ {
+ rc = 1;
+ break;
+ }
+ ptr_speller = ptr_speller->next_speller;
+ }
+ weechat_string_free_exploded (argv);
}
+
+ return rc;
}
/*
- * weechat_aspell_config_list_search : search a config cell
+ * weechat_aspell_create_spellers: create spellers for a buffer
*/
-aspell_config_t *
-weechat_aspell_config_list_search (char *server, char *channel)
+void
+weechat_aspell_create_spellers (struct t_gui_buffer *buffer)
{
- aspell_config_t *p, *r = NULL;
-
- if (!server || !channel)
- return NULL;
+ char *dict_list, **argv;
+ int argc, i;
- for(p = aspell_plugin_config; p; p = p->next_config)
+ if (buffer)
{
- if (strcmp(p->server, server) == 0
- && strcmp(p->channel, channel) == 0)
- {
- r = p;
- break;
- }
+ dict_list = weechat_aspell_get_dict (buffer);
+ if (!weechat_aspell_spellers_already_ok (dict_list))
+ {
+ weechat_aspell_speller_free_all ();
+ if (dict_list)
+ {
+ argv = weechat_string_explode (dict_list, ",", 0, 0, &argc);
+ if (argv)
+ {
+ for (i = 0; i < argc; i++)
+ {
+ weechat_aspell_speller_new (argv[i]);
+ }
+ weechat_string_free_exploded (argv);
+ }
+ }
+ }
}
-
- return r;
}
/*
- * weechat_aspell_config_list_add : create and add a new config
+ * weechat_aspell_buffer_switch_cb: callback for "buffer_switch" signel
*/
int
-weechat_aspell_config_list_add (char *server, char *channel)
+weechat_aspell_buffer_switch_cb (void *data, const char *signal,
+ const char *type_data, void *signal_data)
{
- aspell_config_t *c;
-
- c = weechat_aspell_new_config();
- if (!c)
- return 0;
-
- c->channel = strdup (channel);
- c->server = strdup (server);
-
- c->next_config = aspell_plugin_config;
- if (aspell_plugin_config)
- aspell_plugin_config->prev_config = c;
- aspell_plugin_config = c;
+ /* make C compiler happy */
+ (void) data;
+ (void) signal;
+ (void) type_data;
- return 1;
-}
-
-/*
- * weechat_aspell_config_list_remove : remove a speller config
- */
-
-int
-weechat_aspell_config_list_remove(char *server, char *channel)
-{
- aspell_config_t *p;
- int r = 0;
-
- if (!aspell_plugin_config || !server || !channel)
- return 0;
-
- if (!aspell_plugin_config->prev_config
- && !aspell_plugin_config)
- {
- weechat_aspell_free_config (aspell_plugin_config);
- aspell_plugin_config = NULL;
- return 1;
- }
+ weechat_aspell_create_spellers (signal_data);
- for(p = aspell_plugin_config; p; p = p->next_config)
- {
- if (strcmp(p->server, server) == 0
- && strcmp(p->channel, channel) == 0)
- {
- if (p->prev_config)
- p->prev_config->next_config = p->next_config;
- else
- aspell_plugin_config = p->next_config;
-
- if (p->next_config)
- p->next_config->prev_config = p->prev_config;
- weechat_aspell_free_config (p);
- r = 1;
- break;
- }
- }
-
- return r;
+ return WEECHAT_RC_OK;
}
/*
- * weechat_aspell_iso_to_lang :
- * convert an aspell iso lang code
- * in its english full name
+ * weechat_aspell_iso_to_lang: convert an aspell iso lang code in its english
+ * full name
*
*/
char *
-weechat_aspell_iso_to_lang (char *code)
+weechat_aspell_iso_to_lang (const char *code)
{
- iso_langs_t *p;
- char *l;
-
- l = NULL;
+ int i;
- for(p = langs_avail; p->code; ++p)
+ for (i = 0; langs_avail[i].code; i++)
{
- if (strcmp(p->code, code) == 0)
- {
- l = strdup(p->name);
- break;
- }
+ if (strcmp (langs_avail[i].code, code) == 0)
+ return strdup (langs_avail[i].name);
}
-
- if (!l)
- l = strdup ("Unknown");
-
- return l;
+
+ /* lang code not found */
+ return strdup ("Unknown");
}
/*
- * weechat_aspell_iso_to_country :
- * convert an aspell iso country
- * code in its english full name
+ * weechat_aspell_iso_to_country: convert an aspell iso country code in its
+ * english full name
*/
char *
-weechat_aspell_iso_to_country (char *code)
+weechat_aspell_iso_to_country (const char *code)
{
- iso_countries_t *p;
- char *c;
-
- c = NULL;
+ int i;
- for(p = countries_avail; p->code; ++p)
+ for (i = 0; countries_avail[i].code; i++)
{
- if (strcmp(p->code, code) == 0)
- {
- c = strdup(p->name);
- break;
- }
+ if (strcmp (countries_avail[i].code, code) == 0)
+ return strdup (countries_avail[i].name);
}
-
- if (!c)
- c = strdup ("Unknown");
-
- return c;
-}
-
-/*
- * weechat_aspell_speller_exists :
- * return 1 if an aspell dict exists
- * for a lang, 0 otherwise
- */
-
-int
-weechat_aspell_speller_exists (char *lang)
-{
- struct AspellConfig *config;
- AspellDictInfoList *l;
- AspellDictInfoEnumeration *el;
- const AspellDictInfo *di;
- int r;
-
- r = 0;
- config = new_aspell_config();
- l = get_aspell_dict_info_list (config);
- el = aspell_dict_info_list_elements (l);
- di = NULL;
- while (( di = aspell_dict_info_enumeration_next (el)))
- {
- if (strcmp(di->name, lang) == 0)
- {
- r = 1;
- break;
- }
- }
-
- delete_aspell_dict_info_enumeration (el);
- delete_aspell_config (config);
-
- return r;
+ /* country code not found */
+ return strdup ("Unknown");
}
/*
- * weechat_aspell_speller_list_dicts :
- * list all aspell dict installed on system and display them
+ * weechat_aspell_speller_list_dicts: list all aspell dict installed on system
+ * and display them
*/
void
-weechat_aspell_speller_list_dicts (void)
+weechat_aspell_speller_list_dicts ()
{
- char *country, *lang, *p;
+ char *country, *lang, *pos;
char buffer[192];
struct AspellConfig *config;
- AspellDictInfoList *l;
+ AspellDictInfoList *list;
AspellDictInfoEnumeration *el;
- const AspellDictInfo *di;
+ const AspellDictInfo *dict;
config = new_aspell_config();
- l = get_aspell_dict_info_list (config);
- el = aspell_dict_info_list_elements (l);
- di = NULL;
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL, "[%s] *** dictionnaries list :", _PLUGIN_NAME);
-
- while (( di = aspell_dict_info_enumeration_next (el)))
- {
- country = NULL;
- p = strchr (di->code, '_');
-
- if (p)
- {
- *p = '\0';
- lang = weechat_aspell_iso_to_lang ((char*) di->code);
- *p = '_';
- country = weechat_aspell_iso_to_country (p+1);
- }
- else
- lang = weechat_aspell_iso_to_lang ((char*) di->code);
-
- if (strlen (di->jargon) == 0)
- {
- if (p)
- snprintf (buffer, sizeof(buffer), "%-22s %s (%s)", di->name, lang, country);
- else
- snprintf (buffer, sizeof(buffer), "%-22s %s", di->name, lang);
- }
- else
- {
- if (p)
- snprintf (buffer, sizeof(buffer), "%-22s %s (%s - %s)", di->name, lang, country, di->jargon);
- else
- snprintf (buffer, sizeof(buffer), "%-22s %s (%s)", di->name, lang, di->jargon);
- }
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL, "[%s] - %s", _PLUGIN_NAME, buffer);
-
- if (lang)
- free (lang);
- if (country)
- free (country);
- }
-
- delete_aspell_dict_info_enumeration (el);
- delete_aspell_config (config);
-}
-
-/*
- * weechat_aspell_config_show : display plugin settings
- */
-
-void
-weechat_aspell_config_show (void)
-{
- aspell_config_t *p;
+ list = get_aspell_dict_info_list (config);
+ el = aspell_dict_info_list_elements (list);
- if (!aspell_plugin_config)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] *** No buffers with spellchecking enable",
- _PLUGIN_NAME);
- else
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] *** Spellchecking is active on the following buffers :",
- _PLUGIN_NAME);
-
- for(p = aspell_plugin_config; p; p = p->next_config)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] -> %s@%s with lang '%s'",
- _PLUGIN_NAME, p->channel, p->server, p->speller->lang);
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] *** plugin options :", _PLUGIN_NAME);
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] -> word-size = %d",
- _PLUGIN_NAME, aspell_plugin_options.word_size);
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SHOW] -> color = %s",
- _PLUGIN_NAME, aspell_plugin_options.color_name);
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- aspell_plugin_options.check_sync == 1
- ? "[%s] [SHOW] -> realtime spellchecking is enable"
- : "[%s] [SHOW] -> asynchronous spellchecking is enable"
- ,
- _PLUGIN_NAME);
-}
-
-/*
- * weechat_aspell_config_addword : adding a word in personnal dictionaries
- */
-
-int
-weechat_aspell_config_addword(char *word)
-{
- char *server, *channel;
- aspell_config_t *c;
- int ret;
+ weechat_printf (NULL, "");
+ weechat_printf (NULL,
+ /* TRANSLATORS: %s is "aspell" */
+ _( "%s dictionnaries list:"),
+ ASPELL_PLUGIN_NAME);
- ret = 0;
- channel = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "channel", NULL);
- server = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "server", NULL);
-
- if (!server || !channel)
- return 0;
-
- c = weechat_aspell_config_list_search (server, channel);
- if (c) {
- if (aspell_speller_add_to_personal (
- c->speller->speller, (const char *) word, strlen(word)) == 1)
- ret = 1;
+ while ((dict = aspell_dict_info_enumeration_next (el)))
+ {
+ country = NULL;
+ pos = strchr (dict->code, '_');
+
+ if (pos)
+ {
+ pos[0] = '\0';
+ lang = weechat_aspell_iso_to_lang ((char*)dict->code);
+ pos[0] = '_';
+ country = weechat_aspell_iso_to_country (pos + 1);
+ }
+ else
+ lang = weechat_aspell_iso_to_lang ((char*)dict->code);
+
+ if (strlen (dict->jargon) == 0)
+ {
+ if (pos)
+ {
+ snprintf (buffer, sizeof (buffer), "%-22s %s (%s)",
+ dict->name, lang, country);
+ }
+ else
+ {
+ snprintf (buffer, sizeof (buffer), "%-22s %s",
+ dict->name, lang);
+ }
+ }
+ else
+ {
+ if (pos)
+ {
+ snprintf (buffer, sizeof (buffer), "%-22s %s (%s - %s)",
+ dict->name, lang, country, dict->jargon);
+ }
+ else
+ {
+ snprintf (buffer, sizeof (buffer), "%-22s %s (%s)",
+ dict->name, lang, dict->jargon);
+ }
+ }
+
+ weechat_printf (NULL, " %s", buffer);
+
+ if (lang)
+ free (lang);
+ if (country)
+ free (country);
}
- if (ret)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ADD-WORD] word '%s' successfully added in your personnal dictionnary",
- _PLUGIN_NAME, word);
- else
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ADD-WORD] an error occured while adding word '%s' in your personnal dict",
- _PLUGIN_NAME, word);
-
- if (server)
- free (server);
- if (channel)
- free (channel);
-
- return ret;
+ delete_aspell_dict_info_enumeration (el);
+ delete_aspell_config (config);
}
/*
- * weechat_aspell_config_dump : display debug infos
+ * weechat_aspell_add_word : add a word in personnal dictionary
*/
void
-weechat_aspell_config_dump (void)
+weechat_aspell_add_word (const char *lang, const char *word)
{
- aspell_config_t *p;
- aspell_speller_t *s;
-
- if (!aspell_plugin_config)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [DEBUG] [CONFIG] no config",
- _PLUGIN_NAME);
-
- for(p = aspell_plugin_config; p; p = p->next_config)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [DEBUG] [CONFIG] @%p server='%s' channel='%s' @speller=%p lang='%s' @p=%p @n=%p",
- _PLUGIN_NAME, p, p->server, p->channel, p->speller, p->speller->lang, p->prev_config, p->next_config);
+ struct t_aspell_speller *new_speller, *ptr_speller;
- if (!aspell_plugin_speller)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [DEBUG] [SPELLER] no speller",
- _PLUGIN_NAME);
-
- for(s = aspell_plugin_speller; s; s = s->next_speller)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [DEBUG] [SPELLER] @%p lang='%s' refs=%d @engine=%p @p=%p @n=%p",
- _PLUGIN_NAME, s, s->lang, s->refs, s->speller, s->prev_speller, s->next_speller);
-}
-
-/*
- * weechat_aspell_config_enable_for : internal subroutine
- */
-
-void
-weechat_aspell_config_enable_for (char *server, char *channel, char *lang)
-{
- aspell_config_t *c;
- aspell_speller_t *s;
-
- if (!weechat_aspell_speller_exists (lang))
+ new_speller = NULL;
+ ptr_speller = weechat_aspell_speller_search (lang);
+ if (!ptr_speller)
{
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [WARN] '%s' dictionary doesn't seems to be available on your system",
- _PLUGIN_NAME, lang);
- return;
- }
-
- c = weechat_aspell_config_list_search (server, channel);
- if (c)
- {
- c->speller->refs--;
- if (c->speller->refs == 0)
- weechat_aspell_speller_list_remove (c->speller->lang);
- weechat_aspell_config_list_remove (server, channel);
+ if (!weechat_aspell_speller_exists (lang))
+ {
+ weechat_printf (NULL,
+ _("%s: error: dictionary \"%s\" is not "
+ "available on your system"),
+ ASPELL_PLUGIN_NAME, lang);
+ return;
+ }
+ new_speller = weechat_aspell_speller_new (lang);
+ if (!new_speller)
+ return;
+ ptr_speller = new_speller;
}
- if (!weechat_aspell_config_list_add (server, channel))
+ if (aspell_speller_add_to_personal (ptr_speller->speller,
+ word,
+ strlen (word)) == 1)
{
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [ERROR] enabling spell checking on %s@%s failed",
- _PLUGIN_NAME, channel, server);
- return;
- }
-
- s = weechat_aspell_speller_list_search (lang);
-
- if (!s) {
- weechat_aspell_speller_list_add (lang);
- s = aspell_plugin_speller;
+ weechat_printf (NULL,
+ _("%s: word \"%s\" added to personal dictionary"),
+ ASPELL_PLUGIN_NAME, word);
}
else
- s->refs++;
-
- aspell_plugin_config->speller = s;
-
-}
-
-/*
- * weechat_aspell_config_enable :
- * enabling given lang spell checking on current server/channel
- */
-
-void
-weechat_aspell_config_enable (char *lang)
-{
- char *channel, *server;
-
- channel = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "channel", NULL);
- server = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "server", NULL);
-
- if (!server || !channel)
{
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [WARN] you are not in a channel",
- _PLUGIN_NAME);
- return;
+ weechat_printf (NULL,
+ _("%s%s: failed to add word to personal "
+ "dictionary"),
+ weechat_prefix ("error"), ASPELL_PLUGIN_NAME);
}
- weechat_aspell_config_enable_for (server, channel, lang);
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] spell checking '%s' is now active on %s@%s",
- _PLUGIN_NAME, lang, channel, server);
-
- if (channel)
- free (channel);
- if (server)
- free (server);
+ if (new_speller)
+ weechat_aspell_speller_free (new_speller);
}
/*
- * weechat_aspell_config_disable :
- * disabling spell checking on current server/channel
+ * weechat_aspell_command_authorized: return 1 if command is authorized for
+ * spell checking, otherwise 0
*/
-void
-weechat_aspell_config_disable (void)
+int
+weechat_aspell_command_authorized (const char *command)
{
- aspell_config_t *c;
- char *channel, *server;
+ int length_command, i;
- channel = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "channel", NULL);
- server = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "server", NULL);
-
- if (!server || !channel)
- {
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [WARN] you are not in a channel",
- _PLUGIN_NAME, NULL, NULL);
- return;
- }
+ if (!command)
+ return 1;
- c = weechat_aspell_config_list_search (server, channel);
- if (!c)
+ length_command = strlen (command);
+
+ for (i = 0; i < weechat_aspell_count_commands_to_check; i++)
{
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [WARN] spell checking is not active on %s@%s",
- _PLUGIN_NAME, channel, server);
- if (channel)
- free (channel);
- if (server)
- free (server);
- return;
+ if ((weechat_aspell_length_commands_to_check[i] == length_command)
+ && (weechat_strcasecmp (command,
+ weechat_aspell_commands_to_check[i]) == 0))
+ {
+ /* command is authorized */
+ return 1;
+ }
}
- c->speller->refs--;
- if (c->speller->refs == 0)
- weechat_aspell_speller_list_remove (c->speller->lang);
-
- weechat_aspell_config_list_remove (server, channel);
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] spell checking is now inactive on %s@%s",
- _PLUGIN_NAME, channel, server);
-
- if (channel)
- free (channel);
- if (server)
- free (server);
+ /* command is not authorized */
+ return 0;
}
/*
- * weechat_aspell_config_set : setting options values
+ * weechat_aspell_string_strip_punctuation: strip punctuation chars at the
+ * begining and at the end of a word
*/
-int
-weechat_aspell_config_set(char *option, char *value)
+char *
+weechat_aspell_string_strip_punctuation (const char *word)
{
- int c;
+ const char *ptr_start, *ptr_end;
- if (strcmp (option, "word-size") == 0)
- {
- aspell_plugin_options.word_size = atoi ((value == NULL) ? "" : value);
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SET] setting %s = %d",
- _PLUGIN_NAME, option, aspell_plugin_options.word_size);
- }
- else if (strcmp (option, "toggle-check-mode") == 0)
- {
- aspell_plugin_options.check_sync = aspell_plugin_options.check_sync == 1 ? 0 : 1;
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- aspell_plugin_options.check_sync == 1
- ? "[%s] [SET] spellchecking is now set in realtime mode"
- : "[%s] [SET] spellchecking is now set in asynchronous mode",
- _PLUGIN_NAME, option);
- }
- else if (strcmp (option, "color") == 0)
+ if (!word)
+ return NULL;
+
+ ptr_start = word;
+ while (ptr_start[0])
{
- c = weechat_aspell_plugin->get_irc_color (weechat_aspell_plugin, (value == NULL) ? "" : value);
- if (c == -1)
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SET] setting %s = %s failed : color '%s' is unknown",
- _PLUGIN_NAME, option,
- (value == NULL) ? "" : value,
- (value == NULL) ? "" : value);
- else
- {
- aspell_plugin_options.color = c;
- if (aspell_plugin_options.color_name)
- free (aspell_plugin_options.color_name);
- aspell_plugin_options.color_name = strdup (value);
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL,
- "[%s] [SET] setting %s = %s",
- _PLUGIN_NAME, option, aspell_plugin_options.color_name);
- }
+ if (!ispunct (ptr_start[0]))
+ break;
+ ptr_start++;
}
- else
- return 0;
-
- return 1;
-}
-/*
- * weechat_aspell_config_save : saving plugin config
- */
-
-int
-weechat_aspell_config_save (void)
-{
- aspell_config_t *p, *q;
- char *servers, *channels, *option;
- char **servers_list;
- int n, i, s, found;
+ if (!ptr_start[0])
+ return strdup ("");
- servers = NULL;
-
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "servers", "");
+ ptr_end = ptr_start + strlen (ptr_start) - 1;
- for(p = aspell_plugin_config; p; p = p->next_config)
+ while (ptr_end >= ptr_start)
{
- servers = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, "servers");
-
- if (!servers)
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "servers", p->server);
- else if (strlen (servers) == 0)
- {
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "servers", p->server);
- free (servers);
- }
- else
- {
- servers_list = weechat_aspell_plugin->explode_string (weechat_aspell_plugin, servers, " ", 0, &s);
- if (servers_list)
- {
- found = 0;
- for (i=0; i<s; i++)
- {
- if (strcmp (servers_list[i], p->server) == 0)
- {
- found = 1;
- break;
- }
- }
- if (found == 0)
- {
- n = strlen (servers) + strlen (p->server) + 2;
- servers = realloc (servers, n);
- strcat (servers, " ");
- strcat (servers, p->server);
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "servers", servers);
- }
- free (servers_list);
- }
- free (servers);
- }
-
- channels = NULL;
- for(q = aspell_plugin_config; q; q = q->next_config)
- {
- if (strcmp (p->server, q->server) == 0)
- {
- if (!channels)
- channels = strdup (q->channel);
- else
- {
- n = strlen (channels) + strlen (q->channel) + 2;
- channels = realloc (channels, n);
- strcat (channels, " ");
- strcat (channels, q->channel);
- }
-
- n = 7 + strlen (p->server) + strlen (q->channel);
- option = malloc (n);
- snprintf (option, n, "lang_%s_%s", p->server, q->channel);
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, option, q->speller->lang);
- free (option);
- }
- }
-
- if (channels)
- {
- n = 10 + strlen (p->server);
- option = malloc (n);
- snprintf (option, n, "channels_%s", p->server);
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, option, channels);
- free (option);
- free (channels);
- }
+ if (!ispunct (ptr_end[0]))
+ break;
+ ptr_end--;
}
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL, "[%s] [SAVE] configuration saved", _PLUGIN_NAME);
- return 1;
+ if (ptr_end < ptr_start)
+ return strdup ("");
+
+ return weechat_strndup (ptr_start, ptr_end - ptr_start + 1);
}
/*
- * weechat_aspell_config_load : loading plugin config
+ * weechat_aspell_string_is_url: detect if a word is an url
*/
-int
-weechat_aspell_config_load(void)
+int
+weechat_aspell_string_is_url (const char *word)
{
- char *servers, *channels, *lang;
- char *option_s, *option_l;
- char **servers_list, **channels_list;
- int i, j, s, c, n;
-
- servers = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, "servers");
- if (!servers)
- return 0;
-
- servers_list = weechat_aspell_plugin->explode_string (weechat_aspell_plugin, servers, " ", 0, &s);
-
- if (servers_list)
- {
- for (i=0; i<s; i++)
- {
- n = 10 + strlen (servers_list[i]);
- option_s = malloc (n);
- snprintf (option_s, n, "channels_%s", servers_list[i]);
-
- channels = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, option_s);
- if (channels)
- {
- channels_list = weechat_aspell_plugin->explode_string (weechat_aspell_plugin, channels, " ", 0, &c);
- if (channels_list)
- {
- for (j=0; j<c; j++)
- {
- n = 7 + strlen (servers_list[i]) + strlen (channels_list[j]);
- option_l = malloc (n);
- snprintf (option_l, n, "lang_%s_%s", servers_list[i], channels_list[j]);
-
- lang = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, option_l);
- if (lang)
- {
- weechat_aspell_config_enable_for (servers_list[i], channels_list[j], lang);
- free (lang);
- }
- free (option_l);
- }
- weechat_aspell_plugin->free_exploded_string (weechat_aspell_plugin, channels_list);
- }
- free (channels);
- }
- free (option_s);
- }
-
- weechat_aspell_plugin->free_exploded_string (weechat_aspell_plugin, servers_list);
- }
-
- weechat_aspell_plugin->print_server (weechat_aspell_plugin, "[%s] [LOAD] configuration loaded", _PLUGIN_NAME);
- return 1;
+ if ((weechat_strncasecmp(word, "http://", 7) == 0)
+ || (weechat_strncasecmp(word, "https://", 8) == 0)
+ || (weechat_strncasecmp(word, "ftp://", 6) == 0)
+ || (weechat_strncasecmp(word, "tftp://", 7) == 0)
+ || (weechat_strncasecmp(word, "ftps://", 7) == 0)
+ || (weechat_strncasecmp(word, "ssh://", 6) == 0)
+ || (weechat_strncasecmp(word, "fish://", 7) == 0)
+ || (weechat_strncasecmp(word, "dict://", 7) == 0)
+ || (weechat_strncasecmp(word, "ldap://", 7) == 0)
+ || (weechat_strncasecmp(word, "file://", 7) == 0)
+ || (weechat_strncasecmp(word, "telnet://", 9) == 0)
+ || (weechat_strncasecmp(word, "gopher://", 9) == 0)
+ || (weechat_strncasecmp(word, "irc://", 6) == 0)
+ || (weechat_strncasecmp(word, "ircs://", 7) == 0)
+ || (weechat_strncasecmp(word, "irc6://", 7) == 0)
+ || (weechat_strncasecmp(word, "irc6s://", 8) == 0)
+ || (weechat_strncasecmp(word, "cvs://", 6) == 0)
+ || (weechat_strncasecmp(word, "svn://", 6) == 0)
+ || (weechat_strncasecmp(word, "svn+ssh://", 10) == 0)
+ || (weechat_strncasecmp(word, "git://", 6) == 0))
+ return 1;
+
+ return 0;
}
/*
- * weechat_aspell_options_save : saving plugin options
+ * weechat_aspell_string_is_simili_number: detect if a word is made of chars and
+ * punctuation
*/
int
-weechat_aspell_options_save(void)
+weechat_aspell_string_is_simili_number (const char *word)
{
- char buf[8];
+ const char *ptr_word;
- snprintf (buf, sizeof(buf), "%d", aspell_plugin_options.word_size);
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "word-size", buf);
+ if (!word)
+ return 0;
- snprintf (buf, sizeof(buf), "%d", aspell_plugin_options.check_sync);
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "check-sync", buf);
+ ptr_word = word;
+ while (ptr_word[0])
+ {
+ if (!ispunct (ptr_word[0]) && !isdigit (ptr_word[0]))
+ return 0;
+ ptr_word++;
+ }
- weechat_aspell_plugin->set_plugin_config (weechat_aspell_plugin, "color", aspell_plugin_options.color_name);
-
- weechat_aspell_plugin->print (weechat_aspell_plugin, NULL, NULL, "[%s] [SAVE] options saved", _PLUGIN_NAME);
+ /* there's only digit or punctuation */
return 1;
}
/*
- * weechat_aspell_options_load : loading plugin options
+ * weechat_aspell_check_word: spell check a word
+ * return 1 if word is ok, 0 if word is mispelled
*/
int
-weechat_aspell_options_load(void)
+weechat_aspell_check_word (struct t_gui_buffer *buffer, const char *word)
{
- char *buffer;
- int n;
+ char *clean_word;
+ struct t_aspell_speller *ptr_speller;
+ int rc;
- buffer = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, "word-size");
- if (buffer)
- {
- aspell_plugin_options.word_size = atoi (buffer);
- free (buffer);
- }
- else
- aspell_plugin_options.word_size = _PLUGIN_OPTION_WORD_SIZE;
+ clean_word = weechat_aspell_string_strip_punctuation (word);
- buffer = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, "check-sync");
- if (buffer)
- {
- aspell_plugin_options.check_sync = atoi (buffer);
- if (aspell_plugin_options.check_sync != 0 && aspell_plugin_options.check_sync != 1)
- aspell_plugin_options.check_sync = _PLUGIN_OPTION_CHECK_SYNC;
- free (buffer);
- }
- else
- aspell_plugin_options.check_sync = _PLUGIN_OPTION_CHECK_SYNC;
+ if (!clean_word)
+ return 1;
+ rc = 0;
- buffer = weechat_aspell_plugin->get_plugin_config (weechat_aspell_plugin, "color");
- if (buffer)
- {
- n = weechat_aspell_plugin->get_irc_color (weechat_aspell_plugin, buffer);
- if (n == -1)
- {
- aspell_plugin_options.color = weechat_aspell_plugin->get_irc_color (weechat_aspell_plugin, _PLUGIN_OPTION_COLOR);
- aspell_plugin_options.color_name = strdup (_PLUGIN_OPTION_COLOR);
- }
- else
- {
- aspell_plugin_options.color = n;
- aspell_plugin_options.color_name = strdup (buffer);
- }
- free (buffer);
- }
- else {
- aspell_plugin_options.color = weechat_aspell_plugin->get_irc_color (weechat_aspell_plugin, _PLUGIN_OPTION_COLOR);
- aspell_plugin_options.color_name = strdup (_PLUGIN_OPTION_COLOR);
+ /* word too small? then do not check word */
+ if ((weechat_config_integer (weechat_aspell_config_check_word_min_length) > 0)
+ && ((int)strlen (clean_word) < weechat_config_integer (weechat_aspell_config_check_word_min_length)))
+ rc = 1;
+ else
+ {
+ /* word is URL? then do not check word */
+ if (weechat_aspell_string_is_url (clean_word))
+ rc = 1;
+ else
+ {
+ /* word is a number? then do not check word */
+ if (weechat_aspell_string_is_simili_number (clean_word))
+ rc = 1;
+ else
+ {
+ /* word is a nick of nicklist on this buffer? then do not check word */
+ if (weechat_nicklist_search_nick (buffer, NULL, clean_word))
+ rc = 1;
+ else
+ {
+ /* check word with all spellers for this buffer (order is important) */
+ for (ptr_speller = weechat_aspell_spellers; ptr_speller;
+ ptr_speller = ptr_speller->next_speller)
+ {
+ if (aspell_speller_check (ptr_speller->speller, clean_word, -1) == 1)
+ {
+ rc = 1;
+ break;
+ }
+ }
+ }
+ }
+ }
}
- weechat_aspell_plugin->print_server (weechat_aspell_plugin, "[%s] [LOAD] options loaded", _PLUGIN_NAME);
- return 1;
+ free (clean_word);
+
+ return rc;
}
/*
- * weechat_aspell_speller_command : manage "/aspell" uses
+ * weechat_aspell_modifier_cb: modifier for input text
*/
-int
-weechat_aspell_speller_command (t_weechat_plugin *p,
- int argc, char **argv,
- char *handler_args,
- void *handler_pointer)
+char *
+weechat_aspell_modifier_cb (void *data, const char *modifier,
+ const char *modifier_data, const char *string)
{
- char helpcmd[32];
- char **args;
- int c, r;
+ struct t_gui_buffer *buffer;
+ unsigned int value;
+ char *result, *ptr_string, *pos_space, *color_normal, *color_error;
+ int length, index_result, length_word, word_ok;
+ int length_color_normal, length_color_error;
/* make C compiler happy */
- (void) p;
- (void) handler_args;
- (void) handler_pointer;
-
- snprintf(helpcmd, sizeof(helpcmd), "/help %s", plugin_command);
- r = 0;
-
- if ((argc == 3) && argv[1] && argv[2])
- {
- args = weechat_aspell_plugin->explode_string (weechat_aspell_plugin, argv[2], " ", 0, &c);
- if (args)
- {
- if (c >= 1)
- {
- if (strcmp (args[0], "dictlist") == 0)
- {
- weechat_aspell_speller_list_dicts ();
- r = 1;
- }
- else if (strcmp (args[0], "show") == 0)
- {
- weechat_aspell_config_show ();
- r = 1;
- }
- else if (strcmp (args[0], "save") == 0)
- {
- weechat_aspell_config_save ();
- weechat_aspell_options_save();
- r = 1;
- }
- else if (strcmp (args[0], "dump") == 0)
- {
- weechat_aspell_config_dump ();
- r = 1;
- }
- else if (strcmp (args[0], "enable") == 0)
- {
- if (c >= 2)
- {
- weechat_aspell_config_enable (args[1]);
- r = 1;
- }
- }
- else if (strcmp (args[0], "disable") == 0)
- weechat_aspell_config_disable ();
- else if (strcmp (args[0], "set") == 0)
- {
- if (c >= 2)
- {
- r = weechat_aspell_config_set (args[1], args[2]);
- }
- }
- else if (strcmp (args[0], "add-word") == 0)
- {
- if (c >= 2)
- {
- weechat_aspell_config_addword (args[1]);
- r = 1;
- }
- }
-
- }
- weechat_aspell_plugin->free_exploded_string (weechat_aspell_plugin, args);
- }
- }
-
- if (r == 0)
- weechat_aspell_plugin->exec_command (weechat_aspell_plugin, NULL, NULL, helpcmd);
+ (void) data;
+ (void) modifier;
- return PLUGIN_RC_OK;
-}
-
-/*
- * weechat_aspell_nick_in_server_channel :
- * check presence of a nick in a server/channel
- */
-
-int
-weechat_aspell_nick_in_channel (char *nick, char *server, char *channel)
-{
- t_plugin_nick_info *nick_info, *ptr_nick;
- int ret;
-
- ret = 0;
- if (!nick || !server || ! channel)
- return ret;
+ if (!string)
+ return NULL;
- nick_info = weechat_aspell_plugin->get_nick_info (
- weechat_aspell_plugin, server, channel);
- if (!nick_info)
- return ret;
-
- for(ptr_nick = nick_info; ptr_nick; ptr_nick = ptr_nick->next_nick)
- {
- if (strcmp (nick, ptr_nick->nick) == 0) {
- ret = 1;
- break;
- }
- }
+ sscanf (modifier_data, "%x", &value);
+ buffer = (struct t_gui_buffer *)value;
- weechat_aspell_plugin->free_nick_info (weechat_aspell_plugin, nick_info);
-
- return ret;
-}
-
-/*
- * weechat_aspell_clean_word :
- * strip punct chars at the begining and at the end of a word
- */
-
-char *
-weechat_aspell_clean_word (char *word, int *offset)
-{
- int len;
- char *buffer, *w, *p;
-
- if (!word)
- return NULL;
+ if (!weechat_aspell_spellers)
+ return NULL;
- buffer = strdup (word);
-
- *offset = 0;
- p = buffer;
- while (p)
+ /* for performance: return last stirng built if input string is the
+ same (for example user just change cursor position, or input text is
+ refreshed with same content */
+ if (aspell_last_modifier_string
+ && (strcmp (string, aspell_last_modifier_string) == 0))
{
- if (!ispunct(*p))
- break;
- p++;
- (*offset)++;
+ return (aspell_last_modifier_result) ?
+ strdup (aspell_last_modifier_result) : NULL;
}
-
- p = buffer + strlen(buffer) - 1;
- while (p >= buffer)
+
+ /* free last modifier string and result */
+ if (aspell_last_modifier_string)
{
- if (!ispunct(*p))
- break;
- p--;
+ free (aspell_last_modifier_string);
+ aspell_last_modifier_string = NULL;
}
-
- len = p - buffer - *offset + 1;
- if (len <= 0)
+ if (aspell_last_modifier_result)
{
- free (buffer);
- return NULL;
+ free (aspell_last_modifier_result);
+ aspell_last_modifier_result = NULL;
}
- w = malloc (len+1);
-
- if (w) {
- memcpy (w, buffer + *offset, len);
- w[len] = '\0';
- }
-
- free (buffer);
-
- return w;
-}
-
-/*
- * weechat_aspell_is_simili_number :
- * detect if a word is made of chars and punctation
- */
-
-int
-weechat_aspell_is_simili_number (char *word)
-{
- int len, ret, i;
+ /* save last modifier string received */
+ aspell_last_modifier_string = strdup (string);
- ret = 1;
- len = strlen (word);
+ color_normal = weechat_color (weechat_config_string (weechat_config_get ("weechat.color.input")));
+ length_color_normal = strlen (color_normal);
+ color_error = weechat_color (weechat_config_string (weechat_aspell_config_look_color));
+ length_color_error = strlen (color_error);
- if (!word)
- return 0;
+ length = strlen (string);
+ result = malloc (length + (length * length_color_error));
+ result[0] = '\0';
- for (i=0; i<len; i++)
+ if (result)
{
- if (!ispunct(word[i]) && !isdigit(word[i]))
- {
- ret = 0;
- break;
- }
+ ptr_string = aspell_last_modifier_string;
+ index_result = 0;
+
+ /* check if string is a command */
+ if ((ptr_string[0] == '/') && ptr_string[1] && (ptr_string[1] != '/')
+ && (ptr_string[1] != ' '))
+ {
+ ptr_string++;
+ pos_space = strchr (ptr_string, ' ');
+ if (!pos_space)
+ {
+ free (result);
+ return NULL;
+ }
+
+ pos_space[0] = '\0';
+
+ /* exit if command is not authorized for spell checking */
+ if (!weechat_aspell_command_authorized (ptr_string))
+ {
+ free (result);
+ return NULL;
+ }
+ result[index_result++] = '/';
+ strcpy (result + index_result, ptr_string);
+ index_result += strlen (ptr_string);
+
+ pos_space[0] = ' ';
+ ptr_string = pos_space;
+ }
+
+ while (ptr_string[0])
+ {
+ while (ptr_string[0] == ' ')
+ {
+ result[index_result++] = ' ';
+ ptr_string++;
+ }
+ if (!ptr_string[0])
+ break;
+
+ pos_space = strchr (ptr_string, ' ');
+ if (pos_space)
+ {
+ pos_space[0] = '\0';
+ length_word = pos_space - ptr_string;
+ }
+ else
+ length_word = strlen (ptr_string);
+
+ word_ok = weechat_aspell_check_word (buffer, ptr_string);
+
+ /* add error color */
+ if (!word_ok)
+ {
+ strcpy (result + index_result, color_error);
+ index_result += length_color_error;
+ }
+
+ /* add word */
+ strcpy (result + index_result, ptr_string);
+ index_result += length_word;
+
+ /* add normal color (after mispelled word) */
+ if (!word_ok)
+ {
+ strcpy (result + index_result, color_normal);
+ index_result += length_color_normal;
+ }
+
+ if (pos_space)
+ {
+ pos_space[0] = ' ';
+ ptr_string = pos_space;
+ }
+ else
+ break;
+ }
+
+ result[index_result] = '\0';
}
- return ret;
-}
-
-/*
- * weechat_aspell_is_url :
- * detect if a word is an url
- */
-
-int
-weechat_aspell_is_url (char *word)
-{
- int ret;
-
- ret = 0;
- if (strncasecmp(word, "http://", 7) == 0
- || strncasecmp(word, "https://", 8) == 0
- || strncasecmp(word, "ftp://", 6) == 0
- || strncasecmp(word, "tftp://", 7) == 0
- || strncasecmp(word, "ftps://", 7) == 0
- || strncasecmp(word, "ssh://", 6) == 0
- || strncasecmp(word, "fish://", 7) == 0
- || strncasecmp(word, "dict://", 7) == 0
- || strncasecmp(word, "ldap://", 7) == 0
- || strncasecmp(word, "file://", 7) == 0
- || strncasecmp(word, "telnet://", 9) == 0
- || strncasecmp(word, "gopher://", 9) == 0
- || strncasecmp(word, "irc://", 6) == 0
- || strncasecmp(word, "ircs://", 7) == 0
- || strncasecmp(word, "irc6://", 7) == 0
- || strncasecmp(word, "irc6s://", 8) == 0
- || strncasecmp(word, "cvs://", 6) == 0
- || strncasecmp(word, "svn://", 6) == 0
- || strncasecmp(word, "svn+ssh://", 10) == 0)
- ret = 1;
- return ret;
+ if (!result)
+ return NULL;
+
+ aspell_last_modifier_result = strdup (result);
+ return result;
}
/*
- * weechat_aspell_keyb_check : handler to check spelling on input line
+ * weechat_aspell_command_cb: callback for /aspell command
*/
int
-weechat_aspell_keyb_check (t_weechat_plugin *p, int argc, char **argv,
- char *handler_args, void *handler_pointer)
+weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
+ int argc, char **argv, char **argv_eol)
{
- char *server, *channel;
- aspell_config_t *c;
- cmds_keep_t *cmd;
- int keep_cmd_found;
- char *input, *ptr_input, *pos_space, *clword;
- int count, offset;
+ char *dicts;
/* make C compiler happy */
- (void) p;
- (void) handler_args;
- (void) handler_pointer;
-
- channel = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "channel", NULL);
- server = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "server", NULL);
-
- if (!server || !channel)
- return PLUGIN_RC_OK;
-
- c = weechat_aspell_config_list_search (server, channel);
- if (!c)
- return PLUGIN_RC_OK;
-
- if (aspell_plugin_options.check_sync == 0 && argv[0] && argv[0][0])
- {
- if (argv[0][0] == '*' && !ispunct (argv[0][1]) && !isspace (argv[0][1]))
- return PLUGIN_RC_OK;
- }
-
- if (!(argc == 3 && argv[1] && argv[2]))
- return PLUGIN_RC_OK;
-
- if (strcmp (argv[1], argv[2]) == 0)
- return PLUGIN_RC_OK;
+ (void) data;
- input = weechat_aspell_plugin->get_info (weechat_aspell_plugin, "input", NULL);
- if (!input)
- return PLUGIN_RC_OK;
-
- if (!input[0])
- return PLUGIN_RC_OK;
-
- if (input[0] == '/')
+ if (argc > 1)
{
- keep_cmd_found = 0;
- for(cmd = cmd_tokeep; cmd->cmd; ++cmd)
- {
- if (strncasecmp (input, cmd->cmd, cmd->len) == 0) {
- keep_cmd_found = 1;
- break;
- }
- }
- if (keep_cmd_found == 0)
- return PLUGIN_RC_OK;
+ if (weechat_strcasecmp (argv[1], "dictlist") == 0)
+ {
+ weechat_aspell_speller_list_dicts ();
+ return WEECHAT_RC_OK;
+ }
+ if (weechat_strcasecmp (argv[1], "addword") == 0)
+ {
+ if (argc > 3)
+ weechat_aspell_add_word (argv[2], argv_eol[3]);
+ else
+ {
+ if (!weechat_aspell_spellers)
+ {
+ weechat_printf (NULL,
+ _("%s%s: no dictionary on this buffer for "
+ "adding word"),
+ weechat_prefix ("error"),
+ ASPELL_PLUGIN_NAME);
+ }
+ else if (weechat_aspell_spellers->next_speller)
+ {
+ weechat_printf (NULL,
+ _("%s%s: many dictionaries are defined for "
+ "this buffer, please specify dictionary"),
+ weechat_prefix ("error"),
+ ASPELL_PLUGIN_NAME);
+ }
+ else
+ weechat_aspell_add_word (weechat_aspell_spellers->lang,
+ argv_eol[2]);
+ }
+ return WEECHAT_RC_OK;
+ }
+ if (weechat_strcasecmp (argv[1], "enable") == 0)
+ {
+ if (argc > 2)
+ {
+ dicts = weechat_string_replace (argv_eol[2], " ", "");
+ weechat_aspell_set_dict (buffer,
+ (dicts) ? dicts : argv[2]);
+ if (dicts)
+ free (dicts);
+ }
+ return WEECHAT_RC_OK;
+ }
+ if (weechat_strcasecmp (argv[1], "disable") == 0)
+ {
+ weechat_aspell_set_dict (buffer, NULL);
+ return WEECHAT_RC_OK;
+ }
}
- count = 0;
- ptr_input = input;
- weechat_aspell_plugin->input_color (weechat_aspell_plugin, 0, 0, 0);
- while (ptr_input && ptr_input[0])
- {
- pos_space = strchr (ptr_input, ' ');
- if (pos_space)
- pos_space[0] = '\0';
-
- if (ptr_input[0] != '/' && ptr_input[0] != '-' && ptr_input[0] != '#')
- {
- clword = weechat_aspell_clean_word (ptr_input, &offset);
- if (clword)
- {
- if ( (int) strlen (clword) >= aspell_plugin_options.word_size)
- {
- if (!weechat_aspell_is_url (clword))
- {
- if (!weechat_aspell_is_simili_number (clword))
- {
- if (!weechat_aspell_nick_in_channel (clword, server, channel))
- {
- if (aspell_speller_check (c->speller->speller, clword, -1) != 1)
- {
- if (count == 0)
- weechat_aspell_plugin->input_color (weechat_aspell_plugin, 0, 0, 0);
- weechat_aspell_plugin->input_color (weechat_aspell_plugin, aspell_plugin_options.color,
- ptr_input - input + offset, strlen (clword));
- count++;
- }
- }
- }
- }
- }
- free (clword);
- }
- }
-
- if (pos_space)
- {
- pos_space[0] = ' ';
- ptr_input = pos_space + 1;
- while (ptr_input[0] == ' ')
- ptr_input++;
- }
- else
- ptr_input = NULL;
- }
- weechat_aspell_plugin->input_color (weechat_aspell_plugin, -1, 0, 0);
-
- free (input);
-
- return PLUGIN_RC_OK;
+ return WEECHAT_RC_OK;
}
/*
- * weechat_plugin_init : init function, called when plugin is loaded
+ * weechat_plugin_init : init aspell plugin
*/
int
-weechat_plugin_init (t_weechat_plugin *plugin)
+weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- char help[1024];
- aspell_plugin_speller = NULL;
- aspell_plugin_config = NULL;
- weechat_aspell_plugin = plugin;
-
- snprintf (help, sizeof(help),
- " show : show plugin configuration\n"
- "dictlist : show installed dictionnaries\n"
- " save : save plugin configuration\n"
- " enable : enable aspell on current channel/server\n"
- " disable : disable aspell on current channel/server\n"
- "add-word : add a word in your personnal aspell dict\n"
- " dump : show plugins internals (usefull for debug)\n"
- " set : setting options\n"
- " OPTION := { word-size SIZE | toogle-check-mode | color COLOR }\n"
- " word-size : minimum size for a word to be checked (default : %d)\n"
- " toggle-check-mode : switch between a realtime or an asynchronous checking\n"
- " color : color of the mispelled words\n"
- "\n"
- " *NB : input line beginning with a '/' is not checked\n",
- _PLUGIN_OPTION_WORD_SIZE);
-
- weechat_aspell_plugin->cmd_handler_add (weechat_aspell_plugin, "aspell",
- "Aspell Plugin configuration",
- "{ show | save | dictlist | set [OPTION [VALUE]] | add-word WORD | enable LANG | disable | dump }",
- help,
- "show|dictlist|save|enable|disable|set|add-word|dump word-size|toggle-check-mode|color",
- &weechat_aspell_speller_command, NULL, NULL);
-
- weechat_aspell_plugin->keyboard_handler_add (
- weechat_aspell_plugin, &weechat_aspell_keyb_check, NULL, NULL);
-
- weechat_aspell_options_load ();
- weechat_aspell_config_load ();
-
- return PLUGIN_RC_OK;
+ /* make C compiler happy */
+ (void) argc;
+ (void) argv;
+
+ weechat_plugin = plugin;
+
+ if (!weechat_aspell_config_init ())
+ return WEECHAT_RC_ERROR;
+
+ if (weechat_aspell_config_read () < 0)
+ return WEECHAT_RC_ERROR;
+
+ /* callback for debug */
+ weechat_hook_signal ("debug", &weechat_aspell_debug_cb, NULL);
+
+ /* command /aspell */
+ weechat_hook_command ("aspell",
+ N_("aspell plugin configuration"),
+ N_("[list | enable lang | disable | addword [lang] "
+ "word]"),
+ N_(" list: show installed dictionnaries\n"
+ " enable: enable aspell on current buffer\n"
+ "disable: disable aspell on current buffer\n"
+ "addword: add a word in your personnal aspell dictionary\n"
+ "\n"
+ "Input line beginning with a '/' is not checked, "
+ "except for some commands."),
+ "list|enable|disable|addword",
+ &weechat_aspell_command_cb, NULL);
+
+ /* callback for buffer_switch */
+ weechat_hook_signal ("buffer_switch",
+ &weechat_aspell_buffer_switch_cb, NULL);
+
+ /* callback for spell checking input text */
+ weechat_hook_modifier ("weechat_input_text_display",
+ &weechat_aspell_modifier_cb, NULL);
+
+ weechat_aspell_create_spellers (weechat_current_buffer);
+
+ return WEECHAT_RC_OK;
}
/*
- * weechat_plugin_end : end function, called when plugin is unloaded
+ * weechat_plugin_end : end aspell plugin
*/
-void
-weechat_plugin_end (t_weechat_plugin *p)
+int
+weechat_plugin_end (struct t_weechat_plugin *plugin)
{
- aspell_speller_t *s, *t;
- aspell_config_t *c, *d;
-
/* make C compiler happy */
- (void) p;
+ (void) plugin;
- weechat_aspell_options_save ();
- weechat_aspell_config_save ();
-
- /* freeing memory */
+ weechat_aspell_config_write ();
- /* options */
- if (aspell_plugin_options.color_name)
- free (aspell_plugin_options.color_name);
-
- /* spellers */
- s = aspell_plugin_speller;
- while ( s != NULL)
- {
- t = s;
- s = s->next_speller;
- weechat_aspell_free_speller (t);
- }
+ weechat_aspell_speller_free_all ();
- /* config */
- c = aspell_plugin_config;
- while ( c != NULL)
- {
- d = c;
- c = c->next_config;
- weechat_aspell_free_config (c);
- }
+ if (aspell_last_modifier_string)
+ free (aspell_last_modifier_string);
+ if (aspell_last_modifier_result)
+ free (aspell_last_modifier_result);
+
+ weechat_aspell_config_free ();
+
+ return WEECHAT_RC_OK;
}
diff --git a/src/plugins/aspell/aspell.h b/src/plugins/aspell/aspell.h
index 71d528960..42dc2217b 100644
--- a/src/plugins/aspell/aspell.h
+++ b/src/plugins/aspell/aspell.h
@@ -16,180 +16,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* weechat-aspell.h: Aspell plugin support for WeeChat */
#ifndef __WEECHAT_ASPELL_H
#define __WEECHAT_ASPELL_H 1
#include <aspell.h>
-#define _PLUGIN_OPTION_WORD_SIZE 2
-#define _PLUGIN_OPTION_CHECK_SYNC 0
-#define _PLUGIN_OPTION_COLOR "red"
+#define weechat_plugin weechat_aspell_plugin
+#define ASPELL_PLUGIN_NAME "aspell"
-typedef struct aspell_speller_t
-{
- AspellSpeller *speller;
- char *lang;
- int refs;
-
- struct aspell_speller_t *prev_speller;
- struct aspell_speller_t *next_speller;
-} aspell_speller_t;
-
-typedef struct aspell_config_t
-{
- char *server;
- char *channel;
- aspell_speller_t *speller;
-
- struct aspell_config_t *prev_config;
- struct aspell_config_t *next_config;
-} aspell_config_t;
-
-typedef struct aspell_options_t
-{
- int word_size;
- int check_sync;
- int color;
- char *color_name;
-} aspell_options_t;
-
-typedef struct iso_langs_t
+struct t_aspell_code
{
char *code;
char *name;
-} iso_langs_t;
-
-typedef struct iso_countries_t
-{
- char *code;
- char *name;
-} iso_countries_t;
+};
-typedef struct cmds_keep_t
-{
- char *cmd;
- int len;
-} cmds_keep_t;
+extern int aspell_debug;
-/* aspell supported langs 2006-05-27 */
-iso_langs_t langs_avail[] =
-{
- { "af", "Afrikaans"},
- { "am", "Amharic"},
- { "az", "Azerbaijani"},
- { "be", "Belarusian"},
- { "bg", "Bulgarian"},
- { "bn", "Bengali"},
- { "br", "Breton"},
- { "ca", "Catalan"},
- { "cs", "Czech"},
- { "csb", "Kashubian"},
- { "cy", "Welsh"},
- { "da", "Danish"},
- { "de", "German"},
- { "el", "Greek Modern"},
- { "en", "English"},
- { "eo", "Esperanto"},
- { "es", "Spanish"},
- { "et", "Estonian"},
- { "fa", "Persian"},
- { "fi", "Finnish"},
- { "fo", "Faroese"},
- { "fr", "French"},
- { "ga", "Irish"},
- { "gd", "Gaelic"},
- { "gl", "Galician"},
- { "gu", "Gujarati"},
- { "gv", "Manx"},
- { "he", "Hebrew"},
- { "hi", "Hiligaynon"},
- { "hr", "Croatian"},
- { "hsb", "Upper Sorbian"},
- { "hu", "Hungarian"},
- { "ia", "Interlingua"},
- { "id", "Indonesian"},
- { "is", "Icelandic"},
- { "it", "Italian"},
- { "ku", "Kurdish"},
- { "la", "Latin"},
- { "lt", "Lithuanian"},
- { "lv", "Latvian"},
- { "mg", "Malagasy"},
- { "mi", "Maori"},
- { "mk", "Macedonian"},
- { "mn", "Mongolian"},
- { "mr", "Marathi"},
- { "ms", "Malay"},
- { "mt", "Maltese"},
- { "nb", "Norwegian Bokmal"},
- { "nds", "Saxon Low"},
- { "nl", "Flemish"},
- { "nn", "Norwegian Nynorsk"},
- { "no", "Norwegian"},
- { "ny", "Nyanja"},
- { "or", "Oriya"},
- { "pa", "Panjabi"},
- { "pl", "Polish"},
- { "pt", "Portuguese"},
- { "qu", "Quechua"},
- { "ro", "Romanian"},
- { "ru", "Russian"},
- { "rw", "Kinyarwanda"},
- { "sc", "Sardinian"},
- { "sk", "Slovak"},
- { "sl", "Slovenian"},
- { "sr", "Serbian"},
- { "sv", "Swedish"},
- { "sw", "Swahili"},
- { "ta", "Tamil"},
- { "te", "Telugu"},
- { "tet", "Tetum"},
- { "tl", "Tagalog"},
- { "tn", "Tswana"},
- { "tr", "Turkish"},
- { "uk", "Ukrainian"},
- { "uz", "Uzbek"},
- { "vi", "Vietnamese"},
- { "wa", "Walloon"},
- { "yi", "Yiddish"},
- { "zu", "Zulu"},
- { NULL, NULL}
-};
+extern struct t_weechat_plugin *weechat_aspell_plugin;
-iso_countries_t countries_avail[] =
-{
- { "AT", "Austria" },
- { "BR", "Brazil" },
- { "CA", "Canada" },
- { "CH", "Switzerland" },
- { "DE", "Germany" },
- { "FR", "France" },
- { "GB", "Great Britain" },
- { "PT", "Portugal" },
- { "SK", "Slovakia" },
- { "US", "United States of America" },
- { NULL, NULL}
-};
+extern struct t_aspell_code langs_avail[];
+extern struct t_aspell_code countries_avail[];
-/* internal or irc commands to be use with spellchecking */
-cmds_keep_t cmd_tokeep[] =
-{
- { "/builtin ", 9 },
- { "/ame " , 5 },
- { "/amsg " , 6 },
- { "/away " , 6 },
- { "/cycle " , 7 },
- { "/kick " , 6 },
- { "/kickban " , 9 },
- { "/me " , 4 },
- { "/notice " , 8 },
- { "/part " , 6 },
- { "/query " , 7 },
- { "/quit " , 6 },
- { "/topic " , 7 },
- { NULL, 0}
-};
+extern void weechat_aspell_create_spellers (struct t_gui_buffer *buffer);
#endif /* aspell.h */
diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c
index b76d1dc5e..d124d6d10 100644
--- a/src/plugins/charset/charset.c
+++ b/src/plugins/charset/charset.c
@@ -354,7 +354,7 @@ charset_decode_cb (void *data, const char *modifier, const char *modifier_data,
{
weechat_printf (NULL,
"charset: debug: using 'decode' charset: %s "
- "(modifier='%s', modifier_data='%s', string='%s')",
+ "(modifier=\"%s\", modifier_data=\"%s\", string=\"%s\")",
charset, modifier, modifier_data, string);
}
if (charset && charset[0])
@@ -383,7 +383,7 @@ charset_encode_cb (void *data, const char *modifier, const char *modifier_data,
{
weechat_printf (NULL,
"charset: debug: using 'encode' charset: %s "
- "(modifier='%s', modifier_data='%s', string='%s')",
+ "(modifier=\"%s\", modifier_data=\"%s\", string=\"%s\")",
charset, modifier, modifier_data, string);
}
if (charset && charset[0])
@@ -407,11 +407,11 @@ charset_set (struct t_config_section *section, const char *type,
value) > 0)
{
if (value && value[0])
- weechat_printf (NULL, _("Charset: %s, %s => %s"),
- type, name, value);
+ weechat_printf (NULL, "%s: %s, %s => %s",
+ CHARSET_PLUGIN_NAME, type, name, value);
else
- weechat_printf (NULL, _("Charset: %s, %s: removed"),
- type, name);
+ weechat_printf (NULL, _("%s: %s, %s: removed"),
+ CHARSET_PLUGIN_NAME, type, name);
}
}
diff --git a/src/plugins/demo/demo.c b/src/plugins/demo/demo.c
index 08c4dc5fd..bedb096f9 100644
--- a/src/plugins/demo/demo.c
+++ b/src/plugins/demo/demo.c
@@ -87,7 +87,7 @@ demo_printf_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (argc > 1)
weechat_printf (buffer,
- "demo_printf: '%s'", argv_eol[1]);
+ "demo_printf: \"%s\"", argv_eol[1]);
else
{
weechat_printf (buffer,
@@ -121,7 +121,7 @@ demo_buffer_input_data_cb (void *data, struct t_gui_buffer *buffer,
weechat_printf (buffer,
"buffer_input_data_cb: buffer = %x (%s), "
- "input_data = '%s'",
+ "input_data = \"%s\"",
buffer,
weechat_buffer_get_string (buffer, "name"),
input_data);
@@ -372,7 +372,7 @@ demo_signal_cb (void *data, const char *signal, const char *type_data,
{
weechat_printf (NULL,
_("demo_signal: signal: %s, type_data: %s, "
- "signal_data: '%s'"),
+ "signal_data: \"%s\""),
signal, type_data, (char *)signal_data);
}
else if (strcmp (type_data, WEECHAT_HOOK_SIGNAL_INT) == 0)
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 7d6d7b987..e89865ed1 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -2795,7 +2795,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
{
weechat_printf (NULL, "");
weechat_printf (NULL,
- _("Servers with '%s':"),
+ _("Servers with \"%s\":"),
server_name);
}
one_server_found = 1;
diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c
index 22d827436..d69b05edf 100644
--- a/src/plugins/irc/irc-ignore.c
+++ b/src/plugins/irc/irc-ignore.c
@@ -230,9 +230,9 @@ irc_ignore_free (struct t_irc_ignore *ignore)
/* remove filter from filters list */
if (ignore->prev_ignore)
- ignore->prev_ignore->next_ignore = ignore->next_ignore;
+ (ignore->prev_ignore)->next_ignore = ignore->next_ignore;
if (ignore->next_ignore)
- ignore->next_ignore->prev_ignore = ignore->prev_ignore;
+ (ignore->next_ignore)->prev_ignore = ignore->prev_ignore;
if (irc_ignore_list == ignore)
irc_ignore_list = ignore->next_ignore;
if (last_irc_ignore == ignore)
diff --git a/src/plugins/logger/logger-config.h b/src/plugins/logger/logger-config.h
index e789e7f7a..c2c1d6fa1 100644
--- a/src/plugins/logger/logger-config.h
+++ b/src/plugins/logger/logger-config.h
@@ -23,8 +23,6 @@
#define LOGGER_CONFIG_NAME "logger"
-extern struct t_config_file *logger_config_file;
-
extern struct t_config_option *logger_config_look_backlog;
extern struct t_config_option *logger_config_file_auto_log;
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index 71211a702..7a880d97a 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -179,7 +179,7 @@ script_ptr2str (void *pointer)
if (!pointer)
return strdup ("");
- snprintf (pointer_str, sizeof (pointer_str) - 1,
+ snprintf (pointer_str, sizeof (pointer_str),
"0x%x", (unsigned int)pointer);
return strdup (pointer_str);