Skip to content

Instantly share code, notes, and snippets.

@foxlet
Created January 3, 2015 13:48
Show Gist options
  • Save foxlet/177f9e07989e14edddb7 to your computer and use it in GitHub Desktop.
Save foxlet/177f9e07989e14edddb7 to your computer and use it in GitHub Desktop.
modules/commands/cs_entrymsg.cpp
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (ci == NULL)
{
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
return;
}
if (Anope::ReadOnly && !params[1].equals_ci("LIST"))
{
source.Reply(READ_ONLY_MODE);
return;
}
bool has_access = false;
if (source.HasPriv("chanserv/access/modify"))
has_access = true;
else if (source.AccessFor(ci).HasPriv("ACCESS_CHANGE"))
has_access = true;
if (!has_access)
{
source.Reply(ACCESS_DENIED);
return;
}
if (params[1].equals_ci("LIST"))
this->DoList(source, ci);
else if (params[1].equals_ci("CLEAR"))
this->DoClear(source, ci);
else if (params.size() < 3)
this->OnSyntaxError(source, "");
else if (params[1].equals_ci("ADD"))
this->DoAdd(source, ci, params[2]);
else if (params[1].equals_ci("DEL"))
this->DoDel(source, ci, params[2]);
else
this->OnSyntaxError(source, "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment