From 9962fae1a176d62813d8c83ca77104a2efc60e92 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 8 May 2011 19:48:26 -0400 Subject: Calculate nc::channelcount at runtime --- src/chanserv.cpp | 2 +- src/regchannel.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/chanserv.cpp b/src/chanserv.cpp index 393ad935d..42d637c38 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -282,7 +282,7 @@ bool IsFounder(User *user, ChannelInfo *ci) if (user->isSuperAdmin) return true; - if (user->Account() && user->Account() == ci->founder) + if (user->Account() && user->Account() == ci->GetFounder()) return true; return false; diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 5a94027ae..1bd8807d9 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -166,6 +166,28 @@ ChannelInfo::~ChannelInfo() --this->founder->channelcount; } +/** Change the founder of the channek + * @params nc The new founder + */ +void ChannelInfo::SetFounder(NickCore *nc) +{ + if (this->founder) + --this->founder->channelcount; + this->founder = nc; + if (this->founder) + ++this->founder->channelcount; + if (this->founder == this->successor) + this->successor = NULL; +} + +/** Get the founder of the channel + * @return The founder + */ +NickCore *ChannelInfo::GetFounder() const +{ + return this->founder; +} + /** Find which bot should send mode/topic/etc changes for this channel * @return The bot */ -- cgit