1
0
mirror of https://github.com/anope/anope.git synced 2026-06-24 22:06:38 +02:00
Files
anope/modules/core/hs_delall.cpp
T
2010-09-26 02:33:01 -04:00

81 lines
1.8 KiB
C++

/* HostServ core functions
*
* (C) 2003-2010 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 CommandHSDelAll : public Command
{
public:
CommandHSDelAll() : Command("DELALL", 1, 1, "hostserv/del")
{
}
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
Anope::string nick = params[0];
NickAlias *na;
if ((na = findnick(nick)))
{
if (na->HasFlag(NS_FORBIDDEN))
{
u->SendMessage(HostServ, NICK_X_FORBIDDEN, nick.c_str());
return MOD_CONT;
}
FOREACH_MOD(I_OnDeleteVhost, OnDeleteVhost(na));
NickCore *nc = na->nc;
for (std::list<NickAlias *>::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end; ++it)
{
na = *it;
na->hostinfo.RemoveVhost();
}
Log(LOG_ADMIN, u, this) << "for all nicks in group " << nc->display;
u->SendMessage(HostServ, HOST_DELALL, nc->display.c_str());
}
else
u->SendMessage(HostServ, HOST_NOREG, nick.c_str());
return MOD_CONT;
}
bool OnHelp(User *u, const Anope::string &subcommand)
{
u->SendMessage(HostServ, HOST_HELP_DELALL);
return true;
}
void OnSyntaxError(User *u, const Anope::string &subcommand)
{
SyntaxError(HostServ, u, "DELALL", HOST_DELALL_SYNTAX);
}
void OnServHelp(User *u)
{
u->SendMessage(HostServ, HOST_HELP_CMD_DELALL);
}
};
class HSDelAll : public Module
{
CommandHSDelAll commandhsdelall;
public:
HSDelAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator)
{
this->SetAuthor("Anope");
this->SetType(CORE);
this->AddCommand(HostServ, &commandhsdelall);
}
};
MODULE_INIT(HSDelAll)