]> jfr.im git - irc/quakenet/newserv.git/blob - trusts2/trusts_ident.c
move some more data/log paths missed before
[irc/quakenet/newserv.git] / trusts2 / trusts_ident.c
1 #include "trusts.h"
2
3 trustgroupidentcount_t *getnewtrustgroupidentcount(trustgroup_t *tg, char *ident) {
4 trustgroupidentcount_t *tgic = newtrustgroupidentcount();
5 tgic->ident = getsstring(ident,USERLEN);
6 tgic->currenton = 1;
7 tgic->trustgroup = tg;
8
9 trusts_addtrustgroupidenttohash(tgic);
10 return tgic;
11 }
12
13 void increment_ident_count(nick *np, trustgroup_t *tg) {
14 trustgroupidentcount_t* identcnt;
15 identcnt = findtrustgroupcountbyident(np->ident,tg);
16 if(identcnt) {
17 /* ident exists */
18 if( tg->maxperident && (identcnt->currenton+1) > tg->maxperident) {
19 trust_debug("NEWNICK TRUSTED BAD USER: Exceeding User (%s) Ident Limit (%d/%d)",np->ident, identcnt->currenton+1, tg->maxperident);
20 //killuser(NULL, np, "USER: Exceeding User Ident Limit.");
21 }
22 identcnt->currenton++;
23 } else {
24 /* we have a new user to add */
25 getnewtrustgroupidentcount( tg, np->ident );
26 }
27 }
28
29 void decrement_ident_count(nick *np, trustgroup_t *tg) {
30 trustgroupidentcount_t* identcnt;
31 identcnt = findtrustgroupcountbyident(np->ident,tg);
32 if(identcnt) {
33 identcnt->currenton--;
34 if(identcnt->currenton == 0) {
35 trusts_removetrustgroupidentfromhash(identcnt);
36 if (identcnt->ident) {
37 freesstring(identcnt->ident);
38 }
39 freetrustgroupidentcount(identcnt);
40 }
41 }
42 }
43