]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_b.cpp
Add channel modes +n and +t
[user/henk/code/inspircd.git] / src / modes / cmode_b.cpp
index 6dc7f4c370dd5400cac022b8d62e2d490002f05b..5d709d4b796dbc2649d1f67ac678f6c4e6a2dc55 100644 (file)
@@ -28,16 +28,25 @@ ModeChannelBan::ModeChannelBan() : ModeHandler('b', 1, 1, true, MODETYPE_CHANNEL
 ModeAction ModeChannelBan::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
 {
        int status = cstatus(source, channel);
-       adding ? parameter = this->AddBan(source, parameter, channel, status) : parameter = this->DelBan(source, parameter, channel, status);
+       /* Call the correct method depending on wether we're adding or removing the mode */
+       if (adding)
+       {
+               parameter = this->AddBan(source, parameter, channel, status);
+       }
+       else
+       {
+               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;
-       int toomanyexclamation = 0;
-       int toomanyat = 0;
-
        if ((!user) || (!chan))
        {
                log(DEFAULT,"*** BUG *** AddBan was given an invalid parameter");
@@ -100,6 +109,9 @@ std::string& ModeChannelBan::DelBan(userrec *user,std::string& dest,chanrec *cha
                return dest;
        }
 
+       /* 'Clean' the mask, e.g. nick -> nick!*@* */
+       ModeParser::CleanMask(dest);
+
        for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++)
        {
                if (!strcasecmp(i->data,dest.c_str()))