summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/regchannel.h3
-rw-r--r--modules/core/cs_access.cpp6
-rw-r--r--modules/core/cs_xop.cpp4
-rw-r--r--src/regchannel.cpp5
4 files changed, 10 insertions, 8 deletions
diff --git a/include/regchannel.h b/include/regchannel.h
index 71deb1ce7..b051af81a 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -175,11 +175,12 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag,
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
+ * @param wildcard True to match using wildcards
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
- ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0);
+ ChanAccess *GetAccess(const Anope::string &mask, int16 level = 0, bool wildcard = true);
/** Get the size of the accss vector for this channel
* @return The access vector size
diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp
index 43cb58cf1..0f15b1ce5 100644
--- a/modules/core/cs_access.cpp
+++ b/modules/core/cs_access.cpp
@@ -202,7 +202,7 @@ class CommandCSAccess : public Command
return MOD_CONT;
}
- ChanAccess *access = ci->GetAccess(mask);
+ ChanAccess *access = ci->GetAccess(mask, 0, false);
if (access)
{
/* Don't allow lowering from a level >= u_level */
@@ -220,7 +220,7 @@ class CommandCSAccess : public Command
FOREACH_MOD(I_OnAccessChange, OnAccessChange(ci, u, access));
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << na->nick << " (level: " << level << ") as level " << u_level;
+ Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "ADD " << mask << " (level: " << level << ") as level " << u_level;
source.Reply(CHAN_ACCESS_LEVEL_CHANGED, access->mask.c_str(), ci->name.c_str(), level);
return MOD_CONT;
}
@@ -257,7 +257,7 @@ class CommandCSAccess : public Command
}
else
{
- ChanAccess *access = ci->GetAccess(mask);
+ ChanAccess *access = ci->GetAccess(mask, 0, false);
ChanAccess *u_access = ci->GetAccess(u);
int16 u_level = u_access ? u_access->level : 0;
if (!access)
diff --git a/modules/core/cs_xop.cpp b/modules/core/cs_xop.cpp
index f883d1baa..1d1ec7c84 100644
--- a/modules/core/cs_xop.cpp
+++ b/modules/core/cs_xop.cpp
@@ -227,7 +227,7 @@ class XOPBase : public Command
return MOD_CONT;
}
- access = ci->GetAccess(mask);
+ access = ci->GetAccess(mask, 0, false);
if (access)
{
/**
@@ -307,7 +307,7 @@ class XOPBase : public Command
return MOD_CONT;
}
- access = ci->GetAccess(mask);
+ access = ci->GetAccess(mask, 0, false);
/* Special case: is it a number/list? Only do search if it isn't. */
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index d5afbfbcf..e89bbee5c 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -278,14 +278,15 @@ ChanAccess *ChannelInfo::GetAccess(NickCore *nc, int16 level)
*
* @param u The mask to find within the access list vector
* @param level Optional channel access level to compare the access entries to
+ * @param wildcard True to match using wildcards
* @return A ChanAccess struct corresponding to the mask, or NULL if not found
*
* Retrieves an entry from the access list that matches the given mask, optionally also matching a certain level.
*/
-ChanAccess *ChannelInfo::GetAccess(const Anope::string &mask, int16 level)
+ChanAccess *ChannelInfo::GetAccess(const Anope::string &mask, int16 level, bool wildcard)
{
for (unsigned i = 0, end = this->access.size(); i < end; ++i)
- if (Anope::Match(this->access[i]->mask, mask))
+ if (wildcard ? Anope::Match(this->access[i]->mask, mask) : this->access[i]->mask.equals_ci(mask))
return this->access[i];
return NULL;
}