1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* +------------------------------------+
17 * | Inspire Internet Relay Chat Daemon |
18 * +------------------------------------+
20 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
21 * See: http://wiki.inspircd.org/Credits
23 * This program is free but copyrighted software; see
24 * the file COPYING for details.
26 * ---------------------------------------------------
29 #ifndef __CMD_ELINE_H__
30 #define __CMD_ELINE_H__
32 // include the common header files
37 /** Handle /ELINE. These command handlers can be reloaded by the core,
38 * and handle basic RFC1459 commands. Commands within modules work
39 * the same way, however, they can be fully unloaded, where these
42 class CommandEline : public Command
45 /** Constructor for eline.
47 CommandEline ( Module* parent) : Command(parent,"ELINE",1,3) { flags_needed = 'o'; syntax = "<ident@host> [<duration> :<reason>]"; }
49 * @param parameters The parameters to the comamnd
50 * @param pcnt The number of parameters passed to teh command
51 * @param user The user issuing the command
52 * @return A value from CmdResult to indicate command success or failure.
54 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
62 CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User *user)
64 std::string target = parameters[0];
66 if (parameters.size() >= 3)
69 User* find = ServerInstance->FindNick(target.c_str());
73 ih.second = find->GetIPString();
74 target = std::string("*@") + find->GetIPString();
77 ih = ServerInstance->XLines->IdentSplit(target.c_str());
81 user->WriteServ("NOTICE %s :*** Target not found", user->nick.c_str());
85 if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
88 long duration = ServerInstance->Duration(parameters[1].c_str());
90 ELine* el = new ELine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
91 if (ServerInstance->XLines->AddLine(el, user))
95 ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
99 time_t c_requires_crap = duration + ServerInstance->Time();
100 ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
101 ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
107 user->WriteServ("NOTICE %s :*** E-Line for %s already exists",user->nick.c_str(),target.c_str());
112 if (ServerInstance->XLines->DelLine(target.c_str(), "E", user))
114 ServerInstance->SNO->WriteToSnoMask('x',"%s removed E-line on %s",user->nick.c_str(),target.c_str());
118 user->WriteServ("NOTICE %s :*** E-Line %s not found in list, try /stats e.",user->nick.c_str(),target.c_str());
125 COMMAND_INIT(CommandEline)