diff options
author | Adam <Adam@anope.org> | 2013-02-19 03:58:54 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-02-19 04:07:53 -0500 |
commit | 32592987c8f5c2edf347d2312b426ed5c3170e6f (patch) | |
tree | 5ed5ca949219b27b997ea6035d2d0b0d6519a5f4 /src/channels.cpp | |
parent | a1f92638e3c34266c65779df5e353931c0fa1d9d (diff) |
Allow /os mode clear [all] to unset modes, similar to old clearmodes
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index fb0994626..51ceb324c 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -277,6 +277,37 @@ size_t Channel::HasMode(const Anope::string &mname, const Anope::string ¶m) return 0; } +Anope::string Channel::GetModes(bool complete, bool plus) +{ + Anope::string res, params; + + for (std::multimap<Anope::string, Anope::string>::const_iterator it = this->modes.begin(), it_end = this->modes.end(); it != it_end; ++it) + { + ChannelMode *cm = ModeManager::FindChannelModeByName(it->first); + if (!cm || cm->type == MODE_LIST) + continue; + + res += cm->mchar; + + if (complete && !it->second.empty()) + { + ChannelModeParam *cmp = NULL; + if (cm->type == MODE_PARAM) + cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm); + + if (plus || !cmp || !cmp->minus_no_arg) + params += " " + it->second; + } + } + + return res + params; +} + +const Channel::ModeList &Channel::GetModes() const +{ + return this->modes; +} + std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> Channel::GetModeList(const Anope::string &mname) { Channel::ModeList::iterator it = this->modes.find(mname), it_end = it; @@ -827,32 +858,6 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) return true; } -Anope::string Channel::GetModes(bool complete, bool plus) -{ - Anope::string res, params; - - for (std::multimap<Anope::string, Anope::string>::const_iterator it = this->modes.begin(), it_end = this->modes.end(); it != it_end; ++it) - { - ChannelMode *cm = ModeManager::FindChannelModeByName(it->first); - if (!cm || cm->type == MODE_LIST) - continue; - - res += cm->mchar; - - if (complete && !it->second.empty()) - { - ChannelModeParam *cmp = NULL; - if (cm->type == MODE_PARAM) - cmp = anope_dynamic_static_cast<ChannelModeParam *>(cm); - - if (plus || !cmp || !cmp->minus_no_arg) - params += " " + it->second; - } - } - - return res + params; -} - void Channel::ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts) { User *u = User::Find(user); |