From f34f0328a3768b207bd863a531578f6a595499ff Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Wed, 21 Dec 2011 10:48:37 +0100 Subject: [PATCH] Removed the PLUGIN_SUPPORT code, since plugin support is now mandatory. --- src/core/auth.c | 30 ---------------------- src/core/hub.c | 6 ----- src/core/hub.h | 5 +--- src/core/hubevent.c | 57 ----------------------------------------- src/core/netevent.c | 4 --- src/core/plugininvoke.h | 4 --- src/core/pluginloader.c | 2 -- src/uhub.h | 2 -- 8 files changed, 1 insertion(+), 109 deletions(-) diff --git a/src/core/auth.c b/src/core/auth.c index 8f8ffe9..11400ba 100644 --- a/src/core/auth.c +++ b/src/core/auth.c @@ -286,35 +286,24 @@ int acl_shutdown(struct acl_handle* handle) 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) { return 0; } return 1; -#else - // NOT SUPPORTED! - return 0; -#endif } 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) { return 0; } return 1; -#else - // NOT SUPPORTED! - return 0; -#endif } extern int acl_delete_user(struct hub_info* hub, const char* name) { -#ifdef PLUGIN_SUPPORT struct auth_info data; strncpy(data.nickname, name, MAX_NICK_LEN); 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 1; -#else - // NOT SUPPORTED! - return 0; -#endif } struct auth_info* acl_get_access_info(struct hub_info* hub, const char* name) { struct auth_info* info = 0; -#ifdef PLUGIN_SUPPORT info = (struct auth_info*) hub_malloc(sizeof(struct auth_info)); 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 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) \ @@ -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); password_calc[MAX_CID_LEN] = 0; -#ifdef PLUGIN_SUPPORT hub_free(access); -#endif if (strcasecmp(password, password_calc) == 0) { diff --git a/src/core/hub.c b/src/core/hub.c index e084b32..c9e775b 100644 --- a/src/core/hub.c +++ b/src/core/hub.c @@ -875,7 +875,6 @@ void hub_shutdown_service(struct hub_info* hub) g_hub = 0; } -#ifdef PLUGIN_SUPPORT int hub_plugins_load(struct hub_info* hub) { if (!hub->config->file_plugins || !*hub->config->file_plugins) @@ -903,7 +902,6 @@ void hub_plugins_unload(struct hub_info* hub) hub->plugins = 0; } } -#endif 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); } -#ifdef PLUGIN_SUPPORT if (hub_plugins_load(hub) < 0) { hub->status = hub_status_shutdown; } else -#endif hub->status = (hub->config->hub_enabled ? hub_status_running : hub_status_disabled); 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) { -#ifdef PLUGIN_SUPPORT hub_plugins_unload(hub); -#endif adc_msg_free(hub->command_info); adc_msg_free(hub->command_banner); diff --git a/src/core/hub.h b/src/core/hub.h index e18ef07..e8f181a 100644 --- a/src/core/hub.h +++ b/src/core/hub.h @@ -115,10 +115,7 @@ struct hub_info struct linked_list* logout_info; /* Log of people logging out. */ struct command_base* commands; /* Hub command handler */ - -#ifdef PLUGIN_SUPPORT - struct uhub_plugins* plugins; -#endif + struct uhub_plugins* plugins; /* Plug-ins loaded for this hub instance. */ #ifdef SSL_SUPPORT SSL_METHOD* ssl_method; diff --git a/src/core/hubevent.c b/src/core/hubevent.c index 1f5e873..a2dbfb1 100644 --- a/src/core/hubevent.c +++ b/src/core/hubevent.c @@ -20,41 +20,6 @@ #include "uhub.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 */ 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); uman_add(hub, u); -#ifdef PLUGIN_SUPPORT plugin_log_user_login_success(hub, u); -#else - /* Print log message */ - log_user_login(u); -#endif /* Announce new user to all connected users */ 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) { -#ifdef PLUGIN_SUPPORT 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_disconnect_user(hub, u, quit_logon_error); } 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)); -#else - log_user_update_error(u, msg); -#endif hub_send_status(hub, u, msg, status_level_fatal); 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)) { -#ifdef PLUGIN_SUPPORT 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); -#ifdef PLUGIN_SUPPORT plugin_log_user_logout(hub, user, reason); -#else - log_user_logout(user, reason); -#endif - hub_logout_log(hub, user); } diff --git a/src/core/netevent.c b/src/core/netevent.c index a4b125a..46b9306 100644 --- a/src/core/netevent.c +++ b/src/core/netevent.c @@ -176,9 +176,7 @@ void net_on_accept(struct net_connection* con, int event, void *arg) struct hub_probe* probe = 0; struct ip_addr_encap ipaddr; int server_fd = net_con_get_sd(con); -#ifdef PLUGIN_SUPPORT plugin_st status; -#endif 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); 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); -#endif probe = probe_create(hub, fd, &ipaddr); if (!probe) diff --git a/src/core/plugininvoke.h b/src/core/plugininvoke.h index d99b9b5..1c5a391 100644 --- a/src/core/plugininvoke.h +++ b/src/core/plugininvoke.h @@ -23,8 +23,6 @@ #include "uhub.h" #include "plugin_api/handle.h" -#ifdef PLUGIN_SUPPORT - struct hub_info; 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_delete_user(struct hub_info* hub, struct auth_info* user); -#endif - #endif // HAVE_UHUB_PLUGIN_INVOKE_H diff --git a/src/core/pluginloader.c b/src/core/pluginloader.c index 6553ac5..d3f8003 100644 --- a/src/core/pluginloader.c +++ b/src/core/pluginloader.c @@ -19,7 +19,6 @@ #include "uhub.h" -#ifdef PLUGIN_SUPPORT #include "plugin_api/handle.h" struct plugin_callback_data; @@ -256,4 +255,3 @@ struct hub_info* plugin_get_hub(struct plugin_handle* plugin) return data->hub; } -#endif /* PLUGIN_SUPPORT */ diff --git a/src/uhub.h b/src/uhub.h index 224cab3..e26ae01 100644 --- a/src/uhub.h +++ b/src/uhub.h @@ -25,8 +25,6 @@ /* #define MEMORY_DEBUG */ /* #define DEBUG_SENDQ 1 */ -#define PLUGIN_SUPPORT - #include "system.h" #ifndef WIN32