diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-07 21:51:33 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-07 21:51:33 +0000 |
commit | 21480d6f6500637f63ea620eefbab03f69f7cfee (patch) | |
tree | 0be7ce6982862ac265bf29aef5d8c163947f644d | |
parent | 3f50c9807a7dc114697a1309c1752d20c36a0dce (diff) |
Move BanItem into the class
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4152 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modes/cmode_b.h | 3 | ||||
-rw-r--r-- | src/modes/cmode_b.cpp | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/modes/cmode_b.h b/include/modes/cmode_b.h index 4c41e3250..60462d73a 100644 --- a/include/modes/cmode_b.h +++ b/include/modes/cmode_b.h @@ -1,7 +1,10 @@ #include "mode.h" +#include "channels.h" class ModeChannelBan : public ModeHandler { + private: + BanItem b; public: ModeChannelBan(); ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 5865836da..aa57c74d0 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -28,14 +28,18 @@ ModeChannelBan::ModeChannelBan() : ModeHandler('b', 1, 1, true, MODETYPE_CHANNEL ModeAction ModeChannelBan::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = cstatus(source, channel); + /* Call the correct method depending on wether we're adding or removing the mode */ adding ? parameter = this->AddBan(source, parameter, channel, status) : parameter = this->DelBan(source, parameter, channel, status); + /* If the method above 'ate' the parameter by reducing it to an empty string, then + * it won't matter wether we return ALLOW or DENY here, as an empty string overrides + * the return value and is always MODEACTION_DENY if the mode is supposed to have + * a parameter. + */ return MODEACTION_ALLOW; } std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *chan,int status) { - BanItem b; - if ((!user) || (!chan)) { log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter"); |