diff options
-rw-r--r-- | src/plugins/plugin-api.c | 12 | ||||
-rw-r--r-- | src/plugins/plugin-api.h | 2 | ||||
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 4 |
4 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 968cf0dc7..0e5386f1d 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -1382,6 +1382,18 @@ plugin_api_hook_signal (struct t_weechat_plugin *plugin, char *signal, } /* + * plugin_api_hook_signal_send: send a signal + */ + +void +plugin_api_hook_signal_send (struct t_weechat_plugin *plugin, char *signal, + void *pointer) +{ + if (plugin && signal && signal[0]) + hook_signal_exec (signal, pointer); +} + +/* * plugin_api_hook_config: hook a config option */ diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h index 39b2a7748..d4e8c4777 100644 --- a/src/plugins/plugin-api.h +++ b/src/plugins/plugin-api.h @@ -159,6 +159,8 @@ extern struct t_hook *plugin_api_hook_print (struct t_weechat_plugin *, extern struct t_hook *plugin_api_hook_signal (struct t_weechat_plugin *, char *, int (*)(void *, char *, void *), void *); +extern void plugin_api_hook_signal_send (struct t_weechat_plugin *, char *, + void *); extern struct t_hook *plugin_api_hook_config (struct t_weechat_plugin *, char *, char *, int (*)(void *, char *, char *, char *), diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index b231b6e24..9ad3cce15 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -304,6 +304,7 @@ plugin_load (char *filename) new_plugin->hook_fd = &plugin_api_hook_fd; new_plugin->hook_print = &plugin_api_hook_print; new_plugin->hook_signal = &plugin_api_hook_signal; + new_plugin->hook_signal_send = &plugin_api_hook_signal_send; new_plugin->hook_config = &plugin_api_hook_config; new_plugin->hook_completion = &plugin_api_hook_completion; new_plugin->unhook = &plugin_api_unhook; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 81117665c..e73755310 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -170,6 +170,7 @@ struct t_weechat_plugin void *); struct t_hook *(*hook_signal) (struct t_weechat_plugin *, char *, int (*)(void *, char *, void *), void *); + void (*hook_signal_send) (struct t_weechat_plugin *, char *, void *); struct t_hook *(*hook_config) (struct t_weechat_plugin *, char *, char *, int (*)(void *, char *, char *, char *), void *); @@ -421,6 +422,9 @@ struct t_weechat_plugin #define weechat_hook_signal(__signal, __callback, __data) \ weechat_plugin->hook_signal(weechat_plugin, __signal, __callback, \ __data) +#define weechat_hook_signal_send(__signal, __pointer) \ + weechat_plugin->hook_signal_send(weechat_plugin, __signal, \ + __pointer) #define weechat_hook_config(__type, __option, __callback, __data) \ weechat_plugin->hook_config(weechat_plugin, __type, __option, \ __callback, __data) |