unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
svssilence.c (2506B)
1 /* 2 * Unreal Internet Relay Chat Daemon, src/modules/svssilence.c 3 * (C) 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 20 #include "unrealircd.h" 21 22 CMD_FUNC(cmd_svssilence); 23 24 ModuleHeader MOD_HEADER 25 = { 26 "svssilence", /* Name of module */ 27 "5.0", /* Version */ 28 "command /svssilence", /* Short description of module */ 29 "UnrealIRCd Team", 30 "unrealircd-6", 31 }; 32 33 MOD_INIT() 34 { 35 CommandAdd(modinfo->handle, "SVSSILENCE", cmd_svssilence, MAXPARA, CMD_SERVER); 36 MARK_AS_OFFICIAL_MODULE(modinfo); 37 return MOD_SUCCESS; 38 } 39 40 MOD_LOAD() 41 { 42 return MOD_SUCCESS; 43 } 44 45 MOD_UNLOAD() 46 { 47 return MOD_SUCCESS; 48 } 49 50 /* cmd_svssilence() 51 * written by Syzop (copied a lot from cmd_silence), 52 * suggested by <??>. 53 * parv[1] - target nick 54 * parv[2] - space delimited silence list (+Blah +Blih -Bluh etc) 55 * SERVER DISTRIBUTION: 56 * Since UnrealIRCd 5 it is directed to the target client (previously: broadcasted). 57 */ 58 CMD_FUNC(cmd_svssilence) 59 { 60 Client *target; 61 int mine; 62 char *p, *cp, c; 63 char request[BUFSIZE]; 64 65 if (!IsSvsCmdOk(client)) 66 return; 67 68 if (parc < 3 || BadPtr(parv[2]) || !(target = find_user(parv[1], NULL))) 69 return; 70 71 if (!MyUser(target)) 72 { 73 sendto_one(target, NULL, ":%s SVSSILENCE %s :%s", client->name, parv[1], parv[2]); 74 return; 75 } 76 77 /* It's for our client */ 78 strlcpy(request, parv[2], sizeof(request)); 79 for (p = strtok(request, " "); p; p = strtok(NULL, " ")) 80 { 81 c = *p; 82 if ((c == '-') || (c == '+')) 83 p++; 84 else if (!(strchr(p, '@') || strchr(p, '.') || strchr(p, '!') || strchr(p, '*'))) 85 { 86 /* "no such nick" */ 87 continue; 88 } 89 else 90 c = '+'; 91 cp = pretty_mask(p); 92 if ((c == '-' && !del_silence(target, cp)) || 93 (c != '-' && !add_silence(target, cp, 0))) 94 { 95 sendto_prefix_one(target, target, NULL, ":%s SILENCE %c%s", client->name, c, cp); 96 } 97 } 98 }