Added logging of chat messages in the plugin API.

This commit is contained in:
Jan Vidar Krey
2010-08-11 18:44:02 +02:00
parent 5419d07efe
commit 4c960cb977
4 changed files with 89 additions and 80 deletions

View File

@@ -63,15 +63,10 @@
}); \
return status
#define PLUGIN_INVOKE_1(HUB, FUNCNAME, ARG1) \
INVOKE(HUB, FUNCNAME, { \
plugin->funcs.FUNCNAME(plugin, ARG1); \
})
#define PLUGIN_INVOKE_1(HUB, FUNCNAME, ARG1) INVOKE(HUB, FUNCNAME, { plugin->funcs.FUNCNAME(plugin, ARG1); })
#define PLUGIN_INVOKE_2(HUB, FUNCNAME, ARG1, ARG2) INVOKE(HUB, FUNCNAME, { plugin->funcs.FUNCNAME(plugin, ARG1, ARG2); })
#define PLUGIN_INVOKE_3(HUB, FUNCNAME, ARG1, ARG2, ARG3) INVOKE(HUB, FUNCNAME, { plugin->funcs.FUNCNAME(plugin, ARG1, ARG2, ARG3); })
#define PLUGIN_INVOKE_2(HUB, FUNCNAME, ARG1, ARG2) \
INVOKE(HUB, FUNCNAME, { \
plugin->funcs.FUNCNAME(plugin, ARG1, ARG2); \
})
static void convert_user_type(struct plugin_user* puser, struct hub_user* user)
{
@@ -138,7 +133,14 @@ void plugin_log_user_update_error(struct hub_info* hub, struct hub_user* who, co
struct plugin_user user;
convert_user_type(&user, who);
PLUGIN_INVOKE_2(hub, on_user_update_error, &user, reason);
}
}
void plugin_log_chat_message(struct hub_info* hub, struct hub_user* who, const char* message, int flags)
{
struct plugin_user user;
convert_user_type(&user, who);
PLUGIN_INVOKE_3(hub, on_user_chat_message, &user, message, flags);
}
plugin_st plugin_handle_chat_message(struct hub_info* hub, struct hub_user* from, const char* message, int flags)
{