From f474e7e6dc2d36f96150ebe33b23b4ea76814415 Mon Sep 17 00:00:00 2001 From: w00t Date: Mon, 14 Jul 2008 12:15:11 +0000 Subject: Rename quietban to muteban, change character to +b m:, this way it fits with cmode +m, which is what it does. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10019 e03df62e-2008-0410-955e-edbf42e46eb7 --- conf/modules.conf.example | 6 ++-- src/modules/m_muteban.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++++ src/modules/m_nonicks.cpp | 2 +- src/modules/m_quietban.cpp | 82 ---------------------------------------------- 4 files changed, 83 insertions(+), 86 deletions(-) create mode 100644 src/modules/m_muteban.cpp delete mode 100644 src/modules/m_quietban.cpp diff --git a/conf/modules.conf.example b/conf/modules.conf.example index d30aac30e..63b6e1767 100644 --- a/conf/modules.conf.example +++ b/conf/modules.conf.example @@ -1011,9 +1011,9 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Quietban: Implements extended ban q:, which stops anyone matching -# a mask like +b q:nick!user@host from speaking on channel. -# +# Muteban: Implements extended ban m:, which stops anyone matching +# a mask like +b n:nick!user@host from speaking on channel. +# # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp new file mode 100644 index 000000000..30e96e9a9 --- /dev/null +++ b/src/modules/m_muteban.cpp @@ -0,0 +1,79 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" + +/* $ModDesc: Implements extban +b m: - mute bans */ + +class ModuleQuietBan : public Module +{ + private: + public: + ModuleQuietBan(InspIRCd* Me) : Module(Me) + { + Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; + ServerInstance->Modules->Attach(eventlist, this, 3); + } + + virtual ~ModuleQuietBan() + { + } + + virtual Version GetVersion() + { + return Version(1,2,0,0,VF_VENDOR,API_VERSION); + } + + virtual int OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) + { + if (!IS_LOCAL(user)) + return 0; + + if (target_type == TYPE_CHANNEL) + { + if (((Channel *)dest)->IsExtBanned(user, 'm')) + { + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted"); + return 1; + } + } + + return 0; + } + + virtual int OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) + { + if (!IS_LOCAL(user)) + return 0; + + if (target_type == TYPE_CHANNEL) + { + if (((Channel *)dest)->IsExtBanned(user, 'm')) + { + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted"); + return 1; + } + } + + return 0; + } + + virtual void On005Numeric(std::string &output) + { + ServerInstance->AddExtBanChar("m"); + } +}; + + +MODULE_INIT(ModuleQuietBan) + diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 7405c7149..11a74bd1e 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -70,7 +70,7 @@ class ModuleNoNickChange : public Module virtual void On005Numeric(std::string &output) { - ServerInstance->AddExtBanChar("n"); + ServerInstance->AddExtBanChar("N"); } virtual int OnUserPreNick(User* user, const std::string &newnick) diff --git a/src/modules/m_quietban.cpp b/src/modules/m_quietban.cpp deleted file mode 100644 index 062c45c64..000000000 --- a/src/modules/m_quietban.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" - -/* $ModDesc: Implements extban +b q: - quiet bans */ - -class ModuleQuietBan : public Module -{ - private: - public: - ModuleQuietBan(InspIRCd* Me) : Module(Me) - { - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, 3); - } - - virtual ~ModuleQuietBan() - { - } - - virtual Version GetVersion() - { - return Version(1,2,0,0,VF_VENDOR,API_VERSION); - } - - virtual int OnUserPreMessage(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) - { - if (!IS_LOCAL(user)) - return 0; - - if (target_type == TYPE_CHANNEL) - { - if (((Channel *)dest)->IsExtBanned(user, 'q')) - { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted"); - return 1; - } - } - - return 0; - } - - virtual int OnUserPreNotice(User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list) - { - if (!IS_LOCAL(user)) - return 0; - - if (target_type == TYPE_CHANNEL) - { - if (((Channel *)dest)->IsExtBanned(user, 'q')) - { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted"); - return 1; - } - } - - return 0; - } - - virtual void On005Numeric(std::string &output) - { - if (output.find(" EXTBAN=:") == std::string::npos) - output.append(" EXTBAN=:q"); - else - output.insert(output.find(" EXTBAN=:") + 9, "q"); - } -}; - - -MODULE_INIT(ModuleQuietBan) - -- cgit v1.2.3