From eee2636582ebfaae86e5d6262177c01f7e9e5778 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Mon, 9 Jan 2012 19:54:03 +0100 Subject: [PATCH] Added a chat only hub plugin that disables searching and connection setup. This also deprecates the built-in chat_only configuration option. If you need this functionality, then load the mod_chat_only plugin (if it is loaded then only operators are able to search, connect, etc). --- GNUmakefile | 8 +- src/adc/adcconst.h | 5 ++ src/core/config.xml | 8 -- src/core/gen_config.c | 14 --- src/core/gen_config.h | 1 - src/core/hub.c | 26 ++++-- src/core/plugincallback.c | 15 ++++ src/core/plugininvoke.c | 7 ++ src/core/plugininvoke.h | 1 + src/plugin_api/handle.h | 4 + src/plugin_api/message_api.h | 5 ++ src/plugins/mod_chat_only.c | 163 +++++++++++++++++++++++++++++++++++ 12 files changed, 226 insertions(+), 31 deletions(-) create mode 100644 src/plugins/mod_chat_only.c diff --git a/GNUmakefile b/GNUmakefile index 3c9bd6d..68f0416 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -229,6 +229,9 @@ plugin_auth_sqlite_LIBS := -lsqlite3 plugin_chat_history_SOURCE := src/plugins/mod_chat_history.c plugin_chat_history_TARGET := mod_chat_history.so +plugin_chat_only_SOURCE := src/plugins/mod_chat_only.c +plugin_chat_only_TARGET := mod_chat_only.so + # Source to objects libuhub_OBJECTS := $(libuhub_SOURCES:.c=.o) libutils_OBJECTS := $(libutils_SOURCES:.c=.o) @@ -240,7 +243,7 @@ uhub-passwd_OBJECTS := $(uhub-passwd_SOURCES:.c=.o) adcrush_OBJECTS := $(adcrush_SOURCES:.c=.o) admin_OBJECTS := $(admin_SOURCES:.c=.o) -all_plugins := $(plugin_example_TARGET) $(plugin_logging_TARGET) $(plugin_auth_TARGET) $(plugin_auth_sqlite_TARGET) $(plugin_welcome_TARGET) $(plugin_chat_history_TARGET) +all_plugins := $(plugin_example_TARGET) $(plugin_logging_TARGET) $(plugin_auth_TARGET) $(plugin_auth_sqlite_TARGET) $(plugin_welcome_TARGET) $(plugin_chat_history_TARGET) $(plugin_chat_only_TARGET) all_OBJECTS := $(libuhub_OBJECTS) $(uhub_OBJECTS) $(libutils_OBJECTS) $(adcrush_OBJECTS) $(autotest_OBJECTS) $(admin_OBJECTS) $(libadc_common_OBJECTS) $(libadc_client_OBJECTS) all_OBJECTS += $(all_plugins) @@ -280,6 +283,9 @@ $(plugin_logging_TARGET): $(plugin_logging_SOURCES) $(libutils_OBJECTS) $(libadc $(plugin_chat_history_TARGET): $(plugin_chat_history_SOURCE) $(libutils_OBJECTS) $(MSG_CC) $(CC) -shared -fPIC -o $@ $^ $(CFLAGS) +$(plugin_chat_only_TARGET): $(plugin_chat_only_SOURCE) $(libutils_OBJECTS) + $(MSG_CC) $(CC) -shared -fPIC -o $@ $^ $(CFLAGS) + $(plugin_welcome_TARGET): $(plugin_welcome_SOURCES) $(libutils_OBJECTS) $(MSG_CC) $(CC) -shared -fPIC -o $@ $^ $(CFLAGS) diff --git a/src/adc/adcconst.h b/src/adc/adcconst.h index f78db84..45e4f38 100644 --- a/src/adc/adcconst.h +++ b/src/adc/adcconst.h @@ -64,6 +64,11 @@ typedef uint32_t fourcc_t; #define ADC_CMD_FSCH FOURCC('F','S','C','H') #define ADC_CMD_DRES FOURCC('D','R','E','S') +/* invalid search results (spam) */ +#define ADC_CMD_BRES FOURCC('B','R','E','S') +#define ADC_CMD_ERES FOURCC('E','R','E','S') +#define ADC_CMD_FRES FOURCC('F','R','E','S') + /* connection setup */ #define ADC_CMD_DCTM FOURCC('D','C','T','M') #define ADC_CMD_DRCM FOURCC('D','R','C','M') diff --git a/src/core/config.xml b/src/core/config.xml index 990683e..40e4932 100644 --- a/src/core/config.xml +++ b/src/core/config.xml @@ -126,14 +126,6 @@ 0.3.1 - -