From fc826b6f0127f8075e87c8c3d9e8a5b3ee94abe1 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 14 Jun 2008 23:08:11 +0000 Subject: Fix m_shun as per bug #560 reported by Casey, thanks git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9905 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_shun.cpp | 33 ++++++++++++++++++++++++--------- win/inspircdVC80.vcproj | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 56d4be808..0cf62dd35 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -173,11 +173,11 @@ class ModuleShun : public Module virtual int OnStats(char symbol, User* user, string_list& out) { - // XXX write me -//format << Srv->Config->ServerName << " 223 " << user->nick << " :" << iter->banmask << " " << iter->set_on << " " << iter->length << " " << -//iter->set_by << " " << iter->reason; + if (symbol != 'S') + return 0; - return 0; + ServerInstance->XLines->InvokeStats("SHUN", 223, user, out); + return 1; } virtual void OnUserConnect(User* user) @@ -197,18 +197,33 @@ class ModuleShun : public Module virtual int OnPreCommand(std::string &command, std::vector& parameters, User* user, bool validated, const std::string &original_line) { - if((command != "PONG") && (command != "PING")) + if (validated || !user->GetExt("shunned")) + return 0; + + if (!ServerInstance->XLines->MatchesLine("SHUN", user)) { - if (user->GetExt("shunned")) - return 1; + /* The shun previously set on this user has expired or been removed */ + user->Shrink("shunned"); + return 0; } - return 0; + if (command == "QUIT") + { + /* Allow QUIT but dont show any quit message */ + parameters.clear(); + return 0; + } + + /* Always allow PONG and PING */ + if (command == "PONG" || command == "PING") + return 0; + + return 1; } virtual Version GetVersion() { - return Version(1,0,0,0,0,API_VERSION); + return Version(1,2,0,0,VF_VENDOR|VF_COMMON,API_VERSION); } }; diff --git a/win/inspircdVC80.vcproj b/win/inspircdVC80.vcproj index 7d10bfac3..78126bb27 100644 --- a/win/inspircdVC80.vcproj +++ b/win/inspircdVC80.vcproj @@ -2753,6 +2753,26 @@ /> + + + + + + + + @@ -2973,6 +2993,26 @@ /> + + + + + + + + -- cgit v1.2.3