From 1886d90944c312deb2f33a18e2571a1bbb373601 Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 11 May 2007 18:04:53 +0000 Subject: Clear up logic a little here, check error conditions at the top, succeed at the bottom. Little neater :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6974 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_knock.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index d850ed35b..70480e188 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -56,18 +56,14 @@ class cmd_knock : public command_t } line = line + std::string(parameters[pcnt-1]); - if (c->modes[CM_INVITEONLY]) - { - c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str()); - user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name); - return CMD_SUCCESS; - } - else + if (!c->modes[CM_INVITEONLY]) { user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name); return CMD_FAILURE; } + c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str()); + user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name); return CMD_SUCCESS; } }; -- cgit v1.2.3