Plugins: Added on_chat_win_focus

This commit is contained in:
James Booth
2016-04-07 22:06:14 +01:00
parent bfdc3b8807
commit 271278dd20
7 changed files with 59 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ python_plugin_create(const char *const filename)
plugin->on_iq_stanza_receive = python_on_iq_stanza_receive_hook;
plugin->on_contact_offline = python_on_contact_offline_hook;
plugin->on_contact_presence = python_on_contact_presence_hook;
plugin->on_chat_win_focus = python_on_chat_win_focus_hook;
g_free(module_name);
allow_python_threads();
@@ -818,6 +819,27 @@ python_on_contact_presence_hook(ProfPlugin *plugin, const char *const barejid, c
allow_python_threads();
}
void
python_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid)
{
disable_python_threads();
PyObject *p_args = Py_BuildValue("(s)", barejid);
PyObject *p_function;
PyObject *p_module = plugin->module;
if (PyObject_HasAttrString(p_module, "prof_on_chat_win_focus")) {
p_function = PyObject_GetAttrString(p_module, "prof_on_chat_win_focus");
python_check_error();
if (p_function && PyCallable_Check(p_function)) {
PyObject_CallObject(p_function, p_args);
python_check_error();
Py_XDECREF(p_function);
}
}
allow_python_threads();
}
void
python_check_error(void)
{