mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:05:42 +02:00
Add new functions in plugin API: hook_hsignal and hook_hsignal_send
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1045,6 +1045,43 @@ script_api_hook_signal (struct t_weechat_plugin *weechat_plugin,
|
||||
return new_hook;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_hook_hsignal: hook a hsignal
|
||||
* return new hook, NULL if error
|
||||
*/
|
||||
|
||||
struct t_hook *
|
||||
script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data, const char *signal,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data)
|
||||
{
|
||||
struct t_script_callback *new_script_callback;
|
||||
struct t_hook *new_hook;
|
||||
|
||||
new_script_callback = script_callback_alloc ();
|
||||
if (!new_script_callback)
|
||||
return NULL;
|
||||
|
||||
new_hook = weechat_hook_hsignal (signal, callback, new_script_callback);
|
||||
if (!new_hook)
|
||||
{
|
||||
script_callback_free_data (new_script_callback);
|
||||
free (new_script_callback);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
script_callback_init (new_script_callback, script, function, data);
|
||||
new_script_callback->hook = new_hook;
|
||||
|
||||
script_callback_add (script, new_script_callback);
|
||||
|
||||
return new_hook;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_hook_config: hook a config option
|
||||
* return new hook, NULL if error
|
||||
|
||||
@@ -206,6 +206,14 @@ extern struct t_hook *script_api_hook_signal (struct t_weechat_plugin *weechat_p
|
||||
void *signal_data),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *signal,
|
||||
int (*callback)(void *data,
|
||||
const char *signal,
|
||||
struct t_hashtable *hashtable),
|
||||
const char *function,
|
||||
const char *data);
|
||||
extern struct t_hook *script_api_hook_config (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
const char *option,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user