summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 12:29:31 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 12:29:31 +0000
commitc916c63445ab46b060d783181bf41e8b94e8ae27 (patch)
treee962317b9323b31dbbc94835dbcbe36bdc94f654
parent488cea15e8de7f1afa779728aa4af2efd548d268 (diff)
Throw exception if trying to construct a duplicate channel
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8648 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/channels.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index c69f09107..115afea52 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -20,6 +20,10 @@
Channel::Channel(InspIRCd* Instance, const std::string &name, time_t ts) : ServerInstance(Instance)
{
+ chan_hash::iterator findchan = ServerInstance->chanlist->find(name);
+ if (findchan != Instance->chanlist->end())
+ throw CoreException("Cannot create duplicate channel " + name);
+
(*(ServerInstance->chanlist))[name.c_str()] = this;
strlcpy(this->name, name.c_str(), CHANMAX);
this->created = ts ? ts : ServerInstance->Time(true);