summaryrefslogtreecommitdiff
path: root/src/regchannel.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-25 03:16:57 -0400
committerAdam <Adam@anope.org>2011-05-16 04:07:56 -0400
commit076ebafa1b4cc935c466c615b94eaac415af9a67 (patch)
treedbc8b0f9e7b6f954569c13ad35598f5ebe8a081d /src/regchannel.cpp
parent6922bd239c778e8f6f2081476ce20b9426c515ad (diff)
Moved some global functions to be member functions and misc cleanup
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r--src/regchannel.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index 8bc369511..4d8dc8198 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -736,6 +736,34 @@ ModeLock *ChannelInfo::GetMLock(ChannelModeName mname, const Anope::string &para
return NULL;
}
+Anope::string ChannelInfo::GetMLockAsString(bool complete) const
+{
+ Anope::string pos = "+", neg = "-", params;
+
+ for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = this->GetMLock().begin(), it_end = this->GetMLock().end(); it != it_end; ++it)
+ {
+ const ModeLock &ml = it->second;
+ ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name);
+ if (!cm || cm->Type == MODE_LIST || cm->Type == MODE_STATUS)
+ continue;
+
+ if (ml.set)
+ pos += cm->ModeChar;
+ else
+ neg += cm->ModeChar;
+
+ if (complete && !ml.param.empty() && cm->Type == MODE_PARAM)
+ params += " " + ml.param;
+ }
+
+ if (pos.length() == 1)
+ pos.clear();
+ if (neg.length() == 1)
+ neg.clear();
+
+ return pos + neg + params;
+}
+
/** Check whether a user is permitted to be on this channel
* @param u The user
* @return true if they were banned, false if they are allowed