unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
regonly.c (1817B)
1 /* 2 * Registered users only UnrealIRCd Module (Channel Mode +R) 3 * (C) Copyright 2014 Travis McArthur (Heero) 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 20 #include "unrealircd.h" 21 22 23 ModuleHeader MOD_HEADER 24 = { 25 "chanmodes/regonly", 26 "4.2", 27 "Channel Mode +R", 28 "UnrealIRCd Team", 29 "unrealircd-6", 30 }; 31 32 Cmode_t EXTCMODE_REGONLY; 33 34 #define IsRegOnly(channel) (channel->mode.mode & EXTCMODE_REGONLY) 35 36 int regonly_check(Client *client, Channel *channel, const char *key, char **errmsg); 37 38 39 MOD_TEST() 40 { 41 return MOD_SUCCESS; 42 } 43 44 MOD_INIT() 45 { 46 CmodeInfo req; 47 48 memset(&req, 0, sizeof(req)); 49 req.paracount = 0; 50 req.letter = 'R'; 51 req.is_ok = extcmode_default_requirehalfop; 52 CmodeAdd(modinfo->handle, req, &EXTCMODE_REGONLY); 53 54 HookAdd(modinfo->handle, HOOKTYPE_CAN_JOIN, 0, regonly_check); 55 56 57 MARK_AS_OFFICIAL_MODULE(modinfo); 58 return MOD_SUCCESS; 59 } 60 61 MOD_LOAD() 62 { 63 return MOD_SUCCESS; 64 } 65 66 MOD_UNLOAD() 67 { 68 return MOD_SUCCESS; 69 } 70 71 int regonly_check (Client *client, Channel *channel, const char *key, char **errmsg) 72 { 73 if (IsRegOnly(channel) && !IsLoggedIn(client)) 74 { 75 *errmsg = STR_ERR_NEEDREGGEDNICK; 76 return ERR_NEEDREGGEDNICK; 77 } 78 return 0; 79 } 80