X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_zline.cpp;h=fdb156e0ab51a93049b4ffcd1f5f68607fe02026;hb=882084defcc43c876ecb10e30086b63ac074fcad;hp=e2cca76497e2ebde8c41c9c6631a1b1534b49258;hpb=63d3e056b742598f48ba9a8df216b06117a37910;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index e2cca7649..fdb156e0a 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -1,16 +1,24 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 Daniel De Graaf + * Copyright (C) 2009 Matt Smith + * Copyright (C) 2007-2008 Robin Burchell * - * 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" #include "xline.h" /** Handle /ZLINE. These command handlers can be reloaded by the core, @@ -41,13 +49,13 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User { if (target.find('!') != std::string::npos) { - user->WriteServ("NOTICE %s :*** You cannot include a nickname in a zline, a zline must ban only an IP mask",user->nick.c_str()); + user->WriteNotice("*** You cannot include a nickname in a zline, a zline must ban only an IP mask"); return CMD_FAILURE; } - User *u = ServerInstance->FindNick(target.c_str()); + User *u = ServerInstance->FindNick(target); - if (u) + if ((u) && (u->registered == REG_ALL)) { target = u->GetIPString(); } @@ -64,9 +72,8 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User if (ServerInstance->IPMatchesEveryone(ipaddr,user)) return CMD_FAILURE; - long duration = ServerInstance->Duration(parameters[1].c_str()); - - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr); + unsigned long duration = InspIRCd::Duration(parameters[1]); + ZLine* zl = new ZLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr); if (ServerInstance->XLines->AddLine(zl,user)) { if (!duration) @@ -76,15 +83,16 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User else { time_t c_requires_crap = duration + ServerInstance->Time(); + std::string timestr = ServerInstance->TimeString(c_requires_crap); ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),ipaddr, - ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str()); + timestr.c_str(), parameters[2].c_str()); } ServerInstance->XLines->ApplyLines(); } else { delete zl; - user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick.c_str(),ipaddr); + user->WriteNotice("*** Z-Line for " + std::string(ipaddr) + " already exists"); } } else @@ -95,7 +103,7 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User } else { - user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick.c_str(),target.c_str()); + user->WriteNotice("*** Z-Line " + target + " not found in list, try /stats Z."); return CMD_FAILURE; } }