1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/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(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'T') { }
24 class ModuleNoNotice : public Module
30 ModuleNoNotice(InspIRCd* Me)
34 nt = new NoNotice(ServerInstance);
35 if (!ServerInstance->Modes->AddMode(nt))
36 throw ModuleException("Could not add new modes!");
37 Implementation eventlist[] = { I_OnUserPreNotice, I_On005Numeric };
38 ServerInstance->Modules->Attach(eventlist, this, 2);
41 virtual void On005Numeric(std::string &output)
43 ServerInstance->AddExtBanChar('T');
46 virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
48 if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
50 Channel* c = (Channel*)dest;
51 if (c->IsModeSet('T') || c->IsExtBanned(user, 'T'))
53 if (ServerInstance->ULine(user->server))
58 else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetStatus(user) == STATUS_OP)
60 // channel ops are exempt if set in conf.
65 user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str());
73 virtual ~ModuleNoNotice()
75 ServerInstance->Modes->DelMode(nt);
79 virtual Version GetVersion()
81 return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
85 MODULE_INIT(ModuleNoNotice)