unrealircd

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

showwhois.c (1839B)

      1 /*
      2  * Show when someone does a /WHOIS on you (User mode +W)
      3  * (C) Copyright 2000-.. 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 #define IsWhois(cptr)    (cptr->umodes & UMODE_SHOWWHOIS)
     23 
     24 /* Module header */
     25 ModuleHeader MOD_HEADER
     26   = {
     27 	"usermodes/showwhois",
     28 	"4.2",
     29 	"User Mode +W",
     30 	"UnrealIRCd Team",
     31 	"unrealircd-6",
     32     };
     33 
     34 /* Global variables */
     35 long UMODE_SHOWWHOIS = 0L;
     36 
     37 /* Forward declarations */
     38 int showwhois_whois(Client *requester, Client *target, NameValuePrioList **list);
     39 
     40 MOD_TEST()
     41 {
     42 	return MOD_SUCCESS;
     43 }
     44 
     45 MOD_INIT()
     46 {
     47 	UmodeAdd(modinfo->handle, 'W', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_SHOWWHOIS);
     48 	
     49 	HookAdd(modinfo->handle, HOOKTYPE_WHOIS, 0, showwhois_whois);
     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 showwhois_whois(Client *requester, Client *target, NameValuePrioList **list)
     66 {
     67 	if (IsWhois(target) && (requester != target))
     68 	{
     69 		sendnotice(target,
     70 			"*** %s (%s@%s) did a /whois on you.",
     71 			requester->name,
     72 			requester->user->username, requester->user->realhost);
     73 	}
     74 
     75 	return 0;
     76 }