mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
core: add function "hook_set" in plugin API, add "subplugin" in hooks (set by script plugins), display subplugin in /help on commands (task #12049)
This commit is contained in:
committed by
Sebastien Helleu
parent
92aa9bff45
commit
c03fcd5e12
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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() \
|
||||
|
||||
Reference in New Issue
Block a user