1 // Hostname cloaking (+x mode) module for inspircd.
2 // version 1.0.0.1 by brain (C. J. Edwards) Mar 2004.
4 // When loaded this module will automatically set the
5 // +x mode on all connecting clients.
7 // Setting +x on a client causes the module to change the
8 // dhost entry (displayed host) for each user who has the
9 // mode, cloaking their host. Unlike unreal, the algorithm
10 // is non-reversible as uncloaked hosts are passed along
11 // the server->server link, and all encoding of hosts is
12 // done locally on the server by this module.
20 /* $ModDesc: Provides masking of user hostnames */
24 void handle_globops(char **parameters, int pcnt, userrec *user)
26 std::string line = "";
27 for (int i = 0; i < pcnt; i++)
29 line = line + string(parameters[i]) + " ";
31 Srv->SendToModeMask("g",WM_OR,line);
35 class ModuleGlobops : public Module
42 if (!Srv->AddExtendedMode('g',MT_CLIENT,true,0,0))
44 Srv->Log(DEFAULT,"*** m_globops: ERROR, failed to allocate user mode +g!");
45 printf("Could not claim usermode +g for this module!");
48 Srv->AddCommand("GLOBOPS",handle_globops,'o',1);
51 virtual ~ModuleGlobops()
56 virtual Version GetVersion()
58 return Version(1,0,0,1);
61 virtual bool OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
63 // check if this is our mode character...
64 if ((modechar == 'g') && (type == MT_CLIENT))
66 // we dont actually do anything with the mode in this module -
67 // just tell the core its been claimed and is ok to give users.
72 // this mode isn't ours, we have to bail and return 0 to not handle it.
77 virtual void OnOper(userrec* user)
79 char* modes[2]; // only two parameters
80 modes[0] = user->nick; // first parameter is the nick
81 modes[1] = "+g"; // second parameter is the mode
82 Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +g"
87 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
89 class ModuleGlobopsFactory : public ModuleFactory
92 ModuleGlobopsFactory()
96 ~ModuleGlobopsFactory()
100 virtual Module * CreateModule()
102 return new ModuleGlobops;
108 extern "C" void * init_module( void )
110 return new ModuleGlobopsFactory;