summaryrefslogtreecommitdiff
path: root/src/plugins/buflist
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-06-05 14:56:14 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-06-05 14:56:14 +0200
commitfa3a4355ce111aecc5ed668d02cb40c5a52cc8d8 (patch)
tree468bed5d27a36e0e74cf1e991f0a2c7d0b0e7612 /src/plugins/buflist
parent4947ed6d31e9d582975fa011531bf15eb0252e3c (diff)
downloadweechat-fa3a4355ce111aecc5ed668d02cb40c5a52cc8d8.zip
buflist: display a warning when the script "buffers.pl" is loaded
Diffstat (limited to 'src/plugins/buflist')
-rw-r--r--src/plugins/buflist/buflist.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c
index 8db714018..42ff7c687 100644
--- a/src/plugins/buflist/buflist.c
+++ b/src/plugins/buflist/buflist.c
@@ -351,6 +351,44 @@ buflist_sort_buffers ()
}
/*
+ * Callback called when a Perl script is loaded: if the script is buffers.pl,
+ * then we display a warning.
+ */
+
+int
+buflist_script_loaded_cb (const void *pointer, void *data, const char *signal,
+ const char *type_data, void *signal_data)
+{
+ int length;
+
+ /* make C compiler happy */
+ (void) pointer;
+ (void) data;
+ (void) signal;
+ (void) type_data;
+
+ if (!signal_data)
+ return WEECHAT_RC_OK;
+
+ length = strlen (signal_data);
+ if ((length >= 10)
+ && (strncmp (signal_data + length - 10, "buffers.pl", 10) == 0))
+ {
+ weechat_printf (NULL,
+ _("%sbuflist: warning: the script buffers.pl is "
+ "loaded and provides a bar with list of buffers "
+ "similar to the buflist plugin; you may want to "
+ "uninstall the script buffers.pl "
+ "(/script remove buffers.pl) or disable/unload the "
+ "buflist plugin; see WeeChat release notes for more "
+ "information"),
+ weechat_prefix ("error"));
+ }
+
+ return WEECHAT_RC_OK;
+}
+
+/*
* Initializes buflist plugin.
*/
@@ -420,9 +458,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hashtable_set (keys, "__quiet", "1");
weechat_key_bind ("mouse", keys);
}
-
weechat_hashtable_free (keys);
+ weechat_hook_signal ("perl_script_loaded",
+ &buflist_script_loaded_cb, NULL, NULL);
+
return WEECHAT_RC_OK;
}