From 448112f3e62b34693e1106f48c7b638468b42675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 2 Jul 2017 12:57:55 +0200 Subject: [PATCH] fset: hook signal "debug_dump" --- src/plugins/fset/fset.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/plugins/fset/fset.c b/src/plugins/fset/fset.c index e7045921f..404dc8ce9 100644 --- a/src/plugins/fset/fset.c +++ b/src/plugins/fset/fset.c @@ -50,6 +50,38 @@ struct t_hdata *fset_hdata_config_option = NULL; struct t_hdata *fset_hdata_fset_option = NULL; +/* + * Callback for signal "debug_dump". + */ + +int +fset_debug_dump_cb (const void *pointer, void *data, + const char *signal, const char *type_data, + void *signal_data) +{ + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) signal; + (void) type_data; + + if (!signal_data + || (weechat_strcasecmp ((char *)signal_data, FSET_PLUGIN_NAME) == 0)) + { + weechat_log_printf (""); + weechat_log_printf ("***** \"%s\" plugin dump *****", + weechat_plugin->name); + + fset_option_print_log (); + + weechat_log_printf (""); + weechat_log_printf ("***** End of \"%s\" plugin dump *****", + weechat_plugin->name); + } + + return WEECHAT_RC_OK; +} + /* * Adds the fset bar. */ @@ -108,6 +140,8 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) fset_hdata_fset_option = weechat_hdata_get ("fset_option"); + /* hook some signals */ + weechat_hook_signal ("debug_dump", &fset_debug_dump_cb, NULL, NULL); weechat_hook_signal ("window_scrolled", &fset_buffer_window_scrolled_cb, NULL, NULL);