From 4a2b9ebcf38d6c0a2860b966421b3af125438488 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 25 May 2010 00:57:25 -0500 Subject: Renamed all of source files from .c to .cpp --- src/core/CMakeLists.txt | 3 +- src/core/Makefile | 8 +- src/core/bs_act.c | 88 ----- src/core/bs_act.cpp | 88 +++++ src/core/bs_assign.c | 98 ------ src/core/bs_assign.cpp | 98 ++++++ src/core/bs_badwords.c | 282 --------------- src/core/bs_badwords.cpp | 282 +++++++++++++++ src/core/bs_bot.c | 432 ----------------------- src/core/bs_bot.cpp | 432 +++++++++++++++++++++++ src/core/bs_botlist.c | 96 ------ src/core/bs_botlist.cpp | 96 ++++++ src/core/bs_help.c | 55 --- src/core/bs_help.cpp | 55 +++ src/core/bs_info.c | 263 -------------- src/core/bs_info.cpp | 263 ++++++++++++++ src/core/bs_kick.c | 348 ------------------- src/core/bs_kick.cpp | 348 +++++++++++++++++++ src/core/bs_say.c | 94 ----- src/core/bs_say.cpp | 94 +++++ src/core/bs_set.c | 198 ----------- src/core/bs_set.cpp | 198 +++++++++++ src/core/bs_unassign.c | 76 ----- src/core/bs_unassign.cpp | 76 +++++ src/core/cs_access.c | 616 --------------------------------- src/core/cs_access.cpp | 616 +++++++++++++++++++++++++++++++++ src/core/cs_akick.c | 596 -------------------------------- src/core/cs_akick.cpp | 596 ++++++++++++++++++++++++++++++++ src/core/cs_ban.c | 119 ------- src/core/cs_ban.cpp | 119 +++++++ src/core/cs_clear.c | 184 ---------- src/core/cs_clear.cpp | 184 ++++++++++ src/core/cs_drop.c | 127 ------- src/core/cs_drop.cpp | 127 +++++++ src/core/cs_forbid.c | 132 ------- src/core/cs_forbid.cpp | 132 +++++++ src/core/cs_getkey.c | 79 ----- src/core/cs_getkey.cpp | 79 +++++ src/core/cs_help.c | 78 ----- src/core/cs_help.cpp | 78 +++++ src/core/cs_info.c | 181 ---------- src/core/cs_info.cpp | 181 ++++++++++ src/core/cs_invite.c | 97 ------ src/core/cs_invite.cpp | 97 ++++++ src/core/cs_kick.c | 103 ------ src/core/cs_kick.cpp | 103 ++++++ src/core/cs_list.c | 201 ----------- src/core/cs_list.cpp | 201 +++++++++++ src/core/cs_modes.c | 452 ------------------------ src/core/cs_modes.cpp | 452 ++++++++++++++++++++++++ src/core/cs_register.c | 136 -------- src/core/cs_register.cpp | 136 ++++++++ src/core/cs_set.c | 835 --------------------------------------------- src/core/cs_set.cpp | 835 +++++++++++++++++++++++++++++++++++++++++++++ src/core/cs_status.c | 79 ----- src/core/cs_status.cpp | 79 +++++ src/core/cs_suspend.c | 194 ----------- src/core/cs_suspend.cpp | 194 +++++++++++ src/core/cs_topic.c | 101 ------ src/core/cs_topic.cpp | 101 ++++++ src/core/cs_unban.c | 93 ----- src/core/cs_unban.cpp | 93 +++++ src/core/cs_xop.c | 650 ----------------------------------- src/core/cs_xop.cpp | 650 +++++++++++++++++++++++++++++++++++ src/core/enc_md5.c | 398 --------------------- src/core/enc_md5.cpp | 398 +++++++++++++++++++++ src/core/enc_none.c | 78 ----- src/core/enc_none.cpp | 78 +++++ src/core/enc_old.c | 401 ---------------------- src/core/enc_old.cpp | 401 ++++++++++++++++++++++ src/core/enc_sha1.c | 257 -------------- src/core/enc_sha1.cpp | 257 ++++++++++++++ src/core/enc_sha256.c | 345 ------------------- src/core/enc_sha256.cpp | 345 +++++++++++++++++++ src/core/hs_del.c | 76 ----- src/core/hs_del.cpp | 76 +++++ src/core/hs_delall.c | 81 ----- src/core/hs_delall.cpp | 81 +++++ src/core/hs_group.c | 69 ---- src/core/hs_group.cpp | 69 ++++ src/core/hs_help.c | 51 --- src/core/hs_help.cpp | 51 +++ src/core/hs_list.c | 135 -------- src/core/hs_list.cpp | 135 ++++++++ src/core/hs_off.c | 65 ---- src/core/hs_off.cpp | 65 ++++ src/core/hs_on.c | 79 ----- src/core/hs_on.cpp | 79 +++++ src/core/hs_set.c | 173 ---------- src/core/hs_set.cpp | 173 ++++++++++ src/core/hs_setall.c | 171 ---------- src/core/hs_setall.cpp | 171 ++++++++++ src/core/ms_cancel.c | 92 ----- src/core/ms_cancel.cpp | 92 +++++ src/core/ms_check.c | 108 ------ src/core/ms_check.cpp | 108 ++++++ src/core/ms_del.c | 222 ------------ src/core/ms_del.cpp | 222 ++++++++++++ src/core/ms_help.c | 51 --- src/core/ms_help.cpp | 51 +++ src/core/ms_info.c | 221 ------------ src/core/ms_info.cpp | 221 ++++++++++++ src/core/ms_list.c | 179 ---------- src/core/ms_list.cpp | 179 ++++++++++ src/core/ms_read.c | 164 --------- src/core/ms_read.cpp | 164 +++++++++ src/core/ms_rsend.c | 95 ------ src/core/ms_rsend.cpp | 95 ++++++ src/core/ms_send.c | 63 ---- src/core/ms_send.cpp | 63 ++++ src/core/ms_sendall.c | 79 ----- src/core/ms_sendall.cpp | 79 +++++ src/core/ms_set.c | 275 --------------- src/core/ms_set.cpp | 275 +++++++++++++++ src/core/ms_staff.c | 76 ----- src/core/ms_staff.cpp | 76 +++++ src/core/ns_access.c | 184 ---------- src/core/ns_access.cpp | 184 ++++++++++ src/core/ns_alist.c | 158 --------- src/core/ns_alist.cpp | 158 +++++++++ src/core/ns_drop.c | 131 ------- src/core/ns_drop.cpp | 131 +++++++ src/core/ns_forbid.c | 124 ------- src/core/ns_forbid.cpp | 124 +++++++ src/core/ns_getemail.c | 90 ----- src/core/ns_getemail.cpp | 90 +++++ src/core/ns_getpass.c | 97 ------ src/core/ns_getpass.cpp | 97 ++++++ src/core/ns_ghost.c | 106 ------ src/core/ns_ghost.cpp | 106 ++++++ src/core/ns_group.c | 298 ---------------- src/core/ns_group.cpp | 298 ++++++++++++++++ src/core/ns_help.c | 67 ---- src/core/ns_help.cpp | 67 ++++ src/core/ns_identify.c | 129 ------- src/core/ns_identify.cpp | 129 +++++++ src/core/ns_info.c | 223 ------------ src/core/ns_info.cpp | 223 ++++++++++++ src/core/ns_list.c | 230 ------------- src/core/ns_list.cpp | 230 +++++++++++++ src/core/ns_logout.c | 101 ------ src/core/ns_logout.cpp | 101 ++++++ src/core/ns_recover.c | 127 ------- src/core/ns_recover.cpp | 127 +++++++ src/core/ns_register.c | 400 ---------------------- src/core/ns_register.cpp | 400 ++++++++++++++++++++++ src/core/ns_release.c | 109 ------ src/core/ns_release.cpp | 109 ++++++ src/core/ns_resetpass.c | 172 ---------- src/core/ns_resetpass.cpp | 172 ++++++++++ src/core/ns_saset.c | 589 -------------------------------- src/core/ns_saset.cpp | 589 ++++++++++++++++++++++++++++++++ src/core/ns_sendpass.c | 104 ------ src/core/ns_sendpass.cpp | 104 ++++++ src/core/ns_set.c | 545 ----------------------------- src/core/ns_set.cpp | 545 +++++++++++++++++++++++++++++ src/core/ns_status.c | 80 ----- src/core/ns_status.cpp | 80 +++++ src/core/ns_suspend.c | 198 ----------- src/core/ns_suspend.cpp | 198 +++++++++++ src/core/ns_update.c | 68 ---- src/core/ns_update.cpp | 68 ++++ src/core/os_akill.c | 403 ---------------------- src/core/os_akill.cpp | 403 ++++++++++++++++++++++ src/core/os_chankill.c | 120 ------- src/core/os_chankill.cpp | 120 +++++++ src/core/os_chanlist.c | 110 ------ src/core/os_chanlist.cpp | 110 ++++++ src/core/os_clearmodes.c | 190 ----------- src/core/os_clearmodes.cpp | 190 +++++++++++ src/core/os_defcon.c | 523 ---------------------------- src/core/os_defcon.cpp | 523 ++++++++++++++++++++++++++++ src/core/os_global.c | 65 ---- src/core/os_global.cpp | 65 ++++ src/core/os_help.c | 50 --- src/core/os_help.cpp | 50 +++ src/core/os_ignore.c | 204 ----------- src/core/os_ignore.cpp | 204 +++++++++++ src/core/os_jupe.c | 81 ----- src/core/os_jupe.cpp | 81 +++++ src/core/os_kick.c | 83 ----- src/core/os_kick.cpp | 83 +++++ src/core/os_mode.c | 74 ---- src/core/os_mode.cpp | 74 ++++ src/core/os_modinfo.c | 102 ------ src/core/os_modinfo.cpp | 102 ++++++ src/core/os_modlist.c | 211 ------------ src/core/os_modlist.cpp | 211 ++++++++++++ src/core/os_modload.c | 76 ----- src/core/os_modload.cpp | 76 +++++ src/core/os_modunload.c | 78 ----- src/core/os_modunload.cpp | 78 +++++ src/core/os_news.c | 478 -------------------------- src/core/os_news.cpp | 478 ++++++++++++++++++++++++++ src/core/os_noop.c | 92 ----- src/core/os_noop.cpp | 92 +++++ src/core/os_oline.c | 86 ----- src/core/os_oline.cpp | 86 +++++ src/core/os_quit.c | 65 ---- src/core/os_quit.cpp | 65 ++++ src/core/os_reload.c | 67 ---- src/core/os_reload.cpp | 67 ++++ src/core/os_restart.c | 64 ---- src/core/os_restart.cpp | 64 ++++ src/core/os_session.c | 505 --------------------------- src/core/os_session.cpp | 505 +++++++++++++++++++++++++++ src/core/os_set.c | 311 ----------------- src/core/os_set.cpp | 311 +++++++++++++++++ src/core/os_shutdown.c | 65 ---- src/core/os_shutdown.cpp | 65 ++++ src/core/os_sqline.c | 407 ---------------------- src/core/os_sqline.cpp | 407 ++++++++++++++++++++++ src/core/os_staff.c | 87 ----- src/core/os_staff.cpp | 87 +++++ src/core/os_stats.c | 398 --------------------- src/core/os_stats.cpp | 398 +++++++++++++++++++++ src/core/os_svsnick.c | 104 ------ src/core/os_svsnick.cpp | 104 ++++++ src/core/os_szline.c | 405 ---------------------- src/core/os_szline.cpp | 405 ++++++++++++++++++++++ src/core/os_umode.c | 89 ----- src/core/os_umode.cpp | 89 +++++ src/core/os_update.c | 57 ---- src/core/os_update.cpp | 57 ++++ src/core/os_userlist.c | 113 ------ src/core/os_userlist.cpp | 113 ++++++ src/core/ss_main.c | 68 ---- src/core/ss_main.cpp | 68 ++++ 228 files changed, 21251 insertions(+), 21256 deletions(-) delete mode 100644 src/core/bs_act.c create mode 100644 src/core/bs_act.cpp delete mode 100644 src/core/bs_assign.c create mode 100644 src/core/bs_assign.cpp delete mode 100644 src/core/bs_badwords.c create mode 100644 src/core/bs_badwords.cpp delete mode 100644 src/core/bs_bot.c create mode 100644 src/core/bs_bot.cpp delete mode 100644 src/core/bs_botlist.c create mode 100644 src/core/bs_botlist.cpp delete mode 100644 src/core/bs_help.c create mode 100644 src/core/bs_help.cpp delete mode 100644 src/core/bs_info.c create mode 100644 src/core/bs_info.cpp delete mode 100644 src/core/bs_kick.c create mode 100644 src/core/bs_kick.cpp delete mode 100644 src/core/bs_say.c create mode 100644 src/core/bs_say.cpp delete mode 100644 src/core/bs_set.c create mode 100644 src/core/bs_set.cpp delete mode 100644 src/core/bs_unassign.c create mode 100644 src/core/bs_unassign.cpp delete mode 100644 src/core/cs_access.c create mode 100644 src/core/cs_access.cpp delete mode 100644 src/core/cs_akick.c create mode 100644 src/core/cs_akick.cpp delete mode 100644 src/core/cs_ban.c create mode 100644 src/core/cs_ban.cpp delete mode 100644 src/core/cs_clear.c create mode 100644 src/core/cs_clear.cpp delete mode 100644 src/core/cs_drop.c create mode 100644 src/core/cs_drop.cpp delete mode 100644 src/core/cs_forbid.c create mode 100644 src/core/cs_forbid.cpp delete mode 100644 src/core/cs_getkey.c create mode 100644 src/core/cs_getkey.cpp delete mode 100644 src/core/cs_help.c create mode 100644 src/core/cs_help.cpp delete mode 100644 src/core/cs_info.c create mode 100644 src/core/cs_info.cpp delete mode 100644 src/core/cs_invite.c create mode 100644 src/core/cs_invite.cpp delete mode 100644 src/core/cs_kick.c create mode 100644 src/core/cs_kick.cpp delete mode 100644 src/core/cs_list.c create mode 100644 src/core/cs_list.cpp delete mode 100644 src/core/cs_modes.c create mode 100644 src/core/cs_modes.cpp delete mode 100644 src/core/cs_register.c create mode 100644 src/core/cs_register.cpp delete mode 100644 src/core/cs_set.c create mode 100644 src/core/cs_set.cpp delete mode 100644 src/core/cs_status.c create mode 100644 src/core/cs_status.cpp delete mode 100644 src/core/cs_suspend.c create mode 100644 src/core/cs_suspend.cpp delete mode 100644 src/core/cs_topic.c create mode 100644 src/core/cs_topic.cpp delete mode 100644 src/core/cs_unban.c create mode 100644 src/core/cs_unban.cpp delete mode 100644 src/core/cs_xop.c create mode 100644 src/core/cs_xop.cpp delete mode 100644 src/core/enc_md5.c create mode 100644 src/core/enc_md5.cpp delete mode 100644 src/core/enc_none.c create mode 100644 src/core/enc_none.cpp delete mode 100644 src/core/enc_old.c create mode 100644 src/core/enc_old.cpp delete mode 100644 src/core/enc_sha1.c create mode 100644 src/core/enc_sha1.cpp delete mode 100644 src/core/enc_sha256.c create mode 100644 src/core/enc_sha256.cpp delete mode 100644 src/core/hs_del.c create mode 100644 src/core/hs_del.cpp delete mode 100644 src/core/hs_delall.c create mode 100644 src/core/hs_delall.cpp delete mode 100644 src/core/hs_group.c create mode 100644 src/core/hs_group.cpp delete mode 100644 src/core/hs_help.c create mode 100644 src/core/hs_help.cpp delete mode 100644 src/core/hs_list.c create mode 100644 src/core/hs_list.cpp delete mode 100644 src/core/hs_off.c create mode 100644 src/core/hs_off.cpp delete mode 100644 src/core/hs_on.c create mode 100644 src/core/hs_on.cpp delete mode 100644 src/core/hs_set.c create mode 100644 src/core/hs_set.cpp delete mode 100644 src/core/hs_setall.c create mode 100644 src/core/hs_setall.cpp delete mode 100644 src/core/ms_cancel.c create mode 100644 src/core/ms_cancel.cpp delete mode 100644 src/core/ms_check.c create mode 100644 src/core/ms_check.cpp delete mode 100644 src/core/ms_del.c create mode 100644 src/core/ms_del.cpp delete mode 100644 src/core/ms_help.c create mode 100644 src/core/ms_help.cpp delete mode 100644 src/core/ms_info.c create mode 100644 src/core/ms_info.cpp delete mode 100644 src/core/ms_list.c create mode 100644 src/core/ms_list.cpp delete mode 100644 src/core/ms_read.c create mode 100644 src/core/ms_read.cpp delete mode 100644 src/core/ms_rsend.c create mode 100644 src/core/ms_rsend.cpp delete mode 100644 src/core/ms_send.c create mode 100644 src/core/ms_send.cpp delete mode 100644 src/core/ms_sendall.c create mode 100644 src/core/ms_sendall.cpp delete mode 100644 src/core/ms_set.c create mode 100644 src/core/ms_set.cpp delete mode 100644 src/core/ms_staff.c create mode 100644 src/core/ms_staff.cpp delete mode 100644 src/core/ns_access.c create mode 100644 src/core/ns_access.cpp delete mode 100644 src/core/ns_alist.c create mode 100644 src/core/ns_alist.cpp delete mode 100644 src/core/ns_drop.c create mode 100644 src/core/ns_drop.cpp delete mode 100644 src/core/ns_forbid.c create mode 100644 src/core/ns_forbid.cpp delete mode 100644 src/core/ns_getemail.c create mode 100644 src/core/ns_getemail.cpp delete mode 100644 src/core/ns_getpass.c create mode 100644 src/core/ns_getpass.cpp delete mode 100644 src/core/ns_ghost.c create mode 100644 src/core/ns_ghost.cpp delete mode 100644 src/core/ns_group.c create mode 100644 src/core/ns_group.cpp delete mode 100644 src/core/ns_help.c create mode 100644 src/core/ns_help.cpp delete mode 100644 src/core/ns_identify.c create mode 100644 src/core/ns_identify.cpp delete mode 100644 src/core/ns_info.c create mode 100644 src/core/ns_info.cpp delete mode 100644 src/core/ns_list.c create mode 100644 src/core/ns_list.cpp delete mode 100644 src/core/ns_logout.c create mode 100644 src/core/ns_logout.cpp delete mode 100644 src/core/ns_recover.c create mode 100644 src/core/ns_recover.cpp delete mode 100644 src/core/ns_register.c create mode 100644 src/core/ns_register.cpp delete mode 100644 src/core/ns_release.c create mode 100644 src/core/ns_release.cpp delete mode 100644 src/core/ns_resetpass.c create mode 100644 src/core/ns_resetpass.cpp delete mode 100644 src/core/ns_saset.c create mode 100644 src/core/ns_saset.cpp delete mode 100644 src/core/ns_sendpass.c create mode 100644 src/core/ns_sendpass.cpp delete mode 100644 src/core/ns_set.c create mode 100644 src/core/ns_set.cpp delete mode 100644 src/core/ns_status.c create mode 100644 src/core/ns_status.cpp delete mode 100644 src/core/ns_suspend.c create mode 100644 src/core/ns_suspend.cpp delete mode 100644 src/core/ns_update.c create mode 100644 src/core/ns_update.cpp delete mode 100644 src/core/os_akill.c create mode 100644 src/core/os_akill.cpp delete mode 100644 src/core/os_chankill.c create mode 100644 src/core/os_chankill.cpp delete mode 100644 src/core/os_chanlist.c create mode 100644 src/core/os_chanlist.cpp delete mode 100644 src/core/os_clearmodes.c create mode 100644 src/core/os_clearmodes.cpp delete mode 100644 src/core/os_defcon.c create mode 100644 src/core/os_defcon.cpp delete mode 100644 src/core/os_global.c create mode 100644 src/core/os_global.cpp delete mode 100644 src/core/os_help.c create mode 100644 src/core/os_help.cpp delete mode 100644 src/core/os_ignore.c create mode 100644 src/core/os_ignore.cpp delete mode 100644 src/core/os_jupe.c create mode 100644 src/core/os_jupe.cpp delete mode 100644 src/core/os_kick.c create mode 100644 src/core/os_kick.cpp delete mode 100644 src/core/os_mode.c create mode 100644 src/core/os_mode.cpp delete mode 100644 src/core/os_modinfo.c create mode 100644 src/core/os_modinfo.cpp delete mode 100644 src/core/os_modlist.c create mode 100644 src/core/os_modlist.cpp delete mode 100644 src/core/os_modload.c create mode 100644 src/core/os_modload.cpp delete mode 100644 src/core/os_modunload.c create mode 100644 src/core/os_modunload.cpp delete mode 100644 src/core/os_news.c create mode 100644 src/core/os_news.cpp delete mode 100644 src/core/os_noop.c create mode 100644 src/core/os_noop.cpp delete mode 100644 src/core/os_oline.c create mode 100644 src/core/os_oline.cpp delete mode 100644 src/core/os_quit.c create mode 100644 src/core/os_quit.cpp delete mode 100644 src/core/os_reload.c create mode 100644 src/core/os_reload.cpp delete mode 100644 src/core/os_restart.c create mode 100644 src/core/os_restart.cpp delete mode 100644 src/core/os_session.c create mode 100644 src/core/os_session.cpp delete mode 100644 src/core/os_set.c create mode 100644 src/core/os_set.cpp delete mode 100644 src/core/os_shutdown.c create mode 100644 src/core/os_shutdown.cpp delete mode 100644 src/core/os_sqline.c create mode 100644 src/core/os_sqline.cpp delete mode 100644 src/core/os_staff.c create mode 100644 src/core/os_staff.cpp delete mode 100644 src/core/os_stats.c create mode 100644 src/core/os_stats.cpp delete mode 100644 src/core/os_svsnick.c create mode 100644 src/core/os_svsnick.cpp delete mode 100644 src/core/os_szline.c create mode 100644 src/core/os_szline.cpp delete mode 100644 src/core/os_umode.c create mode 100644 src/core/os_umode.cpp delete mode 100644 src/core/os_update.c create mode 100644 src/core/os_update.cpp delete mode 100644 src/core/os_userlist.c create mode 100644 src/core/os_userlist.cpp delete mode 100644 src/core/ss_main.c create mode 100644 src/core/ss_main.cpp (limited to 'src/core') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f8547872b..2af2b3ea9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,5 +1,4 @@ -# Find all the *.c and *.cpp files within the current source directory, and sort the list -file(GLOB CORE_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") +# Find all the *.cpp files within the current source directory, and sort the list file(GLOB CORE_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") set(CORE_SRCS ${CORE_SRCS_C} ${CORE_SRCS_CPP}) sort_list(CORE_SRCS) diff --git a/src/core/Makefile b/src/core/Makefile index 122522d69..e1dec257c 100644 --- a/src/core/Makefile +++ b/src/core/Makefile @@ -8,8 +8,7 @@ MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \ 'PROFILE=${PROFILE}' 'SHARED=${SHARED}' \ 'MODULEFLAGS=${MODULEFLAGS}' 'MAKEBIN=${MAKEBIN}' -OBJECTS= $(SRCS:.c=.so) -OBJECTS+= $(SRCS:.cpp=.so) +OBJECTS= $(SRCS:.cpp=.so) CDEFS= -rdynamic -Wall all: modules subs @@ -21,10 +20,7 @@ install: distclean: spotless -.SUFFIXES: .c .cpp .so - -.c.so: - $(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -o $@ $< +.SUFFIXES: .cpp .so .cpp.so: $(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -o $@ $< diff --git a/src/core/bs_act.c b/src/core/bs_act.c deleted file mode 100644 index 1bf11e078..000000000 --- a/src/core/bs_act.c +++ /dev/null @@ -1,88 +0,0 @@ -/* BotServ core functions - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandBSAct : public Command -{ - public: - CommandBSAct() : Command("ACT", 2, 2) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - ChannelInfo *ci = cs_findchan(params[0].c_str()); - ci::string message = params[1]; - - if (!check_access(u, ci, CA_SAY)) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (!ci->bi) - { - notice_help(Config.s_BotServ, u, BOT_NOT_ASSIGNED); - return MOD_CONT; - } - - if (!ci->c || ci->c->users.size() < Config.BSMinUsers) - { - notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name.c_str()); - return MOD_CONT; - } - - size_t i = 0; - while ((i = message.find_first_of("\001"), i) && i != std::string::npos) - message.erase(i, 1); - - ircdproto->SendAction(ci->bi, ci->name.c_str(), "%s", message.c_str()); - ci->bi->lastmsg = time(NULL); - if (Config.LogBot && Config.LogChannel && LogChan && !debug && findchan(Config.LogChannel)) - ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "ACT %s %s %s", u->nick.c_str(), ci->name.c_str(), message.c_str()); - return MOD_CONT; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - syntax_error(Config.s_BotServ, u, "ACT", BOT_ACT_SYNTAX); - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(Config.s_BotServ, u, BOT_HELP_ACT); - return true; - } -}; - -class BSAct : public Module -{ - public: - BSAct(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion(VERSION_STRING); - this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSAct()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ACT); - } -}; - -MODULE_INIT(BSAct) diff --git a/src/core/bs_act.cpp b/src/core/bs_act.cpp new file mode 100644 index 000000000..1bf11e078 --- /dev/null +++ b/src/core/bs_act.cpp @@ -0,0 +1,88 @@ +/* BotServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandBSAct : public Command +{ + public: + CommandBSAct() : Command("ACT", 2, 2) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + ChannelInfo *ci = cs_findchan(params[0].c_str()); + ci::string message = params[1]; + + if (!check_access(u, ci, CA_SAY)) + { + notice_lang(Config.s_BotServ, u, ACCESS_DENIED); + return MOD_CONT; + } + + if (!ci->bi) + { + notice_help(Config.s_BotServ, u, BOT_NOT_ASSIGNED); + return MOD_CONT; + } + + if (!ci->c || ci->c->users.size() < Config.BSMinUsers) + { + notice_lang(Config.s_BotServ, u, BOT_NOT_ON_CHANNEL, ci->name.c_str()); + return MOD_CONT; + } + + size_t i = 0; + while ((i = message.find_first_of("\001"), i) && i != std::string::npos) + message.erase(i, 1); + + ircdproto->SendAction(ci->bi, ci->name.c_str(), "%s", message.c_str()); + ci->bi->lastmsg = time(NULL); + if (Config.LogBot && Config.LogChannel && LogChan && !debug && findchan(Config.LogChannel)) + ircdproto->SendPrivmsg(ci->bi, Config.LogChannel, "ACT %s %s %s", u->nick.c_str(), ci->name.c_str(), message.c_str()); + return MOD_CONT; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + syntax_error(Config.s_BotServ, u, "ACT", BOT_ACT_SYNTAX); + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_BotServ, u, BOT_HELP_ACT); + return true; + } +}; + +class BSAct : public Module +{ + public: + BSAct(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(CORE); + this->AddCommand(BotServ, new CommandBSAct()); + + ModuleManager::Attach(I_OnBotServHelp, this); + } + void OnBotServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ACT); + } +}; + +MODULE_INIT(BSAct) diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c deleted file mode 100644 index dc847eb66..000000000 --- a/src/core/bs_assign.c +++ /dev/null @@ -1,98 +0,0 @@ -/* BotServ core functions - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandBSAssign : public Command -{ - public: - CommandBSAssign() : Command("ASSIGN", 2, 2) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - const char *chan = params[0].c_str(); - const char *nick = params[1].c_str(); - BotInfo *bi; - ChannelInfo *ci; - - if (readonly) - { - notice_lang(Config.s_BotServ, u, BOT_ASSIGN_READONLY); - return MOD_CONT; - } - - if (!(bi = findbot(nick))) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); - return MOD_CONT; - } - - ci = cs_findchan(chan); - - if (ci->botflags.HasFlag(BS_NOBOT) || (!check_access(u, ci, CA_ASSIGN) && !u->Account()->HasPriv("botserv/administration"))) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (bi->HasFlag(BI_PRIVATE) && !u->Account()->HasCommand("botserv/assign/private")) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (ci->bi && ci::string(ci->bi->nick.c_str()) == nick) - { - notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ALREADY, ci->bi->nick.c_str(), chan); - return MOD_CONT; - } - - bi->Assign(u, ci); - notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ASSIGNED, bi->nick.c_str(), ci->name.c_str()); - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(Config.s_BotServ, u, BOT_HELP_ASSIGN); - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - syntax_error(Config.s_BotServ, u, "ASSIGN", BOT_ASSIGN_SYNTAX); - } -}; - -class BSAssign : public Module -{ - public: - BSAssign(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion(VERSION_STRING); - this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSAssign); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ASSIGN); - } -}; - -MODULE_INIT(BSAssign) diff --git a/src/core/bs_assign.cpp b/src/core/bs_assign.cpp new file mode 100644 index 000000000..dc847eb66 --- /dev/null +++ b/src/core/bs_assign.cpp @@ -0,0 +1,98 @@ +/* BotServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandBSAssign : public Command +{ + public: + CommandBSAssign() : Command("ASSIGN", 2, 2) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + const char *chan = params[0].c_str(); + const char *nick = params[1].c_str(); + BotInfo *bi; + ChannelInfo *ci; + + if (readonly) + { + notice_lang(Config.s_BotServ, u, BOT_ASSIGN_READONLY); + return MOD_CONT; + } + + if (!(bi = findbot(nick))) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); + return MOD_CONT; + } + + ci = cs_findchan(chan); + + if (ci->botflags.HasFlag(BS_NOBOT) || (!check_access(u, ci, CA_ASSIGN) && !u->Account()->HasPriv("botserv/administration"))) + { + notice_lang(Config.s_BotServ, u, ACCESS_DENIED); + return MOD_CONT; + } + + if (bi->HasFlag(BI_PRIVATE) && !u->Account()->HasCommand("botserv/assign/private")) + { + notice_lang(Config.s_BotServ, u, ACCESS_DENIED); + return MOD_CONT; + } + + if (ci->bi && ci::string(ci->bi->nick.c_str()) == nick) + { + notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ALREADY, ci->bi->nick.c_str(), chan); + return MOD_CONT; + } + + bi->Assign(u, ci); + notice_lang(Config.s_BotServ, u, BOT_ASSIGN_ASSIGNED, bi->nick.c_str(), ci->name.c_str()); + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_BotServ, u, BOT_HELP_ASSIGN); + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + syntax_error(Config.s_BotServ, u, "ASSIGN", BOT_ASSIGN_SYNTAX); + } +}; + +class BSAssign : public Module +{ + public: + BSAssign(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(CORE); + this->AddCommand(BotServ, new CommandBSAssign); + + ModuleManager::Attach(I_OnBotServHelp, this); + } + void OnBotServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_ASSIGN); + } +}; + +MODULE_INIT(BSAssign) diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c deleted file mode 100644 index ce026e9c4..000000000 --- a/src/core/bs_badwords.c +++ /dev/null @@ -1,282 +0,0 @@ -/* BotServ core functions - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ -/*************************************************************************/ - -#include "module.h" - -class BadwordsListCallback : public NumberList -{ - User *u; - ChannelInfo *ci; - bool SentHeader; - public: - BadwordsListCallback(User *_u, ChannelInfo *_ci, const std::string &list) : NumberList(list), u(_u), ci(_ci), SentHeader(false) - { - } - - ~BadwordsListCallback() - { - if (!SentHeader) - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); - } - - void HandleNumber(unsigned Number) - { - if (Number > ci->GetBadWordCount()) - return; - - if (!SentHeader) - { - SentHeader = true; - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name.c_str()); - } - - DoList(u, ci, Number - 1, ci->GetBadWord(Number - 1)); - } - - static void DoList(User *u, ChannelInfo *ci, unsigned Number, BadWord *bw) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_FORMAT, Number + 1, bw->word.c_str(), ((bw->type == BW_SINGLE) ? "(SINGLE)" : ((bw->type == BW_START) ? "(START)" : ((bw->type == BW_END) ? "(END)" : "")))); - } -}; - -class BadwordsDelCallback : public NumberList -{ - User *u; - ChannelInfo *ci; - unsigned Deleted; - public: - BadwordsDelCallback(User *_u, ChannelInfo *_ci, const std::string &list) : NumberList(list), u(_u), ci(_ci), Deleted(0) - { - } - - ~BadwordsDelCallback() - { - if (!Deleted) - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); - else if (Deleted == 1) - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_ONE, ci->name.c_str()); - else - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_SEVERAL, Deleted, ci->name.c_str()); - } - - void HandleNumber(unsigned Number) - { - if (Number > ci->GetBadWordCount()) - return; - - ++Deleted; - ci->EraseBadWord(Number - 1); - } -}; - -class CommandBSBadwords : public Command -{ - private: - CommandReturn DoList(User *u, ChannelInfo *ci, const ci::string &word) - { - if (!ci->GetBadWordCount()) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name.c_str()); - } - else if (!word.empty() && strspn(word.c_str(), "1234567890,-") == word.length()) - (new BadwordsListCallback(u, ci, word.c_str()))->Process(); - else - { - bool SentHeader = false; - - for (unsigned i = 0; i < ci->GetBadWordCount(); i++) - { - BadWord *bw = ci->GetBadWord(i); - - if (!word.empty() && !Anope::Match(bw->word, word.c_str(), false)) - continue; - - if (!SentHeader) - { - SentHeader = true; - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name.c_str()); - } - - BadwordsListCallback::DoList(u, ci, i, bw); - } - - if (!SentHeader) - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); - } - - return MOD_CONT; - } - - CommandReturn DoAdd(User *u, ChannelInfo *ci, const ci::string &word) - { - size_t pos = word.find_last_of(" "); - BadWordType type = BW_ANY; - ci::string realword = word; - - if (pos != ci::string::npos) - { - ci::string opt = ci::string(word, pos + 1); - if (!opt.empty()) - { - if (opt == "SINGLE") - type = BW_SINGLE; - else if (opt == "START") - type = BW_START; - else if (opt == "END") - type = BW_END; - } - realword = ci::string(word, 0, pos); - } - - if (ci->GetBadWordCount() >= Config.BSBadWordsMax) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_REACHED_LIMIT, Config.BSBadWordsMax); - return MOD_CONT; - } - - for (unsigned i = 0; i < ci->GetBadWordCount(); ++i) - { - BadWord *bw = ci->GetBadWord(i); - - if (!bw->word.empty() && (Config.BSCaseSensitive && !stricmp(bw->word.c_str(), realword.c_str()) - || (!Config.BSCaseSensitive && bw->word == realword.c_str()))) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS, bw->word.c_str(), ci->name.c_str()); - return MOD_CONT; - } - } - - ci->AddBadWord(realword.c_str(), type); - - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ADDED, realword.c_str(), ci->name.c_str()); - - return MOD_CONT; - } - - CommandReturn DoDelete(User *u, ChannelInfo *ci, const ci::string &word) - { - /* Special case: is it a number/list? Only do search if it isn't. */ - if (!word.empty() && isdigit(word[0]) && strspn(word.c_str(), "1234567890,-") == word.length()) - (new BadwordsDelCallback(u, ci, word.c_str()))->Process(); - else - { - unsigned i; - BadWord *badword; - - for (i = 0; i < ci->GetBadWordCount(); ++i) - { - badword = ci->GetBadWord(i); - - if (badword->word == word) - break; - } - - if (i == ci->GetBadWordCount()) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NOT_FOUND, word.c_str(), ci->name.c_str()); - return MOD_CONT; - } - - ci->EraseBadWord(i); - - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name.c_str()); - } - - return MOD_CONT; - } - - CommandReturn DoClear(User *u, ChannelInfo *ci) - { - ci->ClearBadWords(); - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_CLEAR); - return MOD_CONT; - } - public: - CommandBSBadwords() : Command("BADWORDS", 2, 3) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - const char *chan = params[0].c_str(); - ci::string cmd = params[1]; - ci::string word = params.size() > 2 ? params[2].c_str() : ""; - ChannelInfo *ci; - bool need_args = cmd == "LIST" || cmd == "CLEAR"; - - if (!need_args && word.empty()) - { - this->OnSyntaxError(u, cmd); - return MOD_CONT; - } - - ci = cs_findchan(chan); - - if (!check_access(u, ci, CA_BADWORDS) && (!need_args || !u->Account()->HasPriv("botserv/administration"))) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (readonly) - { - notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DISABLED); - return MOD_CONT; - } - - if (cmd == "ADD") - return this->DoAdd(u, ci, word); - else if (cmd == "DEL") - return this->DoDelete(u, ci, word); - else if (cmd == "LIST") - return this->DoList(u, ci, word); - else if (cmd == "CLEAR") - return this->DoClear(u, ci); - else - this->OnSyntaxError(u, ""); - - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_help(Config.s_BotServ, u, BOT_HELP_BADWORDS); - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - syntax_error(Config.s_BotServ, u, "BADWORDS", BOT_BADWORDS_SYNTAX); - } -}; - -class BSBadwords : public Module -{ - public: - BSBadwords(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion(VERSION_STRING); - this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSBadwords); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BADWORDS); - } -}; - -MODULE_INIT(BSBadwords) diff --git a/src/core/bs_badwords.cpp b/src/core/bs_badwords.cpp new file mode 100644 index 000000000..ce026e9c4 --- /dev/null +++ b/src/core/bs_badwords.cpp @@ -0,0 +1,282 @@ +/* BotServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ +/*************************************************************************/ + +#include "module.h" + +class BadwordsListCallback : public NumberList +{ + User *u; + ChannelInfo *ci; + bool SentHeader; + public: + BadwordsListCallback(User *_u, ChannelInfo *_ci, const std::string &list) : NumberList(list), u(_u), ci(_ci), SentHeader(false) + { + } + + ~BadwordsListCallback() + { + if (!SentHeader) + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); + } + + void HandleNumber(unsigned Number) + { + if (Number > ci->GetBadWordCount()) + return; + + if (!SentHeader) + { + SentHeader = true; + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name.c_str()); + } + + DoList(u, ci, Number - 1, ci->GetBadWord(Number - 1)); + } + + static void DoList(User *u, ChannelInfo *ci, unsigned Number, BadWord *bw) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_FORMAT, Number + 1, bw->word.c_str(), ((bw->type == BW_SINGLE) ? "(SINGLE)" : ((bw->type == BW_START) ? "(START)" : ((bw->type == BW_END) ? "(END)" : "")))); + } +}; + +class BadwordsDelCallback : public NumberList +{ + User *u; + ChannelInfo *ci; + unsigned Deleted; + public: + BadwordsDelCallback(User *_u, ChannelInfo *_ci, const std::string &list) : NumberList(list), u(_u), ci(_ci), Deleted(0) + { + } + + ~BadwordsDelCallback() + { + if (!Deleted) + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); + else if (Deleted == 1) + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_ONE, ci->name.c_str()); + else + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED_SEVERAL, Deleted, ci->name.c_str()); + } + + void HandleNumber(unsigned Number) + { + if (Number > ci->GetBadWordCount()) + return; + + ++Deleted; + ci->EraseBadWord(Number - 1); + } +}; + +class CommandBSBadwords : public Command +{ + private: + CommandReturn DoList(User *u, ChannelInfo *ci, const ci::string &word) + { + if (!ci->GetBadWordCount()) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_EMPTY, ci->name.c_str()); + } + else if (!word.empty() && strspn(word.c_str(), "1234567890,-") == word.length()) + (new BadwordsListCallback(u, ci, word.c_str()))->Process(); + else + { + bool SentHeader = false; + + for (unsigned i = 0; i < ci->GetBadWordCount(); i++) + { + BadWord *bw = ci->GetBadWord(i); + + if (!word.empty() && !Anope::Match(bw->word, word.c_str(), false)) + continue; + + if (!SentHeader) + { + SentHeader = true; + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_LIST_HEADER, ci->name.c_str()); + } + + BadwordsListCallback::DoList(u, ci, i, bw); + } + + if (!SentHeader) + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NO_MATCH, ci->name.c_str()); + } + + return MOD_CONT; + } + + CommandReturn DoAdd(User *u, ChannelInfo *ci, const ci::string &word) + { + size_t pos = word.find_last_of(" "); + BadWordType type = BW_ANY; + ci::string realword = word; + + if (pos != ci::string::npos) + { + ci::string opt = ci::string(word, pos + 1); + if (!opt.empty()) + { + if (opt == "SINGLE") + type = BW_SINGLE; + else if (opt == "START") + type = BW_START; + else if (opt == "END") + type = BW_END; + } + realword = ci::string(word, 0, pos); + } + + if (ci->GetBadWordCount() >= Config.BSBadWordsMax) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_REACHED_LIMIT, Config.BSBadWordsMax); + return MOD_CONT; + } + + for (unsigned i = 0; i < ci->GetBadWordCount(); ++i) + { + BadWord *bw = ci->GetBadWord(i); + + if (!bw->word.empty() && (Config.BSCaseSensitive && !stricmp(bw->word.c_str(), realword.c_str()) + || (!Config.BSCaseSensitive && bw->word == realword.c_str()))) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS, bw->word.c_str(), ci->name.c_str()); + return MOD_CONT; + } + } + + ci->AddBadWord(realword.c_str(), type); + + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_ADDED, realword.c_str(), ci->name.c_str()); + + return MOD_CONT; + } + + CommandReturn DoDelete(User *u, ChannelInfo *ci, const ci::string &word) + { + /* Special case: is it a number/list? Only do search if it isn't. */ + if (!word.empty() && isdigit(word[0]) && strspn(word.c_str(), "1234567890,-") == word.length()) + (new BadwordsDelCallback(u, ci, word.c_str()))->Process(); + else + { + unsigned i; + BadWord *badword; + + for (i = 0; i < ci->GetBadWordCount(); ++i) + { + badword = ci->GetBadWord(i); + + if (badword->word == word) + break; + } + + if (i == ci->GetBadWordCount()) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_NOT_FOUND, word.c_str(), ci->name.c_str()); + return MOD_CONT; + } + + ci->EraseBadWord(i); + + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DELETED, badword->word.c_str(), ci->name.c_str()); + } + + return MOD_CONT; + } + + CommandReturn DoClear(User *u, ChannelInfo *ci) + { + ci->ClearBadWords(); + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_CLEAR); + return MOD_CONT; + } + public: + CommandBSBadwords() : Command("BADWORDS", 2, 3) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + const char *chan = params[0].c_str(); + ci::string cmd = params[1]; + ci::string word = params.size() > 2 ? params[2].c_str() : ""; + ChannelInfo *ci; + bool need_args = cmd == "LIST" || cmd == "CLEAR"; + + if (!need_args && word.empty()) + { + this->OnSyntaxError(u, cmd); + return MOD_CONT; + } + + ci = cs_findchan(chan); + + if (!check_access(u, ci, CA_BADWORDS) && (!need_args || !u->Account()->HasPriv("botserv/administration"))) + { + notice_lang(Config.s_BotServ, u, ACCESS_DENIED); + return MOD_CONT; + } + + if (readonly) + { + notice_lang(Config.s_BotServ, u, BOT_BADWORDS_DISABLED); + return MOD_CONT; + } + + if (cmd == "ADD") + return this->DoAdd(u, ci, word); + else if (cmd == "DEL") + return this->DoDelete(u, ci, word); + else if (cmd == "LIST") + return this->DoList(u, ci, word); + else if (cmd == "CLEAR") + return this->DoClear(u, ci); + else + this->OnSyntaxError(u, ""); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_BotServ, u, BOT_HELP_BADWORDS); + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + syntax_error(Config.s_BotServ, u, "BADWORDS", BOT_BADWORDS_SYNTAX); + } +}; + +class BSBadwords : public Module +{ + public: + BSBadwords(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion(VERSION_STRING); + this->SetType(CORE); + this->AddCommand(BotServ, new CommandBSBadwords); + + ModuleManager::Attach(I_OnBotServHelp, this); + } + void OnBotServHelp(User *u) + { + notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BADWORDS); + } +}; + +MODULE_INIT(BSBadwords) diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c deleted file mode 100644 index 2c5888554..000000000 --- a/src/core/bs_bot.c +++ /dev/null @@ -1,432 +0,0 @@ -/* BotServ core functions - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. - * - * - */ -/*************************************************************************/ - -#include "module.h" - -class CommandBSBot : public Command -{ - private: - CommandReturn DoAdd(User *u, const std::vector ¶ms) - { - const char *nick = params[1].c_str(); - const char *user = params[2].c_str(); - const char *host = params[3].c_str(); - const char *real = params[4].c_str(); - const char *ch = NULL; - BotInfo *bi; - - if (findbot(nick)) - { - notice_lang(Config.s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick); - return MOD_CONT; - } - - if (strlen(nick) > Config.NickLen) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - if (strlen(user) > Config.UserLen) - { - notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen); - return MOD_CONT; - } - - if (strlen(user) > Config.HostLen) - { - notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen); - return MOD_CONT; - } - - /* Check the nick is valid re RFC 2812 */ - if (isdigit(nick[0]) || nick[0] == '-') - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) - { - if (!isvalidnick(*ch)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - } - - /* check for hardcored ircd forbidden nicks */ - if (!ircdproto->IsNickValid(nick)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - /* Check the host is valid re RFC 2812 */ - if (!isValidHost(host, 3)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_HOST); - return MOD_CONT; - } - - for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) - { - if (!isalnum(*ch)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); - return MOD_CONT; - } - } - - - /* We check whether the nick is registered, and inform the user - * if so. You need to drop the nick manually before you can use - * it as a bot nick from now on -GD - */ - if (findnick(nick)) - { - notice_lang(Config.s_BotServ, u, NICK_ALREADY_REGISTERED, nick); - return MOD_CONT; - } - - if (!(bi = new BotInfo(nick, user, host, real))) - { - notice_lang(Config.s_BotServ, u, BOT_BOT_CREATION_FAILED); - return MOD_CONT; - } - - /* We check whether user with this nick is online, and kill it if so */ - EnforceQlinedNick(nick, Config.s_BotServ); - - notice_lang(Config.s_BotServ, u, BOT_BOT_ADDED, bi->nick.c_str(), bi->user.c_str(), bi->host.c_str(), bi->real.c_str()); - - FOREACH_MOD(I_OnBotCreate, OnBotCreate(bi)); - return MOD_CONT; - } - - CommandReturn DoChange(User *u, const std::vector ¶ms) - { - const char *oldnick = params[1].c_str(); - const char *nick = params.size() > 2 ? params[2].c_str() : NULL; - const char *user = params.size() > 3 ? params[3].c_str() : NULL; - const char *host = params.size() > 4 ? params[4].c_str() : NULL; - const char *real = params.size() > 5 ? params[5].c_str() : NULL; - const char *ch = NULL; - BotInfo *bi; - - if (!oldnick || !nick) - { - this->OnSyntaxError(u, "CHANGE"); - return MOD_CONT; - } - - if (!(bi = findbot(oldnick))) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); - return MOD_CONT; - } - - if (stricmp(oldnick, nick) && nickIsServices(oldnick, 0)) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); - return MOD_CONT; - } - - if (strlen(nick) > Config.NickLen) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - if (user && strlen(user) > Config.UserLen) - { - notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen); - return MOD_CONT; - } - - if (host && strlen(host) > Config.HostLen) - { - notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen); - return MOD_CONT; - } - - if (stricmp(oldnick, nick) && nickIsServices(nick, 0)) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); - return MOD_CONT; - } - - /* Checks whether there *are* changes. - * Case sensitive because we may want to change just the case. - * And we must finally check that the nick is not already - * taken by another bot. - */ - if (bi->nick == nick && (user ? bi->user == user : 1) && (host ? bi->host == host : 1) && (real ? bi->real == real : 1)) - { - notice_lang(Config.s_BotServ, u, BOT_BOT_ANY_CHANGES); - return MOD_CONT; - } - - /* Check the nick is valid re RFC 2812 */ - if (isdigit(nick[0]) || nick[0] == '-') - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) - { - if (!isvalidnick(*ch)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - } - - /* check for hardcored ircd forbidden nicks */ - if (!ircdproto->IsNickValid(nick)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); - return MOD_CONT; - } - - if (host && !isValidHost(host, 3)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_HOST); - return MOD_CONT; - } - - if (user) - { - for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) - { - if (!isalnum(*ch)) - { - notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); - return MOD_CONT; - } - } - } - - ci::string ci_bi_nick(bi->nick.c_str()); - if (ci_bi_nick != nick && findbot(nick)) - { - notice_lang(Config.s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick); - return MOD_CONT; - } - - if (ci_bi_nick != nick) - { - /* We check whether the nick is registered, and inform the user - * if so. You need to drop the nick manually before you can use - * it as a bot nick from now on -GD - */ - if (findnick(nick)) - { - notice_lang(Config.s_BotServ, u, NICK_ALREADY_REGISTERED, nick); - return MOD_CONT; - } - - /* The new nick is really different, so we remove the Q line for - the old nick. */ - if (ircd->sqline) - { - XLine x(bi->nick.c_str()); - ircdproto->SendSQLineDel(&x); - } - - /* We check whether user with this nick is online, and kill it if so */ - EnforceQlinedNick(nick, Config.s_BotServ); - } - - if (user) - ircdproto->SendQuit(bi, "Quit: Be right back"); - else - { - ircdproto->SendChangeBotNick(bi, nick); - XLine x(bi->nick.c_str(), "Reserved for services"); - ircdproto->SendSQLine(&x); - } - - if (bi->nick != nick) - bi->ChangeNick(nick); - - if (user && bi->user != user) - bi->user = user; - if (host && bi->host != host) - bi->host = host; - if (real && bi->real != real) - bi->real = real; - - if (user) - { - if (ircd->ts6) { - // This isn't the nicest way to do this, unfortunately. - bi->uid = ts6_uid_retrieve(); - } - ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->pseudoclient_mode, bi->uid); - XLine x(bi->nick.c_str(), "Reserved for services"); - ircdproto->SendSQLine(&x); - bi->RejoinAll(); - } - - notice_lang(Config.s_BotServ, u, BOT_BOT_CHANGED, oldnick, bi->nick.c_str(), bi->user.c_str(), bi->host.c_str(), bi->real.c_str()); - - FOREACH_MOD(I_OnBotChange, OnBotChange(bi)); - return MOD_CONT; - } - - CommandReturn DoDel(User *u, const std::vector ¶ms) - { - const char *nick = params[1].c_str(); - BotInfo *bi; - - if (!nick) - { - this->OnSyntaxError(u, "DEL"); - return MOD_CONT; - } - - if (!(bi = findbot(nick))) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); - return MOD_CONT; - } - - if (nickIsServices(nick, 0)) - { - notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); - return MOD_CONT; - } - - FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi)); - - ircdproto->SendQuit(bi, "Quit: Help! I'm being deleted by %s!", u->nick.c_str()); - XLine x(bi->nick.c_str()); - ircdproto->SendSQLineDel(&x); - - delete bi; - notice_lang(Config.s_BotServ, u, BOT_BOT_DELETED, nick); - return MOD_CONT; - } - public: - CommandBSBot() : Command("BOT", 1, 6) - { - this->SetFlag(CFLAG_STRIP_CHANNEL); - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - ci::string cmd = params[0]; - - if (readonly) - { - notice_lang(Config.s_BotServ, u, BOT_BOT_READONLY); - return MOD_CONT; - } - - if (cmd == "ADD") - { - // ADD nick user host real - 5 - if (!u->Account()->HasCommand("botserv/bot/add")) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (params.size() < 5) - { - this->OnSyntaxError(u, "ADD"); - return MOD_CONT; - } - - std::vector tempparams = params; - // ADD takes less params than CHANGE, so we need to take 6 if given and append it with a space to 5. - if (tempparams.size() >= 6) - tempparams[4] = tempparams[4] + " " + tempparams[5]; - - return this->DoAdd(u, tempparams); - } - else if (cmd == "CHANGE") - { - // CHANGE oldn newn user host real - 6 - // but only oldn and newn are required - if (!u->Account()->HasCommand("botserv/bot/change")) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (params.size() < 3) - { - this->OnSyntaxError(u, "CHANGE"); - return MOD_CONT; - } - - return this->DoChange(u, params); - } - else if (cmd == "DEL") - { - // DEL nick - if (!u->Account()->HasCommand("botserv/bot/del")) - { - notice_lang(Config.s_BotServ, u, ACCESS_DENIED); - return MOD_CONT; - } - - if (params.size() < 1) - { - this->OnSyntaxError(u, "DEL"); - return MOD_CONT; - } - - return this->DoDel(u, params); - } - else - this->OnSyntaxError(u, ""); - - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - notice_lang(Config.s_BotServ, u, BOT_SERVADMIN_HELP_BOT); - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - syntax_error(Config.s_BotServ, u, "BOT", BOT_BOT_SYNTAX); - } -}; - -class BSBot : public Module -{ - public: - BSBot(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetVersion(VERSION_STRING); - this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSBot()); - - ModuleManager::Attach(I_OnBotServHelp, this); - } - void OnBotServHelp(User *u) - { - notice_lang(Config.s_BotServ, u, BOT_HELP_CMD_BOT); - } -}; - -MODULE_INIT(BSBot) diff --git a/src/core/bs_bot.cpp b/src/core/bs_bot.cpp new file mode 100644 index 000000000..2c5888554 --- /dev/null +++ b/src/core/bs_bot.cpp @@ -0,0 +1,432 @@ +/* BotServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandBSBot : public Command +{ + private: + CommandReturn DoAdd(User *u, const std::vector ¶ms) + { + const char *nick = params[1].c_str(); + const char *user = params[2].c_str(); + const char *host = params[3].c_str(); + const char *real = params[4].c_str(); + const char *ch = NULL; + BotInfo *bi; + + if (findbot(nick)) + { + notice_lang(Config.s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick); + return MOD_CONT; + } + + if (strlen(nick) > Config.NickLen) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + if (strlen(user) > Config.UserLen) + { + notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen); + return MOD_CONT; + } + + if (strlen(user) > Config.HostLen) + { + notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen); + return MOD_CONT; + } + + /* Check the nick is valid re RFC 2812 */ + if (isdigit(nick[0]) || nick[0] == '-') + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) + { + if (!isvalidnick(*ch)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + } + + /* check for hardcored ircd forbidden nicks */ + if (!ircdproto->IsNickValid(nick)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + /* Check the host is valid re RFC 2812 */ + if (!isValidHost(host, 3)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_HOST); + return MOD_CONT; + } + + for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) + { + if (!isalnum(*ch)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); + return MOD_CONT; + } + } + + + /* We check whether the nick is registered, and inform the user + * if so. You need to drop the nick manually before you can use + * it as a bot nick from now on -GD + */ + if (findnick(nick)) + { + notice_lang(Config.s_BotServ, u, NICK_ALREADY_REGISTERED, nick); + return MOD_CONT; + } + + if (!(bi = new BotInfo(nick, user, host, real))) + { + notice_lang(Config.s_BotServ, u, BOT_BOT_CREATION_FAILED); + return MOD_CONT; + } + + /* We check whether user with this nick is online, and kill it if so */ + EnforceQlinedNick(nick, Config.s_BotServ); + + notice_lang(Config.s_BotServ, u, BOT_BOT_ADDED, bi->nick.c_str(), bi->user.c_str(), bi->host.c_str(), bi->real.c_str()); + + FOREACH_MOD(I_OnBotCreate, OnBotCreate(bi)); + return MOD_CONT; + } + + CommandReturn DoChange(User *u, const std::vector ¶ms) + { + const char *oldnick = params[1].c_str(); + const char *nick = params.size() > 2 ? params[2].c_str() : NULL; + const char *user = params.size() > 3 ? params[3].c_str() : NULL; + const char *host = params.size() > 4 ? params[4].c_str() : NULL; + const char *real = params.size() > 5 ? params[5].c_str() : NULL; + const char *ch = NULL; + BotInfo *bi; + + if (!oldnick || !nick) + { + this->OnSyntaxError(u, "CHANGE"); + return MOD_CONT; + } + + if (!(bi = findbot(oldnick))) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); + return MOD_CONT; + } + + if (stricmp(oldnick, nick) && nickIsServices(oldnick, 0)) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); + return MOD_CONT; + } + + if (strlen(nick) > Config.NickLen) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + if (user && strlen(user) > Config.UserLen) + { + notice_lang(Config.s_BotServ, u, BOT_LONG_IDENT, Config.UserLen); + return MOD_CONT; + } + + if (host && strlen(host) > Config.HostLen) + { + notice_lang(Config.s_BotServ, u, BOT_LONG_HOST, Config.HostLen); + return MOD_CONT; + } + + if (stricmp(oldnick, nick) && nickIsServices(nick, 0)) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, oldnick); + return MOD_CONT; + } + + /* Checks whether there *are* changes. + * Case sensitive because we may want to change just the case. + * And we must finally check that the nick is not already + * taken by another bot. + */ + if (bi->nick == nick && (user ? bi->user == user : 1) && (host ? bi->host == host : 1) && (real ? bi->real == real : 1)) + { + notice_lang(Config.s_BotServ, u, BOT_BOT_ANY_CHANGES); + return MOD_CONT; + } + + /* Check the nick is valid re RFC 2812 */ + if (isdigit(nick[0]) || nick[0] == '-') + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + for (ch = nick; *ch && (ch - nick) < Config.NickLen; ch++) + { + if (!isvalidnick(*ch)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + } + + /* check for hardcored ircd forbidden nicks */ + if (!ircdproto->IsNickValid(nick)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_NICK); + return MOD_CONT; + } + + if (host && !isValidHost(host, 3)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_HOST); + return MOD_CONT; + } + + if (user) + { + for (ch = user; *ch && (ch - user) < Config.UserLen; ch++) + { + if (!isalnum(*ch)) + { + notice_lang(Config.s_BotServ, u, BOT_BAD_IDENT, Config.UserLen); + return MOD_CONT; + } + } + } + + ci::string ci_bi_nick(bi->nick.c_str()); + if (ci_bi_nick != nick && findbot(nick)) + { + notice_lang(Config.s_BotServ, u, BOT_BOT_ALREADY_EXISTS, nick); + return MOD_CONT; + } + + if (ci_bi_nick != nick) + { + /* We check whether the nick is registered, and inform the user + * if so. You need to drop the nick manually before you can use + * it as a bot nick from now on -GD + */ + if (findnick(nick)) + { + notice_lang(Config.s_BotServ, u, NICK_ALREADY_REGISTERED, nick); + return MOD_CONT; + } + + /* The new nick is really different, so we remove the Q line for + the old nick. */ + if (ircd->sqline) + { + XLine x(bi->nick.c_str()); + ircdproto->SendSQLineDel(&x); + } + + /* We check whether user with this nick is online, and kill it if so */ + EnforceQlinedNick(nick, Config.s_BotServ); + } + + if (user) + ircdproto->SendQuit(bi, "Quit: Be right back"); + else + { + ircdproto->SendChangeBotNick(bi, nick); + XLine x(bi->nick.c_str(), "Reserved for services"); + ircdproto->SendSQLine(&x); + } + + if (bi->nick != nick) + bi->ChangeNick(nick); + + if (user && bi->user != user) + bi->user = user; + if (host && bi->host != host) + bi->host = host; + if (real && bi->real != real) + bi->real = real; + + if (user) + { + if (ircd->ts6) { + // This isn't the nicest way to do this, unfortunately. + bi->uid = ts6_uid_retrieve(); + } + ircdproto->SendClientIntroduction(bi->nick, bi->user, bi->host, bi->real, ircd->pseudoclient_mode, bi->uid); + XLine x(bi->nick.c_str(), "Reserved for services"); + ircdproto->SendSQLine(&x); + bi->RejoinAll(); + } + + notice_lang(Config.s_BotServ, u, BOT_BOT_CHANGED, oldnick, bi->nick.c_str(), bi->user.c_str(), bi->host.c_str(), bi->real.c_str()); + + FOREACH_MOD(I_OnBotChange, OnBotChange(bi)); + return MOD_CONT; + } + + CommandReturn DoDel(User *u, const std::vector ¶ms) + { + const char *nick = params[1].c_str(); + BotInfo *bi; + + if (!nick) + { + this->OnSyntaxError(u, "DEL"); + return MOD_CONT; + } + + if (!(bi = findbot(nick))) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); + return MOD_CONT; + } + + if (nickIsServices(nick, 0)) + { + notice_lang(Config.s_BotServ, u, BOT_DOES_NOT_EXIST, nick); + return MOD_CONT; + } + + FOREACH_MOD(I_OnBotDelete, OnBotDelete(bi)); + + ircdproto->SendQuit(bi, "Quit: Help! I'm being deleted by %s!", u->nick.c_str()); + XLine x(bi->nick.c_str()); + ircdproto->SendSQLineDel(&x); + + delete bi; + notice_lang(Config.s_BotServ, u, BOT_BOT_DELETED, nick); + return MOD_CONT; + } + public: + CommandBSBot() : Comman