Anope IRC Services  Version 2.0
hs_off.cpp
Go to the documentation of this file.
1 /* HostServ core functions
2  *
3  * (C) 2003-2014 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> &params) anope_override
24  {
25  User *u = source.GetUser();
26  const NickAlias *na = NickAlias::Find(u->nick);
27 
28  if (!na || !na->HasVhost())
29  source.Reply(HOST_NOT_ASSIGNED);
30  else
31  {
32  IRCD->SendVhostDel(u);
33  Log(LOG_COMMAND, source, this) << "to disable their vhost";
34  source.Reply(_("Your vhost was removed and the normal cloaking restored."));
35  }
36 
37  return;
38  }
39 
40  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
41  {
42  this->SendSyntax(source);
43  source.Reply(" ");
44  source.Reply(_("Deactivates the vhost currently assigned to the nick in use.\n"
45  "When you use this command any user who performs a /whois\n"
46  "on you will see your real host/IP address."));
47  return true;
48  }
49 };
50 
51 class HSOff : public Module
52 {
54 
55  public:
56  HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
57  commandhsoff(this)
58  {
59 
60  }
61 };
62 
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
bool HasVhost() const
Definition: nickalias.cpp:96
Definition: users.h:34
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
#define HOST_NOT_ASSIGNED
Definition: language.h:127
Definition: hs_off.cpp:51
#define anope_override
Definition: services.h:56
virtual void SendVhostDel(User *)
Definition: protocol.h:100
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
#define MODULE_INIT(x)
Definition: modules.h:45
bool RequireUser() const
Definition: command.cpp:169
Anope::string nick
Definition: users.h:62
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: hs_off.cpp:23
HSOff(const Anope::string &modname, const Anope::string &creator)
Definition: hs_off.cpp:56
CommandHSOff(Module *creator)
Definition: hs_off.cpp:17
void SendSyntax(CommandSource &)
Definition: command.cpp:145
Definition: logger.h:53
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: hs_off.cpp:40
#define _(x)
Definition: services.h:50
CommandHSOff commandhsoff
Definition: hs_off.cpp:53