From 9a01e01e05d716a1474e4619b6ffabe8d3a4ffeb Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 19 Sep 2013 23:58:14 +0100 Subject: [PATCH] Added before message displayed hook to c plugins --- src/plugins/c_plugins.c | 15 +++++++++++++++ src/plugins/c_plugins.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/plugins/c_plugins.c b/src/plugins/c_plugins.c index 30cc2464..efa8cbb3 100644 --- a/src/plugins/c_plugins.c +++ b/src/plugins/c_plugins.c @@ -51,6 +51,7 @@ c_plugin_create(const char * const filename) plugin->on_start_func = c_on_start_hook; plugin->on_connect_func = c_on_connect_hook; plugin->on_disconnect_func = c_on_disconnect_hook; + plugin->before_message_displayed_func = c_before_message_displayed_hook; plugin->on_message_received_func = c_on_message_received_hook; plugin->on_room_message_received_func = c_on_room_message_received_hook; plugin->on_private_message_received_func = c_on_private_message_received_hook; @@ -126,6 +127,20 @@ c_on_disconnect_hook(ProfPlugin *plugin, const char * const account_name, const func (account_name, fulljid); } +char * +c_before_message_displayed_hook(ProfPlugin *plugin, const char *message) +{ + void * f = NULL; + char* (*func)(const char * __message); + assert (plugin && plugin->module); + + if (NULL == (f = dlsym (plugin->module, "prof_before_message_displayed"))) + return NULL; + + func = (char* (*)(const char * const)) f; + return func (message); +} + char * c_on_message_received_hook(ProfPlugin *plugin, const char * const jid, const char *message) { diff --git a/src/plugins/c_plugins.h b/src/plugins/c_plugins.h index bffbcb4a..d026ad5b 100644 --- a/src/plugins/c_plugins.h +++ b/src/plugins/c_plugins.h @@ -11,6 +11,7 @@ void c_init_hook(ProfPlugin *plugin, const char * const version, const char * co void c_on_start_hook(ProfPlugin *plugin); void c_on_connect_hook(ProfPlugin *plugin, const char * const account_name, const char * const fulljid); void c_on_disconnect_hook(ProfPlugin *plugin, const char * const account_name, const char * const fulljid); +char * c_before_message_displayed_hook(ProfPlugin *plugin, const char *message); char * c_on_message_received_hook(ProfPlugin *plugin, const char * const jid, const char *message); char * c_on_private_message_received_hook(ProfPlugin *plugin, const char * const room, const char * const nick, const char *message);