X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_zline.cpp;h=2c5997558a4346b307827e5b1e9c9b80e389d2cc;hb=11916574f67962dce1d7a2fdf7ef6a3d2d1fa49f;hp=cee7f616d5dfbd2f4467445a37bf813904f04696;hpb=46a39046196f55b52336e19662bb7bac85b731ac;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index cee7f616d..2c5997558 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -49,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(); } @@ -72,8 +72,7 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User if (ServerInstance->IPMatchesEveryone(ipaddr,user)) return CMD_FAILURE; - long duration = ServerInstance->Duration(parameters[1].c_str()); - + 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)) { @@ -84,15 +83,16 @@ CmdResult CommandZline::Handle (const std::vector& parameters, User else { time_t c_requires_crap = duration + ServerInstance->Time(); + std::string timestr = InspIRCd::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 @@ -103,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; } }