Add pre chat and room message blocking

This commit is contained in:
James Booth
2017-01-22 18:08:29 +00:00
parent 7090f85d85
commit 83385cdbc0
9 changed files with 85 additions and 21 deletions

View File

@@ -125,6 +125,7 @@ python_plugin_create(const char *const filename)
plugin->lang = LANG_PYTHON;
plugin->module = p_module;
plugin->init_func = python_init_hook;
plugin->contains_hook = python_contains_hook;
plugin->on_start_func = python_on_start_hook;
plugin->on_shutdown_func = python_on_shutdown_hook;
plugin->on_unload_func = python_on_unload_hook;
@@ -184,6 +185,22 @@ python_init_hook(ProfPlugin *plugin, const char *const version, const char *cons
allow_python_threads();
}
gboolean
python_contains_hook(ProfPlugin *plugin, const char *const hook)
{
disable_python_threads();
gboolean res = FALSE;
PyObject *p_module = plugin->module;
if (PyObject_HasAttrString(p_module, hook)) {
res = TRUE;
}
allow_python_threads();
return res;
}
void
python_on_start_hook(ProfPlugin *plugin)
{