mirror of
https://github.com/anope/anope.git
synced 2026-07-04 04:43:13 +02:00
Fixed /cs clone copying channel access, fixed restricted, and fixed some compiler warnings
This commit is contained in:
@@ -118,7 +118,7 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
|
||||
/** Copy constructor
|
||||
* @param ci The ChannelInfo to copy settings to
|
||||
*/
|
||||
ChannelInfo(ChannelInfo *ci);
|
||||
ChannelInfo(ChannelInfo &ci);
|
||||
|
||||
/** Default destructor
|
||||
*/
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
if (what.empty())
|
||||
{
|
||||
delete target_ci;
|
||||
target_ci = new ChannelInfo(ci);
|
||||
target_ci = new ChannelInfo(*ci);
|
||||
target_ci->name = target;
|
||||
RegisteredChannelList[target_ci->name] = target_ci;
|
||||
target_ci->c = findchan(target_ci->name);
|
||||
|
||||
@@ -148,7 +148,7 @@ class CommandNSInfo : public Command
|
||||
source.Reply(" ");
|
||||
source.Reply(_("Displays information about the given nickname, such as\n"
|
||||
"the nick's owner, last seen address and time, and nick\n"
|
||||
"options. If no nick is given, an you are identified,\n"
|
||||
"options. If no nick is given, and you are identified,\n"
|
||||
"your account name is used, else your current nickname is\n"
|
||||
"used."));
|
||||
|
||||
|
||||
@@ -69,34 +69,24 @@ class CommandCSEnforce : public Command
|
||||
|
||||
void DoRestricted(Channel *c)
|
||||
{
|
||||
/*ChannelInfo *ci;
|
||||
int16 old_nojoin_level;
|
||||
Anope::string mask;
|
||||
|
||||
if (!(ci = c->ci))
|
||||
ChannelInfo *ci = c->ci;
|
||||
if (ci == NULL)
|
||||
return;
|
||||
|
||||
old_nojoin_level = ci->levels[CA_NOJOIN];
|
||||
if (ci->levels[CA_NOJOIN] < 0)
|
||||
ci->levels[CA_NOJOIN] = 0;
|
||||
|
||||
for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; )
|
||||
{
|
||||
UserContainer *uc = *it++;
|
||||
User *user = uc->user;
|
||||
|
||||
if (check_access(uc->user, ci, CA_NOJOIN))
|
||||
if (ci->AccessFor(user).empty())
|
||||
{
|
||||
get_idealban(ci, uc->user, mask);
|
||||
Anope::string reason = translate(uc->user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
Anope::string mask;
|
||||
get_idealban(ci, user, mask);
|
||||
Anope::string reason = translate(user, CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
c->SetMode(NULL, CMODE_BAN, mask);
|
||||
c->Kick(NULL, uc->user, "%s", reason.c_str());
|
||||
c->Kick(NULL, user, "%s", reason.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
ci->levels[CA_NOJOIN] = old_nojoin_level;
|
||||
XXX
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void DoCModeR(Channel *c)
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ void CommandSource::DoReply()
|
||||
}
|
||||
}
|
||||
|
||||
Command::Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params, const Anope::string &spermission) : Service(owner, sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), permission(spermission), module(owner)
|
||||
Command::Command(Module *o, const Anope::string &sname, size_t min_params, size_t max_params, const Anope::string &spermission) : Service(o, sname), Flags<CommandFlag>(CommandFlagStrings), MaxParams(max_params), MinParams(min_params), permission(spermission), module(owner)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ void Command::SendSyntax(CommandSource &source)
|
||||
}
|
||||
}
|
||||
|
||||
void Command::SendSyntax(CommandSource &source, const Anope::string &syntax)
|
||||
void Command::SendSyntax(CommandSource &source, const Anope::string &syn)
|
||||
{
|
||||
source.Reply(_("Syntax: \002%s %s\002"), source.command.c_str(), syntax.c_str());
|
||||
source.Reply(_("Syntax: \002%s %s\002"), source.command.c_str(), syn.c_str());
|
||||
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), source.owner->nick.c_str(), source.command.c_str());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ Anope::string XLine::GetHost() const
|
||||
|
||||
/** Constructor
|
||||
*/
|
||||
XLineManager::XLineManager(Module *creator, const Anope::string &name, char t) : Service(creator, name), type(t)
|
||||
XLineManager::XLineManager(Module *creator, const Anope::string &xname, char t) : Service(creator, xname), type(t)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+36
-15
@@ -61,9 +61,9 @@ ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, C
|
||||
/** Copy constructor
|
||||
* @param ci The ChannelInfo to copy settings to
|
||||
*/
|
||||
ChannelInfo::ChannelInfo(ChannelInfo *ci) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), botflags(BotServFlagStrings)
|
||||
ChannelInfo::ChannelInfo(ChannelInfo &ci) : Flags<ChannelInfoFlag, CI_END>(ChannelInfoFlagStrings), botflags(BotServFlagStrings)
|
||||
{
|
||||
*this = *ci;
|
||||
*this = ci;
|
||||
|
||||
if (this->founder)
|
||||
++this->founder->channelcount;
|
||||
@@ -76,21 +76,35 @@ ChannelInfo::ChannelInfo(ChannelInfo *ci) : Flags<ChannelInfoFlag, CI_END>(Chann
|
||||
++this->bi->chancount;
|
||||
|
||||
for (int i = 0; i < TTB_SIZE; ++i)
|
||||
this->ttb[i] = ci->ttb[i];
|
||||
this->ttb[i] = ci.ttb[i];
|
||||
|
||||
// XXX access
|
||||
|
||||
for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
|
||||
for (unsigned i = 0; i < ci.GetAccessCount(); ++i)
|
||||
{
|
||||
AutoKick *takick = ci->GetAkick(i);
|
||||
ChanAccess *taccess = ci.GetAccess(i);
|
||||
AccessProvider *provider = taccess->provider;
|
||||
|
||||
ChanAccess *newaccess = provider->Create();
|
||||
newaccess->ci = taccess->ci;
|
||||
newaccess->mask = taccess->mask;
|
||||
newaccess->creator = taccess->creator;
|
||||
newaccess->last_seen = taccess->last_seen;
|
||||
newaccess->created = taccess->created;
|
||||
newaccess->Unserialize(taccess->Serialize());
|
||||
|
||||
this->AddAccess(newaccess);
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < ci.GetAkickCount(); ++i)
|
||||
{
|
||||
AutoKick *takick = ci.GetAkick(i);
|
||||
if (takick->HasFlag(AK_ISNICK))
|
||||
this->AddAkick(takick->creator, takick->nc, takick->reason, takick->addtime, takick->last_used);
|
||||
else
|
||||
this->AddAkick(takick->creator, takick->mask, takick->reason, takick->addtime, takick->last_used);
|
||||
}
|
||||
for (unsigned i = 0; i < ci->GetBadWordCount(); ++i)
|
||||
for (unsigned i = 0; i < ci.GetBadWordCount(); ++i)
|
||||
{
|
||||
BadWord *bw = ci->GetBadWord(i);
|
||||
BadWord *bw = ci.GetBadWord(i);
|
||||
this->AddBadWord(bw->word, bw->type);
|
||||
}
|
||||
}
|
||||
@@ -158,20 +172,20 @@ BotInfo *ChannelInfo::WhoSends()
|
||||
{
|
||||
if (this && this->bi)
|
||||
return this->bi;
|
||||
BotInfo *bi = findbot(Config->ChanServ);
|
||||
if (bi)
|
||||
return bi;
|
||||
BotInfo *tbi = findbot(Config->ChanServ);
|
||||
if (tbi)
|
||||
return tbi;
|
||||
else if (!BotListByNick.empty())
|
||||
return BotListByNick.begin()->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Add an entry to the channel access list
|
||||
* @param access The entry
|
||||
* @param taccess The entry
|
||||
*/
|
||||
void ChannelInfo::AddAccess(ChanAccess *access)
|
||||
void ChannelInfo::AddAccess(ChanAccess *taccess)
|
||||
{
|
||||
this->access.push_back(access);
|
||||
this->access.push_back(taccess);
|
||||
}
|
||||
|
||||
/** Get an entry from the channel access list by index
|
||||
@@ -752,6 +766,13 @@ bool ChannelInfo::CheckKick(User *user)
|
||||
}
|
||||
}
|
||||
|
||||
if (!do_kick && this->HasFlag(CI_RESTRICTED) && this->AccessFor(user).empty() && (!this->founder || user->Account() != this->founder))
|
||||
{
|
||||
do_kick = true;
|
||||
get_idealban(this, user, mask);
|
||||
reason = translate(user->Account(), CHAN_NOT_ALLOWED_TO_JOIN);
|
||||
}
|
||||
|
||||
if (!do_kick)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user