Removed the PLUGIN_SUPPORT code, since plugin support is now mandatory.

This commit is contained in:
Jan Vidar Krey 2011-12-21 10:48:37 +01:00
parent f31fc65e1d
commit f34f0328a3
8 changed files with 1 additions and 109 deletions

View File

@ -286,35 +286,24 @@ int acl_shutdown(struct acl_handle* handle)
extern int acl_register_user(struct hub_info* hub, struct auth_info* info) extern int acl_register_user(struct hub_info* hub, struct auth_info* info)
{ {
#ifdef PLUGIN_SUPPORT
if (plugin_auth_register_user(hub, info) != st_allow) if (plugin_auth_register_user(hub, info) != st_allow)
{ {
return 0; return 0;
} }
return 1; return 1;
#else
// NOT SUPPORTED!
return 0;
#endif
} }
extern int acl_update_user(struct hub_info* hub, struct auth_info* info) extern int acl_update_user(struct hub_info* hub, struct auth_info* info)
{ {
#ifdef PLUGIN_SUPPORT
if (plugin_auth_update_user(hub, info) != st_allow) if (plugin_auth_update_user(hub, info) != st_allow)
{ {
return 0; return 0;
} }
return 1; return 1;
#else
// NOT SUPPORTED!
return 0;
#endif
} }
extern int acl_delete_user(struct hub_info* hub, const char* name) extern int acl_delete_user(struct hub_info* hub, const char* name)
{ {
#ifdef PLUGIN_SUPPORT
struct auth_info data; struct auth_info data;
strncpy(data.nickname, name, MAX_NICK_LEN); strncpy(data.nickname, name, MAX_NICK_LEN);
data.nickname[MAX_NICK_LEN] = '\0'; data.nickname[MAX_NICK_LEN] = '\0';
@ -325,16 +314,11 @@ extern int acl_delete_user(struct hub_info* hub, const char* name)
return 0; return 0;
} }
return 1; return 1;
#else
// NOT SUPPORTED!
return 0;
#endif
} }
struct auth_info* acl_get_access_info(struct hub_info* hub, const char* name) struct auth_info* acl_get_access_info(struct hub_info* hub, const char* name)
{ {
struct auth_info* info = 0; struct auth_info* info = 0;
#ifdef PLUGIN_SUPPORT
info = (struct auth_info*) hub_malloc(sizeof(struct auth_info)); info = (struct auth_info*) hub_malloc(sizeof(struct auth_info));
if (plugin_auth_get_user(hub, name, info) != st_allow) if (plugin_auth_get_user(hub, name, info) != st_allow)
{ {
@ -342,18 +326,6 @@ struct auth_info* acl_get_access_info(struct hub_info* hub, const char* name)
return NULL; return NULL;
} }
return info; return info;
#else
info = (struct auth_info*) list_get_first(hub->acl->users);
while (info)
{
if (strcasecmp((char*)info->nickname, name) == 0)
{
return info;
}
info = (struct auth_info*) list_get_next(hub->acl->users);
}
return NULL;
#endif
} }
#define STR_LIST_CONTAINS(LIST, STR) \ #define STR_LIST_CONTAINS(LIST, STR) \
@ -511,9 +483,7 @@ int acl_password_verify(struct hub_info* hub, struct hub_user* user, const char*
base32_encode((unsigned char*) tiger_res, TIGERSIZE, password_calc); base32_encode((unsigned char*) tiger_res, TIGERSIZE, password_calc);
password_calc[MAX_CID_LEN] = 0; password_calc[MAX_CID_LEN] = 0;
#ifdef PLUGIN_SUPPORT
hub_free(access); hub_free(access);
#endif
if (strcasecmp(password, password_calc) == 0) if (strcasecmp(password, password_calc) == 0)
{ {

View File

@ -875,7 +875,6 @@ void hub_shutdown_service(struct hub_info* hub)
g_hub = 0; g_hub = 0;
} }
#ifdef PLUGIN_SUPPORT
int hub_plugins_load(struct hub_info* hub) int hub_plugins_load(struct hub_info* hub)
{ {
if (!hub->config->file_plugins || !*hub->config->file_plugins) if (!hub->config->file_plugins || !*hub->config->file_plugins)
@ -903,7 +902,6 @@ void hub_plugins_unload(struct hub_info* hub)
hub->plugins = 0; hub->plugins = 0;
} }
} }
#endif
void hub_set_variables(struct hub_info* hub, struct acl_handle* acl) void hub_set_variables(struct hub_info* hub, struct acl_handle* acl)
{ {
@ -979,13 +977,11 @@ void hub_set_variables(struct hub_info* hub, struct acl_handle* acl)
hub_free(tmp); hub_free(tmp);
} }
#ifdef PLUGIN_SUPPORT
if (hub_plugins_load(hub) < 0) if (hub_plugins_load(hub) < 0)
{ {
hub->status = hub_status_shutdown; hub->status = hub_status_shutdown;
} }
else else
#endif
hub->status = (hub->config->hub_enabled ? hub_status_running : hub_status_disabled); hub->status = (hub->config->hub_enabled ? hub_status_running : hub_status_disabled);
hub_free(server); hub_free(server);
@ -994,9 +990,7 @@ void hub_set_variables(struct hub_info* hub, struct acl_handle* acl)
void hub_free_variables(struct hub_info* hub) void hub_free_variables(struct hub_info* hub)
{ {
#ifdef PLUGIN_SUPPORT
hub_plugins_unload(hub); hub_plugins_unload(hub);
#endif
adc_msg_free(hub->command_info); adc_msg_free(hub->command_info);
adc_msg_free(hub->command_banner); adc_msg_free(hub->command_banner);

View File

@ -115,10 +115,7 @@ struct hub_info
struct linked_list* logout_info; /* Log of people logging out. */ struct linked_list* logout_info; /* Log of people logging out. */
struct command_base* commands; /* Hub command handler */ struct command_base* commands; /* Hub command handler */
struct uhub_plugins* plugins; /* Plug-ins loaded for this hub instance. */
#ifdef PLUGIN_SUPPORT
struct uhub_plugins* plugins;
#endif
#ifdef SSL_SUPPORT #ifdef SSL_SUPPORT
SSL_METHOD* ssl_method; SSL_METHOD* ssl_method;

View File

@ -20,41 +20,6 @@
#include "uhub.h" #include "uhub.h"
#include "plugin_api/handle.h" #include "plugin_api/handle.h"
#ifndef PLUGIN_SUPPORT
static void log_user_login(struct hub_user* u)
{
const char* cred = auth_cred_to_string(u->credentials);
const char* addr = user_get_address(u);
LOG_USER("LoginOK %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, cred, u->user_agent);
}
static void log_user_login_error(struct hub_user* u, enum status_message msg)
{
const char* addr = user_get_address(u);
const char* message = hub_get_status_message_log(u->hub, msg);
LOG_USER("LoginError %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message, u->user_agent);
}
static void log_user_update_error(struct hub_user* u, enum status_message msg)
{
const char* addr = user_get_address(u);
const char* message = hub_get_status_message_log(u->hub, msg);
LOG_USER("UpdateError %s/%s %s \"%s\" (%s) \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message, u->user_agent);
}
static void log_user_logout(struct hub_user* u, const char* message)
{
const char* addr = user_get_address(u);
LOG_USER("Logout %s/%s %s \"%s\" (%s)", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, message);
}
static void log_user_nick_change(struct hub_user* u, const char* nick)
{
const char* addr = user_get_address(u);
LOG_USER("NickChange %s/%s %s \"%s\" -> \"%s\"", sid_to_string(u->id.sid), u->id.cid, addr, u->id.nick, nick);
}
#endif /* !PLUGIN_SUPPORT */
/* Send MOTD, do logging etc */ /* Send MOTD, do logging etc */
void on_login_success(struct hub_info* hub, struct hub_user* u) void on_login_success(struct hub_info* hub, struct hub_user* u)
{ {
@ -66,12 +31,7 @@ void on_login_success(struct hub_info* hub, struct hub_user* u)
user_set_state(u, state_normal); user_set_state(u, state_normal);
uman_add(hub, u); uman_add(hub, u);
#ifdef PLUGIN_SUPPORT
plugin_log_user_login_success(hub, u); plugin_log_user_login_success(hub, u);
#else
/* Print log message */
log_user_login(u);
#endif
/* Announce new user to all connected users */ /* Announce new user to all connected users */
if (user_is_logged_in(u)) if (user_is_logged_in(u))
@ -91,22 +51,14 @@ void on_login_success(struct hub_info* hub, struct hub_user* u)
void on_login_failure(struct hub_info* hub, struct hub_user* u, enum status_message msg) void on_login_failure(struct hub_info* hub, struct hub_user* u, enum status_message msg)
{ {
#ifdef PLUGIN_SUPPORT
plugin_log_user_login_error(hub, u, hub_get_status_message_log(hub, msg)); plugin_log_user_login_error(hub, u, hub_get_status_message_log(hub, msg));
#else
log_user_login_error(u, msg);
#endif
hub_send_status(hub, u, msg, status_level_fatal); hub_send_status(hub, u, msg, status_level_fatal);
hub_disconnect_user(hub, u, quit_logon_error); hub_disconnect_user(hub, u, quit_logon_error);
} }
void on_update_failure(struct hub_info* hub, struct hub_user* u, enum status_message msg) void on_update_failure(struct hub_info* hub, struct hub_user* u, enum status_message msg)
{ {
#ifdef PLUGIN_SUPPORT
plugin_log_user_update_error(hub, u, hub_get_status_message_log(hub, msg)); plugin_log_user_update_error(hub, u, hub_get_status_message_log(hub, msg));
#else
log_user_update_error(u, msg);
#endif
hub_send_status(hub, u, msg, status_level_fatal); hub_send_status(hub, u, msg, status_level_fatal);
hub_disconnect_user(hub, u, quit_update_error); hub_disconnect_user(hub, u, quit_update_error);
} }
@ -115,11 +67,7 @@ void on_nick_change(struct hub_info* hub, struct hub_user* u, const char* nick)
{ {
if (user_is_logged_in(u)) if (user_is_logged_in(u))
{ {
#ifdef PLUGIN_SUPPORT
plugin_log_user_nick_change(hub, u, nick); plugin_log_user_nick_change(hub, u, nick);
#else
log_user_nick_change(u, nick);
#endif
} }
} }
@ -127,12 +75,7 @@ void on_logout_user(struct hub_info* hub, struct hub_user* user)
{ {
const char* reason = user_get_quit_reason_string(user->quit_reason); const char* reason = user_get_quit_reason_string(user->quit_reason);
#ifdef PLUGIN_SUPPORT
plugin_log_user_logout(hub, user, reason); plugin_log_user_logout(hub, user, reason);
#else
log_user_logout(user, reason);
#endif
hub_logout_log(hub, user); hub_logout_log(hub, user);
} }

View File

@ -176,9 +176,7 @@ void net_on_accept(struct net_connection* con, int event, void *arg)
struct hub_probe* probe = 0; struct hub_probe* probe = 0;
struct ip_addr_encap ipaddr; struct ip_addr_encap ipaddr;
int server_fd = net_con_get_sd(con); int server_fd = net_con_get_sd(con);
#ifdef PLUGIN_SUPPORT
plugin_st status; plugin_st status;
#endif
for (;;) for (;;)
{ {
@ -200,7 +198,6 @@ void net_on_accept(struct net_connection* con, int event, void *arg)
} }
} }
#ifdef PLUGIN_SUPPORT
status = plugin_check_ip_early(hub, &ipaddr); status = plugin_check_ip_early(hub, &ipaddr);
if (status == st_deny) if (status == st_deny)
{ {
@ -210,7 +207,6 @@ void net_on_accept(struct net_connection* con, int event, void *arg)
} }
plugin_log_connection_accepted(hub, &ipaddr); plugin_log_connection_accepted(hub, &ipaddr);
#endif
probe = probe_create(hub, fd, &ipaddr); probe = probe_create(hub, fd, &ipaddr);
if (!probe) if (!probe)

View File

@ -23,8 +23,6 @@
#include "uhub.h" #include "uhub.h"
#include "plugin_api/handle.h" #include "plugin_api/handle.h"
#ifdef PLUGIN_SUPPORT
struct hub_info; struct hub_info;
struct ip_addr_encap; struct ip_addr_encap;
@ -63,7 +61,5 @@ plugin_st plugin_auth_register_user(struct hub_info* hub, struct auth_info* user
plugin_st plugin_auth_update_user(struct hub_info* hub, struct auth_info* user); plugin_st plugin_auth_update_user(struct hub_info* hub, struct auth_info* user);
plugin_st plugin_auth_delete_user(struct hub_info* hub, struct auth_info* user); plugin_st plugin_auth_delete_user(struct hub_info* hub, struct auth_info* user);
#endif
#endif // HAVE_UHUB_PLUGIN_INVOKE_H #endif // HAVE_UHUB_PLUGIN_INVOKE_H

View File

@ -19,7 +19,6 @@
#include "uhub.h" #include "uhub.h"
#ifdef PLUGIN_SUPPORT
#include "plugin_api/handle.h" #include "plugin_api/handle.h"
struct plugin_callback_data; struct plugin_callback_data;
@ -256,4 +255,3 @@ struct hub_info* plugin_get_hub(struct plugin_handle* plugin)
return data->hub; return data->hub;
} }
#endif /* PLUGIN_SUPPORT */

View File

@ -25,8 +25,6 @@
/* #define MEMORY_DEBUG */ /* #define MEMORY_DEBUG */
/* #define DEBUG_SENDQ 1 */ /* #define DEBUG_SENDQ 1 */
#define PLUGIN_SUPPORT
#include "system.h" #include "system.h"
#ifndef WIN32 #ifndef WIN32