unrealircd

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

plaintext-policy.c (2026B)

      1 /*
      2  *   IRC - Internet Relay Chat, src/modules/plaintext-policy.c
      3  *   (C) 2017 Syzop & 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 ModuleHeader MOD_HEADER
     26   = {
     27 	"plaintext-policy",
     28 	"5.0",
     29 	"Plaintext Policy CAP",
     30 	"UnrealIRCd Team",
     31 	"unrealircd-6",
     32 	};
     33 
     34 MOD_INIT()
     35 {
     36 	MARK_AS_OFFICIAL_MODULE(modinfo);
     37 
     38 	return MOD_SUCCESS;
     39 }
     40 
     41 void init_plaintext_policy(ModuleInfo *modinfo);
     42 
     43 MOD_LOAD()
     44 {
     45 	/* init_plaintext_policy is delayed to MOD_LOAD due to configuration dependency */
     46 	init_plaintext_policy(modinfo);
     47 	return MOD_SUCCESS;
     48 }
     49 
     50 MOD_UNLOAD()
     51 {
     52 	return MOD_SUCCESS;
     53 }
     54 
     55 const char *plaintext_policy_capability_parameter(Client *client)
     56 {
     57 	static char buf[128];
     58 	
     59 	snprintf(buf, sizeof(buf), "user=%s,oper=%s,server=%s",
     60              policy_valtostr(iConf.plaintext_policy_user),
     61              policy_valtostr(iConf.plaintext_policy_oper),
     62              policy_valtostr(iConf.plaintext_policy_server));
     63 	return buf;
     64 }
     65 
     66 void init_plaintext_policy(ModuleInfo *modinfo)
     67 {
     68 	ClientCapabilityInfo cap;
     69 
     70 	memset(&cap, 0, sizeof(cap));
     71 	cap.name = "unrealircd.org/plaintext-policy";
     72 	cap.flags = CLICAP_FLAGS_ADVERTISE_ONLY;
     73 	cap.parameter = plaintext_policy_capability_parameter;
     74 	ClientCapabilityAdd(modinfo->handle, &cap, NULL);
     75 }