From b15038c4c3109fa4e326ef657493e08bbbc6881d Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 1 Nov 2008 23:58:33 +0000 Subject: Obsolete m_restrictbanned, add , default on.. this is insane to leave off, really, but allow it anyway. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10785 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands/cmd_nick.cpp | 13 +++++++++++++ src/commands/cmd_privmsg.cpp | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src/commands') diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 25b2868ec..a48cf53a9 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -103,6 +103,19 @@ CmdResult CommandNick::Handle (const std::vector& parameters, User user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick.c_str(), parameters[0].c_str(), mq->reason); return CMD_FAILURE; } + + if (ServerInstance->Config->RestrictBannedUsers) + { + for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) + { + Channel *chan = i->first; + if (chan->GetStatus(user) < STATUS_VOICE && chan->IsBanned(user)) + { + user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str()); + return CMD_FAILURE; + } + } + } } /* diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index 7354307fe..a11e53dfb 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -68,18 +68,28 @@ CmdResult CommandPrivmsg::Handle (const std::vector& parameters, Us if (chan) { - if (IS_LOCAL(user)) + if (IS_LOCAL(user) && chan->GetStatus(user) < STATUS_VOICE) { - if ((chan->IsModeSet('n')) && (!chan->HasUser(user))) + if (chan->IsModeSet('n') && !chan->HasUser(user)) { user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str()); return CMD_FAILURE; } - if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE)) + + if (chan->IsModeSet('m')) { user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str()); return CMD_FAILURE; } + + if (ServerInstance->Config->RestrictBannedUsers) + { + if (chan->IsBanned(user)) + { + user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str()); + return CMD_FAILURE; + } + } } int MOD_RESULT = 0; -- cgit v1.2.3