summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinuxdaemon <linuxdaemon@snoonet.org>2018-01-25 16:07:30 -0600
committerlinuxdaemon <linuxdaemon@snoonet.org>2018-01-25 16:07:30 -0600
commit8e5237cca1bf70ffe00291f48484d87b485908c8 (patch)
tree0e43dc4d44fb355eb24b1eb75ecebfafe51d28d3
parent758cf504f1b049c5a1b33f7f774042c5e3efaea5 (diff)
Make sure banredirect metadata can not be duplicated
-rw-r--r--src/modules/m_banredirect.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 1b9e361bf..a0c9bc750 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -40,9 +40,17 @@ class BanRedirectEntry
: targetchan(target), banmask(mask)
{
}
+
+ bool operator<(const BanRedirectEntry& other) const
+ {
+ if (this->targetchan < other.targetchan)
+ return true;
+
+ return this->banmask < other.banmask;
+ }
};
-typedef std::vector<BanRedirectEntry> BanRedirectList;
+typedef std::set<BanRedirectEntry> BanRedirectList;
typedef std::deque<std::string> StringDeque;
class BanRedirect : public ModeWatcher
@@ -180,7 +188,7 @@ class BanRedirect : public ModeWatcher
}
/* Here 'param' doesn't have the channel on it yet */
- redirects->push_back(BanRedirectEntry(mask[CHAN], param));
+ redirects->insert(BanRedirectEntry(mask[CHAN], param));
/* Now it does */
param.append(mask[CHAN]);
@@ -259,7 +267,7 @@ class ModuleBanRedirect : public Module
for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++)
{
- modestack.Push('b', i->targetchan.insert(0, i->banmask));
+ modestack.Push('b', i->banmask + i->targetchan);
}
for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++)