anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
hs_off.cpp (1756B)
1 /* HostServ 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 CommandHSOff : public Command 15 { 16 public: 17 CommandHSOff(Module *creator) : Command(creator, "hostserv/off", 0, 0) 18 { 19 this->SetDesc(_("Deactivates your assigned vhost")); 20 this->RequireUser(true); 21 } 22 23 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override 24 { 25 User *u = source.GetUser(); 26 27 const NickAlias *na = NickAlias::Find(u->nick); 28 if (!na || na->nc != u->Account() || !na->HasVhost()) 29 na = NickAlias::Find(u->Account()->display); 30 31 if (!na || !na->HasVhost()) 32 source.Reply(HOST_NOT_ASSIGNED); 33 else 34 { 35 u->vhost.clear(); 36 IRCD->SendVhostDel(u); 37 u->UpdateHost(); 38 Log(LOG_COMMAND, source, this) << "to disable their vhost"; 39 source.Reply(_("Your vhost was removed and the normal cloaking restored.")); 40 } 41 42 return; 43 } 44 45 bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override 46 { 47 this->SendSyntax(source); 48 source.Reply(" "); 49 source.Reply(_("Deactivates the vhost currently assigned to the nick in use.\n" 50 "When you use this command any user who performs a /whois\n" 51 "on you will see your real host/IP address.")); 52 return true; 53 } 54 }; 55 56 class HSOff : public Module 57 { 58 CommandHSOff commandhsoff; 59 60 public: 61 HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), 62 commandhsoff(this) 63 { 64 if (!IRCD || !IRCD->CanSetVHost) 65 throw ModuleException("Your IRCd does not support vhosts"); 66 } 67 }; 68 69 MODULE_INIT(HSOff)