unrealircd

- supernets unrealircd source & configuration
git clone git://git.acid.vegas/unrealircd.git
Log | Files | Refs | Archive | README | LICENSE

cloak_none.c (2276B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/cloak_none.c
      3  *   (C) 2021 Bram Matthys and The UnrealIRCd Team
      4  *
      5  *   See file AUTHORS in IRC package for additional names of
      6  *   the programmers.
      7  *
      8  *   This program is free software; you can redistribute it and/or modify
      9  *   it under the terms of the GNU General Public License as published by
     10  *   the Free Software Foundation; either version 1, or (at your option)
     11  *   any later version.
     12  *
     13  *   This program is distributed in the hope that it will be useful,
     14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *   GNU General Public License for more details.
     17  *
     18  *   You should have received a copy of the GNU General Public License
     19  *   along with this program; if not, write to the Free Software
     20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21  */
     22 
     23 #include "unrealircd.h"
     24 
     25 char *cloakcsum();
     26 int cloak_config_test(ConfigFile *, ConfigEntry *, int, int *);
     27 
     28 ModuleHeader MOD_HEADER = {
     29 	"cloak_none",
     30 	"1.0",
     31 	"Cloaking module that does nothing",
     32 	"UnrealIRCd Team",
     33 	"unrealircd-6",
     34 };
     35 
     36 MOD_TEST()
     37 {
     38 	if (!CallbackAddString(modinfo->handle, CALLBACKTYPE_CLOAK_KEY_CHECKSUM, cloakcsum))
     39 	{
     40 		unreal_log(ULOG_ERROR, "config", "CLOAK_MODULE_DUPLICATE", NULL,
     41 		           "cloak_none: Error while trying to install callback.\n"
     42 		           "Maybe you have multiple cloaking modules loaded? You can only load one!");
     43 		return MOD_FAILED;
     44 	}
     45 	HookAdd(modinfo->handle, HOOKTYPE_CONFIGTEST, 0, cloak_config_test);
     46 	return MOD_SUCCESS;
     47 }
     48 
     49 MOD_INIT()
     50 {
     51 	MARK_AS_OFFICIAL_MODULE(modinfo);
     52 	return MOD_SUCCESS;
     53 }
     54 
     55 MOD_LOAD()
     56 {
     57 	return MOD_SUCCESS;
     58 }
     59 
     60 MOD_UNLOAD()
     61 {
     62 	return MOD_SUCCESS;
     63 }
     64 
     65 int cloak_config_test(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
     66 {
     67 	int errors = 0;
     68 
     69 	if (type != CONFIG_CLOAKKEYS)
     70 		return 0;
     71 
     72 	if (ce->items)
     73 	{
     74 		config_error("%s:%i: The cloaking module 'cloak_none' is loaded (no cloaking) but "
     75 		             "you also have set::cloak-keys set. Either delete your cloak keys, "
     76 		             "or switch to a real cloaking module.",
     77 		             ce->file->filename, ce->line_number);
     78 		errors++;
     79 	}
     80 	*errs = errors;
     81 	return errors ? -1 : 1;
     82 }
     83 
     84 char *cloakcsum()
     85 {
     86 	return "NONE";
     87 }