summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-06-04 20:56:05 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-06-04 20:56:05 +0200
commit917b2ddf69459ed3d7d81c31e765f80939945041 (patch)
treedec420eddea3102a76c20c39f66717122a045b32 /src
parentc4a482e067f2a7664ed7a262e6f490f473fb48f7 (diff)
downloadweechat-917b2ddf69459ed3d7d81c31e765f80939945041.zip
spell: add a warning if aspell.conf is still present (on first spell load)
Diffstat (limited to 'src')
-rw-r--r--src/plugins/spell/spell.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/plugins/spell/spell.c b/src/plugins/spell/spell.c
index b39e5ce54..dd3597110 100644
--- a/src/plugins/spell/spell.c
+++ b/src/plugins/spell/spell.c
@@ -25,6 +25,7 @@
#include "config.h"
#endif
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -182,6 +183,45 @@ char *spell_url_prefix[] =
/*
+ * Displays a warning if the file aspell.conf is still present in WeeChat
+ * home directory and spell.conf not yet created (upgrade from a version ≤ 2.4
+ * to a version ≥ 2.5).
+ */
+
+void
+spell_warning_aspell_config ()
+{
+ char *aspell_filename, *spell_filename;
+
+ aspell_filename = weechat_string_eval_path_home (
+ "%h/aspell.conf", NULL, NULL, NULL);
+ spell_filename = weechat_string_eval_path_home (
+ "%h/" SPELL_CONFIG_NAME ".conf", NULL, NULL, NULL);
+
+ /* if aspell.conf is there and not spell.conf, display a warning */
+ if (aspell_filename && spell_filename
+ && (access (aspell_filename, F_OK) == 0)
+ && (access (spell_filename, F_OK) != 0))
+ {
+ weechat_printf (NULL,
+ _("%s%s: warning: the plugin \"aspell\" has been "
+ "renamed to \"spell\" and the file %s still exists "
+ "(but not %s); if you upgraded from an older "
+ "version, you should check instructions in release "
+ "notes (version 2.5) to recover your settings"),
+ weechat_prefix ("error"),
+ SPELL_PLUGIN_NAME,
+ aspell_filename,
+ spell_filename);
+ }
+
+ if (aspell_filename)
+ free (aspell_filename);
+ if (spell_filename)
+ free (spell_filename);
+}
+
+/*
* Builds full name of buffer.
*
* Note: result must be freed after use.
@@ -1088,6 +1128,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_plugin = plugin;
+ spell_warning_aspell_config ();
+
#ifdef USE_ENCHANT
/* acquire enchant broker */
broker = enchant_broker_init ();