1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Provides support for unreal-style channel mode +T */
27 class ModuleNoNotice : public Module
32 ModuleNoNotice(Server* Me)
36 Srv->AddExtendedMode('T',MT_CHANNEL,false,0,0);
39 virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text)
41 if (target_type == TYPE_CHANNEL)
43 chanrec* c = (chanrec*)dest;
44 if (c->IsCustomModeSet('T'))
46 if ((Srv->ChanMode(user,c) == "@") || (Srv->ChanMode(user,c) == "%"))
48 // ops and halfops can still /NOTICE the channel
53 WriteServ(user->fd,"404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
61 virtual void On005Numeric(std::string &output)
63 std::stringstream line(output);
64 std::string temp1, temp2;
68 if (temp1.substr(0,10) == "CHANMODES=")
70 // append the chanmode to the end
71 temp1 = temp1.substr(10,temp1.length());
72 temp1 = "CHANMODES=" + temp1 + "T";
74 temp2 = temp2 + temp1 + " ";
77 output = temp2.substr(0,temp2.length()-1);
80 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
82 // check if this is our mode character...
83 if ((modechar == 'T') && (type == MT_CHANNEL))
93 virtual ~ModuleNoNotice()
97 virtual Version GetVersion()
99 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
104 class ModuleNoNoticeFactory : public ModuleFactory
107 ModuleNoNoticeFactory()
111 ~ModuleNoNoticeFactory()
115 virtual Module * CreateModule(Server* Me)
117 return new ModuleNoNotice(Me);
123 extern "C" void * init_module( void )
125 return new ModuleNoNoticeFactory;