From a6884342b0200d5233502015b62e8b31a0105924 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 16 Oct 2006 16:30:03 +0000 Subject: Idea from nenolod, dont allow you to add yourself to your own dccallow list (!) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5482 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_dccallow.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 13d42c0b9..a3ddb2e41 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -57,7 +57,7 @@ class cmd_dccallow : public command_t { // display current DCCALLOW list DisplayDCCAllowList(user); - return CMD_SUCCESS; + return CMD_FAILURE; } else if (pcnt > 0) { @@ -70,13 +70,13 @@ class cmd_dccallow : public command_t { // list current DCCALLOW list DisplayDCCAllowList(user); - return CMD_SUCCESS; + return CMD_FAILURE; } else if (!strcasecmp(parameters[0], "HELP")) { // display help DisplayHelp(user); - return CMD_SUCCESS; + return CMD_FAILURE; } } @@ -141,12 +141,17 @@ class cmd_dccallow : public command_t if (k->nickname == target->nick) { user->WriteServ("996 %s %s :%s is already on your DCCALLOW list", user->nick, user->nick, target->nick); - return CMD_SUCCESS; + return CMD_FAILURE; + } + else if (ServerInstance->MatchText(user->GetFullHost(), k->hostmask)) + { + user->WriteServ("996 %s %s :You cannot add yourself to your own DCCALLOW list!", user->nick, user->nick); + return CMD_FAILURE; } } std::string mask = std::string(target->nick)+"!"+std::string(target->ident)+"@"+std::string(target->dhost); - std::string default_length = Conf->ReadValue("dccallow", "length", 0).c_str(); + std::string default_length = Conf->ReadValue("dccallow", "length", 0); long length; if (pcnt < 2) @@ -178,7 +183,7 @@ class cmd_dccallow : public command_t user->WriteServ("994 %s %s :Added %s to DCCALLOW list for this session", user->nick, user->nick, target->nick); } - return CMD_SUCCESS; + return CMD_FAILURE; } } else @@ -188,7 +193,7 @@ class cmd_dccallow : public command_t return CMD_FAILURE; } } - return CMD_SUCCESS; + return CMD_FAILURE; } void DisplayHelp(userrec* user) -- cgit v1.2.3