X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_kicknorejoin.cpp;h=836f92e6ccdcf1e46e3c7ee3e24ee10f8e594604;hb=8d419c3873cd3593baf4cc5f66bbe854a3a4614f;hp=037dc5678ee09fe11732d255cd2c17e94aa1bbec;hpb=cd712c40e1b352c05e7ae0f72e0a5e84cdf64323;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 037dc5678..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; } } @@ -101,12 +117,12 @@ public: if (memb->chan->IsModeSet(&kr) && (source != memb->user)) { delaylist* dl = kr.ext.get(memb->chan); - if (dl) + if (!dl) { 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)); } } @@ -116,7 +132,7 @@ public: Version GetVersion() { - return Version("Channel mode to delay rejoin after kick", VF_COMMON | VF_VENDOR); + return Version("Channel mode to delay rejoin after kick", VF_VENDOR); } };