1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 /* $ModDesc: Provides support for unreal-style channel mode +T */
18 class NoNotice : public SimpleChannelModeHandler
21 NoNotice(Module* Creator) : SimpleChannelModeHandler(Creator, "nonotice", 'T') { }
24 class ModuleNoNotice : public Module
32 if (!ServerInstance->Modes->AddMode(&nt))
33 throw ModuleException("Could not add new modes!");
34 Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric };
35 ServerInstance->Modules->Attach(eventlist, this, 2);
38 virtual void On005Numeric(std::string &output)
40 ServerInstance->AddExtBanChar('T');
43 virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
46 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
48 Channel* c = (Channel*)dest;
49 if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet('T')))
51 if (ServerInstance->ULine(user->server))
54 return MOD_RES_PASSTHRU;
56 res = ServerInstance->OnCheckExemption(user,c,"nonotice");
57 if (res == MOD_RES_ALLOW)
58 return MOD_RES_PASSTHRU;
61 user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
66 return MOD_RES_PASSTHRU;
69 virtual ~ModuleNoNotice()
73 virtual Version GetVersion()
75 return Version("Provides support for unreal-style channel mode +T", VF_VENDOR);
79 MODULE_INIT(ModuleNoNotice)