1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added before message displayed hook to c plugins

This commit is contained in:
James Booth 2013-09-19 23:58:14 +01:00
parent 6caa57aa0c
commit 9a01e01e05
2 changed files with 16 additions and 0 deletions

View File

@ -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)
{

View File

@ -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);