anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
os_oline.cpp (2210B)
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 CommandOSOLine : public Command 15 { 16 public: 17 CommandOSOLine(Module *creator) : Command(creator, "operserv/oline", 2, 2) 18 { 19 this->SetDesc(_("Give Operflags to a certain user")); 20 this->SetSyntax(_("\037nick\037 \037flags\037")); 21 } 22 23 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override 24 { 25 const Anope::string &nick = params[0]; 26 const Anope::string &flag = params[1]; 27 User *u2 = NULL; 28 29 /* let's check whether the user is online */ 30 if (!(u2 = User::Find(nick, true))) 31 source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); 32 else if (u2 && flag[0] == '+') 33 { 34 IRCD->SendSVSO(source.service, nick, flag); 35 u2->SetMode(source.service, "OPER"); 36 u2->SendMessage(source.service, _("You are now an IRC Operator.")); 37 source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str()); 38 Log(LOG_ADMIN, source, this) << "for " << nick; 39 } 40 else if (u2 && flag[0] == '-') 41 { 42 IRCD->SendSVSO(source.service, nick, flag); 43 source.Reply(_("Operflags \002%s\002 have been removed from \002%s\002."), flag.c_str(), nick.c_str()); 44 Log(LOG_ADMIN, source, this) << "for " << nick; 45 } 46 else 47 this->OnSyntaxError(source, ""); 48 49 return; 50 } 51 52 bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override 53 { 54 this->SendSyntax(source); 55 source.Reply(" "); 56 source.Reply(_("Allows Services Operators to give Operflags to any user.\n" 57 "Flags have to be prefixed with a \"+\" or a \"-\". To\n" 58 "remove all flags simply type a \"-\" instead of any flags.")); 59 return true; 60 } 61 }; 62 63 class OSOLine : public Module 64 { 65 CommandOSOLine commandosoline; 66 67 public: 68 OSOLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), 69 commandosoline(this) 70 { 71 72 if (!IRCD || !IRCD->CanSVSO) 73 throw ModuleException("Your IRCd does not support OMODE."); 74 75 } 76 }; 77 78 MODULE_INIT(OSOLine)