unrealircd

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

clienttagdeny.c (1882B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/echo-message.c
      3  *   (C) 2020 k4be for The UnrealIRCd Team
      4  *
      5  *   See file AUTHORS in IRC package for additional names of
      6  *   the programmers.
      7  *
      8  *   This program is free software; you can redistribute it and/or modify
      9  *   it under the terms of the GNU General Public License as published by
     10  *   the Free Software Foundation; either version 1, or (at your option)
     11  *   any later version.
     12  *
     13  *   This program is distributed in the hope that it will be useful,
     14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  *   GNU General Public License for more details.
     17  *
     18  *   You should have received a copy of the GNU General Public License
     19  *   along with this program; if not, write to the Free Software
     20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     21  */
     22 
     23 #include "unrealircd.h"
     24 
     25 char *ct_isupport_param(void);
     26 int tags_rehash_complete(void);
     27 
     28 Module *module;
     29 
     30 ModuleHeader MOD_HEADER = {
     31 	"clienttagdeny",
     32 	"5.0",
     33 	"Informs clients about supported client tags",
     34 	"k4be",
     35 	"unrealircd-6",
     36 };
     37 
     38 MOD_INIT(){
     39 	MARK_AS_OFFICIAL_MODULE(modinfo);
     40 
     41 	return MOD_SUCCESS;
     42 }
     43 
     44 MOD_LOAD(){
     45 	module = modinfo->handle;
     46 	ISupportAdd(module, "CLIENTTAGDENY", ct_isupport_param());
     47 	HookAdd(module, HOOKTYPE_REHASH_COMPLETE, 0, tags_rehash_complete);
     48 
     49 	return MOD_SUCCESS;
     50 }
     51 
     52 MOD_UNLOAD(){
     53 	return MOD_SUCCESS;
     54 }
     55 
     56 #define BUFLEN 500
     57 
     58 char *ct_isupport_param(void){
     59 	static char buf[BUFLEN];
     60 	MessageTagHandler *m;
     61 	
     62 	strlcpy(buf, "*", sizeof(buf));
     63 
     64 	for (m = mtaghandlers; m; m = m->next) {
     65 		if (!m->unloaded && m->name[0] == '+'){
     66 			strlcat(buf, ",-", sizeof(buf));
     67 			strlcat(buf, m->name+1, sizeof(buf));
     68 		}
     69 	}
     70 	return buf;
     71 }
     72 
     73 int tags_rehash_complete(void){
     74 	ISupportSet(module, "CLIENTTAGDENY", ct_isupport_param());
     75 	return HOOK_CONTINUE;
     76 }
     77