summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/regchannel.h2
-rw-r--r--modules/core/cs_clone.cpp2
-rw-r--r--modules/core/ns_info.cpp2
-rw-r--r--modules/extra/cs_enforce.cpp26
-rw-r--r--src/command.cpp6
-rw-r--r--src/operserv.cpp2
-rw-r--r--src/regchannel.cpp49
7 files changed, 50 insertions, 39 deletions
diff --git a/include/regchannel.h b/include/regchannel.h
index 0a4a7827a..1c1aa7294 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -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
*/
diff --git a/modules/core/cs_clone.cpp b/modules/core/cs_clone.cpp
index b7f8763f7..5ede6a9e4 100644
--- a/modules/core/cs_clone.cpp
+++ b/modules/core/cs_clone.cpp
@@ -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);
diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp
index e2c45958f..5a6d9dc0c 100644
--- a/modules/core/ns_info.cpp
+++ b/modules/core/ns_info.cpp
@@ -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."));
diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp
index 5f59a4b31..26885c9b0 100644
--- a/modules/extra/cs_enforce.cpp
+++ b/modules/extra/cs_enforce.cpp
@@ -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)
diff --git a/src/command.cpp b/src/command.cpp
index 8803edf05..0663ec2fa 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -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());
}
diff --git a/src/operserv.cpp b/src/operserv.cpp
index 9546b7ee1..116fe2a98 100644
--- a/src/operserv.cpp
+++ b/src/operserv.cpp
@@ -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)
{
}
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 1220669e0..7ab251fc9 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -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.GetAccessCount(); ++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)
+ for (unsigned i = 0; i < ci.GetAkickCount(); ++i)
{
- AutoKick *takick = ci->GetAkick(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;