summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-02-19 03:58:54 -0500
committerAdam <Adam@anope.org>2013-02-19 04:07:53 -0500
commit32592987c8f5c2edf347d2312b426ed5c3170e6f (patch)
tree5ed5ca949219b27b997ea6035d2d0b0d6519a5f4 /src
parenta1f92638e3c34266c65779df5e353931c0fa1d9d (diff)
Allow /os mode clear [all] to unset modes, similar to old clearmodes
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp57
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 &param)
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);