summaryrefslogtreecommitdiff
path: root/src/regchannel.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-15 18:03:50 -0500
committerAdam <Adam@anope.org>2010-12-12 19:33:58 -0500
commit1625a5af0ce1368e46705a2f72578eda463f3650 (patch)
tree37b2783e32684aebc879d17f05dcf276f799beaa /src/regchannel.cpp
parent2e9a632e1410fbeadc1b7a0418cf66247e0e458c (diff)
Added /chanserv clone command
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r--src/regchannel.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index b4cded05b..b4c42cb82 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -52,7 +52,7 @@ ChannelInfo::ChannelInfo(const Anope::string &chname)
this->memos.memomax = Config->MSMaxMemos;
this->last_used = this->time_registered = Anope::CurTime;
- this->ttb = new int16[2 * TTB_SIZE];
+ this->ttb = new int16[TTB_SIZE];
for (int i = 0; i < TTB_SIZE; ++i)
this->ttb[i] = 0;
@@ -61,6 +61,51 @@ ChannelInfo::ChannelInfo(const Anope::string &chname)
RegisteredChannelList[this->name] = this;
}
+/** Copy constructor
+ * @param ci The ChannelInfo to copy settings to
+ */
+ChannelInfo::ChannelInfo(ChannelInfo *ci)
+{
+ *this = *ci;
+
+ if (this->founder)
+ ++this->founder->channelcount;
+
+ this->access.clear();
+ this->akick.clear();
+ this->badwords.clear();
+
+ if (this->bi)
+ ++this->bi->chancount;
+
+ this->ttb = new int16[TTB_SIZE];
+ for (int i = 0; i < TTB_SIZE; ++i)
+ this->ttb[i] = ci->ttb[i];
+
+ this->levels = new int16[CA_SIZE];
+ for (int i = 0; i < CA_SIZE; ++i)
+ this->levels[i] = ci->levels[i];
+
+ for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
+ {
+ ChanAccess *access = ci->GetAccess(i);
+ this->AddAccess(access->nc, access->level, access->creator, access->last_seen);
+ }
+ for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
+ {
+ AutoKick *akick = ci->GetAkick(i);
+ if (akick->HasFlag(AK_ISNICK))
+ this->AddAkick(akick->creator, akick->nc, akick->reason, akick->addtime, akick->last_used);
+ else
+ this->AddAkick(akick->creator, akick->mask, akick->reason, akick->addtime, akick->last_used);
+ }
+ for (unsigned i = 0; i < ci->GetBadWordCount(); ++i)
+ {
+ BadWord *bw = ci->GetBadWord(i);
+ this->AddBadWord(bw->word, bw->type);
+ }
+}
+
/** Default destructor, cleans up the channel complete and removes it from the internal list
*/
ChannelInfo::~ChannelInfo()