unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
svsnoop.c (2324B)
1 /* 2 * IRC - Internet Relay Chat, src/modules/svsnoop.c 3 * (C) 2001 The UnrealIRCd Team 4 * 5 * svsnoop command 6 * 7 * See file AUTHORS in IRC package for additional names of 8 * the programmers. 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 1, or (at your option) 13 * any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 */ 24 25 #include "unrealircd.h" 26 27 CMD_FUNC(cmd_svsnoop); 28 29 #define MSG_SVSNOOP "SVSNOOP" 30 31 32 ModuleHeader MOD_HEADER 33 = { 34 "svsnoop", 35 "5.0", 36 "command /svsnoop", 37 "UnrealIRCd Team", 38 "unrealircd-6", 39 }; 40 41 MOD_INIT() 42 { 43 CommandAdd(modinfo->handle, MSG_SVSNOOP, cmd_svsnoop, MAXPARA, CMD_SERVER); 44 MARK_AS_OFFICIAL_MODULE(modinfo); 45 return MOD_SUCCESS; 46 } 47 48 MOD_LOAD() 49 { 50 return MOD_SUCCESS; 51 } 52 53 MOD_UNLOAD() 54 { 55 return MOD_SUCCESS; 56 } 57 58 CMD_FUNC(cmd_svsnoop) 59 { 60 Client *acptr; 61 62 if (!(IsSvsCmdOk(client) && parc > 2)) 63 return; 64 65 if (hunt_server(client, NULL, "SVSNOOP", 1, parc, parv) == HUNTED_ISME) 66 { 67 if (parv[2][0] == '+') 68 { 69 SVSNOOP = 1; 70 unreal_log(ULOG_INFO, "svsnoop", "SVSNOOP_ENABLED", client, 71 "This server has been placed in NOOP mode (by $client) -- all IRCOp rights disabled"); 72 list_for_each_entry(acptr, &client_list, client_node) 73 { 74 if (MyUser(acptr) && IsOper(acptr)) 75 { 76 if (IsOper(acptr)) 77 { 78 irccounts.operators--; 79 VERIFY_OPERCOUNT(acptr, "svsnoop"); 80 } 81 82 if (!list_empty(&acptr->special_node)) 83 list_del(&acptr->special_node); 84 85 RunHook(HOOKTYPE_LOCAL_OPER, client, 0, NULL, NULL); 86 remove_oper_privileges(acptr, 1); 87 } 88 } 89 } 90 else 91 { 92 SVSNOOP = 0; 93 unreal_log(ULOG_INFO, "svsnoop", "SVSNOOP_ENABLED", client, 94 "This server is no longer in NOOP mode (by $client) -- IRCOps can oper up again"); 95 } 96 } 97 }