summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-28 20:56:45 -0400
committerAdam <Adam@anope.org>2010-08-28 20:56:45 -0400
commite820e1af0d01011dbe9d91d2971cc3518f7f3d42 (patch)
tree9eb52cf891c4cd92ad08ad8d2f7c019780bc6223 /src/channels.cpp
parent26ba944d55fb4ee92dd5d7a3d2cfa869a8be151f (diff)
Properly store our clients internal channel status's and burst them if needed.
Also made Flag::HasFlag use test() instead of operator[] to catch errors, and fixed an out of bounds access to a Flags bitset causing crashes on some systems.
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 55de669fd..389577f71 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -82,10 +82,21 @@ void Channel::Reset()
{
UserContainer *uc = *it;
+ Flags<ChannelModeName, CMODE_END * 2> flags = *debug_cast<Flags<ChannelModeName, CMODE_END * 2> *>(uc->Status);
+ uc->Status->ClearFlags();
+
if (findbot(uc->user->nick))
- continue;
+ {
+ for (std::map<char, ChannelMode *>::iterator mit = ModeManager::ChannelModesByChar.begin(), mit_end = ModeManager::ChannelModesByChar.end(); mit != mit_end; ++mit)
+ {
+ ChannelMode *cm = mit->second;
- uc->Status->ClearFlags();
+ if (flags.HasFlag(cm->Name))
+ {
+ this->SetMode(NULL, cm, uc->user->nick, false);
+ }
+ }
+ }
}
check_modes(this);