1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 11:06:37 +02:00

Send replies from fantasy commands back to the channel, this will be expanded on later

This commit is contained in:
Adam
2010-11-24 21:40:56 -06:00
parent 37e02a3594
commit cb6ef574e3
154 changed files with 2428 additions and 2111 deletions
+15 -20
View File
@@ -20,35 +20,31 @@ class CommandCSKick : public Command
{
}
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
Anope::string chan = params[0];
Anope::string target = params[1];
Anope::string reason = params.size() > 2 ? params[2] : "Requested";
const Anope::string &chan = params[0];
const Anope::string &target = params[1];
const Anope::string &reason = params.size() > 2 ? params[2] : "Requested";
Channel *c = findchan(chan);
ChannelInfo *ci;
User *u = source.u;
ChannelInfo *ci = source.ci;
Channel *c = ci->c;
User *u2;
int is_same;
is_same = target.equals_cs(u->nick) ? 1 : target.equals_ci(u->nick);
if (c)
ci = c->ci;
bool is_same = target.equals_ci(u->nick);
if (!c)
u->SendMessage(ChanServ, CHAN_X_NOT_IN_USE, chan.c_str());
source.Reply(CHAN_X_NOT_IN_USE, chan.c_str());
else if (is_same ? !(u2 = u) : !(u2 = finduser(target)))
u->SendMessage(ChanServ, NICK_X_NOT_IN_USE, target.c_str());
source.Reply(NICK_X_NOT_IN_USE, target.c_str());
else if (!is_same ? !check_access(u, ci, CA_KICK) : !check_access(u, ci, CA_KICKME))
u->SendMessage(ChanServ, ACCESS_DENIED);
source.Reply(ACCESS_DENIED);
else if (!is_same && (ci->HasFlag(CI_PEACE)) && get_access(u2, ci) >= get_access(u, ci))
u->SendMessage(ChanServ, ACCESS_DENIED);
source.Reply(ACCESS_DENIED);
else if (u2->IsProtected())
u->SendMessage(ChanServ, ACCESS_DENIED);
source.Reply(ACCESS_DENIED);
else if (!c->FindUser(u2))
u->SendMessage(ChanServ, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str());
source.Reply(NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str());
else
{
// XXX
@@ -75,8 +71,7 @@ class CommandCSKick : public Command
void OnServHelp(User *u)
{
if (this->name.equals_ci("KICK"))
u->SendMessage(ChanServ, CHAN_HELP_CMD_KICK);
u->SendMessage(ChanServ, CHAN_HELP_CMD_KICK);
}
};