7 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
11 class ModuleNoNickChange : public Module
18 Srv->AddExtendedMode('N',MT_CHANNEL,false,0,0);
21 virtual ~ModuleNoNickChange()
26 virtual Version GetVersion()
28 return Version(1,0,0,1);
31 virtual int OnUserPreNick(userrec* user, std::string newnick)
33 if (!strcasecmp(user->server,Srv->GetServerName().c_str()))
35 for (int i =0; i != MAXCHANS; i++)
37 if (user->chans[i].channel != NULL)
39 chanrec* curr = user->chans[i].channel;
40 if (curr->IsCustomModeSet('N'))
42 // don't allow the nickchange, theyre on at least one channel with +N set
43 WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name);
52 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
54 // check if this is our mode character...
55 if ((modechar == 'N') && (type == MT_CHANNEL))
67 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
69 class ModuleNoNickChangeFactory : public ModuleFactory
72 ModuleNoNickChangeFactory()
76 ~ModuleNoNickChangeFactory()
80 virtual Module * CreateModule()
82 return new ModuleNoNickChange;
88 extern "C" void * init_module( void )
90 return new ModuleNoNickChangeFactory;