WIP
This commit is contained in:
parent
de01486c0f
commit
9ac1a378d0
@ -1,6 +1,6 @@
|
|||||||
##
|
##
|
||||||
## Makefile for uhub
|
## Makefile for uhub
|
||||||
## Copyright (C) 2007-2013, Jan Vidar Krey <janvidar@extatic.org>
|
## Copyright (C) 2007-2019, Jan Vidar Krey <janvidar@extatic.org>
|
||||||
#
|
#
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 2.8.2)
|
cmake_minimum_required (VERSION 2.8.2)
|
||||||
@ -120,6 +120,7 @@ add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c)
|
|||||||
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c)
|
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c)
|
||||||
add_library(mod_no_guest_downloads MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_no_guest_downloads.c)
|
add_library(mod_no_guest_downloads MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_no_guest_downloads.c)
|
||||||
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c)
|
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c)
|
||||||
|
add_library(mod_require_tls MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_require_tls.c)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(uhub ws2_32)
|
target_link_libraries(uhub ws2_32)
|
||||||
@ -139,6 +140,7 @@ set_target_properties(
|
|||||||
mod_chat_only
|
mod_chat_only
|
||||||
mod_no_guest_downloads
|
mod_no_guest_downloads
|
||||||
mod_topic
|
mod_topic
|
||||||
|
mod_require_tls
|
||||||
PROPERTIES PREFIX "")
|
PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
||||||
@ -154,6 +156,7 @@ target_link_libraries(mod_no_guest_downloads utils)
|
|||||||
target_link_libraries(mod_chat_only utils)
|
target_link_libraries(mod_chat_only utils)
|
||||||
target_link_libraries(mod_logging utils)
|
target_link_libraries(mod_logging utils)
|
||||||
target_link_libraries(mod_topic utils)
|
target_link_libraries(mod_topic utils)
|
||||||
|
target_link_libraries(mod_require_tls utils)
|
||||||
target_link_libraries(utils network)
|
target_link_libraries(utils network)
|
||||||
target_link_libraries(mod_welcome network)
|
target_link_libraries(mod_welcome network)
|
||||||
target_link_libraries(mod_logging network)
|
target_link_libraries(mod_logging network)
|
||||||
|
@ -96,6 +96,29 @@ static int cbfunc_user_disconnect(struct plugin_handle* plugin, struct plugin_us
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cbfunc_user_redirect(struct plugin_handle* plugin, struct plugin_user* user, const char* address)
|
||||||
|
{
|
||||||
|
char* buffer = adc_msg_escape(address);
|
||||||
|
struct adc_message* command = adc_msg_construct(ADC_CMD_IQUI, strlen(buffer) + 10);
|
||||||
|
adc_msg_add_named_argument(command, ADC_QUI_FLAG_REDIRECT, buffer);
|
||||||
|
route_to_user(plugin_get_hub(plugin), convert_user_type(user), command);
|
||||||
|
adc_msg_free(command);
|
||||||
|
hub_free(buffer);
|
||||||
|
hub_disconnect_user(plugin_get_hub(plugin), convert_user_type(user), quit_disconnected);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cbfunc_user_is_tls_connected(struct plugin_handle* plugin, struct plugin_user* user)
|
||||||
|
{
|
||||||
|
#ifdef SSL_SUPPORT
|
||||||
|
struct hub_user* u = convert_user_type(user);
|
||||||
|
return net_con_is_ssl(u->connection);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int cbfunc_command_add(struct plugin_handle* plugin, struct plugin_command_handle* cmdh)
|
static int cbfunc_command_add(struct plugin_handle* plugin, struct plugin_command_handle* cmdh)
|
||||||
{
|
{
|
||||||
struct plugin_callback_data* data = get_callback_data(plugin);
|
struct plugin_callback_data* data = get_callback_data(plugin);
|
||||||
@ -203,6 +226,8 @@ void plugin_register_callback_functions(struct plugin_handle* handle)
|
|||||||
handle->hub.send_broadcast_message = cbfunc_send_broadcast;
|
handle->hub.send_broadcast_message = cbfunc_send_broadcast;
|
||||||
handle->hub.send_status_message = cbfunc_send_status;
|
handle->hub.send_status_message = cbfunc_send_status;
|
||||||
handle->hub.user_disconnect = cbfunc_user_disconnect;
|
handle->hub.user_disconnect = cbfunc_user_disconnect;
|
||||||
|
handle->hub.user_redirect = cbfunc_user_redirect;
|
||||||
|
handle->hub.user_is_tls_connected = cbfunc_user_is_tls_connected;
|
||||||
handle->hub.command_add = cbfunc_command_add;
|
handle->hub.command_add = cbfunc_command_add;
|
||||||
handle->hub.command_del = cbfunc_command_del;
|
handle->hub.command_del = cbfunc_command_del;
|
||||||
handle->hub.command_arg_reset = cbfunc_command_arg_reset;
|
handle->hub.command_arg_reset = cbfunc_command_arg_reset;
|
||||||
|
@ -114,6 +114,8 @@ typedef int (*hfunc_send_message)(struct plugin_handle*, struct plugin_user* use
|
|||||||
typedef int (*hfunc_send_broadcast_message)(struct plugin_handle*, const char* message);
|
typedef int (*hfunc_send_broadcast_message)(struct plugin_handle*, const char* message);
|
||||||
typedef int (*hfunc_send_status)(struct plugin_handle*, struct plugin_user* to, int code, const char* message);
|
typedef int (*hfunc_send_status)(struct plugin_handle*, struct plugin_user* to, int code, const char* message);
|
||||||
typedef int (*hfunc_user_disconnect)(struct plugin_handle*, struct plugin_user* user);
|
typedef int (*hfunc_user_disconnect)(struct plugin_handle*, struct plugin_user* user);
|
||||||
|
typedef int (*hfunc_user_redirect)(struct plugin_handle*, struct plugin_user* user, const char* address);
|
||||||
|
typedef int (*hfunc_user_is_tls_connected)(struct plugin_handle*, struct plugin_user* user);
|
||||||
typedef int (*hfunc_command_add)(struct plugin_handle*, struct plugin_command_handle*);
|
typedef int (*hfunc_command_add)(struct plugin_handle*, struct plugin_command_handle*);
|
||||||
typedef int (*hfunc_command_del)(struct plugin_handle*, struct plugin_command_handle*);
|
typedef int (*hfunc_command_del)(struct plugin_handle*, struct plugin_command_handle*);
|
||||||
|
|
||||||
@ -137,6 +139,8 @@ struct plugin_hub_funcs
|
|||||||
hfunc_send_broadcast_message send_broadcast_message;
|
hfunc_send_broadcast_message send_broadcast_message;
|
||||||
hfunc_send_status send_status_message;
|
hfunc_send_status send_status_message;
|
||||||
hfunc_user_disconnect user_disconnect;
|
hfunc_user_disconnect user_disconnect;
|
||||||
|
hfunc_user_redirect user_redirect;
|
||||||
|
hfunc_user_is_tls_connected user_is_tls_connected;
|
||||||
hfunc_command_add command_add;
|
hfunc_command_add command_add;
|
||||||
hfunc_command_del command_del;
|
hfunc_command_del command_del;
|
||||||
hfunc_command_arg_reset command_arg_reset;
|
hfunc_command_arg_reset command_arg_reset;
|
||||||
|
Loading…
Reference in New Issue
Block a user