anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
os_kick.cpp (2132B)
1 /* OperServ core functions 2 * 3 * (C) 2003-2022 Anope Team 4 * Contact us at team@anope.org 5 * 6 * Please read COPYING and README for further details. 7 * 8 * Based on the original code of Epona by Lara. 9 * Based on the original code of Services by Andy Church. 10 */ 11 12 #include "module.h" 13 14 class CommandOSKick : public Command 15 { 16 public: 17 CommandOSKick(Module *creator) : Command(creator, "operserv/kick", 3, 3) 18 { 19 this->SetDesc(_("Kick a user from a channel")); 20 this->SetSyntax(_("\037channel\037 \037user\037 \037reason\037")); 21 } 22 23 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override 24 { 25 const Anope::string &chan = params[0]; 26 const Anope::string &nick = params[1]; 27 const Anope::string &s = params[2]; 28 Channel *c; 29 User *u2; 30 31 if (!(c = Channel::Find(chan))) 32 { 33 source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); 34 return; 35 } 36 37 if (c->bouncy_modes) 38 { 39 source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?")); 40 return; 41 } 42 43 if (!(u2 = User::Find(nick, true))) 44 { 45 source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); 46 return; 47 } 48 49 if (!c->Kick(source.service, u2, "%s (%s)", source.GetNick().c_str(), s.c_str())) 50 { 51 source.Reply(ACCESS_DENIED); 52 return; 53 } 54 55 Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")"; 56 } 57 58 bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override 59 { 60 this->SendSyntax(source); 61 source.Reply(" "); 62 source.Reply(_("Allows staff to kick a user from any channel.\n" 63 "Parameters are the same as for the standard /KICK\n" 64 "command. The kick message will have the nickname of the\n" 65 "IRCop sending the KICK command prepended; for example:\n" 66 " \n" 67 "*** SpamMan has been kicked off channel #my_channel by %s (Alcan (Flood))"), source.service->nick.c_str()); 68 return true; 69 } 70 }; 71 72 class OSKick : public Module 73 { 74 CommandOSKick commandoskick; 75 76 public: 77 OSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), 78 commandoskick(this) 79 { 80 81 } 82 }; 83 84 MODULE_INIT(OSKick)