From d54fd9b1e6b31f69332a9241b5f17330c0ad61e0 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 30 Aug 2006 09:03:03 +0000 Subject: Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5080 e03df62e-2008-0410-955e-edbf42e46eb7 --- .Makefile.inc | 1 - configure | 21 ++-- include/commands.h | 78 ------------- include/commands/cmd_motd.h | 5 +- include/commands/cmd_pass.h | 5 +- include/commands/cmd_pong.h | 5 +- include/commands/cmd_rules.h | 5 +- include/commands/cmd_squit.h | 5 +- include/commands/cmd_summon.h | 5 +- include/commands/cmd_users.h | 7 +- src/base.cpp | 5 - src/channels.cpp | 14 --- src/cmd_admin.cpp | 4 - src/cmd_away.cpp | 6 - src/cmd_commands.cpp | 4 - src/cmd_connect.cpp | 2 - src/cmd_die.cpp | 7 -- src/cmd_eline.cpp | 6 - src/cmd_gline.cpp | 8 +- src/cmd_info.cpp | 4 - src/cmd_invite.cpp | 5 - src/cmd_ison.cpp | 6 - src/cmd_join.cpp | 4 - src/cmd_kick.cpp | 5 - src/cmd_kill.cpp | 7 -- src/cmd_kline.cpp | 11 -- src/cmd_links.cpp | 5 - src/cmd_list.cpp | 2 - src/cmd_loadmodule.cpp | 4 - src/cmd_lusers.cpp | 4 - src/cmd_map.cpp | 5 - src/cmd_modules.cpp | 12 -- src/cmd_motd.cpp | 2 - src/cmd_names.cpp | 4 - src/cmd_nick.cpp | 10 +- src/cmd_notice.cpp | 8 -- src/cmd_oper.cpp | 13 --- src/cmd_part.cpp | 4 - src/cmd_pass.cpp | 2 - src/cmd_ping.cpp | 5 - src/cmd_pong.cpp | 2 - src/cmd_privmsg.cpp | 4 - src/cmd_qline.cpp | 3 - src/cmd_quit.cpp | 14 --- src/cmd_rehash.cpp | 4 - src/cmd_restart.cpp | 4 - src/cmd_rules.cpp | 2 - src/cmd_server.cpp | 4 - src/cmd_squit.cpp | 2 - src/cmd_stats.cpp | 21 +--- src/cmd_summon.cpp | 2 - src/cmd_time.cpp | 3 - src/cmd_topic.cpp | 3 - src/cmd_trace.cpp | 4 - src/cmd_unloadmodule.cpp | 4 - src/cmd_user.cpp | 10 +- src/cmd_userhost.cpp | 5 - src/cmd_users.cpp | 2 - src/cmd_version.cpp | 5 - src/cmd_wallops.cpp | 4 - src/cmd_who.cpp | 4 - src/cmd_whois.cpp | 2 - src/cmd_whowas.cpp | 3 - src/cmd_zline.cpp | 5 - src/command_parse.cpp | 255 +++++++++++++++++++++++++++++++++++++---- src/commands.cpp | 28 ----- src/configreader.cpp | 6 - src/cull_list.cpp | 18 --- src/dns.cpp | 7 -- src/dynamic.cpp | 7 -- src/hashcomp.cpp | 4 - src/helperfuncs.cpp | 20 ---- src/inspircd.cpp | 8 -- src/inspsocket.cpp | 6 - src/inspstring.cpp | 3 - src/message.cpp | 15 --- src/mode.cpp | 8 -- src/modes/cmode_h.cpp | 8 -- src/modes/cmode_o.cpp | 8 -- src/modes/cmode_v.cpp | 7 -- src/modules.cpp | 20 ---- src/modules/m_alias.cpp | 1 - src/modules/m_cban.cpp | 6 - src/modules/m_chanprotect.cpp | 1 - src/modules/m_check.cpp | 2 - src/modules/m_namesx.cpp | 2 - src/modules/m_remove.cpp | 19 ++- src/modules/m_safelist.cpp | 18 +-- src/modules/m_services.cpp | 2 - src/modules/m_spanningtree.cpp | 11 -- src/modules/m_spy.cpp | 23 +--- src/snomasks.cpp | 5 - src/socket.cpp | 1 - src/socketengine.cpp | 3 - src/socketengine_epoll.cpp | 3 - src/socketengine_kqueue.cpp | 4 - src/socketengine_select.cpp | 4 - src/timer.cpp | 5 - src/userprocess.cpp | 22 ---- src/users.cpp | 7 -- src/wildcard.cpp | 1 - src/xline.cpp | 15 --- 102 files changed, 283 insertions(+), 731 deletions(-) delete mode 100644 src/message.cpp diff --git a/.Makefile.inc b/.Makefile.inc index b699e6cce..8ab595c3b 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -49,7 +49,6 @@ install: all @-install -v -m 0700 src/libIRCDhash.so $(LIBPATH) @-install -v -m 0700 src/libIRCDhelper.so $(LIBPATH) @-install -v -m 0700 src/libIRCDinspsocket.so $(LIBPATH) - @-install -v -m 0700 src/libIRCDmessage.so $(LIBPATH) @-install -v -m 0700 src/libIRCDmode.so $(LIBPATH) @-install -v -m 0700 src/libIRCDmodules.so $(LIBPATH) @-install -v -m 0700 src/libIRCDsocket.so $(LIBPATH) diff --git a/configure b/configure index 5d47bdc7e..ee64860e6 100755 --- a/configure +++ b/configure @@ -1424,20 +1424,20 @@ elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) { if ($config{OSNAME} =~ /CYGWIN/) { print FH < -#include -#include -#include -#include -#include -#include "users.h" -#include "channels.h" -#include "modules.h" - -/* XXX Serious WTFness XXX - * - * Well, unless someone invents a wildcard or - * regexp #include, and makes it a standard, - * we're stuck with this way of including all - * the commands. - */ - -#include "commands/cmd_admin.h" -#include "commands/cmd_away.h" -#include "commands/cmd_commands.h" -#include "commands/cmd_connect.h" -#include "commands/cmd_die.h" -#include "commands/cmd_eline.h" -#include "commands/cmd_gline.h" -#include "commands/cmd_info.h" -#include "commands/cmd_invite.h" -#include "commands/cmd_ison.h" -#include "commands/cmd_join.h" -#include "commands/cmd_kick.h" -#include "commands/cmd_kill.h" -#include "commands/cmd_kline.h" -#include "commands/cmd_links.h" -#include "commands/cmd_list.h" -#include "commands/cmd_loadmodule.h" -#include "commands/cmd_lusers.h" -#include "commands/cmd_map.h" -#include "commands/cmd_modules.h" -#include "commands/cmd_motd.h" -#include "commands/cmd_names.h" -#include "commands/cmd_nick.h" -#include "commands/cmd_notice.h" -#include "commands/cmd_oper.h" -#include "commands/cmd_part.h" -#include "commands/cmd_pass.h" -#include "commands/cmd_ping.h" -#include "commands/cmd_pong.h" -#include "commands/cmd_privmsg.h" -#include "commands/cmd_qline.h" -#include "commands/cmd_quit.h" -#include "commands/cmd_rehash.h" -#include "commands/cmd_restart.h" -#include "commands/cmd_rules.h" -#include "commands/cmd_server.h" -#include "commands/cmd_squit.h" -#include "commands/cmd_stats.h" -#include "commands/cmd_summon.h" -#include "commands/cmd_time.h" -#include "commands/cmd_topic.h" -#include "commands/cmd_trace.h" -#include "commands/cmd_unloadmodule.h" -#include "commands/cmd_user.h" -#include "commands/cmd_userhost.h" -#include "commands/cmd_users.h" -#include "commands/cmd_version.h" -#include "commands/cmd_wallops.h" -#include "commands/cmd_who.h" -#include "commands/cmd_whois.h" -#include "commands/cmd_whowas.h" -#include "commands/cmd_zline.h" - - -#endif diff --git a/include/commands/cmd_motd.h b/include/commands/cmd_motd.h index 9389ea61e..310627ab1 100644 --- a/include/commands/cmd_motd.h +++ b/include/commands/cmd_motd.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h index 412710a2b..6cc48d423 100644 --- a/include/commands/cmd_pass.h +++ b/include/commands/cmd_pass.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_pong.h b/include/commands/cmd_pong.h index 2857f0b86..2399603e7 100644 --- a/include/commands/cmd_pong.h +++ b/include/commands/cmd_pong.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_rules.h b/include/commands/cmd_rules.h index ae6bc86c7..496f4a0f0 100644 --- a/include/commands/cmd_rules.h +++ b/include/commands/cmd_rules.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_squit.h b/include/commands/cmd_squit.h index 11da3d832..0c6f06f1a 100644 --- a/include/commands/cmd_squit.h +++ b/include/commands/cmd_squit.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_summon.h b/include/commands/cmd_summon.h index c0bc6e17a..eaf4735d1 100644 --- a/include/commands/cmd_summon.h +++ b/include/commands/cmd_summon.h @@ -19,12 +19,9 @@ // include the common header files -#include -#include #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/include/commands/cmd_users.h b/include/commands/cmd_users.h index 552a42382..bd1607607 100644 --- a/include/commands/cmd_users.h +++ b/include/commands/cmd_users.h @@ -18,13 +18,10 @@ #define __CMD_USERS_H__ // include the common header files - -#include -#include +// #include -#include -#include #include +#include "inspircd.h" #include "users.h" #include "channels.h" diff --git a/src/base.cpp b/src/base.cpp index 6b680ce1a..b2101d574 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -17,12 +17,7 @@ #include "inspircd_config.h" #include "base.h" #include -#include -#include -#include #include "inspircd.h" -#include "modules.h" - const int bitfields[] = {1,2,4,8,16,32,64,128}; const int inverted_bitfields[] = {~1,~2,~4,~8,~16,~32,~64,~128}; diff --git a/src/channels.cpp b/src/channels.cpp index ba4277eb5..f340e12bf 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -16,27 +16,13 @@ using namespace std; -#include -#include -#include -#include -#include #include #include "configreader.h" #include "inspircd.h" -#include "hash_map.h" #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" -#include "commands.h" #include "wildcard.h" #include "mode.h" -#include "xline.h" -#include "inspstring.h" - -#include "typedefs.h" chanrec::chanrec(InspIRCd* Instance) : ServerInstance(Instance) { diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp index d87b2de2c..3db1457e4 100644 --- a/src/cmd_admin.cpp +++ b/src/cmd_admin.cpp @@ -16,12 +16,8 @@ #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_admin.h" - - void cmd_admin::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("256 %s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName); diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp index 64c16e914..6746cf5e2 100644 --- a/src/cmd_away.cpp +++ b/src/cmd_away.cpp @@ -14,17 +14,11 @@ * --------------------------------------------------- */ -#include -#include "inspircd_config.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_away.h" - - void cmd_away::Handle (const char** parameters, int pcnt, userrec *user) { if ((pcnt) && (*parameters[0])) diff --git a/src/cmd_commands.cpp b/src/cmd_commands.cpp index d61c5d8ee..bd4f0db65 100644 --- a/src/cmd_commands.cpp +++ b/src/cmd_commands.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_commands.h" - - void cmd_commands::Handle (const char** parameters, int pcnt, userrec *user) { for (nspace::hash_map::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++) diff --git a/src/cmd_connect.cpp b/src/cmd_connect.cpp index b8383d93c..5e33316a8 100644 --- a/src/cmd_connect.cpp +++ b/src/cmd_connect.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_connect.h" /* diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp index e3ee48296..353c8ccd6 100644 --- a/src/cmd_die.cpp +++ b/src/cmd_die.cpp @@ -14,17 +14,10 @@ * --------------------------------------------------- */ -#include -#include -#include #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_die.h" - - void cmd_die::Handle (const char** parameters, int pcnt, userrec *user) { if (!strcmp(parameters[0],ServerInstance->Config->diepass)) diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp index 4af72138a..be49fe714 100644 --- a/src/cmd_eline.cpp +++ b/src/cmd_eline.cpp @@ -14,18 +14,12 @@ * --------------------------------------------------- */ -#include -#include #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "xline.h" - #include "commands/cmd_eline.h" - - void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user) { if (pcnt >= 3) diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp index d167e698b..c2921d64d 100644 --- a/src/cmd_gline.cpp +++ b/src/cmd_gline.cpp @@ -14,17 +14,11 @@ * --------------------------------------------------- */ -#include -#include #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "xline.h" - -#include "commands/cmd_eline.h" - - +#include "commands/cmd_gline.h" void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user) { diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp index 8f81c823f..b3253daef 100644 --- a/src/cmd_info.cpp +++ b/src/cmd_info.cpp @@ -17,12 +17,8 @@ #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_info.h" - - void cmd_info::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ( "371 %s :. o O (The Inspire Internet Relay Chat Server) O o .", user->nick); diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp index 781bcad28..9c5abacde 100644 --- a/src/cmd_invite.cpp +++ b/src/cmd_invite.cpp @@ -14,16 +14,11 @@ * --------------------------------------------------- */ -#include #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_invite.h" - - void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user) { int MOD_RESULT = 0; diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp index 5500334ce..cf60b6f6b 100644 --- a/src/cmd_ison.cpp +++ b/src/cmd_ison.cpp @@ -14,16 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" -#include "ctables.h" #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_ison.h" - - void cmd_ison::Handle (const char** parameters, int pcnt, userrec *user) { char retbuf[MAXBUF]; diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp index 3e3801432..25fb558f1 100644 --- a/src/cmd_join.cpp +++ b/src/cmd_join.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_join.h" - - void cmd_join::Handle (const char** parameters, int pcnt, userrec *user) { if (pcnt > 1) diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp index 07b389689..8c0b83498 100644 --- a/src/cmd_kick.cpp +++ b/src/cmd_kick.cpp @@ -14,15 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_kick.h" - - void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user) { char reason[MAXKICK]; diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index bb5d47f12..fa294ad9e 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -14,18 +14,11 @@ * --------------------------------------------------- */ -#include -#include "inspircd_config.h" -#include "hash_map.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_kill.h" - - void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) { userrec *u = ServerInstance->FindNick(parameters[0]); diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp index ff1805753..eb83cfbf4 100644 --- a/src/cmd_kline.cpp +++ b/src/cmd_kline.cpp @@ -14,21 +14,10 @@ * --------------------------------------------------- */ -#include -#include -#include -#include -#include -#include - -#include "inspircd_config.h" #include "configreader.h" -#include "hash_map.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "xline.h" - #include "commands/cmd_kline.h" void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp index 1c61b0e70..d1312fbe0 100644 --- a/src/cmd_links.cpp +++ b/src/cmd_links.cpp @@ -14,16 +14,11 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_links.h" - - void cmd_links::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("364 %s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc); diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp index ab9ca083d..066c80611 100644 --- a/src/cmd_list.cpp +++ b/src/cmd_list.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "ctables.h" -#include "commands.h" #include "inspircd.h" #include "commands/cmd_list.h" #include "wildcard.h" diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp index 9b3a85f1d..b2bf2c72f 100644 --- a/src/cmd_loadmodule.cpp +++ b/src/cmd_loadmodule.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_loadmodule.h" - - void cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->LoadModule(parameters[0])) diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp index 416dd2924..69ec7494f 100644 --- a/src/cmd_lusers.cpp +++ b/src/cmd_lusers.cpp @@ -15,13 +15,9 @@ */ #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_lusers.h" - - void cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user) { // this lusers command shows one server at all times because diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp index 19e963e63..b8873b6c1 100644 --- a/src/cmd_map.cpp +++ b/src/cmd_map.cpp @@ -14,15 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_map.h" - - void cmd_map::Handle (const char** parameters, int pcnt, userrec *user) { // as with /LUSERS this does nothing without a linking diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp index 442983873..8b1f2ac3f 100644 --- a/src/cmd_modules.cpp +++ b/src/cmd_modules.cpp @@ -14,25 +14,13 @@ * --------------------------------------------------- */ -#include -#include -#include -#include -#include -#include -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" -#include "hash_map.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "wildcard.h" #include "commands/cmd_modules.h" - - char* itab[] = { "OnUserConnect", "OnUserQuit", "OnUserDisconnect", "OnUserJoin", "OnUserPart", "OnRehash", "OnServerRaw", "OnExtendedMode", "OnUserPreJoin", "OnUserPreKick", "OnUserKick", "OnOper", "OnInfo", "OnWhois", "OnUserPreInvite", diff --git a/src/cmd_motd.cpp b/src/cmd_motd.cpp index c57da2e9f..5c47f3541 100644 --- a/src/cmd_motd.cpp +++ b/src/cmd_motd.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_motd.h" void cmd_motd::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp index 0012a132f..ac8e18270 100644 --- a/src/cmd_names.cpp +++ b/src/cmd_names.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_names.h" - - void cmd_names::Handle (const char** parameters, int pcnt, userrec *user) { chanrec* c; diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 04d204d7b..d15c49367 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -14,19 +14,11 @@ * --------------------------------------------------- */ -#include -#include -#include "inspircd_config.h" #include "configreader.h" -#include "hash_map.h" #include "users.h" #include "modules.h" -#include "commands.h" -#include "xline.h" -#include "dns.h" - #include "inspircd.h" -#include "hashcomp.h" +#include "xline.h" #include "commands/cmd_nick.h" void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp index 006036145..394346a44 100644 --- a/src/cmd_notice.cpp +++ b/src/cmd_notice.cpp @@ -14,18 +14,10 @@ * --------------------------------------------------- */ -#include -#include -#include -#include #include "configreader.h" -#include "hash_map.h" #include "users.h" #include "modules.h" #include "wildcard.h" -#include "commands.h" - -#include "hashcomp.h" #include "commands/cmd_notice.h" void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp index f62d7bd7f..bf81ee19e 100644 --- a/src/cmd_oper.cpp +++ b/src/cmd_oper.cpp @@ -14,24 +14,11 @@ * --------------------------------------------------- */ -#include -#include -#include -#include "inspircd_config.h" #include "configreader.h" #include "typedefs.h" #include "users.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" -#include "commands.h" -#include "mode.h" -#include "xline.h" -#include "inspstring.h" -#include "hashcomp.h" -#include "socketengine.h" -#include "command_parse.h" #include "commands/cmd_oper.h" bool OneOfMatches(const char* host, const char* ip, const char* hostlist) diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp index afa59580c..c77dbe5eb 100644 --- a/src/cmd_part.cpp +++ b/src/cmd_part.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_part.h" - - void cmd_part::Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp index 080cd6517..ed34dbb85 100644 --- a/src/cmd_pass.cpp +++ b/src/cmd_pass.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_pass.h" void cmd_pass::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp index 515312670..8c8a6a992 100644 --- a/src/cmd_ping.cpp +++ b/src/cmd_ping.cpp @@ -16,13 +16,8 @@ #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_ping.h" - - - void cmd_ping::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]); diff --git a/src/cmd_pong.cpp b/src/cmd_pong.cpp index 11973a729..5317ad5b3 100644 --- a/src/cmd_pong.cpp +++ b/src/cmd_pong.cpp @@ -15,10 +15,8 @@ */ #include "users.h" -#include "commands.h" #include "commands/cmd_pong.h" - void cmd_pong::Handle (const char** parameters, int pcnt, userrec *user) { // set the user as alive so they survive to next ping diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index ce5ece2a2..5078c8a4a 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -14,15 +14,11 @@ * --------------------------------------------------- */ -#include -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" #include "users.h" #include "modules.h" #include "wildcard.h" -#include "commands.h" - #include "commands/cmd_privmsg.h" void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp index 4de2a4c38..e1bec6ddc 100644 --- a/src/cmd_qline.cpp +++ b/src/cmd_qline.cpp @@ -14,13 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "xline.h" - #include "commands/cmd_qline.h" void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp index c1e73bc84..19dbf9bf0 100644 --- a/src/cmd_quit.cpp +++ b/src/cmd_quit.cpp @@ -14,24 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" -#include "wildcard.h" -#include "commands.h" -#include "mode.h" -#include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" -#include "socketengine.h" #include "commands/cmd_quit.h" void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp index 0a535adc3..f7017da4e 100644 --- a/src/cmd_rehash.cpp +++ b/src/cmd_rehash.cpp @@ -14,15 +14,11 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "commands/cmd_rehash.h" - - void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(CONFIG_FILE)); diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp index 5704b3416..c159b8b0c 100644 --- a/src/cmd_restart.cpp +++ b/src/cmd_restart.cpp @@ -16,12 +16,8 @@ #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_restart.h" - - void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user) { char *argv[32]; diff --git a/src/cmd_rules.cpp b/src/cmd_rules.cpp index f1788772e..38a815837 100644 --- a/src/cmd_rules.cpp +++ b/src/cmd_rules.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_rules.h" void cmd_rules::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp index e179f9305..691780b2f 100644 --- a/src/cmd_server.cpp +++ b/src/cmd_server.cpp @@ -15,13 +15,9 @@ */ #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_server.h" - - void cmd_server::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteServ("666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick); diff --git a/src/cmd_squit.cpp b/src/cmd_squit.cpp index e583d4fa3..f6d334028 100644 --- a/src/cmd_squit.cpp +++ b/src/cmd_squit.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_squit.h" /* diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 71031e570..9335ea09b 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -14,31 +14,12 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" -#include "hash_map.h" -#include -#include #include -#ifndef RUSAGE_SELF -#define RUSAGE_SELF 0 -#define RUSAGE_CHILDREN -1 -#endif #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" -#include "wildcard.h" -#include "commands.h" -#include "mode.h" #include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" -#include "socketengine.h" -#include "command_parse.h" #include "commands/cmd_stats.h" void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user) @@ -163,7 +144,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(ServerInstance->Config->RULES.size())); results.push_back(sn+" 249 "+user->nick+" :Modules(VECTOR) "+ConvToStr(ServerInstance->modules.size())+" ("+ConvToStr(ServerInstance->modules.size()*sizeof(Module))+")"); results.push_back(sn+" 249 "+user->nick+" :ClassFactories(VECTOR) "+ConvToStr(ServerInstance->factory.size())+" ("+ConvToStr(ServerInstance->factory.size()*sizeof(ircd_module))+")"); - if (!getrusage(RUSAGE_SELF,&R)) + if (!getrusage(0,&R)) /* RUSAGE_SELF */ { results.push_back(sn+" 249 "+user->nick+" :Total allocation: "+ConvToStr(R.ru_maxrss)+"K"); results.push_back(sn+" 249 "+user->nick+" :Signals: "+ConvToStr(R.ru_nsignals)); diff --git a/src/cmd_summon.cpp b/src/cmd_summon.cpp index c14f9af5d..4a95d15ca 100644 --- a/src/cmd_summon.cpp +++ b/src/cmd_summon.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_summon.h" void cmd_summon::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp index a4ae310d1..9fb9cf702 100644 --- a/src/cmd_time.cpp +++ b/src/cmd_time.cpp @@ -14,11 +14,8 @@ * --------------------------------------------------- */ -#include #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_time.h" void cmd_time::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp index 1939af7b2..07498a1b3 100644 --- a/src/cmd_topic.cpp +++ b/src/cmd_topic.cpp @@ -14,14 +14,11 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "commands/cmd_topic.h" - void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user) { chanrec* Ptr; diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp index 6f4fecc75..d1bbd0e6f 100644 --- a/src/cmd_trace.cpp +++ b/src/cmd_trace.cpp @@ -15,13 +15,9 @@ */ #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_trace.h" - - void cmd_trace::Handle (const char** parameters, int pcnt, userrec *user) { for (user_hash::iterator i = ServerInstance->clientlist.begin(); i != ServerInstance->clientlist.end(); i++) diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp index df84603a6..88600ada9 100644 --- a/src/cmd_unloadmodule.cpp +++ b/src/cmd_unloadmodule.cpp @@ -16,12 +16,8 @@ #include "inspircd.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_unloadmodule.h" - - void cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user) { if (ServerInstance->UnloadModule(parameters[0])) diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp index 66a275c72..12a29f3bd 100644 --- a/src/cmd_user.cpp +++ b/src/cmd_user.cpp @@ -14,15 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_user.h" - - void cmd_user::Handle (const char** parameters, int pcnt, userrec *user) { if (user->registered < REG_NICKUSER) @@ -34,8 +29,9 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user) } else { /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */ - /* XXX - Should this IDENTMAX + 1 be IDENTMAX - 1? Ok, users.h has it defined as - * char ident[IDENTMAX+2]; - WTF? + /* XXX - The ident field is IDENTMAX+2 in size to account for +1 for the optional + * ~ character, and +1 for null termination, therefore we can safely use up to + * IDENTMAX here. */ strlcpy(user->ident, parameters[0], IDENTMAX); strlcpy(user->fullname,parameters[3],MAXGECOS); diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp index d78d24646..4c94dcb90 100644 --- a/src/cmd_userhost.cpp +++ b/src/cmd_userhost.cpp @@ -14,15 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "users.h" -#include "commands.h" - #include "inspircd.h" #include "commands/cmd_userhost.h" - - void cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user) { char Return[MAXBUF],junk[MAXBUF]; diff --git a/src/cmd_users.cpp b/src/cmd_users.cpp index ff8877df4..50db9e473 100644 --- a/src/cmd_users.cpp +++ b/src/cmd_users.cpp @@ -15,8 +15,6 @@ */ #include "users.h" -#include "commands.h" - #include "commands/cmd_users.h" void cmd_users::Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp index eab4aec01..c050121a4 100644 --- a/src/cmd_version.cpp +++ b/src/cmd_version.cpp @@ -17,13 +17,8 @@ #include "inspircd.h" #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_version.h" - - - void cmd_version::Handle (const char** parameters, int pcnt, userrec *user) { std::stringstream out(ServerInstance->Config->data005); diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp index 11a4664e8..d47d7ae77 100644 --- a/src/cmd_wallops.cpp +++ b/src/cmd_wallops.cpp @@ -16,12 +16,8 @@ #include "configreader.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_wallops.h" - - void cmd_wallops::Handle (const char** parameters, int pcnt, userrec *user) { user->WriteWallOps(std::string(parameters[0])); diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 6f52ebb63..5ab54dc02 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -17,13 +17,9 @@ #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "wildcard.h" #include "commands/cmd_who.h" - - /* get the last 'visible' chan of a user */ static char *getlastchanname(userrec *u) { diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index a2cc3343a..3e8406dd1 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -18,8 +18,6 @@ #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" - #include "commands/cmd_whois.h" const char* Spacify(char* n) diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp index fe0d8c90d..ba2c6460d 100644 --- a/src/cmd_whowas.cpp +++ b/src/cmd_whowas.cpp @@ -14,11 +14,8 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "users.h" -#include "commands.h" - #include "commands/cmd_whowas.h" void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user) diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp index 145b1ee2e..0a87a030b 100644 --- a/src/cmd_zline.cpp +++ b/src/cmd_zline.cpp @@ -14,18 +14,13 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" #include "users.h" #include "modules.h" -#include "commands.h" #include "xline.h" - #include "commands/cmd_zline.h" - - void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user) { if (pcnt >= 3) diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d7c8aefe5..7febff972 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -14,40 +14,249 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include "users.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" -#include "mode.h" -#include "commands.h" #include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" #include "socketengine.h" #include "userprocess.h" #include "socket.h" -#include "dns.h" -#include "typedefs.h" #include "command_parse.h" -#include "ctables.h" - #define nspace __gnu_cxx +/* XXX Serious WTFness XXX + * + * Well, unless someone invents a wildcard or + * regexp #include, and makes it a standard, + * we're stuck with this way of including all + * the commands. + */ + +#include "commands/cmd_admin.h" +#include "commands/cmd_away.h" +#include "commands/cmd_commands.h" +#include "commands/cmd_connect.h" +#include "commands/cmd_die.h" +#include "commands/cmd_eline.h" +#include "commands/cmd_gline.h" +#include "commands/cmd_info.h" +#include "commands/cmd_invite.h" +#include "commands/cmd_ison.h" +#include "commands/cmd_join.h" +#include "commands/cmd_kick.h" +#include "commands/cmd_kill.h" +#include "commands/cmd_kline.h" +#include "commands/cmd_links.h" +#include "commands/cmd_list.h" +#include "commands/cmd_loadmodule.h" +#include "commands/cmd_lusers.h" +#include "commands/cmd_map.h" +#include "commands/cmd_modules.h" +#include "commands/cmd_motd.h" +#include "commands/cmd_names.h" +#include "commands/cmd_nick.h" +#include "commands/cmd_notice.h" +#include "commands/cmd_oper.h" +#include "commands/cmd_part.h" +#include "commands/cmd_pass.h" +#include "commands/cmd_ping.h" +#include "commands/cmd_pong.h" +#include "commands/cmd_privmsg.h" +#include "commands/cmd_qline.h" +#include "commands/cmd_quit.h" +#include "commands/cmd_rehash.h" +#include "commands/cmd_restart.h" +#include "commands/cmd_rules.h" +#include "commands/cmd_server.h" +#include "commands/cmd_squit.h" +#include "commands/cmd_stats.h" +#include "commands/cmd_summon.h" +#include "commands/cmd_time.h" +#include "commands/cmd_topic.h" +#include "commands/cmd_trace.h" +#include "commands/cmd_unloadmodule.h" +#include "commands/cmd_user.h" +#include "commands/cmd_userhost.h" +#include "commands/cmd_users.h" +#include "commands/cmd_version.h" +#include "commands/cmd_wallops.h" +#include "commands/cmd_who.h" +#include "commands/cmd_whois.h" +#include "commands/cmd_whowas.h" +#include "commands/cmd_zline.h" + +bool InspIRCd::ULine(const char* server) +{ + if (!server) + return false; + if (!*server) + return true; + + return (find(Config->ulines.begin(),Config->ulines.end(),server) != Config->ulines.end()); +} + +int InspIRCd::OperPassCompare(const char* data,const char* input) +{ + int MOD_RESULT = 0; + FOREACH_RESULT_I(this,I_OnOperCompare,OnOperCompare(data,input)) + Log(DEBUG,"OperPassCompare: %d",MOD_RESULT); + if (MOD_RESULT == 1) + return 0; + if (MOD_RESULT == -1) + return 1; + Log(DEBUG,"strcmp fallback: '%s' '%s' %d",data,input,strcmp(data,input)); + return strcmp(data,input); +} + +long InspIRCd::Duration(const char* str) +{ + char n_field[MAXBUF]; + long total = 0; + n_field[0] = 0; + + if ((!strchr(str,'s')) && (!strchr(str,'m')) && (!strchr(str,'h')) && (!strchr(str,'d')) && (!strchr(str,'w')) && (!strchr(str,'y'))) + { + std::string n = str; + n += 's'; + return Duration(n.c_str()); + } + + for (char* i = (char*)str; *i; i++) + { + // if we have digits, build up a string for the value in n_field, + // up to 10 digits in size. + if ((*i >= '0') && (*i <= '9')) + { + strlcat(n_field,i,10); + } + else + { + // we dont have a digit, check for numeric tokens + switch (tolower(*i)) + { + case 's': + total += atoi(n_field); + break; + + case 'm': + total += (atoi(n_field)*duration_m); + break; + + case 'h': + total += (atoi(n_field)*duration_h); + break; + + case 'd': + total += (atoi(n_field)*duration_d); + break; + + case 'w': + total += (atoi(n_field)*duration_w); + break; + + case 'y': + total += (atoi(n_field)*duration_y); + break; + } + n_field[0] = 0; + } + } + // add trailing seconds + total += atoi(n_field); + + return total; +} + +/* All other ircds when doing this check usually just look for a string of *@* or *. We're smarter than that, though. */ + +bool InspIRCd::HostMatchesEveryone(const std::string &mask, userrec* user) +{ + char buffer[MAXBUF]; + char itrigger[MAXBUF]; + long matches = 0; + + if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF)) + strlcpy(itrigger,"95.5",MAXBUF); + + if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0)) + return false; + + for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++) + { + strlcpy(buffer,u->second->ident,MAXBUF); + charlcat(buffer,'@',MAXBUF); + strlcat(buffer,u->second->host,MAXBUF); + if (match(buffer,mask.c_str())) + matches++; + } + float percent = ((float)matches / (float)clientlist.size()) * 100; + if (percent > (float)atof(itrigger)) + { + WriteOpers("*** \2WARNING\2: %s tried to set a G/K/E line mask of %s, which covers %.2f%% of the network!",user->nick,mask.c_str(),percent); + return true; + } + return false; +} + +bool InspIRCd::IPMatchesEveryone(const std::string &ip, userrec* user) +{ + char itrigger[MAXBUF]; + long matches = 0; + + if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF)) + strlcpy(itrigger,"95.5",MAXBUF); + + if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0)) + return false; + + for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++) + { + if (match(u->second->GetIPString(),ip.c_str(),true)) + matches++; + } + + float percent = ((float)matches / (float)clientlist.size()) * 100; + if (percent > (float)atof(itrigger)) + { + WriteOpers("*** \2WARNING\2: %s tried to set a Z line mask of %s, which covers %.2f%% of the network!",user->nick,ip.c_str(),percent); + return true; + } + return false; +} + +bool InspIRCd::NickMatchesEveryone(const std::string &nick, userrec* user) +{ + char itrigger[MAXBUF]; + long matches = 0; + + if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF)) + strlcpy(itrigger,"95.5",MAXBUF); + + if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0)) + return false; + + for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++) + { + if (match(u->second->nick,nick.c_str())) + matches++; + } + + float percent = ((float)matches / (float)clientlist.size()) * 100; + if (percent > (float)atof(itrigger)) + { + WriteOpers("*** \2WARNING\2: %s tried to set a Q line mask of %s, which covers %.2f%% of the network!",user->nick,nick.c_str(),percent); + return true; + } + return false; +} + + + + + /* Special commands which may occur without registration of the user */ cmd_user* command_user; cmd_nick* command_nick; @@ -293,9 +502,9 @@ void CommandParser::ProcessBuffer(std::string &buffer,userrec *user) if (!user) return; - while ((a = buffer.find("\n")) != std::string::npos) + while ((a = buffer.rfind("\n")) != std::string::npos) buffer.erase(a); - while ((a = buffer.find("\r")) != std::string::npos) + while ((a = buffer.rfind("\r")) != std::string::npos) buffer.erase(a); if (buffer.length()) diff --git a/src/commands.cpp b/src/commands.cpp index 7e2878497..581dde34b 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -14,42 +14,14 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include "configreader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef RUSAGE_SELF -#define RUSAGE_SELF 0 -#define RUSAGE_CHILDREN -1 -#endif #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" -#include "commands.h" -#include "mode.h" #include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" -#include "socketengine.h" -#include "typedefs.h" #include "command_parse.h" -/* XXX - these really belong in helperfuncs perhaps -- w00t */ bool InspIRCd::ULine(const char* server) { if (!server) diff --git a/src/configreader.cpp b/src/configreader.cpp index d8651766d..81ed63bf2 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -14,16 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" -#include #include -#include #include #include "inspircd.h" -#include "inspstring.h" - -#include "userprocess.h" #include "xline.h" std::vector old_module_names, new_module_names, added_modules, removed_modules; diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 74e16e64e..9fd4a6987 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -16,26 +16,8 @@ using namespace std; -#include "inspircd_config.h" #include "inspircd.h" -#include -#include -#include -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" -#include "modules.h" -#include "dynamic.h" -#include "wildcard.h" -#include "commands.h" -#include "xline.h" -#include "inspstring.h" -#include "inspircd.h" - -#include "hashcomp.h" -#include "typedefs.h" #include "cull_list.h" /* diff --git a/src/dns.cpp b/src/dns.cpp index 8f23eaa6c..d25a5e102 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -26,20 +26,13 @@ looks like this, walks like this or tastes like this. using namespace std; -#include -#include #include #include #include -#include -#include #include #include -#include #include "dns.h" #include "inspircd.h" - -#include "inspircd_config.h" #include "socketengine.h" #include "configreader.h" #include "socket.h" diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 3a6c0897c..ab6f55610 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -16,9 +16,7 @@ using namespace std; -#include "inspircd_config.h" #include "configreader.h" -#include "globals.h" #include "dynamic.h" #ifndef STATIC_LINK @@ -27,12 +25,7 @@ using namespace std; #include "modlist.h" #endif -#include "inspstring.h" - #include "inspircd.h" -#include -#include -#include DLLManager::DLLManager(InspIRCd* ServerInstance, const char *fname) { diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index aa53da964..88b9b582c 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -16,13 +16,9 @@ using namespace std; -#include "inspircd_config.h" #include "inspircd.h" -#include #include "hashcomp.h" - #include - #define nspace __gnu_cxx /****************************************************** diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 07f9228d4..4afe7afeb 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -15,32 +15,12 @@ */ #include -#include "inspircd_config.h" #include "configreader.h" -#include -#include -#include -#include -#include -#include -#include -#ifdef HAS_EXECINFO -#include -#endif -#include "connection.h" #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" #include "mode.h" #include "xline.h" -#include "commands.h" -#include "inspstring.h" - -#include "hashcomp.h" -#include "typedefs.h" #include "inspircd.h" static char TIMESTR[26]; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 328306744..7efbaa54f 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -30,16 +30,8 @@ #include "inspircd.h" #include "configreader.h" #include -#include -#include #include -#include -#include -#include -#include #include -#include -#include #include "modules.h" #include "mode.h" #include "xline.h" diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 63bfee39e..d1dc1ce6b 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -14,12 +14,6 @@ * --------------------------------------------------- */ -#include -#include -#include -#include -#include -#include "inspircd_config.h" #include "socket.h" #include "configreader.h" #include "inspstring.h" diff --git a/src/inspstring.cpp b/src/inspstring.cpp index 71aed43ba..83f058b18 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -1,8 +1,5 @@ -#include "inspircd_config.h" #include "inspstring.h" -#include #include -#include /* * Copyright (c) 1998 Todd C. Miller diff --git a/src/message.cpp b/src/message.cpp deleted file mode 100644 index 09385df22..000000000 --- a/src/message.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * - * - * Written by Craig Edwards, Craig McLure, and others. - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ diff --git a/src/mode.cpp b/src/mode.cpp index 3faea44ba..32ec4e64d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -16,17 +16,10 @@ using namespace std; -#include "inspircd_config.h" #include "inspircd.h" -#include "configreader.h" -#include -#include "hash_map.h" -#include "connection.h" #include "users.h" #include "modules.h" #include "inspstring.h" - -#include "commands.h" #include "mode.h" /* +s (secret) */ @@ -53,7 +46,6 @@ using namespace std; #include "modes/cmode_h.h" /* +v (channel voice) */ #include "modes/cmode_v.h" - /* +s (server notices) */ #include "modes/umode_s.h" /* +w (see wallops) */ diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index d58fb94c9..9197cbd72 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -1,17 +1,9 @@ -#include -#include -#include "inspircd_config.h" #include "configreader.h" -#include "hash_map.h" #include "inspircd.h" #include "mode.h" #include "channels.h" #include "users.h" - -#include "commands.h" #include "modules.h" -#include "inspstring.h" -#include "hashcomp.h" #include "modes/cmode_h.h" ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, 'h', 1, 1, true, MODETYPE_CHANNEL, false, '%') diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index bed7da615..85eb08c38 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -1,17 +1,9 @@ -#include -#include -#include "inspircd_config.h" #include "configreader.h" -#include "hash_map.h" #include "inspircd.h" #include "mode.h" #include "channels.h" #include "users.h" - -#include "commands.h" #include "modules.h" -#include "inspstring.h" -#include "hashcomp.h" #include "modes/cmode_o.h" ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(Instance, 'o', 1, 1, true, MODETYPE_CHANNEL, false, '@') diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index f12d9f9cf..50b74cef7 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -1,16 +1,9 @@ -#include -#include -#include "inspircd_config.h" #include "configreader.h" -#include "hash_map.h" #include "inspircd.h" #include "mode.h" #include "channels.h" #include "users.h" -#include "commands.h" #include "modules.h" -#include "inspstring.h" -#include "hashcomp.h" #include "modes/cmode_v.h" ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+') diff --git a/src/modules.cpp b/src/modules.cpp index fe6db535c..d3db06d45 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -14,39 +14,19 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" -//#include "inspircd.h" #include "configreader.h" -#include -#include -#include -#include -#include -#include -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" #include "mode.h" #include "xline.h" -#include "commands.h" -#include "inspstring.h" - -#include "hashcomp.h" #include "socket.h" #include "socketengine.h" -#include "typedefs.h" -#include "modules.h" #include "command_parse.h" #include "dns.h" #include "inspircd.h" // version is a simple class for holding a modules version number - Version::Version(int major, int minor, int revision, int build, int flags) : Major(major), Minor(minor), Revision(revision), Build(build), Flags(flags) { diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 855b5b46c..d7ac3d04a 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -19,7 +19,6 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" #include "inspircd.h" #include diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index a774968bb..21a3533ec 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -16,15 +16,9 @@ */ #include -#include -#include -#include #include "users.h" #include "channels.h" #include "modules.h" - -#include "hashcomp.h" -#include "commands.h" #include "configreader.h" #include "inspircd.h" diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 5a6e4853d..4127f0eb3 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -18,7 +18,6 @@ #include "channels.h" #include "modules.h" #include "inspircd.h" -#include "commands.h" /* $ModDesc: Provides channel modes +a and +q */ diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index b3a9dbb1f..d09793489 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -19,9 +19,7 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" #include "inspircd.h" - #include "wildcard.h" /* $ModDesc: Provides the /check command to retrieve information on a user, channel, or IP address */ diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 90c55e648..267c8f468 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -19,9 +19,7 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" #include "inspircd.h" -#include static const char* dummy = "ON"; diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 0d66f0202..95c454347 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -1,14 +1,27 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. + * E-mail: + * + * + * + * Written by Craig Edwards, Craig McLure, and others. + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + /* Support for a dancer-style /remove command, an alternative to /kick to try and avoid auto-rejoin-on-kick scripts */ /* Written by Om, 25-03-05 */ #include -#include #include "users.h" #include "channels.h" #include "modules.h" - #include "configreader.h" -#include "commands.h" #include "inspircd.h" /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 1f7f2742f..831ddcac5 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -19,10 +19,9 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" - -#include #include "configreader.h" #include "inspircd.h" +#include "wildcard.h" class ListData : public classbase { @@ -30,9 +29,10 @@ class ListData : public classbase long list_start; long list_position; bool list_ended; + const std::string glob; ListData() : list_start(0), list_position(0), list_ended(false) {}; - ListData(long pos, time_t t) : list_start(t), list_position(pos), list_ended(false) {}; + ListData(long pos, time_t t, const std::string &pattern) : list_start(t), list_position(pos), list_ended(false), glob(pattern) {}; }; /* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */ @@ -52,6 +52,7 @@ class ListTimer : public InspTimer char buffer[MAXBUF]; chanrec *chan; InspIRCd* ServerInstance; + const std::string glob; public: @@ -99,6 +100,8 @@ class ListTimer : public InspTimer chan = ServerInstance->GetChannelIndex(ld->list_position); /* spool details */ bool has_user = (chan && chan->HasUser(u)); + if (!match(chan->name, ld->glob.c_str())) + continue; if ((chan) && (((!(chan->modes[CM_PRIVATE])) && (!(chan->modes[CM_SECRET]))) || (has_user))) { long users = chan->GetUserCounter(); @@ -210,7 +213,7 @@ class ModuleSafeList : public Module /* * start at channel 0! ;) */ - ld = new ListData(0,ServerInstance->Time()); + ld = new ListData(0,ServerInstance->Time(), pcnt ? parameters[0] : "*"); user->Extend("safelist_cache", ld); listusers.push_back(user); @@ -263,11 +266,8 @@ class ModuleSafeList : public Module } }; - - - -/******************************************************************************************************/ - + + class ModuleSafeListFactory : public ModuleFactory { public: diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index dc33cb9ed..f32964a44 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -19,8 +19,6 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" -#include "hashcomp.h" #include "inspircd.h" static bool kludgeme = false; diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 3f515ff84..162d43590 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -18,27 +18,16 @@ using namespace std; -#include -#include -#include -#include "globals.h" -#include "inspircd_config.h" -#include "hash_map.h" #include "configreader.h" #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" #include "commands/cmd_whois.h" #include "commands/cmd_stats.h" #include "socket.h" - #include "inspircd.h" #include "wildcard.h" -#include "inspstring.h" -#include "hashcomp.h" #include "xline.h" -#include "typedefs.h" #include "cull_list.h" #include "aes.h" diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 410d9b732..bcf2a25ac 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -23,27 +23,12 @@ using namespace std; /* $ModDesc: Provides SPYLIST and SPYNAMES capability, allowing opers to see who's in +s channels */ -#include -#include -#include -#include "globals.h" #include "inspircd_config.h" -#include #include "users.h" #include "channels.h" #include "modules.h" -#include "commands.h" -#include "socket.h" - #include "inspircd.h" -#include "inspstring.h" -#include "hashcomp.h" -#include "xline.h" -#include "typedefs.h" -#include "cull_list.h" -#include "aes.h" - -#define nspace __gnu_cxx +#include "wildcard.h" void spy_userlist(userrec *user,chanrec *c) { @@ -80,7 +65,7 @@ void spy_userlist(userrec *user,chanrec *c) class cmd_spylist : public command_t { public: - cmd_spylist (InspIRCd* Instance) : command_t(Instance,"SPYLIST", 'o', 0) + cmd_spylist (InspIRCd* Instance) : command_t(Instance,"SPYLIST", 'o', 0) { this->source = "m_spy.so"; syntax = ""; @@ -92,6 +77,8 @@ class cmd_spylist : public command_t user->WriteServ("321 %s Channel :Users Name",user->nick); for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++) { + if (pcnt && !match(i->second->name, parameters[0])) + continue; user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,i->second->GetUserCounter(),i->second->ChanModes(true),i->second->topic); } user->WriteServ("323 %s :End of channel list.",user->nick); @@ -101,7 +88,7 @@ class cmd_spylist : public command_t class cmd_spynames : public command_t { public: - cmd_spynames (InspIRCd* Instance) : command_t(Instance,"SPYNAMES", 'o', 0) + cmd_spynames (InspIRCd* Instance) : command_t(Instance,"SPYNAMES", 'o', 0) { this->source = "m_spy.so"; syntax = "{{,}}"; diff --git a/src/snomasks.cpp b/src/snomasks.cpp index 73dbe9a6c..3655abeb8 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -14,14 +14,9 @@ * --------------------------------------------------- */ -#include -#include #include #include "configreader.h" #include "users.h" -#include "modules.h" -#include "commands.h" -#include "xline.h" #include "snomasks.h" SnomaskManager::SnomaskManager(InspIRCd* Instance) : ServerInstance(Instance) diff --git a/src/socket.cpp b/src/socket.cpp index 2dc8f017d..eaa8e0d8c 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -18,7 +18,6 @@ #include "configreader.h" #include "socket.h" #include "inspircd.h" -#include "inspstring.h" #include "socketengine.h" #include "wildcard.h" diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 895f21306..a10d905fb 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -14,10 +14,7 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" -#include -#include #include "socketengine.h" int EventHandler::GetFd() diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp index be46451fa..2e3f28af6 100644 --- a/src/socketengine_epoll.cpp +++ b/src/socketengine_epoll.cpp @@ -14,11 +14,8 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "inspircd.h" #include -#include -#include #include "socketengine_epoll.h" EPollEngine::EPollEngine(InspIRCd* Instance) : SocketEngine(Instance) diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp index f10e6350e..008de44ca 100644 --- a/src/socketengine_kqueue.cpp +++ b/src/socketengine_kqueue.cpp @@ -14,14 +14,10 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" -#include "globals.h" #include "inspircd.h" #include #include #include -#include -#include #include "socketengine_kqueue.h" diff --git a/src/socketengine_select.cpp b/src/socketengine_select.cpp index e0e47b8eb..04f49bac5 100644 --- a/src/socketengine_select.cpp +++ b/src/socketengine_select.cpp @@ -14,11 +14,7 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" -#include "globals.h" #include "inspircd.h" -#include -#include #include #include "socketengine_select.h" diff --git a/src/timer.cpp b/src/timer.cpp index 148dafc68..9157c1521 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -14,12 +14,7 @@ * --------------------------------------------------- */ -#include -#include -#include "inspircd_config.h" #include "inspircd.h" -#include "typedefs.h" - #include "timer.h" void TimerManager::TickTimers(time_t TIME) diff --git a/src/userprocess.cpp b/src/userprocess.cpp index ed5c4e7ae..c10489252 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -18,36 +18,14 @@ using namespace std; -#include "inspircd_config.h" #include "configreader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" -#include "mode.h" -#include "commands.h" #include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" #include "socketengine.h" #include "userprocess.h" #include "inspircd.h" -#include "typedefs.h" #include "command_parse.h" #include "cull_list.h" diff --git a/src/users.cpp b/src/users.cpp index 36874d0d7..46f5d512b 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -14,19 +14,12 @@ * --------------------------------------------------- */ -#include "inspircd_config.h" #include "configreader.h" #include "channels.h" -#include "connection.h" #include "users.h" #include "inspircd.h" #include -#include "inspstring.h" -#include "commands.h" - -#include "typedefs.h" #include "socketengine.h" -#include "hashcomp.h" #include "wildcard.h" #include "xline.h" #include "cull_list.h" diff --git a/src/wildcard.cpp b/src/wildcard.cpp index b0602c82e..eacffcb04 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -17,7 +17,6 @@ using namespace std; #include -#include "inspircd_config.h" #include "inspircd.h" #include "hashcomp.h" #include "inspstring.h" diff --git a/src/xline.cpp b/src/xline.cpp index 93251b9e4..2fd36bff5 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -16,26 +16,11 @@ using namespace std; -#include "inspircd_config.h" #include "inspircd.h" -#include -#include -#include -#include -#include #include "users.h" -#include "ctables.h" -#include "globals.h" #include "modules.h" -#include "dynamic.h" #include "wildcard.h" -#include "commands.h" #include "xline.h" -#include "inspstring.h" - -#include "hashcomp.h" -#include "typedefs.h" -#include "configreader.h" #include "cull_list.h" /* Version two, now with optimized expiry! -- cgit v1.2.3