diff options
| author | 2008-01-06 12:29:31 +0000 | |
|---|---|---|
| committer | 2008-01-06 12:29:31 +0000 | |
| commit | c916c63445ab46b060d783181bf41e8b94e8ae27 (patch) | |
| tree | e962317b9323b31dbbc94835dbcbe36bdc94f654 /src/channels.cpp | |
| parent | Move CreateChannel to a constructor instead (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
Diffstat (limited to 'src/channels.cpp')
| -rw-r--r-- | src/channels.cpp | 4 |
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); |
