unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
nickchange.c (1917B)
1 /* 2 * Extended ban that affects nick-changes only (+b ~n) 3 * (C) Copyright 2003-.. Bram Matthys (Syzop) and the UnrealIRCd team 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 1, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 #include "unrealircd.h" 20 21 ModuleHeader MOD_HEADER 22 = { 23 "extbans/nickchange", 24 "4.2", 25 "ExtBan ~n - prevent nick-changes only", 26 "UnrealIRCd Team", 27 "unrealircd-6", 28 }; 29 30 /* Forward declarations */ 31 int extban_nickchange_is_banned(BanContext *b); 32 33 /** Called upon module init */ 34 MOD_INIT() 35 { 36 ExtbanInfo req; 37 38 memset(&req, 0, sizeof(req)); 39 req.letter = 'n'; 40 req.name = "nickchange"; 41 req.is_ok = extban_is_ok_nuh_extban; 42 req.conv_param = extban_conv_param_nuh_or_extban; 43 req.is_banned = extban_nickchange_is_banned; 44 req.is_banned_events = BANCHK_NICK; 45 req.options = EXTBOPT_ACTMODIFIER; 46 if (!ExtbanAdd(modinfo->handle, req)) 47 { 48 config_error("could not register extended ban type"); 49 return MOD_FAILED; 50 } 51 52 MARK_AS_OFFICIAL_MODULE(modinfo); 53 54 return MOD_SUCCESS; 55 } 56 57 /** Called upon module load */ 58 MOD_LOAD() 59 { 60 return MOD_SUCCESS; 61 } 62 63 /** Called upon unload */ 64 MOD_UNLOAD() 65 { 66 return MOD_SUCCESS; 67 } 68 69 /** This ban that affects nick-changes only */ 70 int extban_nickchange_is_banned(BanContext *b) 71 { 72 if (check_channel_access(b->client, b->channel, "v")) 73 return 0; 74 75 return ban_check_mask(b); 76 }