X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_muteban.cpp;h=61d592b2b9dba45bea8d60905e0f7aa247b1d339;hb=d4a1ea70451abb333e71f9cff09b624db59531a0;hp=1b6cdff93fa821a1ff38b7cd7311287f1763fa45;hpb=7a67685bcb863b0d4199715e86697fee423596c2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 1b6cdff93..61d592b2b 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -20,15 +20,16 @@ #include "inspircd.h" -/* $ModDesc: Implements extban +b m: - mute bans */ - class ModuleQuietBan : public Module { + private: + bool notifyuser; + public: - void init() CXX11_OVERRIDE + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); + ConfigTag* tag = ServerInstance->Config->ConfValue("muteban"); + notifyuser = tag->getBool("notifyuser", true); } Version GetVersion() CXX11_OVERRIDE @@ -36,15 +37,21 @@ class ModuleQuietBan : public Module return Version("Implements extban +b m: - mute bans",VF_OPTCOMMON|VF_VENDOR); } - ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE { - if (!IS_LOCAL(user) || target_type != TYPE_CHANNEL) + if (!IS_LOCAL(user) || target.type != MessageTarget::TYPE_CHANNEL) return MOD_RES_PASSTHRU; - Channel* chan = static_cast(dest); + Channel* chan = target.Get(); if (chan->GetExtBanStatus(user, 'm') == MOD_RES_DENY && chan->GetPrefixValue(user) < VOICE_VALUE) { - user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)", user->nick.c_str(), chan->name.c_str()); + if (!notifyuser) + { + details.echo_original = true; + return MOD_RES_DENY; + } + + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're muted)"); return MOD_RES_DENY; }