diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-30 01:07:14 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-01-30 01:07:14 +0000 |
commit | 0fedacd78dce0cf8727b0a68c6f4fdbfc2a14b72 (patch) | |
tree | 5b9bf70d8c73aeb96bee91ccccd9fe0734da9f1b /src/modules | |
parent | 3cddc21bae68b84598579e6e438cd23dffae16fc (diff) |
Merge in patches to fix bug #487, submitted by dz, thanks :)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8769 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_knock.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 876c4f121..69c04dd9c 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -30,6 +30,7 @@ class CommandKnock : public Command CmdResult Handle (const char** parameters, int pcnt, User *user) { Channel* c = ServerInstance->FindChan(parameters[0]); + std::string line; if (!c) { @@ -37,19 +38,17 @@ class CommandKnock : public Command return CMD_FAILURE; } - std::string line; - - if (c->IsModeSet('K')) + if (c->HasUser(user)) { - user->WriteServ("480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name); + user->WriteServ("480 %s :Can't KNOCK on %s, you are already on that channel.", user->nick, c->name); return CMD_FAILURE; } - for (int i = 1; i < pcnt - 1; i++) + if (c->IsModeSet('K')) { - line = line + std::string(parameters[i]) + " "; + user->WriteServ("480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name); + return CMD_FAILURE; } - line = line + std::string(parameters[pcnt-1]); if (!c->modes[CM_INVITEONLY]) { @@ -57,6 +56,12 @@ class CommandKnock : public Command return CMD_FAILURE; } + for (int i = 1; i < pcnt - 1; i++) + { + line = line + std::string(parameters[i]) + " "; + } + line = line + std::string(parameters[pcnt-1]); + 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; |