diff --git a/Changes b/Changes index cbcbce8de..cdf42b861 100644 --- a/Changes +++ b/Changes @@ -2882,3 +2882,4 @@ seen. gmtime warning still there command overrides. (#0001553) reported by AngryWolf - Modulized: time, svskill - Modulized: sjoin, pass, userhost, ison, silence +- Modulized: knock, umode2, squit, protoctl diff --git a/include/msg.h b/include/msg.h index d95f6e1af..1ca979c5f 100644 --- a/include/msg.h +++ b/include/msg.h @@ -305,11 +305,11 @@ extern int m_wallops(); extern int m_nick(), m_error(); extern int m_chatops(), m_dns(); extern int m_gnotice(), m_goper(), m_globops(), m_locops(); -extern int m_protoctl(), m_tkl(); +extern int m_tkl(); extern int m_motd(), m_user(); extern int m_server(), m_info(), m_links(), m_summon(), m_stats(); extern int m_users(), m_version(), m_help(); -extern int m_squit(), m_connect(); +extern int m_connect(); extern int m_trace(); extern int m_names(), m_admin(); extern int m_lusers(), m_umode(), m_close(); @@ -317,12 +317,12 @@ extern int m_motd(), m_whowas(), m_silence(); extern int m_service(), m_watch(); extern int m_map(), m_dalinfo(); extern int m_addline(), m_rules(); -extern int m_knock(),m_credits(); +extern int m_credits(); extern int m_license(); extern int m_netinfo(), m_addmotd(), m_addomotd(); extern int m_svsfline(); extern int m_botmotd(), m_sjoin(); -extern int m_umode2(), m_dccdeny(), m_undccdeny(); +extern int m_dccdeny(), m_undccdeny(); extern int m_opermotd(); extern int m_module(), m_alias(), m_tkl(), m_opermotd(); extern int m_rehash(), m_die(), m_restart(); diff --git a/makefile.win32 b/makefile.win32 index e6442c62c..04742d843 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -148,8 +148,9 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/M_SVSLUSERS.OBJ \ SRC/M_SVSWATCH.OBJ SRC/M_SVSSILENCE.OBJ SRC/M_SENDSNO.OBJ SRC/M_SVSSNO.OBJ \ SRC/M_SAJOIN.OBJ SRC/M_SAPART.OBJ SRC/M_SAMODE.OBJ SRC/M_KICK.OBJ SRC/M_TOPIC.OBJ \ - SRC/M_INVITE.OBJ SRC/M_LIST.OBJ SRC/M_TIME.OBJ SRC/M_SVSKILL.OBJ \ - SRC/M_SJOIN.OBJ SRC/M_PASS.OBJ SRC/M_USERHOST.OBJ SRC/M_ISON.OBJ SRC/M_SILENCE.OBJ + SRC/M_INVITE.OBJ SRC/M_LIST.OBJ SRC/M_TIME.OBJ SRC/M_SVSKILL.OBJ SRC/M_KNOCK.OBJ \ + SRC/M_UMODE2.OBJ SRC/M_SQUIT.OBJ SRC/M_PROTOCTL.OBJ SRC/M_SJOIN.OBJ SRC/M_PASS.OBJ \ + SRC/M_USERHOST.OBJ SRC/M_ISON.OBJ SRC/M_SILENCE.OBJ ALL: CONF UNREAL.EXE WIRCD.EXE @@ -542,6 +543,18 @@ src/m_ison.obj: src/modules/m_ison.c $(INCLUDES) src/m_silence.obj: src/modules/m_silence.c $(INCLUDES) $(CC) $(CFLAGS) src/modules/m_silence.c +src/m_knock.obj: src/modules/m_knock.c $(INCLUDES) + $(CC) $(CFLAGS) src/modules/m_knock.c + +src/m_umode2.obj: src/modules/m_umode2.c $(INCLUDES) + $(CC) $(CFLAGS) src/modules/m_umode2.c + +src/m_squit.obj: src/modules/m_squit.c $(INCLUDES) + $(CC) $(CFLAGS) src/modules/m_squit.c + +src/m_protoctl.obj: src/modules/m_protoctl.c $(INCLUDES) + $(CC) $(CFLAGS) src/modules/m_protoctl.c + src/win32/win32.res: src/win32/win32gui.rc $(RC) /l 0x409 /fosrc/win32/win32.res /i ./include /i ./src \ /d NDEBUG src/win32/win32gui.rc diff --git a/src/channel.c b/src/channel.c index 8aab6cc59..6d93d42cf 100644 --- a/src/channel.c +++ b/src/channel.c @@ -4501,114 +4501,6 @@ void send_user_joins(aClient *cptr, aClient *user) return; } - -/* -** m_knock -** parv[0] - sender prefix -** parv[1] - channel -** parv[2] - reason -** -** Coded by Stskeeps -** Additional bugfixes/ideas by codemastr -** (C) codemastr & Stskeeps -** -*/ -CMD_FUNC(m_knock) -{ - aChannel *chptr; - char buf[1024], chbuf[CHANNELLEN + 8]; - - if (IsServer(sptr)) - return 0; - - if (parc < 2 || *parv[1] == '\0') - { - sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), - me.name, parv[0], "KNOCK"); - return -1; - } - - if (MyConnect(sptr)) - clean_channelname(parv[1]); - - if (check_channelmask(sptr, cptr, parv[1])) - return 0; - /* bugfix for /knock PRv Please? */ - if (*parv[1] != '#') - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, - sptr->name, - parv[1], "Remember to use a # prefix in channel name"); - - return 0; - } - if (!(chptr = find_channel(parv[1], NullChn))) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, sptr->name, parv[1], "Channel does not exist!"); - return 0; - } - - /* IsMember bugfix by codemastr */ - if (IsMember(sptr, chptr) == 1) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, - sptr->name, chptr->chname, "You're already there!"); - return 0; - } - if (chptr->mode.mode & MODE_NOKNOCK) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, - sptr->name, chptr->chname, "No knocks are allowed! (+K)"); - return 0; - } - - if (!(chptr->mode.mode & MODE_INVITEONLY)) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, - sptr->name, chptr->chname, "Channel is not invite only!"); - return 0; - } - - if (is_banned(sptr, chptr, BANCHK_JOIN)) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, sptr->name, chptr->chname, "You're banned!"); - return 0; - } - - if ((chptr->mode.mode & MODE_NOINVITE) && !is_chan_op(sptr, chptr)) - { - sendto_one(sptr, err_str(ERR_CANNOTKNOCK), - me.name, - sptr->name, - chptr->chname, "The channel does not allow invites (+V)"); - - return 0; - } - - ircsprintf(chbuf, "%s%s", CHANOPPFX, chptr->chname); - ircsprintf(buf, "[Knock] by %s!%s@%s (%s)", - sptr->name, sptr->user->username, GetHost(sptr), - parv[2] ? parv[2] : "no reason specified"); - sendto_channelprefix_butone_tok(NULL, &me, chptr, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, - MSG_NOTICE, TOK_NOTICE, chbuf, buf, 0); - - sendto_one(sptr, ":%s %s %s :Knocked on %s", me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", - sptr->name, chptr->chname); - -#ifdef NEWCHFLOODPROT - if (chptr->mode.floodprot && !IsULine(sptr) && - do_chanflood(chptr->mode.floodprot, FLD_KNOCK) && MyClient(sptr)) - do_chanflood_action(chptr, FLD_KNOCK, "knock"); -#endif - return 0; -} - static int send_ban_list(aClient *cptr, char *chname, TS creationtime, aChannel *channel) { Ban *top; diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 8ffe5b6b3..882e1b33c 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -36,7 +36,8 @@ R_MODULES=m_sethost.so m_chghost.so m_chgident.so m_setname.so \ m_svswatch.so m_svssilence.so m_sendsno.so m_svssno.so \ m_sajoin.so m_sapart.so m_samode.so m_kick.so m_topic.so \ m_invite.so m_list.so m_time.so m_svskill.so m_sjoin.so \ - m_pass.so m_userhost.so m_ison.so m_silence.so + m_pass.so m_userhost.so m_ison.so m_silence.so m_knock.so \ + m_umode2.so m_squit.so m_protoctl.so COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \ m_sdesc.c m_svsmode.c m_swhois.c m_svsmotd.c m_svsnline.c \ @@ -49,7 +50,8 @@ COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \ m_svslusers.c m_svswatch.c m_svssilence.c m_sendsno.c \ m_svssno.c m_sajoin.c m_sapart.c m_samode.c m_kick.c m_topic.c \ m_invite.c m_list.c m_time.c m_svskill.c m_sjoin.c \ - m_pass.c m_userhost.c m_ison.c m_silence.c + m_pass.c m_userhost.c m_ison.c m_silence.c m_knock.c m_umode2.c \ + m_squit.c m_protoctl.c MODULES=commands.so $(R_MODULES) @@ -311,5 +313,21 @@ m_silence.so: m_silence.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_silence.so m_silence.c +m_knock.so: m_knock.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_knock.so m_knock.c + +m_umode2.so: m_umode2.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_umode2.so m_umode2.c + +m_squit.so: m_squit.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_squit.so m_squit.c + +m_protoctl.so: m_protoctl.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_protoctl.so m_protoctl.c + clean: $(RM) -f *.o *.so *~ core diff --git a/src/modules/l_commands.c b/src/modules/l_commands.c index 57a1a0388..acddd7aa0 100644 --- a/src/modules/l_commands.c +++ b/src/modules/l_commands.c @@ -98,6 +98,8 @@ extern int m_samode_Init(ModuleInfo *modinfo), m_time_Init(ModuleInfo *modinfo); extern int m_svskill_Init(ModuleInfo *modinfo), m_sjoin_Init(ModuleInfo *modinfo); extern int m_pass_Init(ModuleInfo *modinfo), m_userhost_Init(ModuleInfo *modinfo); extern int m_ison_Init(ModuleInfo *modinfo), m_silence_Init(ModuleInfo *modinfo); +extern int m_knock_Init(ModuleInfo *modinfo), m_umode2_Init(ModuleInfo *modinfo); +extern int m_squit_Init(ModuleInfo *modinfo), m_protoctl_Init(ModuleInfo *modinfo); #ifdef GUEST extern int m_guest_Init(ModuleInfo *modinfo); #endif @@ -126,6 +128,8 @@ extern int m_samode_Load(int module_load), m_time_Load(int module_load); extern int m_svskill_Load(int module_load), m_sjoin_Load(int module_load); extern int m_pass_Load(int module_load), m_userhost_Load(int module_load); extern int m_ison_Load(int module_load), m_silence_Load(int module_load); +extern int m_knock_Load(int module_load), m_umode2_Load(int module_load); +extern int m_squit_Load(int module_load), m_protoctl_Load(int module_load); #ifdef GUEST extern int m_guest_Load(int module_load); #endif @@ -143,10 +147,10 @@ extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload(), m_vhost_Unloa extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload(), m_svslusers_Unload(); extern int m_svswatch_Unload(), m_svssilence_Unload(), m_svskill_Unload(); extern int m_sendsno_Unload(), m_svssno_Unload(), m_time_Unload(); -extern int m_sajoin_Unload(), m_sapart_Unload(); -extern int m_kick_Unload(), m_topic_Unload(); -extern int m_invite_Unload(), m_list_Unload(); -extern int m_samode_Unload(), m_sjoin_Unload(); +extern int m_sajoin_Unload(), m_sapart_Unload(), m_knock_Umload(); +extern int m_kick_Unload(), m_topic_Unload(), m_umode2_Unload(); +extern int m_invite_Unload(), m_list_Unload(), m_squit_Unload(); +extern int m_samode_Unload(), m_sjoin_Unload(), m_protoctl_Unload(); extern int m_pass_Unload(), m_userhost_Unload(); extern int m_ison_Unload(), m_silence_Unload(); #ifdef GUEST @@ -242,6 +246,10 @@ int l_commands_Init(ModuleInfo *modinfo) m_ison_Init(ModCmdsInfo); m_silence_Init(ModCmdsInfo); m_svskill_Init(ModCmdsInfo); + m_knock_Init(ModCmdsInfo); + m_umode2_Init(ModCmdsInfo); + m_squit_Init(ModCmdsInfo); + m_protoctl_Init(ModCmdsInfo); #ifdef GUEST m_guest_Init(ModCmdsInfo); #endif @@ -314,6 +322,10 @@ int l_commands_Load(int module_load) m_userhost_Load(module_load); m_ison_Load(module_load); m_silence_Load(module_load); + m_knock_Load(module_load); + m_umode2_Load(module_load); + m_squit_Load(module_load); + m_protoctl_Load(module_load); #ifdef GUEST m_guest_Load(module_load); #endif @@ -386,6 +398,10 @@ int l_commands_Unload(int module_unload) m_userhost_Unload(); m_ison_Unload(); m_silence_Unload(); + m_knock_Unload(); + m_umode2_Unload(); + m_squit_Unload(); + m_protoctl_Unload(); #ifdef GUEST m_guest_Unload(); #endif diff --git a/src/modules/m_knock.c b/src/modules/m_knock.c new file mode 100644 index 000000000..f3ace1697 --- /dev/null +++ b/src/modules/m_knock.c @@ -0,0 +1,188 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_knock.c + * (C) 2004 The UnrealIRCd Team + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +DLLFUNC int m_knock(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +#define MSG_KNOCK "KNOCK" +#define TOK_KNOCK "AI" + +ModuleHeader MOD_HEADER(m_knock) + = { + "m_knock", + "$Id$", + "command /knock", + NULL, + NULL + }; + +DLLFUNC int MOD_INIT(m_knock)(ModuleInfo *modinfo) +{ + add_Command(MSG_KNOCK, TOK_KNOCK, m_knock, 2); + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(m_knock)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(m_knock)(int module_unload) +{ + if (del_Command(MSG_KNOCK, TOK_KNOCK, m_knock) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + MOD_HEADER(m_knock).name); + } + return MOD_SUCCESS; +} + +/* +** m_knock +** parv[0] - sender prefix +** parv[1] - channel +** parv[2] - reason +** +** Coded by Stskeeps +** Additional bugfixes/ideas by codemastr +** (C) codemastr & Stskeeps +** +*/ +CMD_FUNC(m_knock) +{ + aChannel *chptr; + char buf[1024], chbuf[CHANNELLEN + 8]; + + if (IsServer(sptr)) + return 0; + + if (parc < 2 || *parv[1] == '\0') + { + sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS), + me.name, parv[0], "KNOCK"); + return -1; + } + + if (MyConnect(sptr)) + clean_channelname(parv[1]); + + if (check_channelmask(sptr, cptr, parv[1])) + return 0; + /* bugfix for /knock PRv Please? */ + if (*parv[1] != '#') + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, + sptr->name, + parv[1], "Remember to use a # prefix in channel name"); + + return 0; + } + if (!(chptr = find_channel(parv[1], NullChn))) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, sptr->name, parv[1], "Channel does not exist!"); + return 0; + } + + /* IsMember bugfix by codemastr */ + if (IsMember(sptr, chptr) == 1) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, + sptr->name, chptr->chname, "You're already there!"); + return 0; + } + if (chptr->mode.mode & MODE_NOKNOCK) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, + sptr->name, chptr->chname, "No knocks are allowed! (+K)"); + return 0; + } + + if (!(chptr->mode.mode & MODE_INVITEONLY)) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, + sptr->name, chptr->chname, "Channel is not invite only!"); + return 0; + } + + if (is_banned(sptr, chptr, BANCHK_JOIN)) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, sptr->name, chptr->chname, "You're banned!"); + return 0; + } + + if ((chptr->mode.mode & MODE_NOINVITE) && !is_chan_op(sptr, chptr)) + { + sendto_one(sptr, err_str(ERR_CANNOTKNOCK), + me.name, + sptr->name, + chptr->chname, "The channel does not allow invites (+V)"); + + return 0; + } + + ircsprintf(chbuf, "%s%s", CHANOPPFX, chptr->chname); + ircsprintf(buf, "[Knock] by %s!%s@%s (%s)", + sptr->name, sptr->user->username, GetHost(sptr), + parv[2] ? parv[2] : "no reason specified"); + sendto_channelprefix_butone_tok(NULL, &me, chptr, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER, + MSG_NOTICE, TOK_NOTICE, chbuf, buf, 0); + + sendto_one(sptr, ":%s %s %s :Knocked on %s", me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", + sptr->name, chptr->chname); + +#ifdef NEWCHFLOODPROT + if (chptr->mode.floodprot && !IsULine(sptr) && + do_chanflood(chptr->mode.floodprot, FLD_KNOCK) && MyClient(sptr)) + do_chanflood_action(chptr, FLD_KNOCK, "knock"); +#endif + return 0; +} diff --git a/src/modules/m_protoctl.c b/src/modules/m_protoctl.c new file mode 100644 index 000000000..58d89e1f2 --- /dev/null +++ b/src/modules/m_protoctl.c @@ -0,0 +1,319 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_protoctl.c + * (C) 2004 The UnrealIRCd Team + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +DLLFUNC int m_protoctl(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +#define MSG_PROTOCTL "PROTOCTL" +#define TOK_PROTOCTL "_" + +ModuleHeader MOD_HEADER(m_protoctl) + = { + "m_protoctl", + "$Id$", + "command /protoctl", + NULL, + NULL + }; + +DLLFUNC int MOD_INIT(m_protoctl)(ModuleInfo *modinfo) +{ + add_CommandX(MSG_PROTOCTL, TOK_PROTOCTL, m_protoctl, MAXPARA, M_UNREGISTERED|M_SERVER|M_USER); + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(m_protoctl)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(m_protoctl)(int module_unload) +{ + if (del_Command(MSG_PROTOCTL, TOK_PROTOCTL, m_protoctl) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + MOD_HEADER(m_protoctl).name); + } + return MOD_SUCCESS; +} + +/* + * m_protoctl + * parv[0] = Sender prefix + * parv[1+] = Options + */ +CMD_FUNC(m_protoctl) +{ + int i; +#ifndef PROTOCTL_MADNESS + int remove = 0; +#endif + char proto[128], *s; +/* static char *dummyblank = ""; Yes, it is kind of ugly */ + +#ifdef PROTOCTL_MADNESS + if (GotProtoctl(sptr)) + { + /* + * But we already GOT a protoctl msg! + */ + if (!IsServer(sptr)) + sendto_one(cptr, + "ERROR :Already got a PROTOCTL from you."); + return 0; + } +#endif + cptr->flags |= FLAGS_PROTOCTL; + /* parv[parc - 1] */ + for (i = 1; i < parc; i++) + { + strncpyzt(proto, parv[i], sizeof proto); + s = proto; +#ifndef PROTOCTL_MADNESS + if (*s == '-') + { + s++; + remove = 1; + } + else + remove = 0; +#endif +/* equal = (char *)index(proto, '='); + if (equal == NULL) + options = dummyblank; + else + { + options = &equal[1]; + equal[0] = '\0'; + } +*/ + if (strcmp(s, "NOQUIT") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearNoQuit(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetNoQuit(cptr); + + } + else if (strcmp(s, "TOKEN") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearToken(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetToken(cptr); + } + else if (strcmp(s, "HCN") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearHybNotice(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetHybNotice(cptr); + } + else if (strcmp(s, "SJOIN") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearSJOIN(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetSJOIN(cptr); + } + else if (strcmp(s, "SJOIN2") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearSJOIN2(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetSJOIN2(cptr); + } + else if (strcmp(s, "NICKv2") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearNICKv2(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, "Chose protocol %s for link %s", + proto, cptr->name)); + SetNICKv2(cptr); + } + else if (strcmp(s, "UMODE2") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearUMODE2(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetUMODE2(cptr); + } + else if (strcmp(s, "NS") == 0) + { +#ifdef PROTOCTL_MADNESS + if (remove) + { + ClearNS(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetNS(cptr); + } + else if (strcmp(s, "VL") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearVL(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetVL(cptr); + } + else if (strcmp(s, "VHP") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearVHP(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetVHP(cptr); + } + else if (strcmp(s, "SJ3") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + ClearSJ3(cptr); + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + SetSJ3(cptr); + } + else if (strcmp(s, "SJB64") == 0) + { +#ifndef PROTOCTL_MADNESS + if (remove) + { + cptr->proto &= ~PROTO_SJB64; + continue; + } +#endif + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + cptr->proto |= PROTO_SJB64; + } + else if (strcmp(s, "ZIP") == 0) + { + if (remove) + { + cptr->proto &= ~PROTO_ZIP; + continue; + } + Debug((DEBUG_ERROR, + "Chose protocol %s for link %s", + proto, cptr->name)); + cptr->proto |= PROTO_ZIP; + } + /* + * Add other protocol extensions here, with proto + * containing the base option, and options containing + * what it equals, if anything. + * + * DO NOT error or warn on unknown proto; we just don't + * support it. + */ + } + + return 0; +} diff --git a/src/modules/m_squit.c b/src/modules/m_squit.c new file mode 100644 index 000000000..e5b2d37c2 --- /dev/null +++ b/src/modules/m_squit.c @@ -0,0 +1,229 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_squit.c + * (C) 2004 The UnrealIRCd Team + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +DLLFUNC int m_squit(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +#define MSG_SQUIT "SQUIT" +#define TOK_SQUIT "-" + +ModuleHeader MOD_HEADER(m_squit) + = { + "m_squit", + "$Id$", + "command /squit", + NULL, + NULL + }; + +DLLFUNC int MOD_INIT(m_squit)(ModuleInfo *modinfo) +{ + add_Command(MSG_SQUIT, TOK_SQUIT, m_squit, 2); + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(m_squit)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(m_squit)(int module_unload) +{ + if (del_Command(MSG_SQUIT, TOK_SQUIT, m_squit) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + MOD_HEADER(m_squit).name); + } + return MOD_SUCCESS; +} + +/* +** m_squit +** parv[0] = sender prefix +** parv[1] = server name +** parv[parc-1] = comment +*/ +CMD_FUNC(m_squit) +{ + char *server; + aClient *acptr; + char *comment = (parc > 2 && parv[parc - 1]) ? + parv[parc - 1] : cptr->name; + + + if (!IsPrivileged(sptr)) + { + sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); + return 0; + } + + if (parc > 1) + { + if (!(*parv[1] == '@')) + { + server = parv[1]; + + /* + ** The following allows wild cards in SQUIT. Only usefull + ** when the command is issued by an oper. + */ + for (acptr = client; + (acptr = next_client(acptr, server)); + acptr = acptr->next) + if (IsServer(acptr) || IsMe(acptr)) + break; + if (acptr && IsMe(acptr)) + { + acptr = cptr; + server = cptr->sockhost; + } + } + else + { + server = parv[1]; + acptr = (aClient *)find_server_by_base64(server + 1); + if (acptr && IsMe(acptr)) + { + acptr = cptr; + server = cptr->sockhost; + } + } + } + else + { + /* + ** This is actually protocol error. But, well, closing + ** the link is very proper answer to that... + */ + server = cptr->sockhost; + acptr = cptr; + } + + /* + ** SQUIT semantics is tricky, be careful... + ** + ** The old (irc2.2PL1 and earlier) code just cleans away the + ** server client from the links (because it is never true + ** "cptr == acptr". + ** + ** This logic here works the same way until "SQUIT host" hits + ** the server having the target "host" as local link. Then it + ** will do a real cleanup spewing SQUIT's and QUIT's to all + ** directions, also to the link from which the orinal SQUIT + ** came, generating one unnecessary "SQUIT host" back to that + ** link. + ** + ** One may think that this could be implemented like + ** "hunt_server" (e.g. just pass on "SQUIT" without doing + ** nothing until the server having the link as local is + ** reached). Unfortunately this wouldn't work in the real life, + ** because either target may be unreachable or may not comply + ** with the request. In either case it would leave target in + ** links--no command to clear it away. So, it's better just + ** clean out while going forward, just to be sure. + ** + ** ...of course, even better cleanout would be to QUIT/SQUIT + ** dependant users/servers already on the way out, but + ** currently there is not enough information about remote + ** clients to do this... --msa + */ + if (!acptr) + { + sendto_one(sptr, err_str(ERR_NOSUCHSERVER), + me.name, parv[0], server); + return 0; + } + if (MyClient(sptr) && ((!OPCanGRoute(sptr) && !MyConnect(acptr)) || + (!OPCanLRoute(sptr) && MyConnect(acptr)))) + { + sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); + return 0; + } + /* + ** Notify all opers, if my local link is remotely squitted + */ + if (MyConnect(acptr) && !IsAnOper(cptr)) + { + + sendto_locfailops("Received SQUIT %s from %s (%s)", + acptr->name, get_client_name(sptr, FALSE), comment); + sendto_serv_butone(&me, + ":%s GLOBOPS :Received SQUIT %s from %s (%s)", me.name, + server, get_client_name(sptr, FALSE), comment); + } + else if (MyConnect(acptr)) + { + if (acptr->user) + { + sendto_one(sptr, + ":%s %s %s :*** Cannot do fake kill by SQUIT !!!", + me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name); + sendto_ops + ("%s tried to do a fake kill using SQUIT (%s (%s))", + sptr->name, acptr->name, comment); + sendto_serv_butone(&me, + ":%s GLOBOPS :%s tried to fake kill using SQUIT (%s (%s))", + me.name, sptr->name, acptr->name, comment); + return 0; + } + sendto_locfailops("Received SQUIT %s from %s (%s)", + acptr->name, get_client_name(sptr, FALSE), comment); + sendto_serv_butone(&me, + ":%s GLOBOPS :Received SQUIT %s from %s (%s)", me.name, + acptr->name, get_client_name(sptr, FALSE), comment); + } + if (IsAnOper(sptr)) + { + /* + * It was manually /squit'ed by a human being(we hope), + * there is a very good chance they don't want us to + * reconnect right away. -Cabal95 + */ + acptr->flags |= FLAGS_SQUIT; + } + + return exit_client(cptr, acptr, sptr, comment); +} diff --git a/src/modules/m_umode2.c b/src/modules/m_umode2.c new file mode 100644 index 000000000..826a8404d --- /dev/null +++ b/src/modules/m_umode2.c @@ -0,0 +1,104 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_umode2.c + * (C) 2004 The UnrealIRCd Team + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "proto.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif + +DLLFUNC int m_umode2(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +#define MSG_UMODE2 "UMODE2" +#define TOK_UMODE2 "|" + +ModuleHeader MOD_HEADER(m_umode2) + = { + "m_umode2", + "$Id$", + "command /umode2", + NULL, + NULL + }; + +DLLFUNC int MOD_INIT(m_umode2)(ModuleInfo *modinfo) +{ + add_Command(MSG_UMODE2, TOK_UMODE2, m_umode2, MAXPARA); + MARK_AS_OFFICIAL_MODULE(modinfo); + return MOD_SUCCESS; +} + +DLLFUNC int MOD_LOAD(m_umode2)(int module_load) +{ + return MOD_SUCCESS; +} + +DLLFUNC int MOD_UNLOAD(m_umode2)(int module_unload) +{ + if (del_Command(MSG_UMODE2, TOK_UMODE2, m_umode2) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + MOD_HEADER(m_umode2).name); + } + return MOD_SUCCESS; +} + +/* + m_umode2 added by Stskeeps + parv[0] - sender + parv[1] - modes to change + + Small wrapper to bandwidth save +*/ + +CMD_FUNC(m_umode2) +{ + char *xparv[5] = { + parv[0], + parv[0], + parv[1], + (parc > 3) ? parv[3] : NULL, + NULL + }; + + if (!parv[1]) + return 0; + return m_umode(cptr, sptr, (parc > 3) ? 4 : 3, xparv); +} diff --git a/src/packet.c b/src/packet.c index ca1471c99..b8e97e617 100644 --- a/src/packet.c +++ b/src/packet.c @@ -230,9 +230,7 @@ void init_CommandHash(void) add_Command(MSG_LUSERS, TOK_LUSERS, m_lusers, MAXPARA); add_Command(MSG_WALLOPS, TOK_WALLOPS, m_wallops, 1); add_CommandX(MSG_ERROR, TOK_ERROR, m_error, MAXPARA, M_UNREGISTERED|M_SERVER); - add_CommandX(MSG_PROTOCTL, TOK_PROTOCTL, m_protoctl, MAXPARA, M_UNREGISTERED|M_SERVER|M_USER); add_CommandX(MSG_SERVER, TOK_SERVER, m_server, MAXPARA, M_UNREGISTERED|M_SERVER); - add_Command(MSG_SQUIT, TOK_SQUIT, m_squit, 2); add_Command(MSG_WHOWAS, TOK_WHOWAS, m_whowas, MAXPARA); add_Command(MSG_NAMES, TOK_NAMES, m_names, MAXPARA); add_Command(MSG_TRACE, TOK_TRACE, m_trace, MAXPARA); @@ -261,7 +259,6 @@ void init_CommandHash(void) add_Command(MSG_MAP, TOK_MAP, m_map, MAXPARA); add_Command(MSG_DALINFO, TOK_DALINFO, m_dalinfo, MAXPARA); add_Command(MSG_ADDLINE, TOK_ADDLINE, m_addline, 1); - add_Command(MSG_KNOCK, TOK_KNOCK, m_knock, 2); add_Command(MSG_CREDITS, TOK_CREDITS, m_credits, MAXPARA); add_Command(MSG_LICENSE, TOK_LICENSE, m_license, MAXPARA); add_Command(MSG_NETINFO, TOK_NETINFO, m_netinfo, MAXPARA); @@ -269,7 +266,6 @@ void init_CommandHash(void) add_Command(MSG_ADDOMOTD, TOK_ADDOMOTD, m_addomotd, 1); add_Command(MSG_SVSFLINE, TOK_SVSFLINE, m_svsfline, MAXPARA); add_Command(MSG_BOTMOTD, TOK_BOTMOTD, m_botmotd, MAXPARA); - add_Command(MSG_UMODE2, TOK_UMODE2, m_umode2, MAXPARA); add_Command(MSG_DCCDENY, TOK_DCCDENY, m_dccdeny, 2); add_Command(MSG_UNDCCDENY, TOK_UNDCCDENY, m_undccdeny, MAXPARA); add_Command(MSG_NEWJOIN, TOK_JOIN, m_join, MAXPARA); diff --git a/src/s_serv.c b/src/s_serv.c index 0a987b11f..7f8ab8a82 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -176,392 +176,6 @@ normal: return 0; } -/* -** m_squit -** parv[0] = sender prefix -** parv[1] = server name -** parv[parc-1] = comment -*/ -CMD_FUNC(m_squit) -{ - char *server; - aClient *acptr; - char *comment = (parc > 2 && parv[parc - 1]) ? - parv[parc - 1] : cptr->name; - - - if (!IsPrivileged(sptr)) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - - if (parc > 1) - { - if (!(*parv[1] == '@')) - { - server = parv[1]; - - /* - ** The following allows wild cards in SQUIT. Only usefull - ** when the command is issued by an oper. - */ - for (acptr = client; - (acptr = next_client(acptr, server)); - acptr = acptr->next) - if (IsServer(acptr) || IsMe(acptr)) - break; - if (acptr && IsMe(acptr)) - { - acptr = cptr; - server = cptr->sockhost; - } - } - else - { - server = parv[1]; - acptr = (aClient *)find_server_by_base64(server + 1); - if (acptr && IsMe(acptr)) - { - acptr = cptr; - server = cptr->sockhost; - } - } - } - else - { - /* - ** This is actually protocol error. But, well, closing - ** the link is very proper answer to that... - */ - server = cptr->sockhost; - acptr = cptr; - } - - /* - ** SQUIT semantics is tricky, be careful... - ** - ** The old (irc2.2PL1 and earlier) code just cleans away the - ** server client from the links (because it is never true - ** "cptr == acptr". - ** - ** This logic here works the same way until "SQUIT host" hits - ** the server having the target "host" as local link. Then it - ** will do a real cleanup spewing SQUIT's and QUIT's to all - ** directions, also to the link from which the orinal SQUIT - ** came, generating one unnecessary "SQUIT host" back to that - ** link. - ** - ** One may think that this could be implemented like - ** "hunt_server" (e.g. just pass on "SQUIT" without doing - ** nothing until the server having the link as local is - ** reached). Unfortunately this wouldn't work in the real life, - ** because either target may be unreachable or may not comply - ** with the request. In either case it would leave target in - ** links--no command to clear it away. So, it's better just - ** clean out while going forward, just to be sure. - ** - ** ...of course, even better cleanout would be to QUIT/SQUIT - ** dependant users/servers already on the way out, but - ** currently there is not enough information about remote - ** clients to do this... --msa - */ - if (!acptr) - { - sendto_one(sptr, err_str(ERR_NOSUCHSERVER), - me.name, parv[0], server); - return 0; - } - if (MyClient(sptr) && ((!OPCanGRoute(sptr) && !MyConnect(acptr)) || - (!OPCanLRoute(sptr) && MyConnect(acptr)))) - { - sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name, parv[0]); - return 0; - } - /* - ** Notify all opers, if my local link is remotely squitted - */ - if (MyConnect(acptr) && !IsAnOper(cptr)) - { - - sendto_locfailops("Received SQUIT %s from %s (%s)", - acptr->name, get_client_name(sptr, FALSE), comment); - sendto_serv_butone(&me, - ":%s GLOBOPS :Received SQUIT %s from %s (%s)", me.name, - server, get_client_name(sptr, FALSE), comment); - } - else if (MyConnect(acptr)) - { - if (acptr->user) - { - sendto_one(sptr, - ":%s %s %s :*** Cannot do fake kill by SQUIT !!!", - me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name); - sendto_ops - ("%s tried to do a fake kill using SQUIT (%s (%s))", - sptr->name, acptr->name, comment); - sendto_serv_butone(&me, - ":%s GLOBOPS :%s tried to fake kill using SQUIT (%s (%s))", - me.name, sptr->name, acptr->name, comment); - return 0; - } - sendto_locfailops("Received SQUIT %s from %s (%s)", - acptr->name, get_client_name(sptr, FALSE), comment); - sendto_serv_butone(&me, - ":%s GLOBOPS :Received SQUIT %s from %s (%s)", me.name, - acptr->name, get_client_name(sptr, FALSE), comment); - } - if (IsAnOper(sptr)) - { - /* - * It was manually /squit'ed by a human being(we hope), - * there is a very good chance they don't want us to - * reconnect right away. -Cabal95 - */ - acptr->flags |= FLAGS_SQUIT; - } - - return exit_client(cptr, acptr, sptr, comment); -} - -/* - * m_protoctl - * parv[0] = Sender prefix - * parv[1+] = Options - */ -CMD_FUNC(m_protoctl) -{ - int i; -#ifndef PROTOCTL_MADNESS - int remove = 0; -#endif - char proto[128], *s; -/* static char *dummyblank = ""; Yes, it is kind of ugly */ - -#ifdef PROTOCTL_MADNESS - if (GotProtoctl(sptr)) - { - /* - * But we already GOT a protoctl msg! - */ - if (!IsServer(sptr)) - sendto_one(cptr, - "ERROR :Already got a PROTOCTL from you."); - return 0; - } -#endif - cptr->flags |= FLAGS_PROTOCTL; - /* parv[parc - 1] */ - for (i = 1; i < parc; i++) - { - strncpyzt(proto, parv[i], sizeof proto); - s = proto; -#ifndef PROTOCTL_MADNESS - if (*s == '-') - { - s++; - remove = 1; - } - else - remove = 0; -#endif -/* equal = (char *)index(proto, '='); - if (equal == NULL) - options = dummyblank; - else - { - options = &equal[1]; - equal[0] = '\0'; - } -*/ - if (strcmp(s, "NOQUIT") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearNoQuit(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetNoQuit(cptr); - - } - else if (strcmp(s, "TOKEN") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearToken(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetToken(cptr); - } - else if (strcmp(s, "HCN") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearHybNotice(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetHybNotice(cptr); - } - else if (strcmp(s, "SJOIN") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearSJOIN(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetSJOIN(cptr); - } - else if (strcmp(s, "SJOIN2") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearSJOIN2(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetSJOIN2(cptr); - } - else if (strcmp(s, "NICKv2") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearNICKv2(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, "Chose protocol %s for link %s", - proto, cptr->name)); - SetNICKv2(cptr); - } - else if (strcmp(s, "UMODE2") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearUMODE2(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - SetUMODE2(cptr); - } - else if (strcmp(s, "NS") == 0) - { -#ifdef PROTOCTL_MADNESS - if (remove) - { - ClearNS(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - SetNS(cptr); - } - else if (strcmp(s, "VL") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearVL(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - SetVL(cptr); - } - else if (strcmp(s, "VHP") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearVHP(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - SetVHP(cptr); - } - else if (strcmp(s, "SJ3") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - ClearSJ3(cptr); - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - SetSJ3(cptr); - } - else if (strcmp(s, "SJB64") == 0) - { -#ifndef PROTOCTL_MADNESS - if (remove) - { - cptr->proto &= ~PROTO_SJB64; - continue; - } -#endif - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - cptr->proto |= PROTO_SJB64; - } - else if (strcmp(s, "ZIP") == 0) - { - if (remove) - { - cptr->proto &= ~PROTO_ZIP; - continue; - } - Debug((DEBUG_ERROR, - "Chose protocol %s for link %s", - proto, cptr->name)); - cptr->proto |= PROTO_ZIP; - } - /* - * Add other protocol extensions here, with proto - * containing the base option, and options containing - * what it equals, if anything. - * - * DO NOT error or warn on unknown proto; we just don't - * support it. - */ - } - - return 0; -} - char *num = NULL; int m_server_synch(aClient *cptr, long numeric, ConfigItem_link *conf); diff --git a/src/s_user.c b/src/s_user.c index bd094f109..b6dafb2ff 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -2479,30 +2479,6 @@ CMD_FUNC(m_umode) return 0; } -/* - m_umode2 added by Stskeeps - parv[0] - sender - parv[1] - modes to change - - Small wrapper to bandwidth save -*/ - -CMD_FUNC(m_umode2) -{ - char *xparv[5] = { - parv[0], - parv[0], - parv[1], - (parc > 3) ? parv[3] : NULL, - NULL - }; - - if (!parv[1]) - return 0; - return m_umode(cptr, sptr, (parc > 3) ? 4 : 3, xparv); -} - - /* * send the MODE string for user (user) to connection cptr * -avalon