diff options
author | Peter Boström <pbos@kth.se> | 2012-07-09 15:16:51 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-07-09 15:16:51 +0200 |
commit | c03fcd5e120de5a29d18d1cc31af8a8d58c95e95 (patch) | |
tree | a25fab15c6f5db1f40e067d67b2e8e769cea14b0 /src/plugins | |
parent | 92aa9bff4588068974857d175490c39f77cfec6f (diff) | |
download | weechat-c03fcd5e120de5a29d18d1cc31af8a8d58c95e95.zip |
core: add function "hook_set" in plugin API, add "subplugin" in hooks (set by script plugins), display subplugin in /help on commands (task #12049)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/script-api.c | 16 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 6 |
3 files changed, 22 insertions, 1 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index d920f03b6..97bbe94b9 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -654,6 +654,7 @@ plugin_load (const char *filename, int argc, char **argv) new_plugin->hook_infolist = &hook_infolist; new_plugin->hook_hdata = &hook_hdata; new_plugin->hook_focus = &hook_focus; + new_plugin->hook_set = &hook_set; new_plugin->unhook = &unhook; new_plugin->unhook_all = &unhook_all_plugin; diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c index ba17d3f14..a54940960 100644 --- a/src/plugins/scripts/script-api.c +++ b/src/plugins/scripts/script-api.c @@ -734,6 +734,7 @@ script_api_hook_command (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -773,6 +774,7 @@ script_api_hook_command_run (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -811,6 +813,7 @@ script_api_hook_timer (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -849,6 +852,7 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -895,6 +899,7 @@ script_api_hook_process_hashtable (struct t_weechat_plugin *weechat_plugin, script_callback_remove (script, new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); new_script_callback->hook = new_hook; @@ -961,6 +966,7 @@ script_api_hook_connect (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1005,6 +1011,7 @@ script_api_hook_print (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1043,6 +1050,7 @@ script_api_hook_signal (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1080,6 +1088,7 @@ script_api_hook_hsignal (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1117,6 +1126,7 @@ script_api_hook_config (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1158,6 +1168,7 @@ script_api_hook_completion (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1196,6 +1207,7 @@ script_api_hook_modifier (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1237,6 +1249,7 @@ script_api_hook_info (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1281,6 +1294,7 @@ script_api_hook_info_hashtable (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1325,6 +1339,7 @@ script_api_hook_infolist (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; @@ -1362,6 +1377,7 @@ script_api_hook_focus (struct t_weechat_plugin *weechat_plugin, free (new_script_callback); return NULL; } + weechat_hook_set (new_hook, "subplugin", script->name); script_callback_init (new_script_callback, script, function, data); new_script_callback->hook = new_hook; diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 35ac07f63..15666c571 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -46,7 +46,7 @@ struct timeval; */ /* API version (used to check that plugin has same API and can be loaded) */ -#define WEECHAT_PLUGIN_API_VERSION "20120323-01" +#define WEECHAT_PLUGIN_API_VERSION "20120709-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -647,6 +647,8 @@ struct t_weechat_plugin struct t_hashtable *(*callback)(void *data, struct t_hashtable *info), void *callback_data); + void (*hook_set) (struct t_hook *hook, const char *property, + const char *value); void (*unhook) (struct t_hook *hook); void (*unhook_all) (struct t_weechat_plugin *plugin); @@ -1381,6 +1383,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); #define weechat_hook_focus(__area, __callback, __data) \ weechat_plugin->hook_focus(weechat_plugin, __area, __callback, \ __data) +#define weechat_hook_set(__hook, __property, __value) \ + weechat_plugin->hook_set(__hook, __property, __value) #define weechat_unhook(__hook) \ weechat_plugin->unhook( __hook) #define weechat_unhook_all() \ |