anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
ns_logout.cpp (2818B)
1 /* NickServ 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 static ServiceReference<NickServService> NickServService("NickServService", "NickServ"); 15 16 class CommandNSLogout : public Command 17 { 18 public: 19 CommandNSLogout(Module *creator) : Command(creator, "nickserv/logout", 0, 2) 20 { 21 this->SetDesc(_("Reverses the effect of the IDENTIFY command")); 22 this->SetSyntax(_("[\037nickname\037 [REVALIDATE]]")); 23 } 24 25 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override 26 { 27 28 const Anope::string &nick = !params.empty() ? params[0] : ""; 29 const Anope::string ¶m = params.size() > 1 ? params[1] : ""; 30 31 User *u2; 32 if (!source.IsServicesOper() && !nick.empty()) 33 this->OnSyntaxError(source, ""); 34 else if (!(u2 = (!nick.empty() ? User::Find(nick, true) : source.GetUser()))) 35 source.Reply(NICK_X_NOT_IN_USE, !nick.empty() ? nick.c_str() : source.GetNick().c_str()); 36 else if (!nick.empty() && u2->IsServicesOper()) 37 source.Reply(_("You can't logout %s, they are a Services Operator."), nick.c_str()); 38 else 39 { 40 if (!nick.empty() && !param.empty() && param.equals_ci("REVALIDATE") && NickServService) 41 NickServService->Validate(u2); 42 43 u2->super_admin = false; /* Don't let people logout and remain a SuperAdmin */ 44 Log(LOG_COMMAND, source, this) << "to logout " << u2->nick; 45 46 /* Remove founder status from this user in all channels */ 47 if (!nick.empty()) 48 source.Reply(_("Nick %s has been logged out."), nick.c_str()); 49 else 50 source.Reply(_("Your nick has been logged out.")); 51 52 IRCD->SendLogout(u2); 53 u2->RemoveMode(source.service, "REGISTERED"); 54 u2->Logout(); 55 56 /* Send out an event */ 57 FOREACH_MOD(OnNickLogout, (u2)); 58 } 59 return; 60 } 61 62 bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override 63 { 64 this->SendSyntax(source); 65 source.Reply(" "); 66 source.Reply(_("Without a parameter, reverses the effect of the \002IDENTIFY\002\n" 67 "command, i.e. make you not recognized as the real owner of the nick\n" 68 "anymore. Note, however, that you won't be asked to reidentify\n" 69 "yourself.\n" 70 " \n" 71 "With a parameter, does the same for the given nick. If you\n" 72 "specify \002REVALIDATE\002 as well, Services will ask the given nick\n" 73 "to re-identify. This is limited to \002Services Operators\002.")); 74 75 return true; 76 } 77 }; 78 79 class NSLogout : public Module 80 { 81 CommandNSLogout commandnslogout; 82 83 public: 84 NSLogout(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), 85 commandnslogout(this) 86 { 87 88 } 89 }; 90 91 MODULE_INIT(NSLogout)