Plugins: Added on_room_history_message
This commit is contained in:
@@ -111,6 +111,7 @@ python_plugin_create(const char *const filename)
|
||||
plugin->post_room_message_display = python_post_room_message_display_hook;
|
||||
plugin->pre_room_message_send = python_pre_room_message_send_hook;
|
||||
plugin->post_room_message_send = python_post_room_message_send_hook;
|
||||
plugin->on_room_history_message = python_on_room_history_message_hook;
|
||||
plugin->pre_priv_message_display = python_pre_priv_message_display_hook;
|
||||
plugin->post_priv_message_display = python_post_priv_message_display_hook;
|
||||
plugin->pre_priv_message_send = python_pre_priv_message_send_hook;
|
||||
@@ -463,6 +464,28 @@ python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, c
|
||||
allow_python_threads();
|
||||
}
|
||||
|
||||
void
|
||||
python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick,
|
||||
const char *const message, const char *const timestamp)
|
||||
{
|
||||
disable_python_threads();
|
||||
PyObject *p_args = Py_BuildValue("ssss", room, nick, message, timestamp);
|
||||
PyObject *p_function;
|
||||
|
||||
PyObject *p_module = plugin->module;
|
||||
if (PyObject_HasAttrString(p_module, "prof_on_room_history_message")) {
|
||||
p_function = PyObject_GetAttrString(p_module, "prof_on_room_history_message");
|
||||
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();
|
||||
}
|
||||
|
||||
char*
|
||||
python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room, const char *const nick,
|
||||
const char *message)
|
||||
|
||||
Reference in New Issue
Block a user