Simplified plugin initialization by using a macro.
This commit is contained in:
@@ -202,12 +202,7 @@ static plugin_st delete_user(struct plugin_handle* plugin, struct auth_info* use
|
||||
|
||||
int plugin_register(struct plugin_handle* plugin, const char* config)
|
||||
{
|
||||
plugin->name = "File authentication plugin";
|
||||
plugin->version = "0.1";
|
||||
plugin->description = "Authenticate users based on a read-only text file.";
|
||||
plugin->plugin_api_version = PLUGIN_API_VERSION;
|
||||
plugin->plugin_funcs_size = sizeof(struct plugin_funcs);
|
||||
memset(&plugin->funcs, 0, sizeof(struct plugin_funcs));
|
||||
PLUGIN_INITIALIZE(plugin, "File authentication plugin", "0.1", "Authenticate users based on a read-only text file.");
|
||||
|
||||
// Authentication actions.
|
||||
plugin->funcs.auth_get_user = get_user;
|
||||
|
||||
@@ -174,12 +174,7 @@ static plugin_st delete_user(struct plugin_handle* plugin, struct auth_info* use
|
||||
|
||||
int plugin_register(struct plugin_handle* plugin, const char* config)
|
||||
{
|
||||
plugin->name = "SQLite authentication plugin";
|
||||
plugin->version = "0.1";
|
||||
plugin->description = "Authenticate users based on a SQLite database.";
|
||||
plugin->plugin_api_version = PLUGIN_API_VERSION;
|
||||
plugin->plugin_funcs_size = sizeof(struct plugin_funcs);
|
||||
memset(&plugin->funcs, 0, sizeof(struct plugin_funcs));
|
||||
PLUGIN_INITIALIZE(plugin, "SQLite authentication plugin", "0.1", "Authenticate users based on a SQLite database.");
|
||||
|
||||
// Authentication actions.
|
||||
plugin->funcs.auth_get_user = get_user;
|
||||
|
||||
@@ -6,22 +6,13 @@
|
||||
|
||||
int plugin_register(struct plugin_handle* plugin, const char* config)
|
||||
{
|
||||
plugin->name = "Example plugin";
|
||||
plugin->version = "1.0";
|
||||
plugin->description = "A simple example plugin";
|
||||
plugin->ptr = NULL;
|
||||
plugin->plugin_api_version = PLUGIN_API_VERSION;
|
||||
plugin->plugin_funcs_size = sizeof(struct plugin_funcs);
|
||||
memset(&plugin->funcs, 0, sizeof(struct plugin_funcs));
|
||||
|
||||
puts("plugin register");
|
||||
PLUGIN_INITIALIZE(plugin, "Example plugin", "1.0", "A simple example plugin");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int plugin_unregister(struct plugin_handle* plugin)
|
||||
{
|
||||
/* No need to do anything! */
|
||||
puts("plugin unregister");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,13 +94,7 @@ static void log_change_nick(struct plugin_handle* plugin, struct plugin_user* us
|
||||
|
||||
int plugin_register(struct plugin_handle* plugin, const char* config)
|
||||
{
|
||||
plugin->name = "Logging plugin";
|
||||
plugin->version = "1.0";
|
||||
plugin->description = "Logs users entering and leaving the hub.";
|
||||
plugin->ptr = NULL;
|
||||
plugin->plugin_api_version = PLUGIN_API_VERSION;
|
||||
plugin->plugin_funcs_size = sizeof(struct plugin_funcs);
|
||||
memset(&plugin->funcs, 0, sizeof(struct plugin_funcs));
|
||||
PLUGIN_INITIALIZE(plugin, "Logging plugin", "1.0", "Logs users entering and leaving the hub.");
|
||||
|
||||
plugin->funcs.on_user_login = log_user_login;
|
||||
plugin->funcs.on_user_login_error = log_user_login_error;
|
||||
|
||||
Reference in New Issue
Block a user