1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 13:46:38 +02:00

Moved /chanserv unban to its own module and added support for unbanning a nickname, this readds !unban nick

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2709 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Adam-
2009-12-16 23:50:33 +00:00
parent aad1a4ca8d
commit 453963eeae
19 changed files with 196 additions and 118 deletions
-50
View File
@@ -105,54 +105,6 @@ class CommandCSBan : public Command
};
class CommandCSUnban : public Command
{
public:
CommandCSUnban() : Command("UNBAN", 1, 1)
{
}
CommandReturn Execute(User *u, const std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
Channel *c;
ChannelInfo *ci;
if (!(c = findchan(chan)))
{
notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan);
return MOD_CONT;
}
ci = c->ci;
if (!check_access(u, ci, CA_UNBAN))
{
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
return MOD_CONT;
}
common_unban(ci, u->nick);
notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, chan);
return MOD_CONT;
}
bool OnHelp(User *u, const ci::string &subcommand)
{
notice_help(Config.s_ChanServ, u, CHAN_HELP_UNBAN);
return true;
}
void OnSyntaxError(User *u, const ci::string &subcommand)
{
syntax_error(Config.s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX);
}
};
class CSBan : public Module
{
public:
@@ -163,14 +115,12 @@ class CSBan : public Module
this->SetType(CORE);
this->AddCommand(CHANSERV, new CommandCSBan("BAN"));
this->AddCommand(CHANSERV, new CommandCSBan("KB"));
this->AddCommand(CHANSERV, new CommandCSUnban());
ModuleManager::Attach(I_OnChanServHelp, this);
}
void OnChanServHelp(User *u)
{
notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_BAN);
notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN);
}
};
+94
View File
@@ -0,0 +1,94 @@
/* ChanServ core functions
*
* (C) 2003-2009 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.
*
* $Id$
*
*/
/*************************************************************************/
#include "module.h"
class CommandCSUnban : public Command
{
public:
CommandCSUnban() : Command("UNBAN", 1, 2)
{
}
CommandReturn Execute(User *u, const std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
Channel *c;
User *u2;
if (!(c = findchan(chan)))
{
notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan);
return MOD_CONT;
}
if (!check_access(u, c->ci, CA_UNBAN))
{
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
return MOD_CONT;
}
u2 = u;
if (params.size() > 1)
u2 = finduser(params[1].c_str());
if (!u2)
{
notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, params[1].c_str());
return MOD_CONT;
}
common_unban(c->ci, u2->nick);
if (u2 == u)
notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED, c->name);
else
notice_lang(Config.s_ChanServ, u, CHAN_UNBANNED_OTHER, u2->nick, c->name);
return MOD_CONT;
}
bool OnHelp(User *u, const ci::string &subcommand)
{
notice_help(Config.s_ChanServ, u, CHAN_HELP_UNBAN);
return true;
}
void OnSyntaxError(User *u, const ci::string &subcommand)
{
syntax_error(Config.s_ChanServ, u, "UNBAN", CHAN_UNBAN_SYNTAX);
}
};
class CSUnban : public Module
{
public:
CSUnban(const std::string &modname, const std::string &creator) : Module(modname, creator)
{
this->SetAuthor("Anope");
this->SetVersion("$Id$");
this->SetType(CORE);
this->AddCommand(CHANSERV, new CommandCSUnban());
ModuleManager::Attach(I_OnChanServHelp, this);
}
void OnChanServHelp(User *u)
{
notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_UNBAN);
}
};
MODULE_INIT(CSUnban)