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 /* $ModDesc: Provides support for unreal-style GLOBOPS and umode +g */
27 class ModuleNoNickChange : public Module
34 Srv->AddExtendedMode('N',MT_CHANNEL,false,0,0);
37 virtual ~ModuleNoNickChange()
42 virtual Version GetVersion()
44 return Version(1,0,0,1);
47 virtual int OnUserPreNick(userrec* user, std::string newnick)
49 if (!strcasecmp(user->server,Srv->GetServerName().c_str()))
51 for (int i =0; i != MAXCHANS; i++)
53 if (user->chans[i].channel != NULL)
55 chanrec* curr = user->chans[i].channel;
56 if (curr->IsCustomModeSet('N'))
58 if (!strchr(user->modes,'o'))
60 // don't allow the nickchange, theyre on at least one channel with +N set
61 // and theyre not an oper
62 WriteServ(user->fd,"447 %s :Can't change nickname while on %s (+N is set)",user->nick,curr->name);
72 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
74 // check if this is our mode character...
75 if ((modechar == 'N') && (type == MT_CHANNEL))
87 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
89 class ModuleNoNickChangeFactory : public ModuleFactory
92 ModuleNoNickChangeFactory()
96 ~ModuleNoNickChangeFactory()
100 virtual Module * CreateModule()
102 return new ModuleNoNickChange;
108 extern "C" void * init_module( void )
110 return new ModuleNoNickChangeFactory;