X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_kicknorejoin.cpp;h=836f92e6ccdcf1e46e3c7ee3e24ee10f8e594604;hb=ac705cd20e12f46bd638093f000dfd541ffc5d22;hp=34df89ae3f398103317ee312f87ab55b2fad926e;hpb=934a3f296f087ae35fb072ede04b0ffdfd695b71;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 34df89ae3..836f92e6c 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -1,16 +1,28 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2008 Pippijn van Steenhoven + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006-2007 Robin Burchell + * Copyright (C) 2006 John Brooks + * Copyright (C) 2006 Craig Edwards + * Copyright (C) 2006 Oliver Lupton * - * This program is free but copyrighted software; see - * the file COPYING for details. + * This file is part of InspIRCd. InspIRCd 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, version 2. * - * --------------------------------------------------- + * 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, see . */ + #include "inspircd.h" /* $ModDesc: Provides channel mode +J (delay rejoin after kick) */ @@ -52,11 +64,14 @@ public: ModuleKickNoRejoin() : kr(this) { - if (!ServerInstance->Modes->AddMode(&kr)) - throw ModuleException("Could not add new modes!"); - ServerInstance->Extensions.Register(&kr.ext); + } + + void init() + { + ServerInstance->Modules->AddService(kr); + ServerInstance->Modules->AddService(kr.ext); Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick }; - ServerInstance->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) @@ -74,8 +89,9 @@ public: { if (iter->first == user) { + std::string modeparam = chan->GetModeParameter(&kr); user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", - user->nick.c_str(), chan->name.c_str(), chan->GetModeParameter(&kr).c_str()); + user->nick.c_str(), chan->name.c_str(), modeparam.c_str()); return MOD_RES_DENY; } } @@ -106,7 +122,7 @@ public: dl = new delaylist; kr.ext.set(memb->chan, dl); } - (*dl)[memb->user] = ServerInstance->Time() + atoi(memb->chan->GetModeParameter(&kr).c_str()); + (*dl)[memb->user] = ServerInstance->Time() + ConvToInt(memb->chan->GetModeParameter(&kr)); } }