X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_b.cpp;h=d9ecb5b07a7ad548137b5abd17aa4fb08a7f16a6;hb=810c662c9b55908101ca085293c52c3239ef22d1;hp=305c91ea45e100bdf46168aa402bb45c661e3694;hpb=d3fb3fd284d0b08c9f4fa48acc0029709685e54a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 305c91ea4..d9ecb5b07 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -25,17 +25,18 @@ #include "hashcomp.h" #include "modes/cmode_b.h" -ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, 'b', 1, 1, true, MODETYPE_CHANNEL, false) +ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(NULL, 'b', PARAM_ALWAYS, MODETYPE_CHANNEL) { + list = true; } -ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding, bool servermode) +ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) { - int status = channel->GetStatus(source); + int status = channel->GetPrefixValue(source); /* Call the correct method depending on wether we're adding or removing the mode */ if (adding) { - parameter = this->AddBan(source, parameter, channel, status, servermode); + parameter = this->AddBan(source, parameter, channel, status); } else { @@ -92,7 +93,7 @@ void ModeChannelBan::DisplayEmptyList(User* user, Channel* channel) user->WriteServ("368 %s %s :End of channel ban list",user->nick.c_str(), channel->name.c_str()); } -std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan, int, bool servermode) +std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan, int) { if ((!user) || (!chan)) { @@ -115,9 +116,9 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan return dest; } - int MOD_RESULT = 0; - FOREACH_RESULT(I_OnAddBan,OnAddBan(user,chan,dest)); - if (MOD_RESULT) + ModResult MOD_RESULT; + FIRST_MOD_RESULT(ServerInstance, OnAddBan, MOD_RESULT, (user,chan,dest)); + if (MOD_RESULT == MOD_RES_DENY) { dest = ""; return dest; @@ -125,7 +126,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan for (BanList::iterator i = chan->bans.begin(); i != chan->bans.end(); i++) { - if (!strcasecmp(i->data.c_str(), dest.c_str())) + if (i->data == dest) { /* dont allow a user to set the same ban twice */ dest = ""; @@ -135,7 +136,7 @@ std::string& ModeChannelBan::AddBan(User *user, std::string &dest, Channel *chan b.set_time = ServerInstance->Time(); b.data.assign(dest, 0, MAXBUF); - b.set_by.assign(servermode ? ServerInstance->Config->ServerName : user->nick, 0, 64); + b.set_by.assign(user->nick, 0, 64); chan->bans.push_back(b); return dest; } @@ -149,7 +150,7 @@ ModePair ModeChannelBan::ModeSet(User*, User*, Channel* channel, const std::stri return std::make_pair(true, i->data); } } - return std::make_pair(false, parameter); + return std::make_pair(false, parameter); } std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan, int) @@ -168,9 +169,9 @@ std::string& ModeChannelBan::DelBan(User *user, std::string& dest, Channel *chan { if (!strcasecmp(i->data.c_str(), dest.c_str())) { - int MOD_RESULT = 0; - FOREACH_RESULT(I_OnDelBan,OnDelBan(user, chan, dest)); - if (MOD_RESULT) + ModResult MOD_RESULT; + FIRST_MOD_RESULT(ServerInstance, OnDelBan, MOD_RESULT, (user, chan, dest)); + if (MOD_RESULT == MOD_RES_DENY) { dest = ""; return dest;