diff options
author | Adam <Adam@anope.org> | 2013-07-01 22:17:52 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-01 22:17:52 -0400 |
commit | 1a3d9a016d3adc49788bbff73aac9b3b5ea85b17 (patch) | |
tree | c0ecf92ed768473bc82ff64a7fce827245f37ba9 /src/channels.cpp | |
parent | 518182ac9204f815258b0de91b3f884d8efa1502 (diff) |
Change extensible keys to require explicitly having a type defined for it. Completely modularize more features like bs_kick, entrymsg, log, mode, etc. Move fantasy to its own module. Move greet to its own module.
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 72 |
1 files changed, 5 insertions, 67 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 9fdc44a49..0b790e54e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -35,7 +35,7 @@ Channel::Channel(const Anope::string &nname, time_t ts) this->name = nname; this->creation_time = ts; - this->syncing = false; + this->syncing = this->botchannel = false; this->server_modetime = this->chanserv_modetime = 0; this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_ts = this->topic_time = 0; @@ -108,48 +108,6 @@ void Channel::CheckModes() FOREACH_RESULT(OnCheckModes, MOD_RESULT, (this)); if (MOD_RESULT == EVENT_STOP) return; - - if (this->ci) - for (ChannelInfo::ModeList::const_iterator it = this->ci->GetMLock().begin(), it_end = this->ci->GetMLock().end(); it != it_end; ++it) - { - const ModeLock *ml = it->second; - ChannelMode *cm = ModeManager::FindChannelModeByName(ml->name); - if (!cm) - continue; - - if (cm->type == MODE_REGULAR) - { - if (!this->HasMode(cm->name) && ml->set) - this->SetMode(NULL, cm); - else if (this->HasMode(cm->name) && !ml->set) - this->RemoveMode(NULL, cm); - } - else if (cm->type == MODE_PARAM) - { - /* If the channel doesnt have the mode, or it does and it isn't set correctly */ - if (ml->set) - { - Anope::string param; - this->GetParam(cm->name, param); - - if (!this->HasMode(cm->name) || (!param.empty() && !ml->param.empty() && !param.equals_cs(ml->param))) - this->SetMode(NULL, cm, ml->param); - } - else - { - if (this->HasMode(cm->name)) - this->RemoveMode(NULL, cm); - } - - } - else if (cm->type == MODE_LIST) - { - if (ml->set) - this->SetMode(NULL, cm, ml->param); - else - this->RemoveMode(NULL, cm, ml->param); - } - } } bool Channel::CheckDelete() @@ -312,7 +270,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *cm, const Anop if (cc) cc->status.AddMode(cm->mchar); - FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm->name, param)); + FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm, param)); /* Enforce secureops, etc */ if (enforce_mlock && MOD_RESULT != EVENT_STOP) @@ -336,7 +294,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *cm, const Anop cml->OnAdd(this, param); } - FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm->name, param)); + FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm, param)); /* Check if we should enforce mlock */ if (!enforce_mlock || MOD_RESULT == EVENT_STOP) @@ -377,7 +335,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *cm, const A if (cc) cc->status.DelMode(cm->mchar); - FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm->name, param)); + FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm, param)); if (enforce_mlock && MOD_RESULT != EVENT_STOP) this->SetCorrectModes(u, false); @@ -404,7 +362,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *cm, const A cml->OnDel(this, param); } - FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm->name, param)); + FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm, param)); /* Check for mlock */ if (!enforce_mlock || MOD_RESULT == EVENT_STOP) @@ -865,26 +823,6 @@ void Channel::SetCorrectModes(User *user, bool give_modes) this->RemoveMode(NULL, cm, user->GetUID()); } } - - // Check mlock - for (ChannelInfo::ModeList::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it) - { - const ModeLock *ml = it->second; - ChannelMode *cm = ModeManager::FindChannelModeByName(ml->name); - if (!cm || cm->type != MODE_STATUS) - continue; - - if (Anope::Match(user->nick, ml->param) || Anope::Match(user->GetDisplayedMask(), ml->param)) - { - if (ml->set != this->HasUserStatus(user, ml->name)) - { - if (ml->set) - this->SetMode(NULL, cm, user->GetUID(), false); - else if (!ml->set) - this->RemoveMode(NULL, cm, user->GetUID(), false); - } - } - } } bool Channel::Unban(User *u, bool full) |