diff options
| author | Adam <Adam@anope.org> | 2011-08-28 15:46:15 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-09-10 02:05:00 -0400 |
| commit | 700a585b1bb38a9dc0ac3e749083250d405488f8 (patch) | |
| tree | 8af306bd60778815fe5a137590d3b888213ad231 /src/regchannel.cpp | |
| parent | 62752db4c49a8679b51d5996003fd3a23c2a3f2d (diff) | |
Allow modules to add their own channel levels
Diffstat (limited to 'src/regchannel.cpp')
| -rw-r--r-- | src/regchannel.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 882649d54..7eceb5942 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -49,9 +49,6 @@ ChannelInfo::ChannelInfo(const Anope::string &chname) : Flags<ChannelInfoFlag, C this->memos.memomax = Config->MSMaxMemos; this->last_used = this->time_registered = Anope::CurTime; - for (int i = 0; i < CA_SIZE; ++i) - this->levels[i] = 0; - for (int i = 0; i < TTB_SIZE; ++i) this->ttb[i] = 0; @@ -781,3 +778,28 @@ void ChannelInfo::RestoreTopic() } } +int16 ChannelInfo::GetLevel(const Anope::string &priv) +{ + if (PrivilegeManager::FindPrivilege(priv) == NULL) + throw CoreException("Unknown privilege " + priv); + + if (this->levels.count(priv) == 0) + this->levels[priv] = 0; + return this->levels[priv]; +} + +void ChannelInfo::SetLevel(const Anope::string &priv, int16 level) +{ + this->levels[priv] = level; +} + +void ChannelInfo::RemoveLevel(const Anope::string &priv) +{ + this->levels.erase(priv); +} + +void ChannelInfo::ClearLevels() +{ + this->levels.clear(); +} + |
