diff options
| author | Sadie Powell <sadie@witchery.services> | 2024-01-24 12:34:03 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2024-01-24 12:34:34 +0000 |
| commit | 484160eb4ed560eeda97c94a42dd8e31431ab251 (patch) | |
| tree | 03600af16b55fa2f268904d7a42a8b87f86c09f4 /modules/hostserv/hs_off.cpp | |
| parent | 7ac1fe58478d58e2480b6919c4abf3a82929169c (diff) | |
Shuffle modules around a bit.
Diffstat (limited to 'modules/hostserv/hs_off.cpp')
| -rw-r--r-- | modules/hostserv/hs_off.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/modules/hostserv/hs_off.cpp b/modules/hostserv/hs_off.cpp new file mode 100644 index 000000000..8e4036726 --- /dev/null +++ b/modules/hostserv/hs_off.cpp @@ -0,0 +1,71 @@ +/* HostServ core functions + * + * (C) 2003-2024 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + +#include "module.h" + +class CommandHSOff final + : public Command +{ +public: + CommandHSOff(Module *creator) : Command(creator, "hostserv/off", 0, 0) + { + this->SetDesc(_("Deactivates your assigned vhost")); + this->RequireUser(true); + } + + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override + { + User *u = source.GetUser(); + + const NickAlias *na = NickAlias::Find(u->nick); + if (!na || na->nc != u->Account() || !na->HasVhost()) + na = NickAlias::Find(u->Account()->display); + + if (!na || !na->HasVhost()) + source.Reply(HOST_NOT_ASSIGNED); + else + { + u->vhost.clear(); + IRCD->SendVhostDel(u); + u->UpdateHost(); + Log(LOG_COMMAND, source, this) << "to disable their vhost"; + source.Reply(_("Your vhost was removed and the normal cloaking restored.")); + } + + return; + } + + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override + { + this->SendSyntax(source); + source.Reply(" "); + source.Reply(_("Deactivates the vhost currently assigned to the nick in use.\n" + "When you use this command any user who performs a /whois\n" + "on you will see your real host/IP address.")); + return true; + } +}; + +class HSOff final + : public Module +{ + CommandHSOff commandhsoff; + +public: + HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), + commandhsoff(this) + { + if (!IRCD || !IRCD->CanSetVHost) + throw ModuleException("Your IRCd does not support vhosts"); + } +}; + +MODULE_INIT(HSOff) |
