aboutsummaryrefslogtreecommitdiffstats
path: root/src/modes/cmode_k.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-07-26 21:54:36 +0000
committerGravatar brain2006-07-26 21:54:36 +0000
commitf4d202cdbbcaa9e17c21e3f74d7816f58b2ffc6a (patch)
tree82709f66aa42e3ffcd96cd261a368d66f65a186c /src/modes/cmode_k.cpp
parentFix reiterpret_cast stuff that doesnt work right (diff)
downloadinspircd++-f4d202cdbbcaa9e17c21e3f74d7816f58b2ffc6a.tar.gz
inspircd++-f4d202cdbbcaa9e17c21e3f74d7816f58b2ffc6a.tar.bz2
inspircd++-f4d202cdbbcaa9e17c21e3f74d7816f58b2ffc6a.zip
Add extra method to mode handler, ModeHandler::ModeSet().
Returns a std::pair<bool,string>. if the bool is true, the mode is set, and the second item in the pair is the parameter set on it, if any If the bool is false, the mode is not set, and the parameter given is returned as the second item of the pair To be used in mode bouncing, to build a safe set of bounced modes (dont ask yet) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4549 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modes/cmode_k.cpp')
-rw-r--r--src/modes/cmode_k.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 9e69ed13b..2f06ba55c 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -8,6 +8,19 @@ ModeChannelKey::ModeChannelKey() : ModeHandler('k', 1, 1, false, MODETYPE_CHANNE
{
}
+std::pair<bool,std::string> ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
+{
+ if (channel->modes[CM_KEY])
+ {
+ return std::make_pair(true, channel->key);
+ }
+ else
+ {
+ return std::make_pair(false, parameter);
+ }
+}
+
+
ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
{
if (channel->modes[CM_KEY] != adding)